OSDev.org

The Place to Start for Operating System Developers
It is currently Fri May 17, 2024 3:00 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: no such instruction: `pushfd'
PostPosted: Mon Jun 25, 2007 2:10 pm 
Offline
Member
Member

Joined: Sun Apr 29, 2007 1:13 am
Posts: 234
I have this code
Code:
.global enable_vm86
.global disable_vm86

.type enable_vm86,@function
enable_vm86:
   pushfd
   popl %eax
   orl %eax, $0x10000
   pushl %eax
   popfd

.type disable_vm86,@function
disable_vm86:
   pushfd
   popl %eax
   andl %eax, $0xFFFDFFFF
   pushl %eax
   popfd

but when i try to assemble my code it tells me Error: no such instruction: `pushfd'


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 25, 2007 2:12 pm 
Offline
Member
Member

Joined: Sat Dec 30, 2006 2:31 pm
Posts: 729
Location: East Coast, USA
Which assembler are you using?

_________________
My OS: Fuzzy Logic


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 25, 2007 2:19 pm 
Offline
Member
Member

Joined: Sun Apr 29, 2007 1:13 am
Posts: 234
gas, but isn't that obvious?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 25, 2007 2:27 pm 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 3:45 am
Posts: 9301
Location: On the balcony, where I can actually keep 1½m distance
no, the operands are reversed

EDIT: tried pushfl?

_________________
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 25, 2007 5:10 pm 
Offline
Member
Member

Joined: Wed Oct 18, 2006 3:29 pm
Posts: 202
Pyrofan1 wrote:
but when i try to assemble my code it tells me Error: no such instruction: `pushfd'


The instruction "pushfd" is "pushfl" on GAS...

And... afaik you can't switch to VM86 mode this way... You need to fake a return from kernel mode to do so...

Read the processor manuals...

JJ


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 25, 2007 5:45 pm 
Offline
Member
Member

Joined: Sun Apr 29, 2007 1:13 am
Posts: 234
Quote:
Read the processor manuals...

can you tell me where in the manual?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 25, 2007 6:05 pm 
Offline
Member
Member

Joined: Sat Dec 30, 2006 2:31 pm
Posts: 729
Location: East Coast, USA
System Programming Guide, Part 1
Quote:
15.2.1 Enabling Virtual-8086 Mode
The processor runs in virtual-8086 mode when the VM (virtual machine) flag in the
EFLAGS register is set. This flag can only be set when the processor switches to a
new protected-mode task or resumes virtual-8086 mode via an IRET instruction.
System software cannot change the state of the VM flag directly in the EFLAGS
register (for example, by using the POPFD instruction). Instead it changes the flag in
the image of the EFLAGS register stored in the TSS or on the stack following a call to
an interrupt- or exception-handler procedure. For example, software sets the VM flag
in the EFLAGS image in the TSS when first creating a virtual-8086 task.

_________________
My OS: Fuzzy Logic


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 9 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group