Calling Bios32-Service -> General Protection Fault

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
sevobal
Member
Member
Posts: 63
Joined: Sun Oct 22, 2006 7:11 am

Calling Bios32-Service -> General Protection Fault

Post by sevobal »

Hi guys,
I've written a routine to detect the BIOS32 Service directory and his entry point (I've checked it also with a hex-editor). But if I try to call it, I get a "General Protection Fault". So what I'm doing wrong?

Here are some more infos for you
- CS and DS have the same base
- CS is execute-only
- DS is read / write (because if I set it to read only my System will not boot)
- I think the calling environment has access to IO space

Maybe it's because I didn't enabled paging, but is it neccessary?

Thank you for your help!
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 »

have you used an debugger to find the failing instruction / line of code?
Bochs is your friend here :wink:
"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 ]
sevobal
Member
Member
Posts: 63
Joined: Sun Oct 22, 2006 7:11 am

Post by sevobal »

I've a little understanding question.
My OS GDT has just 3 Entries, NULL descriptor, cs descriptor and ds descriptor.
Now if I want to use BIOS32 should I add three more entries (cs, ds, ss)?
And when should they be loaded and how does the BIOS32 know in which descriptor he should use (system: null, cs, ds or the new cs, ds, ss)?
If I understand the documentation of BIOS32 I should build three new descriptors, shouldn't I?
User avatar
Kevin McGuire
Member
Member
Posts: 843
Joined: Tue Nov 09, 2004 12:00 am
Location: United States
Contact:

Post by Kevin McGuire »

I know you can call the first entry point using CS, DS, and SS set to the entire address space. I think you just have to make sure all three have the same base address that encompasses the BIOS 32 Service Directory block.

You will also have to perform a far call into it IIRC. I did it but abandoned the idea when I realized I could directly access the PCI bus using ports instead.

Bochs and Qemu do not support the $PCI service from the BIOS 32 Service Directory.
Post Reply