.sect .text; .sect .rom; .sect .data; .sect .bss
.global __echo, __notify, __send, __receive, __sendrec
#! See src/kernel/ipc.h for C definitions
SEND = 1
RECEIVE = 2
SENDREC = 3
NOTIFY = 4
ECHO = 8
SYSVEC = 33 #! trap to kernel
SRC_DST = 8 #! source/ destination process
ECHO_MESS = 8 #! echo doesn't have SRC_DST
MESSAGE = 12 #! message pointer
#!*========================================================================*
#! IPC assembly routines *
#!*========================================================================*
#! all message passing routines save ebp, but destroy eax and ecx.
.sect .text
XLEN = 8
__send:
addi sp, sp, -3*XLEN
sd s0, 1*XLEN(sp)
lw s0, sp #s0 frame pointer
sd x12, 1*XLEN(sp)
lw x10, SRC_DST(s0) #! eax = dest-src
lw x12, MESSAGE(s0) #! ebx = message pointer
li x13, SEND #! _send(dest, ptr)
ecall #software interrupt
ld x0, 1*XLEN(sp)
ld x12, 1*XLEN(sp)
addi sp, sp, 3*XLEN
ret
here's the code