syscall and the emulators

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
tarrox
Posts: 19
Joined: Wed Dec 31, 2008 8:40 am

syscall and the emulators

Post 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
stlw
Member
Member
Posts: 357
Joined: Fri Apr 04, 2008 6:43 am
Contact:

Re: syscall and the emulators

Post 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
tarrox
Posts: 19
Joined: Wed Dec 31, 2008 8:40 am

Re: syscall and the emulators

Post 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.
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:

Re: syscall and the emulators

Post 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 :)
"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 ]
stlw
Member
Member
Posts: 357
Joined: Fri Apr 04, 2008 6:43 am
Contact:

Re: syscall and the emulators

Post 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
stlw
Member
Member
Posts: 357
Joined: Fri Apr 04, 2008 6:43 am
Contact:

Re: syscall and the emulators

Post 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
jal
Member
Member
Posts: 1385
Joined: Wed Oct 31, 2007 9:09 am

Re: syscall and the emulators

Post 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
Post Reply