TIP: Click on subject to list as thread! ANSI
echo: 80xxx
to: ALL
from: FERNANDO ARIEL GONT
date: 1998-03-08 02:26:00
subject: Protected Mode

Hullo All , hope you are having a nice day!!
Well, I'm learning protected mode programming. I'll write a few concepts I
think I got, and would like you to tell me whether they are ok, or if not,
tell me what I'm wrong at...
1)
GDTR is a register that contains the address of a Global descriptor table.
There's only one GDTR, but there may be a lot of GDT.
2)
LDTR is the same as GDTR, but it holds the addres of one LDT, that contains
DATA, and no code.. There's only one LDTR, but there may be several LDT.
3)
GDT contains _*only*_ code, and no data. It can also contain call
gates.
4)
LDT is only for data, and not for code. It can also can also contain call
gates.
5)
When paging mode is off, a segment register contains the address of a
descriptor, which contains a base address that is added to the offset of
the operand to form the linear address.
6)
When paging mode is on, the linear address is obtained as I explained
above, but the job is not finished, yet. This linear address is made up of
three fields. One of them is used as an offset within a PDB (that means
that the address of an entry is calculated as PDBR plus the Directory field
of the linear address). Each entry is 32 bit long, and has a 20 bit address
field that is used to obtain a Page Table's entry. To obtain this address,
the 20 bit field (Address of Page) of the entry to the Page Directory
and the Page field of the linear address are added. The result is the
address of an entry to the page table. The page table has the same
structure as the Page Directory.
Using the 20 bit field (Address of Page) of the _*Page*_ _*Table*_ entry,
and adding the offset field of the linear address to it, we get the address
that will be used to accesss memory.
7)
When I want to access a segment, a protection check is made. Three fieldS
are checked for that:
DPL: Which holds the privilege level of the segment I want to access. I
think it shoul have been defined before.
CPL: It's the current privilege level. I think it's the same as the DPL
field of the selector of the segment code I'm executing my code from.
RPL: This is the DPL field of the selector I'm using to access a segment.
It's defined by me whenever I want to access a segment, and may not be the
same as the DPL field of the selector of de segment I want to access.
The segment will be accessed successfuly if the privilege level of the DPL
field of the selector of the segment I want to access is less or equal than
the most privileged level of both the CPL and the RPL.
8) I've read that there's a field called "DWord count" in the call gate
which specifies the total size of parameterts pushed onto th stack...
But... how does the _*called*_ subroutine know where the call gate is?
How does the called know where it has to return to when the subroutine is
finished? What parameters (besides the ones you want to give the procedure)
are pushed onto the stack?
9) The IOPL is a to bit field in the EFlas register, and detremines which
privilege must a code segment have to use instructions such as IN and OUT.
There's only one IOPL flag in the whole system.
Thank you very very VERY :) much in advance! :)
 -=> Yours sincerely, Fernando Ariel Gont <=-
e-mail: FGont@siscor.bibnal.edu.ar
e-mail "Good Stuff!" _*Magazine*_ : gstuff@siscor.bibnal.edu.ar
FidoNet: 4:900/470.10
Sk-Network (Argentina): Murdock's Point (200:201/300.27)
--- Terminate 5.00 UnReg(145)
---------------
* Origin: A:-Have you ever been TERMINATEd? B:-By whom,daddy? (4:900/470.10)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.