1 #include <minix/ipcconst.h>
2 #include <machine/asm.h>
4 /**========================================================================* */
5 /* IPC assembly routines * */
6 /**========================================================================* */
7 /* all message passing routines save ebx, but destroy eax and ecx. */
9 #define IPCFUNC(name,SETARGS,VEC,POSTTRAP) \
10 ENTRY(usermapped_ ## name ## _softint) ;\
15 int $VEC /* trap to the kernel */ ;\
16 mov %ebx, %ecx /* save %ebx */ ;\
21 ENTRY(usermapped_ ## name ## _sysenter) ;\
29 movl %esp, %esi /* kernel uses %esi for restored %esp */;\
30 movl $0f, %edx /* kernel uses %edx for restored %eip */;\
31 movl $VEC, %edi /* %edi to distinguish ipc/kerncall */ ;\
32 /* !!! There is a dependency of proc_stacktrace() ;\
33 * on this stack layout; it needs to find %ebp on it. ;\
35 SETARGS /* call-specific register setup */ ;\
36 sysenter /* disappear into kernel */ ;\
38 push %edi /* kernel has desired PSW in %edi */ ;\
39 popf /* set PSW kernel wants us to have */ ;\
40 mov %ebx, %ecx /* return w. state mangled; save %ebx */;\
49 ENTRY(usermapped_ ## name ## _syscall) ;\
57 movl $VEC, %edi /* %edi to distinguish ipc/kerncall */ ;\
58 /* !!! There is a dependency of proc_stacktrace() ;\
59 * on this stack layout; it needs to find %ebp on it. ;\
61 SETARGS /* call-specific register setup */ ;\
62 movl %ecx, %edx /* %ecx is clobbered by SYSCALL */ ;\
63 syscall /* disappear into kernel */ ;\
64 push %edi /* kernel has desired PSW in %edi */ ;\
65 popf /* set PSW kernel wants us to have */ ;\
66 mov %ebx, %ecx /* return w. state mangled; save %ebx */;\
76 #define IPCARGS(opcode) \
77 movl 8(%ebp), %eax /* eax = dest-src */ ;\
78 movl 12(%ebp), %ebx /* ebx = message pointer */ ;\
82 movl 12(%ebp), %eax /* eax = count */ ;\
83 movl 8(%ebp), %ebx /* ebx = table */ ;\
88 movl 16(%ebp), %eax /* ecx = saved %ebx */ ;\
92 #define KERNARGS mov 8(%ebp), %eax
94 IPCFUNC(send,IPCARGS(SEND),IPCVEC_UM,)
95 IPCFUNC(receive,IPCARGS(RECEIVE),IPCVEC_UM,GETSTATUS)
96 IPCFUNC(sendrec,IPCARGS(SENDREC),IPCVEC_UM,)
97 IPCFUNC(sendnb,IPCARGS(SENDNB),IPCVEC_UM,)
98 IPCFUNC(notify,IPCARGS(NOTIFY),IPCVEC_UM,)
99 IPCFUNC(senda,SENDA_ARGS,IPCVEC_UM,)
100 IPCFUNC(do_kernel_call,KERNARGS,KERVEC_UM,)
103 LABEL(usermapped_offset)