SLIDE 60 System Calls
06648 .align 16 06649 _s_call: 06650 _p_s_call: 06651 cld ! set direction flag to a known value 06652 sub esp, 6*4 ! skip RETADR, eax, ecx, edx, ebx, est 06653 push ebp ! stack already points into proc table 06654 push esi 06655 push edi 06656
ds 06657
es 06658
fs 06659
gs 06660 mov dx, ss 06661 mov ds, dx 06662 mov es, dx 06663 incb (_k_reenter) 06664 mov esi, esp ! assumes P_STACKBASE == 0 06665 mov esp, k_stktop !
✂✁✜✛✣✢✤✓✥✠✧✦✡✓✩★✫✪✟✞✝✌✕✖✥✞✒☛✬✁✭✓✮✄✩✠✜✪✣✚
06666 xor ebp, ebp ! for stacktrace 06667 ! end of inline save 06668 ! now set up parameters for sys_call() 06669 push ebx ! pointer to user message 06670 push eax ! src/dest 06671 push ecx ! SEND/RECEIVE/BOTH 06672 call _sys_call ! sys_call(function, src_dest, m_ptr) 06673 ! caller is now explicitly in proc_ptr 06674 mov AXREG(esi), eax ! sys_call MUST PRESERVE si 06675 06676 ! Fall into code to restart proc/task running.
Note: s call is called by a nonkernel process to in- voke a system service. This means switching from user to kernel mode. When call is finished, we con- tinue with restart().
02 – 59 Processes/2.6 Implementation in MINIX