22nd May 23:02
microkernel stack switching
I read some books about intel 80386 programming to learn how
intel chips works- programming the 80386, the intel microprecessors
The books say that when the switch occurs,
"the current state is saved in the current TSS and the new TSS is
with the state of the new task(all the regiesters) loaded
into the microprocess." -the intel microprecessors
OR "the current processor register values are wirtten into
fields in the TSS"-programming the 80386
But I understand when an interrupt occurs, by Intel chip default,
CS, EIP,SS,SP,are automatically saved into "struct stackframe_s"
and the kernel CS, SS is loaded onto the registers
except for the remainig registers
so that the 'save' routine finishes the job up
by pushing all the registers onto the "struct stackframe_s" pointed to
by sp0 in TSS.
What I hardly understand is
all the states are already saved in TSS by default according to the
But the minix also do the same job of pushing all the registers onto
the "struct stackframe_s".
Do they do the same job redundantly but minix uses only the "struct
stackframe_s" part ?
Is the TSS the kernel stack ?
Otherwise what is it used for ?
When we use the commands 'push' or 'pop', they use stack created by
How do we declare a structure and use it as a stack ?
What I know is that when a structure is accessed, dot operators should
be used not 'push' or 'pop'
for example in C language
aaa.SS0 = ***;
But how does the command 'push' know it should push some values into
stackfram_s ,which is not pointed by SS but pointed by SP0.
I have some confusion about this.
Would you clear these ?