MINIX doesn't take advantage of x86 task switching, right?

109 views Asked by At

I'm studying MINIX book version (3.1.0) source code and found MINIX 3 doesn't use the cpu's task switching function, instead it just performs a normal iret without NT flag being set. Is that right?

_restart:

! Restart the current process or the next process if it is set. 

    cmp (_next_ptr), 0      ! see if another process is scheduled
    jz  0f
    mov     eax, (_next_ptr)
    mov (_proc_ptr), eax    ! schedule new process 
    mov (_next_ptr), 0
0:  mov esp, (_proc_ptr)    ! will assume P_STACKBASE == 0
    lldt    P_LDT_SEL(esp)      ! enable process' segment descriptors 
    lea eax, P_STACKTOP(esp)    ! arrange for next interrupt
    mov (_tss+TSS3_S_SP0), eax  ! to save state in process table
restart1:
    decb    (_k_reenter)
    o16 pop gs
    o16 pop fs
    o16 pop es
    o16 pop ds
    popad
    add esp, 4      ! skip return adr
    iretd           ! continue process
1

There are 1 answers

0
mevets On

Yes; that is common to almost all x86 OS'es ( although I am about to publish one that tries to use it for giggles ). The whole NT + chase the backlink is a neat idea, but actually makes kernels way harder to implement, and apparently gains very little. The 386 protection model was inherited via the 80286 from the iapx432. The 432 was an object-oriented, capability based protection model implemented in the processor. Note that Google's new somewhat purple OS uses a bunch of those buzzwords.

Unlike the 432, the 80286 ( and successors ) interposed a unix-y system call model which made the whole task-link, nested task thing just something the OS had to undo; so it was easier to avoid it entirely, and treat it like a quirky 68k.

Now that Robert Bedichek is back at intel, I wonder if we might see more ambitious designs like this, rather than the oh, and we have 8 decoder units that has helped us sleep for 20 years.