Okay got it. Thank you everyone. Although it?s really sad to hear that they are going to get rid of segmentation (are they?) just when I am starting to learn it. It?d be so sad.

Most of us are cheering. Segmentation was designed around a limited memory model. It is a good model for small systems, but it becomes a beast when dealing with larger systems. You'll start to understand why as you get further into OS Dev'ing ;)

I would get used to this sort of thing. There will be plenty of things you will have to learn during your study in OS development... stuff you will use once, implement once and forget about it ;)
Posted on 2007-01-27 02:55:10 by SpooK
Thank you spook. I just hope that the world wouldn't tremble down while I'm learning OS development. That's all I'm asking. Holy potatoes I have another question. I ASSUME EAX:PTR to ask another question, right? Okay when my boot loader takes control, it copies the kernel which contains the data, to the physical address of 0x00100000. I have set the base address of my Code Segment Descriptor and the Data Segment Descriptor to 0x00000000. The problem is that when I try to address data in my code I should always add the 0x00100000 to the entries.

For example if I define something like:

VideoX DD 0x00000000

When I want to load the accumulator with the data inside this variable (which is defined in my kernel) in NASM, I can?t simply use:

%idefine PTR

And I have to use:

%idefine PTR

I think that because my kernel?s base address is assumed to have been located at the physical address of 0x00000000 and the kernel is really saved into 0x00100000, then I have to add this offset to the data entries but would it be okay if I set the data segment?s base address in the GDT to 0x00100000? Will that help?

By the way, you guys have helped me a lot and I?m thankful beyond words for that.
Posted on 2007-01-29 05:02:30 by XCHG
"org 0x00100000" :)

Or, for a position-independent kernel, use the "delta trick" and access all variables through delta:

call .delta
pop ebp
sub ebp, delta
mov eax,

Or, smarter yet, use a proper file format with relocations and relocate the kernel.

Personally I don't do relocations, I load kernel to "whereever physical" and set up paging. (where "whereever physical" is currently right at the 1meg mark, but could be more or less whereever - hence the whereever :P ).
Posted on 2007-01-29 06:08:07 by f0dder
or write 64-bit kernel and use RIP-relative addressing :P
Posted on 2007-01-29 06:32:05 by vid
That too - and congrats on the 100 posts ^_^
Posted on 2007-01-29 06:38:09 by f0dder
haven't noticed. Too bad i don't check this board more often, but new posts since last visit doesn't work :(
Posted on 2007-01-29 08:30:02 by vid

haven't noticed. Too bad i don't check this board more often, but new posts since last visit doesn't work :(

On that page, look for "All Unread Topics" ;)
Posted on 2007-01-29 17:26:03 by SpooK