X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=include%2Fasm-sparc64%2Felf.h;h=11c8e68d712a17552a40ecb3f76fa22971b148bf;hb=0dde3e16485dca16eb682dd59da1a598bf62e284;hp=69539a8ab833d4645eaab4ccd2536357af2540d9;hpb=94bc2be31a01a3055ec94176e595dfe208e92d3b;p=linux-2.6-omap-h63xx.git diff --git a/include/asm-sparc64/elf.h b/include/asm-sparc64/elf.h index 69539a8ab83..11c8e68d712 100644 --- a/include/asm-sparc64/elf.h +++ b/include/asm-sparc64/elf.h @@ -7,10 +7,9 @@ */ #include -#ifdef __KERNEL__ #include #include -#endif +#include /* * Sparc section types @@ -68,19 +67,18 @@ #define HWCAP_SPARC_MULDIV 8 #define HWCAP_SPARC_V9 16 #define HWCAP_SPARC_ULTRA3 32 +#define HWCAP_SPARC_BLKINIT 64 +#define HWCAP_SPARC_N2 128 + +#define CORE_DUMP_USE_REGSET /* * These are used to set parameters in the core dumps. */ -#ifndef ELF_ARCH #define ELF_ARCH EM_SPARCV9 #define ELF_CLASS ELFCLASS64 #define ELF_DATA ELFDATA2MSB -typedef unsigned long elf_greg_t; - -#define ELF_NGREG 36 -typedef elf_greg_t elf_gregset_t[ELF_NGREG]; /* Format of 64-bit elf_gregset_t is: * G0 --> G7 * O0 --> O7 @@ -91,24 +89,9 @@ typedef elf_greg_t elf_gregset_t[ELF_NGREG]; * TNPC * Y */ -#define ELF_CORE_COPY_REGS(__elf_regs, __pt_regs) \ -do { unsigned long *dest = &(__elf_regs[0]); \ - struct pt_regs *src = (__pt_regs); \ - unsigned long __user *sp; \ - int i; \ - for(i = 0; i < 16; i++) \ - dest[i] = src->u_regs[i]; \ - /* Don't try this at home kids... */ \ - sp = (unsigned long __user *) \ - ((src->u_regs[14] + STACK_BIAS) \ - & 0xfffffffffffffff8UL); \ - for(i = 0; i < 16; i++) \ - __get_user(dest[i+16], &sp[i]); \ - dest[32] = src->tstate; \ - dest[33] = src->tpc; \ - dest[34] = src->tnpc; \ - dest[35] = src->y; \ -} while (0); +typedef unsigned long elf_greg_t; +#define ELF_NGREG 36 +typedef elf_greg_t elf_gregset_t[ELF_NGREG]; typedef struct { unsigned long pr_regs[32]; @@ -116,17 +99,59 @@ typedef struct { unsigned long pr_gsr; unsigned long pr_fprs; } elf_fpregset_t; -#endif -#define ELF_CORE_COPY_TASK_REGS(__tsk, __elf_regs) \ - ({ ELF_CORE_COPY_REGS((*(__elf_regs)), task_pt_regs(__tsk)); 1; }) +/* Format of 32-bit elf_gregset_t is: + * G0 --> G7 + * O0 --> O7 + * L0 --> L7 + * I0 --> I7 + * PSR, PC, nPC, Y, WIM, TBR + */ +typedef unsigned int compat_elf_greg_t; +#define COMPAT_ELF_NGREG 38 +typedef compat_elf_greg_t compat_elf_gregset_t[COMPAT_ELF_NGREG]; + +typedef struct { + union { + unsigned int pr_regs[32]; + unsigned long pr_dregs[16]; + } pr_fr; + unsigned int __unused; + unsigned int pr_fsr; + unsigned char pr_qcnt; + unsigned char pr_q_entrysize; + unsigned char pr_en; + unsigned int pr_q[64]; +} compat_elf_fpregset_t; + +/* UltraSparc extensions. Still unused, but will be eventually. */ +typedef struct { + unsigned int pr_type; + unsigned int pr_align; + union { + struct { + union { + unsigned int pr_regs[32]; + unsigned long pr_dregs[16]; + long double pr_qregs[8]; + } pr_xfr; + } pr_v8p; + unsigned int pr_xfsr; + unsigned int pr_fprs; + unsigned int pr_xg[8]; + unsigned int pr_xo[8]; + unsigned long pr_tstate; + unsigned int pr_filler[8]; + } pr_un; +} elf_xregset_t; /* * This is used to ensure we don't load something for the wrong architecture. */ -#ifndef elf_check_arch -#define elf_check_arch(x) ((x)->e_machine == ELF_ARCH) /* Might be EM_SPARCV9 or EM_SPARC */ -#endif +#define elf_check_arch(x) ((x)->e_machine == ELF_ARCH) +#define compat_elf_check_arch(x) ((x)->e_machine == EM_SPARC || \ + (x)->e_machine == EM_SPARC32PLUS) +#define compat_start_thread start_thread32 #define USE_ELF_CORE_DUMP #define ELF_EXEC_PAGESIZE PAGE_SIZE @@ -136,20 +161,34 @@ typedef struct { the loader. We need to make sure that it is out of the way of the program that it will "exec", and that there is sufficient room for the brk. */ -#ifndef ELF_ET_DYN_BASE -#define ELF_ET_DYN_BASE 0x0000010000000000UL -#endif +#define ELF_ET_DYN_BASE 0x0000010000000000UL +#define COMPAT_ELF_ET_DYN_BASE 0x0000000070000000UL /* This yields a mask that user programs can use to figure out what instruction set this cpu supports. */ /* On Ultra, we support all of the v8 capabilities. */ -#define ELF_HWCAP ((HWCAP_SPARC_FLUSH | HWCAP_SPARC_STBAR | \ - HWCAP_SPARC_SWAP | HWCAP_SPARC_MULDIV | \ - HWCAP_SPARC_V9) | \ - ((tlb_type == cheetah || tlb_type == cheetah_plus) ? \ - HWCAP_SPARC_ULTRA3 : 0)) +static inline unsigned int sparc64_elf_hwcap(void) +{ + unsigned int cap = (HWCAP_SPARC_FLUSH | HWCAP_SPARC_STBAR | + HWCAP_SPARC_SWAP | HWCAP_SPARC_MULDIV | + HWCAP_SPARC_V9); + + if (tlb_type == cheetah || tlb_type == cheetah_plus) + cap |= HWCAP_SPARC_ULTRA3; + else if (tlb_type == hypervisor) { + if (sun4v_chip_type == SUN4V_CHIP_NIAGARA1 || + sun4v_chip_type == SUN4V_CHIP_NIAGARA2) + cap |= HWCAP_SPARC_BLKINIT; + if (sun4v_chip_type == SUN4V_CHIP_NIAGARA2) + cap |= HWCAP_SPARC_N2; + } + + return cap; +} + +#define ELF_HWCAP sparc64_elf_hwcap(); /* This yields a string that ld.so will use to load implementation specific libraries for optimization. This is more specific in @@ -157,7 +196,6 @@ typedef struct { #define ELF_PLATFORM (NULL) -#ifdef __KERNEL__ #define SET_PERSONALITY(ex, ibcs2) \ do { unsigned long new_flags = current_thread_info()->flags; \ new_flags &= _TIF_32BIT; \ @@ -176,6 +214,5 @@ do { unsigned long new_flags = current_thread_info()->flags; \ else if (current->personality != PER_LINUX32) \ set_personality(PER_LINUX); \ } while (0) -#endif #endif /* !(__ASM_SPARC64_ELF_H) */