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