[9] | 1 | .sect .text; .sect .rom; .sect .data; .sect .bss
|
---|
| 2 | .define __echo, __notify, __send, __receive, __sendrec
|
---|
| 3 |
|
---|
| 4 | ! See src/kernel/ipc.h for C definitions
|
---|
| 5 | SEND = 1
|
---|
| 6 | RECEIVE = 2
|
---|
| 7 | SENDREC = 3
|
---|
| 8 | NOTIFY = 4
|
---|
| 9 | ECHO = 8
|
---|
| 10 | SYSVEC = 33 ! trap to kernel
|
---|
| 11 |
|
---|
| 12 | SRC_DST = 8 ! source/ destination process
|
---|
| 13 | ECHO_MESS = 8 ! echo doesn't have SRC_DST
|
---|
| 14 | MESSAGE = 12 ! message pointer
|
---|
| 15 |
|
---|
| 16 | !*========================================================================*
|
---|
| 17 | ! IPC assembly routines *
|
---|
| 18 | !*========================================================================*
|
---|
| 19 | ! all message passing routines save ebp, but destroy eax and ecx.
|
---|
| 20 | .define __echo, __notify, __send, __receive, __sendrec
|
---|
| 21 | .sect .text
|
---|
| 22 | __send:
|
---|
| 23 | push ebp
|
---|
| 24 | mov ebp, esp
|
---|
| 25 | push ebx
|
---|
| 26 | mov eax, SRC_DST(ebp) ! eax = dest-src
|
---|
| 27 | mov ebx, MESSAGE(ebp) ! ebx = message pointer
|
---|
| 28 | mov ecx, SEND ! _send(dest, ptr)
|
---|
| 29 | int SYSVEC ! trap to the kernel
|
---|
| 30 | pop ebx
|
---|
| 31 | pop ebp
|
---|
| 32 | ret
|
---|
| 33 |
|
---|
| 34 | __receive:
|
---|
| 35 | push ebp
|
---|
| 36 | mov ebp, esp
|
---|
| 37 | push ebx
|
---|
| 38 | mov eax, SRC_DST(ebp) ! eax = dest-src
|
---|
| 39 | mov ebx, MESSAGE(ebp) ! ebx = message pointer
|
---|
| 40 | mov ecx, RECEIVE ! _receive(src, ptr)
|
---|
| 41 | int SYSVEC ! trap to the kernel
|
---|
| 42 | pop ebx
|
---|
| 43 | pop ebp
|
---|
| 44 | ret
|
---|
| 45 |
|
---|
| 46 | __sendrec:
|
---|
| 47 | push ebp
|
---|
| 48 | mov ebp, esp
|
---|
| 49 | push ebx
|
---|
| 50 | mov eax, SRC_DST(ebp) ! eax = dest-src
|
---|
| 51 | mov ebx, MESSAGE(ebp) ! ebx = message pointer
|
---|
| 52 | mov ecx, SENDREC ! _sendrec(srcdest, ptr)
|
---|
| 53 | int SYSVEC ! trap to the kernel
|
---|
| 54 | pop ebx
|
---|
| 55 | pop ebp
|
---|
| 56 | ret
|
---|
| 57 |
|
---|
| 58 | __notify:
|
---|
| 59 | push ebp
|
---|
| 60 | mov ebp, esp
|
---|
| 61 | push ebx
|
---|
| 62 | mov eax, SRC_DST(ebp) ! ebx = destination
|
---|
| 63 | mov ecx, NOTIFY ! _notify(srcdst)
|
---|
| 64 | int SYSVEC ! trap to the kernel
|
---|
| 65 | pop ebx
|
---|
| 66 | pop ebp
|
---|
| 67 | ret
|
---|
| 68 |
|
---|
| 69 | __echo:
|
---|
| 70 | push ebp
|
---|
| 71 | mov ebp, esp
|
---|
| 72 | push ebx
|
---|
| 73 | mov ebx, ECHO_MESS(ebp) ! ebx = message pointer
|
---|
| 74 | mov ecx, ECHO ! _echo(srcdest, ptr)
|
---|
| 75 | int SYSVEC ! trap to the kernel
|
---|
| 76 | pop ebx
|
---|
| 77 | pop ebp
|
---|
| 78 | ret
|
---|
| 79 |
|
---|