flat assembler
Message board for the users of flat assembler.

Index > OS Construction > long mode few questions

Author
Thread Post new topic Reply to topic
b1528932



Joined: 21 May 2010
Posts: 287
b1528932
i have some questions about long mode.
i use bochs to emulate x86. Intel manuals say 1 thing, bochs do other. it might be mine lack of understanding (english isnt my native language), or flaw in bochs.


1. Address wrap. When i try to access data beyond limit 0xFFFFFFFF i should get general protection fault (compatibility mode). This is because limit is in use. However in long mode limit is ignored and accessing it goes right to 0x00000000. Is that correct? Long mode support address wrap arounds? (code fetches also wrap)


2. L flag in code segment tells me is segment is long or compatibility mode.
is this flag ignored anywere else of code segment? what about d_b and g flags? d_b has no effect on rsp/esp, bochs always use rsp.


3. null selectors. long mode accept long selectors except CS and SS.
ok i understand thats the reason is to discourage segmentation usage, and since base/limit are ignored selector isnt really neaded, why SS still use it? Cs require L bit, but SS? Only think i can think of is b_d flag. Why is that? why ss cant be null? i can set all selectors to NULL if in cpl = 0, cpl3 doesnt allow ony SS and CS to be NULL. WHY?


why intel manuals are not strict about that, so i have to test almost everything manualy! Sad
Post 28 Jun 2010, 12:25
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17667
Location: In your JS exploiting you and your system
revolution
Bochs != Real CPU.

Do not rely on Bochs to give you perfect emulation.

Do not rely on the manuals to give you perfect information.

Only tests on a real CPU can give you reliable answers.
Post 28 Jun 2010, 14:47
View user's profile Send private message Visit poster's website Reply with quote
b1528932



Joined: 21 May 2010
Posts: 287
b1528932
bochs might not support all functions of cpu (like hw breakpoints), but basics such as segmentation is supported in 100%. even unreal mode is included.

and i think cpuid is adjusted so programs wont run into unexpected.


bochs is x86 emulator, and i cant imagine using real hardware.

i run bochs 4-5 times a minute, imagine doing this on real hardware.
Post 28 Jun 2010, 15:36
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4242
Location: 2018
edfed
Quote:
i run bochs 4-5 times a minute, imagine doing this on real hardware.


for the moment, but when you'll be aware of what to do to have results, you will use bochs a lot less. and a lot more hw.
Post 28 Jun 2010, 18:46
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.