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 push %edi /* kernel has desired PSW in %edi */ ;\
47 popf /* set PSW kernel wants us to have */ ;\
48 mov %ebx, %ecx /* return w. state mangled; save %ebx */;\
57 ENTRY(usermapped_ ## name ## _syscall) ;\
65 movl $VEC, %edi /* %edi to distinguish ipc/kerncall */ ;\
66 /* !!! There is a dependency of proc_stacktrace() ;\
67 * on this stack layout; it needs to find %ebp on it. ;\
69 SETARGS /* call-specific register setup */ ;\
70 movl %ecx, %edx /* %ecx is clobbered by SYSCALL */ ;\
71 syscall /* disappear into kernel */ ;\
72 push %edi /* kernel has desired PSW in %edi */ ;\
73 popf /* set PSW kernel wants us to have */ ;\
74 mov %ebx, %ecx /* return w. state mangled; save %ebx */;\
84 #define IPCARGS(opcode) \
85 movl 8(%ebp), %eax /* eax = dest-src */ ;\
86 movl 12(%ebp), %ebx /* ebx = message pointer */ ;\
90 movl 12(%ebp), %eax /* eax = count */ ;\
91 movl 8(%ebp), %ebx /* ebx = table */ ;\
96 movl 16(%ebp), %eax /* ecx = saved %ebx */ ;\
100 #define KERNARGS mov 8(%ebp), %eax
102 IPCFUNC(send,IPCARGS(SEND),IPCVEC_UM,)
103 IPCFUNC(receive,IPCARGS(RECEIVE),IPCVEC_UM,GETSTATUS)
104 IPCFUNC(sendrec,IPCARGS(SENDREC),IPCVEC_UM,)
105 IPCFUNC(sendnb,IPCARGS(SENDNB),IPCVEC_UM,)
106 IPCFUNC(notify,IPCARGS(NOTIFY),IPCVEC_UM,)
107 IPCFUNC(senda,SENDA_ARGS,IPCVEC_UM,)
108 IPCFUNC(do_kernel_call,KERNARGS,KERVEC_UM,)
111 LABEL(usermapped_offset)