I've got great interest to how the processor/Windows do context-switch/function-calls between different privilege level.
I've read Intel's document and some other articles. I know x86 is capable of hardware task-switch. But wikipedia articles say that software context-switch is dominating the real world because of performance.
I'd like to know how the features of processor help in a multi-tasking system but it seems that the essential part of multi-tasking does not follow the hardware design.
And since I find that the Intel document is a bit obscure on the topic, no real workflow example is given. "CALL or JMP to TSS descriptor invoke a task switch." How the OS avoid using hardware task-switch? Does it disable TSS completely? I haven't read the Intel document throughout yet. Is there any good books/articles describe this issue with example workflow and details?
Thanks.
Questions about x86 and Windows
Moderator: Moderator Team
Hi!
There are some places in reactos:
• System calls. KiIntSystemCall and KiFastSystemCall. KiSystemService and KiFastCallEntry. KeReturnFromSystemCall.
• Context switch. KiSwapContext, KiSwapContextInternal
There is nothing magical in it.
Look at OS sources, how they do it; then take debugger in hands.Valeron wrote: I'd like to know how the features of processor help in a multi-tasking system but it seems that the essential part of multi-tasking does not follow the hardware design.
There are some places in reactos:
• System calls. KiIntSystemCall and KiFastSystemCall. KiSystemService and KiFastCallEntry. KeReturnFromSystemCall.
• Context switch. KiSwapContext, KiSwapContextInternal
There is nothing magical in it.
Simply does not CALL or JMP to TSS descriptor. :)"CALL or JMP to TSS descriptor invoke a task switch." How the OS avoid using hardware task-switch?
It is not completely disabled. In reactos it is used for NMI and double fault exception. See some code in Ki386InitializeTss.Does it disable TSS completely?
Re: Questions about x86 and Windows
Hi, hto, thanks for your reply.
I haven't read the codes you post yet. I've got another question up.
If I'm going to learn multi-tasking principle, e.g. how the OS and hardware incooperate to achieve context-switch/process memory protection/priviledge level protection..etc, in what order I should read the books/articles?
For example, I read x86 document first, the features relate to multi-tasking is just hardware only, an OS completely employee the hardware can definitely function right to set-up and multi-tasking architeture. But in real world, we know it's another world. The OS give up hardware context-switch but employee the memory protection feature of the processor and GDT/LDT/IDT. And we know there's some feature is mandated, e.g. memory segmentation. You know that the x86 document(volume 3: system programming guide) is very looooooong, and with little example. That makes it not easy to be read.
Should I first understand x86's system feature before understand real-world OS?
I haven't read the codes you post yet. I've got another question up.
If I'm going to learn multi-tasking principle, e.g. how the OS and hardware incooperate to achieve context-switch/process memory protection/priviledge level protection..etc, in what order I should read the books/articles?
For example, I read x86 document first, the features relate to multi-tasking is just hardware only, an OS completely employee the hardware can definitely function right to set-up and multi-tasking architeture. But in real world, we know it's another world. The OS give up hardware context-switch but employee the memory protection feature of the processor and GDT/LDT/IDT. And we know there's some feature is mandated, e.g. memory segmentation. You know that the x86 document(volume 3: system programming guide) is very looooooong, and with little example. That makes it not easy to be read.
Should I first understand x86's system feature before understand real-world OS?
I don't know what to suggest; join #ReactOS IRC channel, where most of the ros devs live. Maybe someone will point to the right direction.Valeron wrote: in what order I should read the books/articles?
Also, there is a wiki page with some links / books. Maybe it will be useful.
In order to understand low-level parts of OS, some knowledge of how the processor works is needed, of course.Should I first understand x86's system feature before understand real-world OS?
You can begin from some OS, and when questions will arise, search answers in books / articles / on the Web / ask people.
Re: Questions about x86 and Windows
Thank you. 

Who is online
Users browsing this forum: DotBot [Crawler], Semrush [Bot] and 2 guests