Page 1 of 1

no such instruction: `pushfd'

Posted: Mon Jun 25, 2007 2:10 pm
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'

Posted: Mon Jun 25, 2007 2:12 pm
by frank
Which assembler are you using?

Posted: Mon Jun 25, 2007 2:19 pm
by Pyrofan1
gas, but isn't that obvious?

Posted: Mon Jun 25, 2007 2:27 pm
by Combuster
no, the operands are reversed

EDIT: tried pushfl?

Posted: Mon Jun 25, 2007 5:10 pm
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

Posted: Mon Jun 25, 2007 5:45 pm
by Pyrofan1
Read the processor manuals...
can you tell me where in the manual?

Posted: Mon Jun 25, 2007 6:05 pm
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.