flat assembler
Message board for the users of flat assembler.

Index > Main > about the operating mode the fasm works

Author
Thread Post new topic Reply to topic
canmeng



Joined: 07 Jun 2010
Posts: 5
canmeng
hello,everybody.I am very interested in the sourcecode of the fasm.I downloaded the sourcecode of the fasm 1.68 for dos.When i saw the file of the mode.inc, i came across a difficult problem :
I don't know the differentce between switch_real32 and switch_real16 procedures.As i can see,when the operating system operates in real mode,only the A1~A19 are effective.so what is the real32?
Post 08 Jun 2010, 13:07
View user's profile Send private message Send e-mail Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17450
Location: In your JS exploiting you and your system
revolution
Search for Flat Real Mode, or UnReal mode.

This may help:
http://en.wikipedia.org/wiki/Unreal_mode
Post 08 Jun 2010, 13:24
View user's profile Send private message Visit poster's website Reply with quote
canmeng



Joined: 07 Jun 2010
Posts: 5
canmeng
Thank you,revolution.I immediately see the link but i am still confused.since in real mode all the 4GB memory can be accessed,why there is a switch_real16? switch_real32 procedure is enough.


Last edited by canmeng on 08 Jun 2010, 13:56; edited 1 time in total
Post 08 Jun 2010, 13:52
View user's profile Send private message Send e-mail Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17450
Location: In your JS exploiting you and your system
revolution
DOS and BIOS only work in 16-bit mode. So any interrupts (both hardware and software) must be processed in 16-bit mode, and then return back to 32-bit mode to continue assembling.
Post 08 Jun 2010, 13:55
View user's profile Send private message Visit poster's website Reply with quote
canmeng



Joined: 07 Jun 2010
Posts: 5
canmeng
Ah,let me think for a while.As if i understand a little.
Both in the switch_real32 and switch_real16, the program will convert to protected mode and after some instructions,convert back to real mode.The switch_real32 and switch_real16 procedures function the same.So what is the difference between them?
Post 08 Jun 2010, 14:05
View user's profile Send private message Send e-mail Reply with quote
canmeng



Joined: 07 Jun 2010
Posts: 5
canmeng
Also,in the modes.inc ,there exists two GDTs.One is real32_GDT,the other is real16_GDT.The program is as follows :

label real32_GDTR pword
real32_GDT_limit dw 3*8-1 ; limit of GDT
real32_GDT_address dd real32_GDT ; linear address of GDT
real32_GDT rw 4 ; null descriptor
dw 0FFFFh,0,9A00h,0CFh ; 32-bit code descriptor
dw 0FFFFh,0,9200h,08Fh ; 4 GB data descriptor
label real16_GDTR pword
real16_GDT_limit dw 2*8-1 ; limit of GDT
real16_GDT_address dd real16_GDT ; linear address of GDT
real16_GDT rw 4 ; null descriptor
dw 0FFFFh,0,9A00h,0 ; 16-bit code descriptor

But the intel manual said that there is only one GDT,here are two.Why?confused.


Last edited by canmeng on 08 Jun 2010, 14:53; edited 1 time in total
Post 08 Jun 2010, 14:21
View user's profile Send private message Send e-mail Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr
canmeng,

CPU also has only one eax register, yet eax can contain different values. Read about lgdt instruction.
Post 08 Jun 2010, 14:43
View user's profile Send private message Reply with quote
canmeng



Joined: 07 Jun 2010
Posts: 5
canmeng
Thank you,baldr.May be what i have learned is too limited.Now i will search some articles about gdt.
Post 09 Jun 2010, 02:12
View user's profile Send private message Send e-mail 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 YouTube, Twitter.

Website powered by rwasa.