About the barebones tutorial
About the barebones tutorial
Why can we write to 0xB8000,Isn't the code segment is read-only?
- Bender
- Member
- Posts: 449
- Joined: Wed Aug 21, 2013 3:53 am
- Libera.chat IRC: bender|
- Location: Asia, Singapore
Re: About the barebones tutorial
So you mean 0xB8000 is a code segment? Hmmm.....
"In a time of universal deceit - telling the truth is a revolutionary act." -- George Orwell
(R3X Runtime VM)(CHIP8 Interpreter OS)
(R3X Runtime VM)(CHIP8 Interpreter OS)
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: About the barebones tutorial
Why do you think you're actually using the code segment for a data access?xtricman wrote:Isn't the code segment is read-only?
Re: About the barebones tutorial
0xb8000 is the default screen buffer memory address. It contains character and color information. There is no code there, only data.
Re: About the barebones tutorial
OK,but how can I know where's data where's code? At first I think when I use reference to memory like C pointer or assembly (%eax)it's using the %DS register by default, and when I use pop or push instruction it's using %SS as the selector, but when I use " movl $32 $start" and debug the kernel, I found it also worked.My code at start is overwrited .Why?Combuster wrote:Why do you think you're actually using the code segment for a data access?
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: About the barebones tutorial
It's always where you left it. It just appears to be a mess because you aren't conciously aware of where you left it.OK,but how can I know where's data where's code?
Memory may be used for everything, it it can only hold one thing at a time. You can't turn a plot of land into both an apartment complex and a park at the same time.
Re: About the barebones tutorial
Your linker script decides where the various sections end up as segments (ELF segments, not x86 hardware segments).
Inspect your ELF kernel with tools such as objdump and readelf.
Inspect your ELF kernel with tools such as objdump and readelf.