flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Flat Real Mode GDT question

Author
Thread Post new topic Reply to topic
adefeo



Joined: 12 Jan 2004
Posts: 46
Location: Bellmore, Long Island, New York
adefeo
Hi all,

I have a quetion concerning FRM. What is the purpouse of the GDT, and what should it look like for FRM? I found this example from another thread, but I'm having trouble understanding what it means, and it fails to compile under FASM (1.62):

Code:
StartOf_GDT:
FlatRM_GDTR:
dw (EndOf_GDT - StartOf_GDT - 1)
dd (StartOf_GDT)
dw 0
;32-bit data selector descriptor
db 0xFF
db 0xFF
db 0x00
db 0x00
db 0x00
db 10010010b
db ((1100b << 4)|(0x0F))
db 0x00
EndOf_GDT:    


Thanks,
Anthony
Post 03 Jul 2005, 18:57
View user's profile Send private message Visit poster's website AIM Address Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
look for some "protected mode description" or "protected mode introduction" or something like that.
Post 03 Jul 2005, 21:00
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7801
Location: Kraków, Poland
Tomasz Grysztar
The source you've quoted doesn't compile with fasm, because it uses NASM's operators << and |, for fasm you should use "shl" and "or" operators.

As for the GDT, it is needed to set up the segment descriptors with 4 GB limit (in this thread you've got more info on FRM: http://board.flatassembler.net/topic.php?t=135 but I guess you've already found it).


Last edited by Tomasz Grysztar on 10 Oct 2005, 21:04; edited 1 time in total
Post 04 Jul 2005, 09:49
View user's profile Send private message Visit poster's website Reply with quote
adefeo



Joined: 12 Jan 2004
Posts: 46
Location: Bellmore, Long Island, New York
adefeo
Ok, 2 more questions:

1. How can I test that FRM is enabled correctly?
2. Do I need to enable the A20 gate to access the full 4GB flat address space?
Post 04 Jul 2005, 13:09
View user's profile Send private message Visit poster's website AIM Address Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7801
Location: Kraków, Poland
Tomasz Grysztar
1. If you try to access offset above 0FFFFh when no FRM is enabled, you will get exception (interrupt) 13. As you can read in the thread I linked to, I used this to enable FRM only when it's not enabled, since I put the FRM initialization routine inside the interrupt 13 handler.

2. Yes, otherwise the addresses above 1 MB will "wrap" and you will access the memory in first megabyte anyway.
Post 04 Jul 2005, 13:14
View user's profile Send private message Visit poster's website Reply with quote
adefeo



Joined: 12 Jan 2004
Posts: 46
Location: Bellmore, Long Island, New York
adefeo
One more question that I just thought of:

Do I still address memory via the segment:offset pair (ex, can I still do a "JMP 0x2000:0x0000", or do I not use segments, since it is "flat" memory space?
Post 04 Jul 2005, 13:38
View user's profile Send private message Visit poster's website AIM Address Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7801
Location: Kraków, Poland
Tomasz Grysztar
You still use segments, since it's still the real mode. What makes it FRM is that you can use 32-bit offset within each segment.
Post 04 Jul 2005, 13:46
View user's profile Send private message Visit poster's website Reply with quote
adefeo



Joined: 12 Jan 2004
Posts: 46
Location: Bellmore, Long Island, New York
adefeo
Thanks for all of your help! I think I'm OK for now...
Post 04 Jul 2005, 13:56
View user's profile Send private message Visit poster's website AIM Address Reply with quote
Chewy509



Joined: 19 Jun 2003
Posts: 297
Location: Bris-vegas, Australia
Chewy509
adefeo wrote:
Thanks for all of your help! I think I'm OK for now...

Hi Adefeo,

Take a look at my last years 512byte OS enrty, it ran in FRM, so you could use it as a working model. It should answer all your questions.

Darran.

PS. http://chewy509.atspace.com/256.html
Post 04 Jul 2005, 22:40
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.