tools/llvm: Do not build with symbols
[minix3.git] / minix / kernel / arch / i386 / usermapped_glo_ipc.S
bloba5a1cde1dabaf357f681ac642b236aaee4c6b90f
1 #include <minix/ipcconst.h>
2 #include <machine/asm.h>
4 /* Redefine _ENTRY to put the following function in the section
5  * ".usermapped_glo". */
6 #undef _ENTRY
7 #define _ENTRY(x) \
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)                                  ;\
19         push    %ebp                                                    ;\
20         movl    %esp, %ebp                                              ;\
21         push    %ebx                                                    ;\
22         SETARGS                                                         ;\
23         int     $VEC    /* trap to the kernel */                        ;\
24         mov     %ebx, %ecx      /* save %ebx */                         ;\
25         POSTTRAP                                                        ;\
26         pop     %ebx                                                    ;\
27         pop     %ebp                                                    ;\
28         ret                                                             ;\
29 ENTRY(usermapped_ ## name ## _sysenter)                                 ;\
30         push    %ebp                                                    ;\
31         movl    %esp, %ebp                                              ;\
32         push    %ebp                                                    ;\
33         push    %edx                                                    ;\
34         push    %ebx                                                    ;\
35         push    %esi                                                    ;\
36         push    %edi                                                    ;\
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.           ;\
42          */                                                             ;\
43         SETARGS                 /* call-specific register setup */      ;\
44         sysenter                /* disappear into kernel */             ;\
45 0:                                                                      ;\
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 */;\
49         pop     %edi                                                    ;\
50         pop     %esi                                                    ;\
51         pop     %ebx                                                    ;\
52         pop     %edx                                                    ;\
53         pop     %ebp                                                    ;\
54         POSTTRAP                                                        ;\
55         pop     %ebp                                                    ;\
56         ret                                                             ;\
57 ENTRY(usermapped_ ## name ## _syscall)                                  ;\
58         push    %ebp                                                    ;\
59         movl    %esp, %ebp                                              ;\
60         push    %ebp                                                    ;\
61         push    %edx                                                    ;\
62         push    %ebx                                                    ;\
63         push    %esi                                                    ;\
64         push    %edi                                                    ;\
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.           ;\
68          */                                                             ;\
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 */;\
75         pop     %edi                                                    ;\
76         pop     %esi                                                    ;\
77         pop     %ebx                                                    ;\
78         pop     %edx                                                    ;\
79         pop     %ebp                                                    ;\
80         POSTTRAP                                                        ;\
81         pop     %ebp                                                    ;\
82         ret
84 #define IPCARGS(opcode)                                                 \
85         movl    8(%ebp), %eax   /* eax = dest-src */                    ;\
86         movl    12(%ebp), %ebx  /* ebx = message pointer */             ;\
87         movl    $opcode, %ecx                                           ;\
89 #define SENDA_ARGS              \
90         movl    12(%ebp), %eax  /* eax = count */                       ;\
91         movl    8(%ebp), %ebx   /* ebx = table */                       ;\
92         movl    $SENDA, %ecx                                            ;\
94 #define GETSTATUS                                                       \
95         push    %eax                                                    ;\
96         movl    16(%ebp), %eax      /* ecx = saved %ebx */              ;\
97         movl    %ecx,  (%eax)                                           ;\
98         pop     %eax
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,)
110 .data
111 LABEL(usermapped_offset)
112 .space 4