Page 1 of 1

About the barebones tutorial

Posted: Fri May 02, 2014 11:22 pm
by xtricman
Why can we write to 0xB8000,Isn't the code segment is read-only?

Re: About the barebones tutorial

Posted: Fri May 02, 2014 11:33 pm
by Bender
So you mean 0xB8000 is a code segment? Hmmm..... :roll:

Re: About the barebones tutorial

Posted: Sat May 03, 2014 4:11 am
by Combuster
xtricman wrote:Isn't the code segment is read-only?
Why do you think you're actually using the code segment for a data access?

Re: About the barebones tutorial

Posted: Sat May 03, 2014 9:14 am
by SpyderTL
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

Posted: Sat May 03, 2014 9:39 am
by xtricman
Combuster wrote:Why do you think you're actually using the code segment for a data access?
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?

Re: About the barebones tutorial

Posted: Sat May 03, 2014 9:49 am
by Combuster
OK,but how can I know where's data where's code?
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.

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

Posted: Sat May 03, 2014 9:50 am
by sortie
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.