Page 1 of 1

syscall and the emulators

Posted: Sat May 30, 2009 4:32 pm
by tarrox
Hi,
For now I am implementing syscalls and for the time being it goes very well.
First I implemented the interrupts version and it works, so i was going further
with amd's syscall. But after I coded everything and wanted to test it with an
emulator, i got some problems.

1. When i use Virtual PC or VirtualBox they say, that syscall isn't there. But why?
My computer has syscall/sysret, don't they just use the same cpu like the host?
Or maybe they just don't support it?

2. When i use Bochs it emulates an intel cpu with sysenter/sysexit, but I want
to check my syscall function. Is there a way to change it by an option to amd?
Just change the vendor string doesn't work. Or have I to recompile Bochs to get
an amd cpu emulation?

Thanks for the little help^^.
Tarrox

Re: syscall and the emulators

Posted: Sun May 31, 2009 1:52 am
by stlw
tarrox wrote:Hi,
For now I am implementing syscalls and for the time being it goes very well.
First I implemented the interrupts version and it works, so i was going further
with amd's syscall. But after I coded everything and wanted to test it with an
emulator, i got some problems.

1. When i use Virtual PC or VirtualBox they say, that syscall isn't there. But why?
My computer has syscall/sysret, don't they just use the same cpu like the host?
Or maybe they just don't support it?

2. When i use Bochs it emulates an intel cpu with sysenter/sysexit, but I want
to check my syscall function. Is there a way to change it by an option to amd?
Just change the vendor string doesn't work. Or have I to recompile Bochs to get
an amd cpu emulation?

Thanks for the little help^^.
Tarrox

SYSCALL/SYSRET is a feature of x86-64 CPU, not necessary AMD. Bochs will report SYSCALL/SYSRET available on any CPU supporting x86-64.
Default release build already compiled to support x86-64, you could use the same (or similar) build script.

Stanislav

Re: syscall and the emulators

Posted: Sun May 31, 2009 6:51 am
by tarrox
stlw wrote: SYSCALL/SYSRET is a feature of x86-64 CPU, not necessary AMD. Bochs will report SYSCALL/SYSRET available on any CPU supporting x86-64.
Default release build already compiled to support x86-64, you could use the same (or similar) build script.
Stanislav
SYSCALL/SYSRET is the implementation of AMD, Intel uses SYSENTER/SYSEXIT and bochs is able to emulate the Intel ones, but i want him to emulate an AMD prozessor to test SYSCALL/SYSRET. So I am asking how to make bochs emulate an AMD cpu and not an Intel one.

Re: syscall and the emulators

Posted: Sun May 31, 2009 7:45 am
by Combuster
The trick I use to get bochs to emulate an AMD processor is to enable 3dnow.

I could pull some other tricks, but that means patching the source. (Which I basically did to get it to emulate a Cyrix) - Speaking of which, those patches are in the tracker and stanislav hates them :)

Re: syscall and the emulators

Posted: Sun May 31, 2009 9:27 am
by stlw
SYSCALL/SYSRET is the implementation of AMD, Intel uses SYSENTER/SYSEXIT and bochs is able to emulate the Intel ones, but i want him to emulate an AMD prozessor to test SYSCALL/SYSRET. So I am asking how to make bochs emulate an AMD cpu and not an Intel one
As the one who wrote Bochs CPU implementation I know what I am talking about :)
It is just a fact.
SYSCALL/SYSRET are in all x86-64 processors - no matters AMD or Intel. BTW, you could just open Intel SDM Vol2b and see SYSCALL/SYSRET there.

Stanislav

Re: syscall and the emulators

Posted: Sun May 31, 2009 9:29 am
by stlw
Combuster wrote:The trick I use to get bochs to emulate an AMD processor is to enable 3dnow.

I could pull some other tricks, but that means patching the source. (Which I basically did to get it to emulate a Cyrix) - Speaking of which, those patches are in the tracker and stanislav hates them :)
Who said I hate them ?

Stanislav

Re: syscall and the emulators

Posted: Fri Jun 05, 2009 6:37 am
by jal
stlw wrote:SYSCALL/SYSRET are in all x86-64 processors - no matters AMD or Intel.
The reason they are in Intel x86-64 is that Intel copied AMDs 64-bit extensions, which requires them. SYSCALL/SYSRET are however also present in 32-bit AMD processors.


JAL