The MASM Forum

General => The Campus => Topic started by: class on June 01, 2012, 12:16:19 AM

Title: questions about 80386
Post by: class on June 01, 2012, 12:16:19 AM
hi guys this is my first topic in this forum :)

i want to make a simple 32 bit operating system
but i have question about protected mode(i visit many websites but still not understand )

first: what is relationship between GDT(memory) and GDT register ?
or relationship between LDT(memory) and LDT register ?
Title: Re: questions about 80386
Post by: dedndave on June 01, 2012, 01:46:40 AM
the tables exist in memory
the registers point to the tables

http://www.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html (http://www.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html)
Title: Re: questions about 80386
Post by: class on June 01, 2012, 02:12:31 AM
Quote from: dedndave on June 01, 2012, 01:46:40 AM
the tables exist in memory
the registers point to the tables

ok
you mean this register is used for loading the table from memory.

i have another question:
who set the selector (like DS)? is the operating system?

can selector(like DS) change inside the program or task like in real mode?
Title: Re: questions about 80386
Post by: MichaelW on June 01, 2012, 03:47:34 AM
A selector is an index into a descriptor table. Selectors are generally loaded into the segment registers by whoever set up the descriptor tables, and the contents of the segment registers can be changed as the program executes.
Title: Re: questions about 80386
Post by: class on June 01, 2012, 04:53:15 AM
Quote from: MichaelW on June 01, 2012, 03:47:34 AM
A selector is an index into a descriptor table. Selectors are generally loaded into the segment registers by whoever set up the descriptor tables, and the contents of the segment registers can be changed as the program executes.
but
if segment registers can be changed as the program executes(by the task itself)
this mean that, the task can load any LDT,
then the task can  access a segment of other tasks!!!
Title: Re: questions about 80386
Post by: dedndave on June 01, 2012, 04:56:14 AM
he never said it wouldn't generate an exception   :biggrin:
Title: Re: questions about 80386
Post by: class on June 01, 2012, 05:11:37 AM
U mean DS can't be changed during execution?
and if we try change DS during execution an exception  will appear?

I ask these question because i want to build very simple 32 bit OS
and also On Monday i have seminar about 80386
Title: Re: questions about 80386
Post by: MichaelW on June 01, 2012, 07:06:49 AM
Quote from: class on June 01, 2012, 04:53:15 AM
Quote from: MichaelW on June 01, 2012, 03:47:34 AM
A selector is an index into a descriptor table. Selectors are generally loaded into the segment registers by whoever set up the descriptor tables, and the contents of the segment registers can be changed as the program executes.
but
if segment registers can be changed as the program executes(by the task itself)
this mean that, the task can load any LDT,
then the task can  access a segment of other tasks!!!

Actually, I did not specify who/what would be changing the contents of the segment registers, just that the contents can be changed. Windows will not allow a user program to make such a change, but protected-mode DOS apps can and do make such changes.

And I can't see how a "simple 32 bit OS" could possibly implement anything resembling multitasking.

Title: Re: questions about 80386
Post by: Greenhorn on June 01, 2012, 09:21:47 AM
Maybe it's worth to take a look at this project.
http://www.henkessoft.de/OS_Dev/OS_Dev1.htm (http://www.henkessoft.de/OS_Dev/OS_Dev1.htm)

Some resources on OS development: http://www.henkessoft.de/OS_Dev/OSDEV%20Ressourcen.html (http://www.henkessoft.de/OS_Dev/OSDEV%20Ressourcen.html)

Although it is in german you can get some good information there.
And maybe google-translation can help you, but I don't know how good thewe translations are ...
Title: Re: questions about 80386
Post by: class on June 02, 2012, 01:59:05 AM
Thank you guys
Title: Re: questions about 80386
Post by: brethren on June 05, 2012, 05:47:22 AM
if your interested in os development this book
http://www.amazon.com/Developing-32-Bit-Operating-System-Cd-Rom/dp/0672306557/ref=sr_1_6?ie=UTF8&qid=1338838748&sr=8-6
is now available as a free pdf, just search for mmurtl v1.0 to get source code
and heres the book (placed there by the author)
http://www.scribd.com/doc/15200312/MMURTL-V10