123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- #ifndef _LINUX_SPARC64_SYSDEP_H
- #define _LINUX_SPARC64_SYSDEP_H 1
- #include <common/sysdep.h>
- #undef SYS_ify
- #define SYS_ify(syscall_name) __NR_##syscall_name
- #ifdef __ASSEMBLER__
- #define SPARC_PIC_THUNK(reg) \
- .ifndef __sparc_get_pc_thunk.reg; \
- .section .text.__sparc_get_pc_thunk.reg,"axG",@progbits,__sparc_get_pc_thunk.reg,comdat; \
- .align 32; \
- .weak __sparc_get_pc_thunk.reg; \
- .hidden __sparc_get_pc_thunk.reg; \
- .type __sparc_get_pc_thunk.reg, #function; \
- __sparc_get_pc_thunk.reg: \
- jmp %o7 + 8; \
- add %o7, %reg, %##reg; \
- .previous; \
- .endif;
- #define SPARC_PIC_THUNK_CALL(reg) \
- sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %##reg; \
- call __sparc_get_pc_thunk.reg; \
- or %##reg, %lo(_GLOBAL_OFFSET_TABLE_+4), %##reg;
- #define SETUP_PIC_REG(reg) \
- SPARC_PIC_THUNK(reg) \
- SPARC_PIC_THUNK_CALL(reg)
- #define SETUP_PIC_REG_LEAF(reg, tmp) \
- SPARC_PIC_THUNK(reg) \
- mov %o7, %##tmp; \
- SPARC_PIC_THUNK_CALL(reg); \
- mov %##tmp, %o7;
- #define LOADSYSCALL(x) mov __NR_##x, %g1
- #define ENTRY(name) \
- .align 4; \
- .global C_SYMBOL_NAME(name); \
- .type name, @function; \
- C_LABEL(name) \
- cfi_startproc;
- #undef END
- #define END(name) \
- cfi_endproc; \
- .size name, . - name
- #define ENTRY_NOCFI(name) \
- .align 4; \
- .global C_SYMBOL_NAME(name); \
- .type name, @function; \
- C_LABEL(name)
- #define END_NOCFI(name) \
- .size name, . - name
- #define LOC(name) .L##name
- #undef PSEUDO
- #define PSEUDO(name, syscall_name, args) \
- .text; \
- ENTRY(name); \
- LOADSYSCALL(syscall_name); \
- ta 0x6d; \
- bcc,pt %xcc, 1f; \
- nop; \
- SYSCALL_ERROR_HANDLER \
- 1:
- #undef PSEUDO_NOERRNO
- #define PSEUDO_NOERRNO(name, syscall_name, args)\
- .text; \
- ENTRY(name); \
- LOADSYSCALL(syscall_name); \
- ta 0x6d;
- #undef PSEUDO_ERRVAL
- #define PSEUDO_ERRVAL(name, syscall_name, args) \
- .text; \
- ENTRY(name); \
- LOADSYSCALL(syscall_name); \
- ta 0x6d;
- #undef PSEUDO_END
- #define PSEUDO_END(name) \
- END(name)
- #ifndef __PIC__
- # define SYSCALL_ERROR_HANDLER \
- mov %o7, %g1; \
- call __syscall_error; \
- mov %g1, %o7;
- #else
- # define SYSCALL_ERROR_HANDLER \
- 0: SETUP_PIC_REG_LEAF(o2,g1) \
- sethi %gdop_hix22(errno), %g1;\
- xor %g1, %gdop_lox10(errno), %g1;\
- ldx [%o2 + %g1], %g1, %gdop(errno);\
- st %o0, [%g1]; \
- jmp %o7 + 8; \
- mov -1, %o0;
- #endif
- #endif
- #define STACK_BIAS 2047
- #endif
|