Comments (2)
Great questions!
Programs can’t directly switch privilege levels; hardware interrupts are safe because the processor has been preconfigured by the OS with where in the OS code to jump to.
This is the first time a hardware interrupt is mentioned. Does it mean other kind of interrupts exist too? Are there any differences in how programs use them?
This was actually a mistake and should say "software interrupts are safe!" Actually fixed yesterday in #20. Great catch :)
When this kernel code finishes, it tells the CPU to switch back to user mode and return the instruction pointer to where it was when the interrupt was triggered. This is accomplished using an instruction like IRET.
From this, my understanding is that IRET is used by kernel code to transfer control back to user space. But that seems to contradict with this paragraph:
Reading the paragraph you quoted, I'm not sure I actually see a contradiction — the kernel code is using the IRET instruction "to switch back to user mode and return the instruction pointer to where it was when the interrupt was triggered". I could definitely make the paragraph a little clearer, though.
Programs can delegate control to the OS with special machine code instructions like INT and IRET.
Can user code call IRET? But it's already in the user space, and it can't access kernel space, so how does that work?
Oh yeah, I guess this is sorta confusingly written. What I meant to get across is that INT and IRET are both instructions for delegating control to the OS; programs use INT but IRET is just as important from the kernel side. Together, the two instructions allow the control delegation I was talking about.
Let me know if you have any other questions!
from putting-the-you-in-cpu.
Thank you!
from putting-the-you-in-cpu.
Related Issues (20)
- EPUB Version HOT 13
- Faggin made the first *microprocessor* HOT 1
- Should I mention PC? HOT 1
- Not a real issue HOT 1
- Hackclub
- PNG image optimization HOT 9
- Reference on the MacOS "split"
- Mismatched lines and line numbers on mobile HOT 3
- Possibility of discussion of ld.so/dyld/etc. behavior HOT 1
- Add bookmarks to the PDF edition
- Coop mutitasking correction/clarification
- Is this calculation correct?
- Time Slicing Diagram
- Maybe a mistake of Ch.4 A brief Explanation of Linking HOT 1
- Broken link in chapter 4
- More info on the SYSCALL_DEFINE3 security vulnerability
- Potentially unclear explanation of register usage in chapter 4 - Becoming an elf lord
- Link in the Section Header Table no longer works
- Kernel space size in virtual memory size
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from putting-the-you-in-cpu.