flat assembler
Message board for the users of flat assembler.

Index > DOS > Is it possible to enter 64-bit mode from real mode directly?

Author
Thread Post new topic Reply to topic
yyc650102



Joined: 01 Jun 2006
Posts: 11
yyc650102
As everybody knows that it's possible to directly enter PMODE even Page-Mode from real mode under DOS. However, is it possible to enter 64-Bit mode under DOS?

Is anyone try it yet?

Thanks !!
Post 15 Jun 2006, 05:54
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
Yes if i understand the ?, as PC's boot up in realmode and you can go from Dos to pmode to long mode.
Here is some code to go from Dos to long mode, it needs converting to fasm, as it coded with YASM.


Description:
Download
Filename: agner2.asm
Filesize: 18.3 KB
Downloaded: 71 Time(s)

Post 15 Jun 2006, 12:01
View user's profile Send private message Reply with quote
yyc650102



Joined: 01 Jun 2006
Posts: 11
yyc650102
I will try it!! Thanks a lot!!
Post 15 Jun 2006, 16:56
View user's profile Send private message Reply with quote
Mac2004



Joined: 15 Dec 2003
Posts: 313
Mac2004
yyc650102: Have you succeeded in converting above source code into Fasm? I have tried and i think Fasm does not produce correct code. I removed all extra code in order to eliminate possible tripple fault causes.

The result: Yasm 0.50rc2 produces working code, Fasm 1.67 produces tripple faulting code. Tripple fault occures when sti command is issued in long mode.

Regard,
Mac2004
Post 03 Jul 2006, 08:17
View user's profile Send private message Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2141
Location: Estonia
Madis731
I started to convert it but there are some strange things happening:
Code:
 movd rbx,mm6
    

What should it do - FASM doesn't allow it - and EVEN I do NOT allow it Very Happy

should it be:
Code:
 movq rbx,mm6
 shl  rbx,32
 shr  rbx,32

;Or better:

 movd ebx,mm6
    


changed a lot of stuff - compare my code with yours and if we find any differences - that's the place to start looking for errors.

What I think that the lack of YASM's support for 64-bit computing is the cause of many problems and the workarounds that worked on YASM are now transfered falsely to FASM. A write from scratch!?


Description: Some converting and adjustments like size operand placement
Download
Filename: agner2-1.asm
Filesize: 17.77 KB
Downloaded: 46 Time(s)


_________________
My updated idol Very Happy http://www.agner.org/optimize/
Post 04 Jul 2006, 19:37
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
Mac2004



Joined: 15 Dec 2003
Posts: 313
Mac2004
Hi Madis731!

I have noticed similar problems while converting. I solved some problems by removing all not so necessary Yasm specific code from the original code. You can download the code altered by me from the link below.

I agree with you that Fasm generally is more liable than Yasm. It's quite annoyning to 'fight' with assembler's own bugs that generate erroneous code.


Here's the link to my code:
http://board.flatassembler.net/topic.php?t=902

regards,
Mac2004
Post 05 Jul 2006, 12:37
View user's profile Send private message Reply with quote
Mac2004



Joined: 15 Dec 2003
Posts: 313
Mac2004
Madis731: I tested your version and it seems quite the same from essential parts except that I removed all debug code from my version.

The result is all the same: Code crashes when sti command is issued in long mode Sad

regards,
Mac2004
Post 05 Jul 2006, 13:12
View user's profile Send private message Reply with quote
lazer1



Joined: 24 Jan 2006
Posts: 185
lazer1
yyc650102 wrote:
As everybody knows that it's possible to directly enter PMODE even Page-Mode from real mode under DOS. However, is it possible to enter 64-Bit mode under DOS?

Is anyone try it yet?

Thanks !!


someone found that you can go directly from real mode to long mode
without going via protected mode, Razz

however when I tried this I had a problem with interrupts,

if you switch off and dont use interrupts you can go directly from real mode
to long mode: just study the Intel docs on real to PM and PM to LM
and then initialise directly from real to LM,

in the transition to LM make sure to set the PM CPU config bit
as that isnt in the docs, and your code will fail without that, Laughing

that bit needs to be set even if you are going from PM, Sad

:I wrote my code exactly as given in the Intel docs and it didnt
function, once I set the PM bit then it did function,

note that LM can only be used with the MMU so it is more work than
PM which can be used without an MMU.

whichever way you do it, you want to begin looking at LM without
interrupts. Only when you understand how to code LM without
interrupts should you attempt LM with interrupts.

once you use an MMU you have to be careful about caching:

memory mapped hardware must be via uncached memory,
otherwise things could happen in the wrong order:

the CPU caches intercept reads + writes and these only reach
the bus in an unpredictable way so things will malfunction,

you should probably switch off all caching to begin with
until you can figure out how to do this properly as
caching control is quite complicated (mtrr's)

so to begin with use LM with no interrupts and no caching,
interrupts and caching are both difficult topics and cannot be
done in a hurry.

the MMU also requires interrupts, however you dont need
an MMU page fault handler if you carefully write your code
only in mapped memory: ,
Post 06 Jul 2006, 14:56
View user's profile Send private message Reply with quote
nasm64developer



Joined: 11 Jul 2006
Posts: 4
nasm64developer
> someone found that you can go directly from real mode to long mode
> without going via protected mode, :P

The only way to do that is via RSM.
Post 11 Jul 2006, 14:54
View user's profile Send private message Reply with quote
Mac2004



Joined: 15 Dec 2003
Posts: 313
Mac2004
nasm64developer: Can you specify where to find to direct long mode thing as you mentioned?

regards,
Mac2004
Post 11 Jul 2006, 20:09
View user's profile Send private message 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.