1 /*- 2 * %sccs.include.redist.c% 3 * 4 * @(#)SYS.h 5.1 (Berkeley) 06/25/92 5 */ 6 7 #include <sys/syscall.h> 8 #include <machine/trap.h> 9 10 #ifdef PROF 11 #define ENTRY(x) \ 12 .align 4; .globl _##x; .proc 1; _##x:; .data; .align 4; 1: .long 0; \ 13 .text; save %sp,-96,%sp; sethi %hi(1b),%o0; call mcount; \ 14 or %o0,%lo(1b),%o0; restore 15 #else 16 #define ENTRY(x) \ 17 .align 4; .globl _##x; .proc 1; _##x: 18 #endif 19 20 /* 21 * ERROR branches to cerror. This is done with a macro so that I can 22 * change it to be position independent later, if need be. 23 */ 24 #define ERROR() \ 25 sethi %hi(cerror),%g1; or %lo(cerror),%g1,%g1; jmp %g1; nop 26 27 /* 28 * SYSCALL is used when further action must be taken before returning. 29 * Note that it adds a `nop' over what we could do, if we only knew what 30 * came at label 1.... 31 */ 32 #define SYSCALL(x) \ 33 ENTRY(x); mov SYS_##x,%g1; t ST_SYSCALL; bcc 1f; nop; ERROR(); 1: 34 35 /* 36 * RSYSCALL is used when the system call should just return. Here 37 * we use the SYSCALL_RFLAG to put the `success' return address in %g7 38 * and avoid a branch. 39 */ 40 #define RSYSCALL(x) \ 41 ENTRY(x); mov (SYS_##x)|SYSCALL_RFLAG,%g1; add %o7,8,%g7; \ 42 t ST_SYSCALL; ERROR() 43 44 /* 45 * PSEUDO(x,y) is like RSYSCALL(y) except that the name is x. 46 */ 47 #define PSEUDO(x,y) \ 48 ENTRY(x); mov (SYS_##y)|SYSCALL_RFLAG,%g1; add %o7,8,%g7; \ 49 t ST_SYSCALL; ERROR() 50 51 #define ASMSTR .asciz 52 53 .globl cerror 54