minix/lib/libc/arch/i386/rts/_ipc.s

85 lines
1.8 KiB
ArmAsm

.sect .text; .sect .rom; .sect .data; .sect .bss
.define __notify, __send, __senda, __sendnb, __receive, __sendrec, __do_kernel_call
! See src/kernel/ipc.h for C definitions
SEND = 1
RECEIVE = 2
SENDREC = 3
NOTIFY = 4
SENDNB = 5
IPCVEC = 33 ! ipc trap to kernel
KERVEC = 32 ! syscall trap to kernel
SRC_DST = 8 ! source/ destination process
MESSAGE = 12 ! message pointer
!*========================================================================*
! IPC assembly routines *
!*========================================================================*
! all message passing routines save ebp, but destroy eax and ecx.
.sect .text
__send:
push ebp
mov ebp, esp
push ebx
mov eax, SRC_DST(ebp) ! eax = dest-src
mov ebx, MESSAGE(ebp) ! ebx = message pointer
mov ecx, SEND ! _send(dest, ptr)
int IPCVEC ! trap to the kernel
pop ebx
pop ebp
ret
__receive:
push ebp
mov ebp, esp
push ebx
mov eax, SRC_DST(ebp) ! eax = dest-src
mov ebx, MESSAGE(ebp) ! ebx = message pointer
mov ecx, RECEIVE ! _receive(src, ptr)
int IPCVEC ! trap to the kernel
pop ebx
pop ebp
ret
__sendrec:
push ebp
mov ebp, esp
push ebx
mov eax, SRC_DST(ebp) ! eax = dest-src
mov ebx, MESSAGE(ebp) ! ebx = message pointer
mov ecx, SENDREC ! _sendrec(srcdest, ptr)
int IPCVEC ! trap to the kernel
pop ebx
pop ebp
ret
__notify:
push ebp
mov ebp, esp
push ebx
mov eax, SRC_DST(ebp) ! eax = destination
mov ecx, NOTIFY ! _notify(srcdst)
int IPCVEC ! trap to the kernel
pop ebx
pop ebp
ret
__sendnb:
push ebp
mov ebp, esp
push ebx
mov eax, SRC_DST(ebp) ! eax = dest-src
mov ebx, MESSAGE(ebp) ! ebx = message pointer
mov ecx, SENDNB ! _sendnb(dest, ptr)
int IPCVEC ! trap to the kernel
pop ebx
pop ebp
ret
__do_kernel_call:
! pass the message pointer to kernel in the %eax register
mov eax, 4(esp)
int KERVEC
ret