Comments (7)
The part titled "Printing to Screen" also goes very quickly. The code fragments could use some more context: which file does it go in, is it top-level or inside a type? (E.g., the text doesn't state that write_str should be inside the Writer type definition.)
Using Unique and sping also require changes to the crate attributes and Cargo.toml. The text could use some clarification there as well.
from blog_os.
Section "Printing Strings" talks about adding b
to make something a byte string, but then there is a type conflict with the definition of write_str.
I suspect this part assumes more Rust knowledge than I have here on day 3 of my journey. :-)
from blog_os.
Thanks a lot! I'll try to clarify these things.
from blog_os.
I was going through the CPUID check myself to try to understand what was going on, and here's the version I ended up with, with some different comments:
check_cpuid:
; Check if CPUID is supported by attempting to flip the ID bit (bit 21) in
; the FLAGS register. If we can flip it, CPUID is available.
; Copy FLAGS in to EAX via stack
pushfd
pop eax
; Copy to ECX as well for comparing later on
mov ecx, eax
; Flip the ID bit
xor eax, 1 << 21
; Copy EAX to FLAGS via the stack
push eax
popfd
; Copy FLAGS back to EAX (with the flipped bit if CPUID is supported)
pushfd
pop eax
; Restore FLAGS from the old version stored in ECX (i.e. flipping the ID bit
; back if it was ever flipped).
push ecx
popfd
; Compare EAX and ECX. If they are equal then that means the bit wasn't
; flipped, and CPUID isn't supported.
xor eax, ecx
jz .no_cpuid
ret
.no_cpuid:
mov al, "1"
jmp error
from blog_os.
@henrikhodne I had to do something similar. The comments in the original code didn't explain why the operations were being done that way.
from blog_os.
@henrikhodne This is very useful! Mind if I include it in the tutorial?
I think you should also update the page in the OSDev Wiki. Your comments are way better!
from blog_os.
@henrikhodne This is very useful! Mind if I include it in the tutorial?
Not at all, go ahead.
And I'll see if I can update the wiki page too.
from blog_os.
Related Issues (20)
- build-std broken as of nightly 74c482104 (2023-05-04) HOT 4
- Post-3.2 Does not compile HOT 2
- post-02 broken on bootloader 0.11.3 and Rust nightly 2023-05-06 HOT 3
- %1 is not a valid Win32 application. (os error 193) HOT 4
- Build-std in cargo.toml is ignored when building HOT 2
- post-04 - Conditional compilation does not seem to work HOT 2
- [Translation] How to help translate to Spanish? HOT 2
- Very very huge Error when using [cargo bootimage] HOT 2
- Is there any way to interact with the filesystem through the bootloader or other crates? HOT 3
- UI Design HOT 2
- Project with bootloader v0.11; Error while compiling `kernel`, says `std` is required by `serde` HOT 8
- cargo bootimage failing HOT 3
- Tests seem to run for both lib and main HOT 2
- Design Enhancement HOT 8
- Table of Content HOT 4
- Has this project been discontinued? don't do this plz because it does do me great favor HOT 1
- Allow a sidebar access to other articles in the website HOT 2
- QEMU Bug in macOS 14: No "Hello, World" in `post-02` - just a black screen. HOT 19
- Add Scheduler tutorial HOT 3
- Unable to run the project as the project crashes after post 3 and i have not even used volatile yet. HOT 4
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 blog_os.