Created ECHO system call for testing purposes.

Furthermore, a quick way to get one's own process number.
This commit is contained in:
Jorrit Herder
2005-05-27 13:57:00 +00:00
parent 07d582872f
commit 8d9c0886cd
7 changed files with 60 additions and 42 deletions

View File

@@ -1,30 +1,31 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define __send, __nb_send, __receive, __nb_receive, __sendrec, __notify
.define __echo, __send, __nb_send, __receive, __nb_receive, __sendrec, __notify
! See ../h/com.h for C definitions
! See src/kernel/ipc.h for C definitions
ECHO = 0
SEND = 1
RECEIVE = 2
BOTH = 3
NOTIFY = 4
NB_SEND = 1 + 16 ! SEND | 0xF0
NB_RECEIVE = 2 + 16 ! RECEIVE | 0xF0
SYSVEC = 33
SYSVEC = 33 ! trap to kernel
SRCDEST = 8
MESSAGE = 12
SRC_DST = 8 ! source/ destination process
ECHO_MESS = 8 ! doesn't have SRC_DST
MESSAGE = 12 ! message pointer
!*========================================================================*
! _send and _receive *
! IPC assembly routines *
!*========================================================================*
! _send(), _nb_send(), _receive(), _nb_receive(), and _sendrec() all
! save ebp, but destroy eax and ecx.
.define __send, __nb_send, __receive, __nb_receive, __sendrec, __notify
! all message passing routines save ebp, but destroy eax and ecx.
.define __echo, __send, __nb_send, __receive, __nb_receive, __sendrec, __notify
.sect .text
__send:
push ebp
mov ebp, esp
push ebx
mov eax, SRCDEST(ebp) ! eax = dest-src
mov eax, SRC_DST(ebp) ! eax = dest-src
mov ebx, MESSAGE(ebp) ! ebx = message pointer
mov ecx, SEND ! _send(dest, ptr)
int SYSVEC ! trap to the kernel
@@ -36,7 +37,7 @@ __nb_send:
push ebp
mov ebp, esp
push ebx
mov eax, SRCDEST(ebp) ! eax = dest-src
mov eax, SRC_DST(ebp) ! eax = dest-src
mov ebx, MESSAGE(ebp) ! ebx = message pointer
mov ecx, NB_SEND ! _nb_send(dest, ptr)
int SYSVEC ! trap to the kernel
@@ -48,7 +49,7 @@ __receive:
push ebp
mov ebp, esp
push ebx
mov eax, SRCDEST(ebp) ! eax = dest-src
mov eax, SRC_DST(ebp) ! eax = dest-src
mov ebx, MESSAGE(ebp) ! ebx = message pointer
mov ecx, RECEIVE ! _receive(src, ptr)
int SYSVEC ! trap to the kernel
@@ -60,7 +61,7 @@ __nb_receive:
push ebp
mov ebp, esp
push ebx
mov eax, SRCDEST(ebp) ! eax = dest-src
mov eax, SRC_DST(ebp) ! eax = dest-src
mov ebx, MESSAGE(ebp) ! ebx = message pointer
mov ecx, NB_RECEIVE ! _nb_receive(src, ptr)
int SYSVEC ! trap to the kernel
@@ -72,7 +73,7 @@ __sendrec:
push ebp
mov ebp, esp
push ebx
mov eax, SRCDEST(ebp) ! eax = dest-src
mov eax, SRC_DST(ebp) ! eax = dest-src
mov ebx, MESSAGE(ebp) ! ebx = message pointer
mov ecx, BOTH ! _sendrec(srcdest, ptr)
int SYSVEC ! trap to the kernel
@@ -84,7 +85,7 @@ __notify:
push ebp
mov ebp, esp
push ebx
mov eax, SRCDEST(ebp) ! eax = dest-src
mov eax, SRC_DST(ebp) ! eax = dest-src
mov ebx, MESSAGE(ebp) ! ebx = message pointer
mov ecx, NOTIFY ! _notify(srcdest, ptr)
int SYSVEC ! trap to the kernel
@@ -92,3 +93,14 @@ __notify:
pop ebp
ret
__echo:
push ebp
mov ebp, esp
push ebx
mov ebx, ECHO_MESS(ebp) ! ebx = message pointer
mov ecx, ECHO ! _echo(srcdest, ptr)
int SYSVEC ! trap to the kernel
pop ebx
pop ebp
ret