



























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




























How does Linux handle service- requests from the cpu and from the peripheral devices?
Normal programming assumes this ‘cycle’:
automatically switch control to a ‘debugger’
program after it has executed an instruction
save return-info, + jump to trap-handler
the saved address is for the instruction which triggered the fault – so it will be that instruction which gets re-fetched after the cause of the problem has been corrected
the saved address is for the instruction following the one which triggered the trap
ESP EFLAGS
EIP
SS
CS
SS:ESP
In case the CPU gets interrupted while it is executing a user application, then the CPU will switch to a new ‘kernel-mode’ stack before saving its current register-values for EFLAGS, CS, and EIP, and in fact will begin by saving on the kernel-mode stack the register-values for SS and ESP which point to the top of user-mode stack (so it can be restored later on)
Segment Base Address Segment Limit 47 1615 0
Privileged instructions: LGDT and LIDT used to set these register-values Unprivileged instructions: SGDT and SIDT used for reading register-values
Kernel must setup these registers during system startup (set-and-forget)
Base[ 15 … 0 ] Limit[ 15 ... 0 ]
31 16 15 0
63 56 39 32
Base[31…24] (^) [19..16]Limit attributes^ Access Base[23…16]
Quadword (64-bits)
Entrypoint Offset[ 31…16 ]
Code-segment Selector Entrypoint Offset[ 15…0 ]
Quadword (64-bits)
0
63
31
32 Gate type code (Reserved)