From owner-svn-src-projects@FreeBSD.ORG Sun Jul 26 00:16:44 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4DACD106566C; Sun, 26 Jul 2009 00:16:44 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3AC448FC08; Sun, 26 Jul 2009 00:16:44 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n6Q0Gi2t054835; Sun, 26 Jul 2009 00:16:44 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n6Q0GiDf054828; Sun, 26 Jul 2009 00:16:44 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200907260016.n6Q0GiDf054828@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 26 Jul 2009 00:16:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r195880 - in projects/ppc64/sys/powerpc: aim include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jul 2009 00:16:44 -0000 Author: nwhitehorn Date: Sun Jul 26 00:16:43 2009 New Revision: 195880 URL: http://svn.freebsd.org/changeset/base/195880 Log: This gets the rest of the shared AIM code building for AIM64. Most of the changes are adjusting printf formats and setting things that should be register_t to register_t. Modified: projects/ppc64/sys/powerpc/aim/trap.c projects/ppc64/sys/powerpc/aim/uma_machdep.c projects/ppc64/sys/powerpc/aim/vm_machdep.c projects/ppc64/sys/powerpc/include/_inttypes.h projects/ppc64/sys/powerpc/include/_stdint.h projects/ppc64/sys/powerpc/include/frame.h Modified: projects/ppc64/sys/powerpc/aim/trap.c ============================================================================== --- projects/ppc64/sys/powerpc/aim/trap.c Sat Jul 25 21:51:12 2009 (r195879) +++ projects/ppc64/sys/powerpc/aim/trap.c Sun Jul 26 00:16:43 2009 (r195880) @@ -65,6 +65,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -284,15 +285,16 @@ printtrap(u_int vector, struct trapframe trapname(vector)); switch (vector) { case EXC_DSI: - printf(" virtual address = 0x%x\n", frame->cpu.aim.dar); + printf(" virtual address = 0x%" PRIxPTR "\n", + frame->cpu.aim.dar); break; case EXC_ISI: - printf(" virtual address = 0x%x\n", frame->srr0); + printf(" virtual address = 0x%" PRIxPTR "\n", frame->srr0); break; } - printf(" srr0 = 0x%x\n", frame->srr0); - printf(" srr1 = 0x%x\n", frame->srr1); - printf(" lr = 0x%x\n", frame->lr); + printf(" srr0 = 0x%" PRIxPTR "\n", frame->srr0); + printf(" srr1 = 0x%" PRIxPTR "\n", frame->srr1); + printf(" lr = 0x%" PRIxPTR "\n", frame->lr); printf(" curthread = %p\n", curthread); if (curthread != NULL) printf(" pid = %d, comm = %s\n", @@ -350,7 +352,8 @@ syscall(struct trapframe *frame) /* * The prep code is MP aware. */ - (*p->p_sysent->sv_prepsyscall)(frame, args, &code, ¶ms); + (*p->p_sysent->sv_prepsyscall)(frame, (int *)args, &code, + ¶ms); } else if (code == SYS_syscall) { /* * code is first argument, @@ -602,7 +605,7 @@ badaddr_read(void *addr, size_t size, in x = *(volatile int32_t *)addr; break; default: - panic("badaddr: invalid size (%d)", size); + panic("badaddr: invalid size (%zd)", size); } /* Make sure we took the machine check, if we caused one. */ Modified: projects/ppc64/sys/powerpc/aim/uma_machdep.c ============================================================================== --- projects/ppc64/sys/powerpc/aim/uma_machdep.c Sat Jul 25 21:51:12 2009 (r195879) +++ projects/ppc64/sys/powerpc/aim/uma_machdep.c Sun Jul 26 00:16:43 2009 (r195880) @@ -100,7 +100,7 @@ uma_small_free(void *mem, int size, u_in return; } - m = PHYS_TO_VM_PAGE((u_int32_t)mem); + m = PHYS_TO_VM_PAGE((vm_offset_t)mem); m->wire_count--; vm_page_free(m); atomic_subtract_int(&cnt.v_wire_count, 1); Modified: projects/ppc64/sys/powerpc/aim/vm_machdep.c ============================================================================== --- projects/ppc64/sys/powerpc/aim/vm_machdep.c Sat Jul 25 21:51:12 2009 (r195879) +++ projects/ppc64/sys/powerpc/aim/vm_machdep.c Sun Jul 26 00:16:43 2009 (r195880) @@ -145,7 +145,8 @@ cpu_fork(struct thread *td1, struct proc KASSERT(td1 == curthread || td1 == &thread0, ("cpu_fork: p1 not curproc and not proc0")); - CTR3(KTR_PROC, "cpu_fork: called td1=%08x p2=%08x flags=%x", (u_int)td1, (u_int)p2, flags); + CTR3(KTR_PROC, "cpu_fork: called td1=%p p2=%p flags=%x", + td1, p2, flags); if ((flags & RFPROC) == 0) return; @@ -207,8 +208,8 @@ cpu_set_fork_handler(td, func, arg) { struct callframe *cf; - CTR4(KTR_PROC, "%s called with td=%08x func=%08x arg=%08x", - __func__, (u_int)td, (u_int)func, (u_int)arg); + CTR4(KTR_PROC, "%s called with td=%p func=%p arg=%p", + __func__, td, func, arg); cf = (struct callframe *)td->td_pcb->pcb_sp; @@ -461,11 +462,11 @@ cpu_set_upcall_kse(struct thread *td, vo stack_t *stack) { struct trapframe *tf; - uint32_t sp; + uintptr_t sp; tf = td->td_frame; /* align stack and alloc space for frame ptr and saved LR */ - sp = ((uint32_t)stack->ss_sp + stack->ss_size - sizeof(uint64_t)) & + sp = ((uintptr_t)stack->ss_sp + stack->ss_size - sizeof(uint64_t)) & ~0x1f; bzero(tf, sizeof(struct trapframe)); Modified: projects/ppc64/sys/powerpc/include/_inttypes.h ============================================================================== --- projects/ppc64/sys/powerpc/include/_inttypes.h Sat Jul 25 21:51:12 2009 (r195879) +++ projects/ppc64/sys/powerpc/include/_inttypes.h Sun Jul 26 00:16:43 2009 (r195880) @@ -44,177 +44,185 @@ * Macros for format specifiers. */ +#ifdef __powerpc64__ +#define PRI64 "l" +#define PRIreg "l" +#else +#define PRI64 "ll" +#define PRIreg +#endif + /* fprintf(3) macros for signed integers. */ #define PRId8 "d" /* int8_t */ #define PRId16 "d" /* int16_t */ #define PRId32 "d" /* int32_t */ -#define PRId64 "lld" /* int64_t */ +#define PRId64 PRI64"d" /* int64_t */ #define PRIdLEAST8 "d" /* int_least8_t */ #define PRIdLEAST16 "d" /* int_least16_t */ #define PRIdLEAST32 "d" /* int_least32_t */ -#define PRIdLEAST64 "lld" /* int_least64_t */ +#define PRIdLEAST64 PRI64"d" /* int_least64_t */ #define PRIdFAST8 "d" /* int_fast8_t */ #define PRIdFAST16 "d" /* int_fast16_t */ #define PRIdFAST32 "d" /* int_fast32_t */ -#define PRIdFAST64 "lld" /* int_fast64_t */ +#define PRIdFAST64 PRI64"d" /* int_fast64_t */ #define PRIdMAX "jd" /* intmax_t */ -#define PRIdPTR "d" /* intptr_t */ +#define PRIdPTR PRIreg"d" /* intptr_t */ #define PRIi8 "i" /* int8_t */ #define PRIi16 "i" /* int16_t */ #define PRIi32 "i" /* int32_t */ -#define PRIi64 "lli" /* int64_t */ +#define PRIi64 PRI64"i" /* int64_t */ #define PRIiLEAST8 "i" /* int_least8_t */ #define PRIiLEAST16 "i" /* int_least16_t */ #define PRIiLEAST32 "i" /* int_least32_t */ -#define PRIiLEAST64 "lli" /* int_least64_t */ +#define PRIiLEAST64 PRI64"i" /* int_least64_t */ #define PRIiFAST8 "i" /* int_fast8_t */ #define PRIiFAST16 "i" /* int_fast16_t */ #define PRIiFAST32 "i" /* int_fast32_t */ -#define PRIiFAST64 "lli" /* int_fast64_t */ +#define PRIiFAST64 PRI64"i" /* int_fast64_t */ #define PRIiMAX "ji" /* intmax_t */ -#define PRIiPTR "i" /* intptr_t */ +#define PRIiPTR PRIreg"i" /* intptr_t */ /* fprintf(3) macros for unsigned integers. */ #define PRIo8 "o" /* uint8_t */ #define PRIo16 "o" /* uint16_t */ #define PRIo32 "o" /* uint32_t */ -#define PRIo64 "llo" /* uint64_t */ +#define PRIo64 PRI64"o" /* uint64_t */ #define PRIoLEAST8 "o" /* uint_least8_t */ #define PRIoLEAST16 "o" /* uint_least16_t */ #define PRIoLEAST32 "o" /* uint_least32_t */ -#define PRIoLEAST64 "llo" /* uint_least64_t */ +#define PRIoLEAST64 PRI64"o" /* uint_least64_t */ #define PRIoFAST8 "o" /* uint_fast8_t */ #define PRIoFAST16 "o" /* uint_fast16_t */ #define PRIoFAST32 "o" /* uint_fast32_t */ -#define PRIoFAST64 "llo" /* uint_fast64_t */ +#define PRIoFAST64 PRI64"o" /* uint_fast64_t */ #define PRIoMAX "jo" /* uintmax_t */ -#define PRIoPTR "o" /* uintptr_t */ +#define PRIoPTR PRIreg"o" /* uintptr_t */ #define PRIu8 "u" /* uint8_t */ #define PRIu16 "u" /* uint16_t */ #define PRIu32 "u" /* uint32_t */ -#define PRIu64 "llu" /* uint64_t */ +#define PRIu64 PRI64"u" /* uint64_t */ #define PRIuLEAST8 "u" /* uint_least8_t */ #define PRIuLEAST16 "u" /* uint_least16_t */ #define PRIuLEAST32 "u" /* uint_least32_t */ -#define PRIuLEAST64 "llu" /* uint_least64_t */ +#define PRIuLEAST64 PRI64"u" /* uint_least64_t */ #define PRIuFAST8 "u" /* uint_fast8_t */ #define PRIuFAST16 "u" /* uint_fast16_t */ #define PRIuFAST32 "u" /* uint_fast32_t */ -#define PRIuFAST64 "llu" /* uint_fast64_t */ +#define PRIuFAST64 PRI64"u" /* uint_fast64_t */ #define PRIuMAX "ju" /* uintmax_t */ -#define PRIuPTR "u" /* uintptr_t */ +#define PRIuPTR PRIreg"u" /* uintptr_t */ #define PRIx8 "x" /* uint8_t */ #define PRIx16 "x" /* uint16_t */ #define PRIx32 "x" /* uint32_t */ -#define PRIx64 "llx" /* uint64_t */ +#define PRIx64 PRI64"x" /* uint64_t */ #define PRIxLEAST8 "x" /* uint_least8_t */ #define PRIxLEAST16 "x" /* uint_least16_t */ #define PRIxLEAST32 "x" /* uint_least32_t */ -#define PRIxLEAST64 "llx" /* uint_least64_t */ +#define PRIxLEAST64 PRI64"x" /* uint_least64_t */ #define PRIxFAST8 "x" /* uint_fast8_t */ #define PRIxFAST16 "x" /* uint_fast16_t */ #define PRIxFAST32 "x" /* uint_fast32_t */ -#define PRIxFAST64 "llx" /* uint_fast64_t */ +#define PRIxFAST64 PRI64"x" /* uint_fast64_t */ #define PRIxMAX "jx" /* uintmax_t */ -#define PRIxPTR "x" /* uintptr_t */ +#define PRIxPTR PRIreg"x" /* uintptr_t */ #define PRIX8 "X" /* uint8_t */ #define PRIX16 "X" /* uint16_t */ #define PRIX32 "X" /* uint32_t */ -#define PRIX64 "llX" /* uint64_t */ +#define PRIX64 PRI64"X" /* uint64_t */ #define PRIXLEAST8 "X" /* uint_least8_t */ #define PRIXLEAST16 "X" /* uint_least16_t */ #define PRIXLEAST32 "X" /* uint_least32_t */ -#define PRIXLEAST64 "llX" /* uint_least64_t */ +#define PRIXLEAST64 PRI64"X" /* uint_least64_t */ #define PRIXFAST8 "X" /* uint_fast8_t */ #define PRIXFAST16 "X" /* uint_fast16_t */ #define PRIXFAST32 "X" /* uint_fast32_t */ -#define PRIXFAST64 "llX" /* uint_fast64_t */ +#define PRIXFAST64 PRI64"X" /* uint_fast64_t */ #define PRIXMAX "jX" /* uintmax_t */ -#define PRIXPTR "X" /* uintptr_t */ +#define PRIXPTR PRIreg"X" /* uintptr_t */ /* fscanf(3) macros for signed integers. */ #define SCNd8 "hhd" /* int8_t */ #define SCNd16 "hd" /* int16_t */ #define SCNd32 "d" /* int32_t */ -#define SCNd64 "lld" /* int64_t */ +#define SCNd64 PRI64"d" /* int64_t */ #define SCNdLEAST8 "hhd" /* int_least8_t */ #define SCNdLEAST16 "hd" /* int_least16_t */ #define SCNdLEAST32 "d" /* int_least32_t */ -#define SCNdLEAST64 "lld" /* int_least64_t */ +#define SCNdLEAST64 PRI64"d" /* int_least64_t */ #define SCNdFAST8 "d" /* int_fast8_t */ #define SCNdFAST16 "d" /* int_fast16_t */ #define SCNdFAST32 "d" /* int_fast32_t */ -#define SCNdFAST64 "lld" /* int_fast64_t */ +#define SCNdFAST64 PRI64"d" /* int_fast64_t */ #define SCNdMAX "jd" /* intmax_t */ -#define SCNdPTR "d" /* intptr_t */ +#define SCNdPTR PRIreg"d" /* intptr_t */ #define SCNi8 "hhi" /* int8_t */ #define SCNi16 "hi" /* int16_t */ #define SCNi32 "i" /* int32_t */ -#define SCNi64 "lli" /* int64_t */ +#define SCNi64 PRI64"i" /* int64_t */ #define SCNiLEAST8 "hhi" /* int_least8_t */ #define SCNiLEAST16 "hi" /* int_least16_t */ #define SCNiLEAST32 "i" /* int_least32_t */ -#define SCNiLEAST64 "lli" /* int_least64_t */ +#define SCNiLEAST64 PRI64"i" /* int_least64_t */ #define SCNiFAST8 "i" /* int_fast8_t */ #define SCNiFAST16 "i" /* int_fast16_t */ #define SCNiFAST32 "i" /* int_fast32_t */ -#define SCNiFAST64 "lli" /* int_fast64_t */ +#define SCNiFAST64 PRI64"i" /* int_fast64_t */ #define SCNiMAX "ji" /* intmax_t */ -#define SCNiPTR "i" /* intptr_t */ +#define SCNiPTR PRIreg"i" /* intptr_t */ /* fscanf(3) macros for unsigned integers. */ #define SCNo8 "hho" /* uint8_t */ #define SCNo16 "ho" /* uint16_t */ #define SCNo32 "o" /* uint32_t */ -#define SCNo64 "llo" /* uint64_t */ +#define SCNo64 PRI64"o" /* uint64_t */ #define SCNoLEAST8 "hho" /* uint_least8_t */ #define SCNoLEAST16 "ho" /* uint_least16_t */ #define SCNoLEAST32 "o" /* uint_least32_t */ -#define SCNoLEAST64 "llo" /* uint_least64_t */ +#define SCNoLEAST64 PRI64"o" /* uint_least64_t */ #define SCNoFAST8 "o" /* uint_fast8_t */ #define SCNoFAST16 "o" /* uint_fast16_t */ #define SCNoFAST32 "o" /* uint_fast32_t */ -#define SCNoFAST64 "llo" /* uint_fast64_t */ +#define SCNoFAST64 PRI64"o" /* uint_fast64_t */ #define SCNoMAX "jo" /* uintmax_t */ -#define SCNoPTR "o" /* uintptr_t */ +#define SCNoPTR PRIreg"o" /* uintptr_t */ #define SCNu8 "hhu" /* uint8_t */ #define SCNu16 "hu" /* uint16_t */ #define SCNu32 "u" /* uint32_t */ -#define SCNu64 "llu" /* uint64_t */ +#define SCNu64 PRI64"u" /* uint64_t */ #define SCNuLEAST8 "hhu" /* uint_least8_t */ #define SCNuLEAST16 "hu" /* uint_least16_t */ #define SCNuLEAST32 "u" /* uint_least32_t */ -#define SCNuLEAST64 "llu" /* uint_least64_t */ +#define SCNuLEAST64 PRI64"u" /* uint_least64_t */ #define SCNuFAST8 "u" /* uint_fast8_t */ #define SCNuFAST16 "u" /* uint_fast16_t */ #define SCNuFAST32 "u" /* uint_fast32_t */ -#define SCNuFAST64 "llu" /* uint_fast64_t */ +#define SCNuFAST64 PRI64"u" /* uint_fast64_t */ #define SCNuMAX "ju" /* uintmax_t */ -#define SCNuPTR "u" /* uintptr_t */ +#define SCNuPTR PRIreg"u" /* uintptr_t */ #define SCNx8 "hhx" /* uint8_t */ #define SCNx16 "hx" /* uint16_t */ #define SCNx32 "x" /* uint32_t */ -#define SCNx64 "llx" /* uint64_t */ +#define SCNx64 PRI64"x" /* uint64_t */ #define SCNxLEAST8 "hhx" /* uint_least8_t */ #define SCNxLEAST16 "hx" /* uint_least16_t */ #define SCNxLEAST32 "x" /* uint_least32_t */ -#define SCNxLEAST64 "llx" /* uint_least64_t */ +#define SCNxLEAST64 PRI64"x" /* uint_least64_t */ #define SCNxFAST8 "x" /* uint_fast8_t */ #define SCNxFAST16 "x" /* uint_fast16_t */ #define SCNxFAST32 "x" /* uint_fast32_t */ -#define SCNxFAST64 "llx" /* uint_fast64_t */ +#define SCNxFAST64 PRI64"x" /* uint_fast64_t */ #define SCNxMAX "jx" /* uintmax_t */ -#define SCNxPTR "x" /* uintptr_t */ +#define SCNxPTR PRIreg"x" /* uintptr_t */ #endif /* !_MACHINE_INTTYPES_H_ */ Modified: projects/ppc64/sys/powerpc/include/_stdint.h ============================================================================== --- projects/ppc64/sys/powerpc/include/_stdint.h Sat Jul 25 21:51:12 2009 (r195879) +++ projects/ppc64/sys/powerpc/include/_stdint.h Sun Jul 26 00:16:43 2009 (r195880) @@ -45,15 +45,22 @@ #define INT8_C(c) (c) #define INT16_C(c) (c) #define INT32_C(c) (c) -#define INT64_C(c) (c ## LL) #define UINT8_C(c) (c) #define UINT16_C(c) (c) #define UINT32_C(c) (c ## U) -#define UINT64_C(c) (c ## ULL) +#ifdef __powerpc64__ +#define INT64_C(c) (c ## L) +#define UINT64_C(c) (c ## UL) +#define INTMAX_C(c) (c ## L) +#define UINTMAX_C(c) (c ## UL) +#else +#define INT64_C(c) (c ## LL) +#define UINT64_C(c) (c ## ULL) #define INTMAX_C(c) (c ## LL) #define UINTMAX_C(c) (c ## ULL) +#endif #endif /* !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) */ @@ -129,9 +136,15 @@ * ISO/IEC 9899:1999 * 7.18.2.4 Limits of integer types capable of holding object pointers */ +#ifdef __powerpc64__ +#define INTPTR_MIN INT64_MIN +#define INTPTR_MAX INT64_MAX +#define UINTPTR_MAX UINT64_MAX +#else #define INTPTR_MIN INT32_MIN #define INTPTR_MAX INT32_MAX #define UINTPTR_MAX UINT32_MAX +#endif /* * ISO/IEC 9899:1999 @@ -145,6 +158,18 @@ * ISO/IEC 9899:1999 * 7.18.3 Limits of other integer types */ +#ifdef __powerpc64__ +/* Limits of ptrdiff_t. */ +#define PTRDIFF_MIN INT64_MIN +#define PTRDIFF_MAX INT64_MAX + +/* Limits of sig_atomic_t. */ +#define SIG_ATOMIC_MIN INT64_MIN +#define SIG_ATOMIC_MAX INT64_MAX + +/* Limit of size_t. */ +#define SIZE_MAX UINT64_MAX +#else /* Limits of ptrdiff_t. */ #define PTRDIFF_MIN INT32_MIN #define PTRDIFF_MAX INT32_MAX @@ -155,6 +180,7 @@ /* Limit of size_t. */ #define SIZE_MAX UINT32_MAX +#endif #ifndef WCHAR_MIN /* Also possibly defined in */ /* Limits of wchar_t. */ Modified: projects/ppc64/sys/powerpc/include/frame.h ============================================================================== --- projects/ppc64/sys/powerpc/include/frame.h Sat Jul 25 21:51:12 2009 (r195879) +++ projects/ppc64/sys/powerpc/include/frame.h Sun Jul 26 00:16:43 2009 (r195880) @@ -55,7 +55,7 @@ struct trapframe { register_t ctr; register_t srr0; register_t srr1; - int exc; + register_t exc; union { struct { /* dar & dsisr are only filled on a DSI trap */ @@ -90,6 +90,6 @@ struct callframe { /* Definitions for syscalls */ #define FIRSTARG 3 /* first arg in reg 3 */ #define NARGREG 8 /* 8 args in regs */ -#define MOREARGS(sp) ((caddr_t)((int)(sp) + 8)) /* more args go here */ +#define MOREARGS(sp) ((caddr_t)((uintptr_t)(sp) + 8)) /* more args go here */ #endif /* _MACHINE_FRAME_H_ */