1 | .sect .text; .sect .rom; .sect .data; .sect .bss
|
---|
2 | .define __ipc_request, __ipc_reply, __ipc_notify, __ipc_receive
|
---|
3 |
|
---|
4 | ! See src/kernel/ipc.h for C definitions.
|
---|
5 | IPC_REQUEST = 16 ! each gets a distinct bit
|
---|
6 | IPC_REPLY = 32
|
---|
7 | IPC_NOTIFY = 64
|
---|
8 | IPC_RECEIVE = 128
|
---|
9 |
|
---|
10 | SYSVEC = 33 ! trap to kernel
|
---|
11 |
|
---|
12 | ! Offsets of arguments relative to stack pointer.
|
---|
13 | SRC_DST = 8 ! source/ destination process
|
---|
14 | SEND_MSG = 12 ! message pointer for sending
|
---|
15 | EVENT_SET = 12 ! notification event set
|
---|
16 | RECV_MSG = 16 ! message pointer for receiving
|
---|
17 |
|
---|
18 |
|
---|
19 | !*========================================================================*
|
---|
20 | ! IPC assembly routines *
|
---|
21 | !*========================================================================*
|
---|
22 | ! all message passing routines save ebp, but destroy eax, ecx, and edx.
|
---|
23 | .define __ipc_request, __ipc_reply, __ipc_notify, __ipc_receive
|
---|
24 | .sect .text
|
---|
25 |
|
---|
26 | __ipc_request:
|
---|
27 | push ebp
|
---|
28 | mov ebp, esp
|
---|
29 | push ebx
|
---|
30 | mov eax, SRC_DST(ebp) ! eax = destination
|
---|
31 | mov ebx, SEND_MSG(ebp) ! ebx = message pointer
|
---|
32 | mov ecx, IPC_REQUEST ! _ipc_request(dst, ptr)
|
---|
33 | int SYSVEC ! trap to the kernel
|
---|
34 | pop ebx
|
---|
35 | pop ebp
|
---|
36 | ret
|
---|
37 |
|
---|
38 | __ipc_reply:
|
---|
39 | push ebp
|
---|
40 | mov ebp, esp
|
---|
41 | push ebx
|
---|
42 | mov eax, SRC_DST(ebp) ! eax = destination
|
---|
43 | mov ebx, SEND_MSG(ebp) ! ebx = message pointer
|
---|
44 | mov ecx, IPC_REPLY ! _ipc_reply(dst, ptr)
|
---|
45 | int SYSVEC ! trap to the kernel
|
---|
46 | pop ebx
|
---|
47 | pop ebp
|
---|
48 | ret
|
---|
49 |
|
---|
50 | __ipc_receive:
|
---|
51 | push ebp
|
---|
52 | mov ebp, esp
|
---|
53 | push ebx
|
---|
54 | mov eax, SRC_DST(ebp) ! eax = source
|
---|
55 | mov edx, EVENT_SET(ebp) ! ebx = event set
|
---|
56 | mov ebx, RCV_MSG(ebp) ! ebx = message pointer
|
---|
57 | mov ecx, IPC_RECEIVE ! _ipc_receive(src, events, ptr)
|
---|
58 | int SYSVEC ! trap to the kernel
|
---|
59 | pop ebx
|
---|
60 | pop ebp
|
---|
61 | ret
|
---|
62 |
|
---|
63 | __ipc_notify:
|
---|
64 | push ebp
|
---|
65 | mov ebp, esp
|
---|
66 | push ebx
|
---|
67 | mov eax, SRC_DST(ebp) ! ebx = destination
|
---|
68 | mov edx, EVENT_SET(ebp) ! edx = event set
|
---|
69 | mov ecx, IPC_NOTIFY ! _ipc_notify(dst, events)
|
---|
70 | int SYSVEC ! trap to the kernel
|
---|
71 | pop ebx
|
---|
72 | pop ebp
|
---|
73 | ret
|
---|
74 |
|
---|
75 |
|
---|