no such instruction: `pushfd'

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Pyrofan1
Member
Member
Posts: 234
Joined: Sun Apr 29, 2007 1:13 am

no such instruction: `pushfd'

Post by Pyrofan1 »

I have this code

Code: Select all

.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'
frank
Member
Member
Posts: 729
Joined: Sat Dec 30, 2006 2:31 pm
Location: East Coast, USA

Post by frank »

Which assembler are you using?
Pyrofan1
Member
Member
Posts: 234
Joined: Sun Apr 29, 2007 1:13 am

Post by Pyrofan1 »

gas, but isn't that obvious?
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post by Combuster »

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 ]
JJeronimo
Member
Member
Posts: 202
Joined: Wed Oct 18, 2006 3:29 pm

Post by JJeronimo »

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
Pyrofan1
Member
Member
Posts: 234
Joined: Sun Apr 29, 2007 1:13 am

Post by Pyrofan1 »

Read the processor manuals...
can you tell me where in the manual?
frank
Member
Member
Posts: 729
Joined: Sat Dec 30, 2006 2:31 pm
Location: East Coast, USA

Post by frank »

System Programming Guide, Part 1
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.
Post Reply