From bfdedbd5a3ba7e6fdc036d212253aa55c9062211 Mon Sep 17 00:00:00 2001 From: Dave Barach Date: Wed, 20 Jan 2016 09:11:55 -0500 Subject: PowerPC64-be arch support. Qemu ("qppc") platform support. Change-Id: Ib0a05f9d1b08bacef09f6d7c101391737031ee0d Signed-off-by: Dave Barach --- vppinfra/vppinfra/bihash_24_8.h | 3 +- vppinfra/vppinfra/cache.h | 15 ++++++++++ vppinfra/vppinfra/longjmp.S | 60 +++++++++++++++++++++------------------- vppinfra/vppinfra/unix-formats.c | 4 ++- 4 files changed, 52 insertions(+), 30 deletions(-) (limited to 'vppinfra') diff --git a/vppinfra/vppinfra/bihash_24_8.h b/vppinfra/vppinfra/bihash_24_8.h index 9d5b3bcbf3c..c789c980fb6 100644 --- a/vppinfra/vppinfra/bihash_24_8.h +++ b/vppinfra/vppinfra/bihash_24_8.h @@ -38,6 +38,7 @@ static inline int clib_bihash_is_free_24_8 (clib_bihash_kv_24_8_t *v) return 0; } +#if !defined(__powerpc64__) && !defined(__aarch64__) static inline u32 crc_u32(u32 data, u32 value) { @@ -70,7 +71,7 @@ static inline u64 clib_bihash_hash_24_8 (clib_bihash_kv_24_8_t *v) return value; } -#if 0 +#else static inline u64 clib_bihash_hash_24_8 (clib_bihash_kv_24_8_t *v) { u64 tmp = v->key[0] ^ v->key[1] ^ v->key[2]; diff --git a/vppinfra/vppinfra/cache.h b/vppinfra/vppinfra/cache.h index 7ed7a1eae82..fea111698a2 100644 --- a/vppinfra/vppinfra/cache.h +++ b/vppinfra/vppinfra/cache.h @@ -40,15 +40,30 @@ #include +/* + * Allow CFLAGS to override the arch-specific cache line size + */ +#ifndef CLIB_LOG2_CACHE_LINE_BYTES + #ifdef __x86_64__ #define CLIB_LOG2_CACHE_LINE_BYTES 6 #endif +#ifdef __aarch64__ +#define CLIB_LOG2_CACHE_LINE_BYTES 7 +#endif + /* Default cache line size of 32 bytes. */ #ifndef CLIB_LOG2_CACHE_LINE_BYTES #define CLIB_LOG2_CACHE_LINE_BYTES 5 #endif +#endif /* CLIB_LOG2_CACHE_LINE_BYTES defined */ + +#if (CLIB_LOG2_CACHE_LINE_BYTES >= 9) +#error Cache line size 512 bytes or greater +#endif + #define CLIB_CACHE_LINE_BYTES (1 << CLIB_LOG2_CACHE_LINE_BYTES) #define CLIB_CACHE_LINE_ALIGN_MARK(mark) u8 mark[0] __attribute__((aligned(CLIB_CACHE_LINE_BYTES))) diff --git a/vppinfra/vppinfra/longjmp.S b/vppinfra/vppinfra/longjmp.S index a469b644766..ac138a96257 100644 --- a/vppinfra/vppinfra/longjmp.S +++ b/vppinfra/vppinfra/longjmp.S @@ -290,38 +290,42 @@ _prologue (clib_longjmp) blr -_prologue (clib_calljmp) - /* Make sure stack is 16 byte aligned. */ - andi. 0, 5, 0xf - sub 5, 5, 0 - addi 5, 5, -16 - - /* Save old stack/link pointer on new stack. */ - std 1, 0(5) + .globl clib_calljmp + .section ".opd","aw" + .align 3 +clib_calljmp: + .quad .L.clib_calljmp,.TOC.@tocbase,0 + .previous + .type clib_calljmp, @function +.L.clib_calljmp: mflr 0 - std 0, 8(5) - - /* Switch stacks. */ - mr 1, 5 - - /* Get function pointer. */ - ld 0, 0(3) - mtctr 0 - - /* Move argument into place. */ - mr 3, 4 - - /* Away we go. */ + mr 9,3 + std 0,16(1) + stdu 1,-112(1) +#APP + std 1,-8(5) + addi 5,5,-256 + mr 1,5 +#NO_APP + ld 10,0(9) + std 2,40(1) + mr 3,4 + mtctr 10 + ld 11,16(9) + ld 2,8(9) bctrl - - /* Switch back to old stack. */ - ld 0, 8(1) + ld 2,40(1) +#APP + addi 1,1,256 + ld 1,-8(1) +#NO_APP + addi 1,1,112 + ld 0,16(1) mtlr 0 - ld 0, 0(1) - mr 1, 0 - - /* Return to caller. */ blr + .long 0 + .byte 0,0,0,1,128,0,0,0 + .size clib_calljmp,.-.L.clib_calljmp #elif defined(__powerpc__) diff --git a/vppinfra/vppinfra/unix-formats.c b/vppinfra/vppinfra/unix-formats.c index f39a4be7428..a4c81ca2f70 100644 --- a/vppinfra/vppinfra/unix-formats.c +++ b/vppinfra/vppinfra/unix-formats.c @@ -884,10 +884,12 @@ u8 * format_signal (u8 * s, va_list * args) u8 * format_ucontext_pc (u8 * s, va_list * args) { - ucontext_t * uc = va_arg (*args, ucontext_t *); + ucontext_t * uc __attribute__((unused)); unsigned long * regs = 0; uword reg_no = 0; + uc = va_arg (*args, ucontext_t *); + #if defined (powerpc) regs = &uc->uc_mcontext.uc_regs->gregs[0]; #elif defined (powerpc64) -- cgit 1.2.3-korg