
* Userspace change to use the new kernel calls - _taskcall(SYSTASK...) changed to _kernel_call(...) - int 32 reused for the kernel calls - _do_kernel_call() to make the trap to kernel - kernel_call() to make the actuall kernel call from C using _do_kernel_call() - unlike ipc call the kernel call always succeeds as kernel is always available, however, kernel may return an error * Kernel side implementation of kernel calls - the SYSTEm task does not run, only the proc table entry is preserved - every data_copy(SYSTEM is no data_copy(KERNEL - "locking" is an empty operation now as everything runs in kernel - sys_task() is replaced by kernel_call() which copies the message into kernel, dispatches the call to its handler and finishes by either copying the results back to userspace (if need be) or by suspending the process because of VM - suspended processes are later made runnable once the memory issue is resolved, picked up by the scheduler and only at this time the call is resumed (in fact restarted) which does not need to copy the message from userspace as the message is already saved in the process structure. - no ned for the vmrestart queue, the scheduler will restart the system calls - no special case in do_vmctl(), all requests remove the RTS_VMREQUEST flag
85 lines
1.8 KiB
ArmAsm
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
|