flat assembler
Message board for the users of flat assembler.

Index > Main > Call BIOS interrupt from 64bit code

Author
Thread Post new topic Reply to topic
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
what is easiest way to call 16bit BIOS interrupt from 64bit code?
Post 05 Oct 2007, 16:34
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
You can not do it, but when i do the 64bit DexOS ver, i will try to going from long mode to pmode to realmode and back.
But i have know idea how it will work out.
Post 05 Oct 2007, 16:50
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
i meant from ring0 code, i can create segment descriptors, switch to real mode, etc. etc.

I was asking for easiest way. I recall there was some CPU feature where you only had to fill some structure ("call gate"), and then simply jump to it somehow, but i never studied it deeper.
Post 05 Oct 2007, 17:06
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
Dex: by the way, "long mode" is not "64-bit" mode. "long mode" is same as "Intel-32e" mode, and it has two submodes: 64-bit mode, and compatibility mode (which can be protected mode or real mode). You should say 64-bit mode Wink
Post 05 Oct 2007, 17:09
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
I did some research, and found out call gates canot be used for this here.

So my question is "reduced" to:

How to enter v86 mode from ring0 proteted mode? got any examples?
Post 05 Oct 2007, 17:51
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
tom tobias



Joined: 09 Sep 2003
Posts: 1320
Location: usa
tom tobias
vid wrote:

How to enter v86 mode from ring0 proteted mode? got any examples?
Source: http://www.amazon.com/I386-I486-Advanced-Programming-Protected/dp/0442013779/ref=sr_1_1/103-0010915-7579862?ie=UTF8&s=books&qid=1191670434&sr=8-1
Page 170:
Ro and Her wrote:

11.2 Enter and Leave V86 Mode
To run the v86 mode task in the i386/i486 machine, a v86 monitor must exist in the system to provide the interface services. Basically, the v86 mode monitor consists of initialization and exception-handling procedures. The v86 monitor must be at privilege level 0 in the protected mode, and control should be issued to a v86 mode task by the v86 monitor. After control transfers to the v86 mode task, there is no way for the v86 mode monitor to regain control except through exceptions. When an exception is generated in a v86 mode task, it enters the exception routine provided by the v86 mode monitor. Since the v86 mode monitor is executed in the protected mode, the VM bit is cleared by the i386/i486 processor when control is passed to the exception routine. At this point the v86 mode monitor can start services that depend on the system needs.
Task switch is one way to enter the v86 mode by using the IRET instruction of the task switch instruction. Since the new task is a v86 mode task, the value stored in the TSS is different from that in the protected mode. The VM bit must be set to 1 in the EFLAGS field, and the segment fields should contain the segment address value instead of the segment selector. If you use the IRET instruciton to return to the v86 mode task, the NT bit in the EFLAGS register must be set and the back link field of the current TSS must link to the TSS segment selector of the v86 mode task.

The code to accomplish this is 23 pages in length....
Rolling Eyes
Post 06 Oct 2007, 11:50
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
oh shit...

i think i will use rather VMX and run BIOS code in virtual machine.

thanks tom
Post 06 Oct 2007, 12:28
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
MazeGen



Joined: 06 Oct 2003
Posts: 975
Location: Czechoslovakia
MazeGen
Yeah, general v86 monitor is probably complicated, but assuming you will run only your own tuned code as an v86 mode task, your v86 monitor doesn't need to be complicated, because you know how the task behaves.
Post 08 Oct 2007, 06:20
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
i want to run BIOS code in my v86 virtual machine.
Post 08 Oct 2007, 11:53
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Octavio



Joined: 21 Jun 2003
Posts: 366
Location: Spain
Octavio
vid wrote:
i want to run BIOS code in my v86 virtual machine.

Is simpler to change to 16bit real mode, first you jump to a 16bit protected mode code where phisical and virtual adress are the same,load the realmode idt and then switch to real mode, a few lines of assembly code are enought.
v86 is designed to run old 16 bit real mode aplications in a protected environnement ,but since you probably want the bios to do some hardware operations ,protection is useless here.
Post 08 Oct 2007, 15:43
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.

Powered by rwasa.