1 #include <minix/ipcconst.h>
2 #include <machine/asm.h>
4 /* Redefine _ENTRY to put the following function in the section
5 * ".usermapped_glo". */
8 _ALIGN_TEXT; .globl x; .type x,@function; x:
10 .section .usermapped_glo, "wax", @progbits
12 /**========================================================================* */
13 /* IPC assembly routines * */
14 /**========================================================================* */
15 /* all message passing routines save ebx, but destroy eax and ecx. */
17 #define IPCFUNC(name,SETARGS,VEC,POSTTRAP) \
18 ENTRY(usermapped_ ## name ## _softint) ;\
23 int $VEC /* trap to the kernel */ ;\
24 mov %ebx, %ecx /* save %ebx */ ;\
29 ENTRY(usermapped_ ## name ## _sysenter) ;\
37 movl %esp, %esi /* kernel uses %esi for restored %esp */;\
38 movl $0f, %edx /* kernel uses %edx for restored %eip */;\
39 movl $VEC, %edi /* %edi to distinguish ipc/kerncall */ ;\
40 /* !!! There is a dependency of proc_stacktrace() ;\
41 * on this stack layout; it needs to find %ebp on it. ;\
43 SETARGS /* call-specific register setup */ ;\
44 sysenter /* disappear into kernel */ ;\
46 mov %ebx, %ecx /* return w. state mangled; save %ebx */;\
55 ENTRY(usermapped_ ## name ## _syscall) ;\
63 movl $VEC, %edi /* %edi to distinguish ipc/kerncall */ ;\
64 /* !!! There is a dependency of proc_stacktrace() ;\
65 * on this stack layout; it needs to find %ebp on it. ;\
67 SETARGS /* call-specific register setup */ ;\
68 movl %ecx, %edx /* %ecx is clobbered by SYSCALL */ ;\
69 syscall /* disappear into kernel */ ;\
70 mov %ebx, %ecx /* return w. state mangled; save %ebx */;\
80 #define IPCARGS(opcode) \
81 movl 8(%ebp), %eax /* eax = dest-src */ ;\
82 movl 12(%ebp), %ebx /* ebx = message pointer */ ;\
86 movl 12(%ebp), %eax /* eax = count */ ;\
87 movl 8(%ebp), %ebx /* ebx = table */ ;\
92 movl 16(%ebp), %eax /* ecx = saved %ebx */ ;\
96 #define KERNARGS mov 8(%ebp), %eax
98 IPCFUNC(send,IPCARGS(SEND),IPCVEC_UM,)
99 IPCFUNC(receive,IPCARGS(RECEIVE),IPCVEC_UM,GETSTATUS)
100 IPCFUNC(sendrec,IPCARGS(SENDREC),IPCVEC_UM,)
101 IPCFUNC(sendnb,IPCARGS(SENDNB),IPCVEC_UM,)
102 IPCFUNC(notify,IPCARGS(NOTIFY),IPCVEC_UM,)
103 IPCFUNC(senda,SENDA_ARGS,IPCVEC_UM,)
104 IPCFUNC(do_kernel_call,KERNARGS,KERVEC_UM,)
107 LABEL(usermapped_offset)