OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Apr 23, 2024 9:28 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Bochs & SYSENTER
PostPosted: Fri Sep 21, 2007 3:15 am 
Offline
Member
Member
User avatar

Joined: Tue Jul 10, 2007 5:27 am
Posts: 2935
Location: York, United Kingdom
Hi guys,

I'm currently trying to compile/run my kernel in bochs here at work. The problem is I'm getting an invalid opcode exception when bochs encounters the instruction 'sysenter' (which, obviously, does not happen at home)

I'm using v2.3 here, the 32-bit version (I've noticed on my home one it comes up as "Bochs: x86-64 emulator" whereas here it's missing the 64.

The systenter instruction was introduced in the PentiumII (?) IIRC so I wonder why it's not implemented in this version of bochs?

Does anyone have any ideas? Do I have to update my bochs install?

EDIT: trying to get the specific version number: bochs doesn't have a --version or -v argument - anyone know how to query it?

_________________
Horizon - a framework and language for SAS-OS development
Project 'Pedigree'
Practical x86 OSDev tutorials


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 21, 2007 3:36 am 
Offline
Member
Member
User avatar

Joined: Thu Nov 16, 2006 12:01 pm
Posts: 7614
Location: Germany
From Bochs user guide, 3.4 Compiling Bochs, 3.4.2 Configure Options:

Quote:
Option: --enable-cpu-level={3,4,5,6}
Default: 5
Comments: Select which CPU level to emulate. Choices are 3,4,5,6 which mean to target 386, 486, Pentium, or Pentium Pro emulation. Pentium Pro support is quite incomplete, so level 5 is the best choice for now.


Ergo, by default Bochs emulates a Pentium.

_________________
Every good solution is obvious once you've found it.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 21, 2007 3:42 am 
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
I'd be tempted to say that you should check CPUID before using special processor instructions :roll:

Bochs' version is displayed whenever you start it. It will not, however, show you the ./configure options which are just as interesting to know.

Anyway, if you require sysenter, you'll have to compile bochs manually. Open cygwin, download the sources, then type ./configure --help which will tell you everything.

_________________
"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: Fri Sep 21, 2007 3:55 am 
Offline
Member
Member
User avatar

Joined: Tue Jul 10, 2007 5:27 am
Posts: 2935
Location: York, United Kingdom
Cheers guys. Looks like '6' for me. I had actually compiled it from source anyway combuster.

And when you start bochs, it will show you only the first two major version numbers (e.g. mine shows '2.3', not '2.3.1')

Combuster: the advantage to checking CPUID for sysenter would be to print a lovely helpful "this kernel will not run, fool" message, as all my syscalls except fork/exec are implemented using sysenter/sysexit! :?

_________________
Horizon - a framework and language for SAS-OS development
Project 'Pedigree'
Practical x86 OSDev tutorials


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 21, 2007 6:15 am 
Offline
Member
Member
User avatar

Joined: Wed Nov 17, 2004 12:00 am
Posts: 202
Location: Germany
JamesM wrote:
And when you start bochs, it will show you only the first two major version numbers (e.g. mine shows '2.3', not '2.3.1')

I don't know of a bochs version 2.3.1
And for me bochs shows 2.3.5 correctly.

_________________
lightOS


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 21, 2007 6:48 am 
Offline
Member
Member
User avatar

Joined: Thu Nov 16, 2006 12:01 pm
Posts: 7614
Location: Germany
bluecode wrote:
I don't know of a bochs version 2.3.1


I do.

_________________
Every good solution is obvious once you've found it.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 21, 2007 7:01 am 
Offline
Member
Member
User avatar

Joined: Thu Oct 21, 2004 11:00 pm
Posts: 349
Location: Munich, Germany
Quote:
Cheers guys. Looks like '6' for me. I had actually compiled it from source anyway combuster


Support for sysenter/sysexit isn't linked to any cpu-level, but rather has to be additionally enabled at compile time. Try running ./configure --enable-sep and have a look at the bochs (user) documentation for more details.

cheers,
gaf


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 21, 2007 8:02 am 
Offline
Member
Member
User avatar

Joined: Wed Nov 17, 2004 12:00 am
Posts: 202
Location: Germany
Solar wrote:
bluecode wrote:
I don't know of a bochs version 2.3.1

I do.

I must be blind. :D Sorry.

_________________
lightOS


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 21, 2007 8:14 am 
Offline
Member
Member
User avatar

Joined: Tue Jul 10, 2007 5:27 am
Posts: 2935
Location: York, United Kingdom
Quote:
Support for sysenter/sysexit isn't linked to any cpu-level, but rather has to be additionally enabled at compile time. Try running ./configure --enable-sep and have a look at the bochs (user) documentation for more details.


Well I compiled it with machine-level=6 and it works. So I'm a happy chappy.

Partially, anyway. I'm having real difficulty compiling my code on this different computer. I've now installed a custom g++/gcc and binutils, and STILL linker errors that don't plague me at home are appearing. Currently they seem to be related to duplicate symbol names between object files and a shared library. On my system if it finds a duplicate symbol in a shared library it just quietly ignores it.

I never realised just how much difference there was between gcc/ld versions and just how easily they can break!

_________________
Horizon - a framework and language for SAS-OS development
Project 'Pedigree'
Practical x86 OSDev tutorials


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 118 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