apm bios pmode

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
lama
Member
Member
Posts: 83
Joined: Thu Apr 16, 2009 8:41 am

apm bios pmode

Post by lama »

Hi,

Can someone please show me how to perform call to apm bios? I'm really stucked here. I have checked for APM PMODE 32BIT support, have setup interface connection and have updated my GDT. Then, I tried to far-call the APM entry point with ax=530a (get power status) and bx=1. What i got was GPF and in bochsout was:
BOCHS-DEBUGGER wrote: LOCK prefix unallowed (op1=0x53, attr=0x0, mod=0x0, nnn=0)
LOCK prefix unallowed (op1=0x53, attr=0x0, mod=0x0, nnn=0)
write_virtual_checks(): write beyond limit, r/w
....maybe the values whitch i caught from 5303 int15 is wrong:
BOCHS-DEBUGGER wrote: pm 32bit cs base : 0xf000 (returned in ax)
apm 16bit cs base : 0xf000 (returned in cx)
apm entrypoint : 0xaf0d (returned in ebx)
apm ds base : 0xf000 (returned in dx)
apm 32/16 cs lenght : 0xfff0 (both) (returned in esi)
apm ds lenght : 0xfff0 (returned in di),
Can someone show me how to do this right? It means a lot for me to get this thing working,
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: apm bios pmode

Post by Combuster »

LOCK prefix unallowed (op1=0x53, attr=0x0, mod=0x0, nnn=0)
Tip of the day: do not try to execute data. Instead jump to the location the bios instructed you to and not somewhere else :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 ]
lama
Member
Member
Posts: 83
Joined: Thu Apr 16, 2009 8:41 am

Re: apm bios pmode

Post by lama »

i dont get it :D if edx is the entry point and ds is set to apm cs - call [ds:edx] - is this a wrong way how to perform call ?show me what you mean please :)
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: apm bios pmode

Post by Combuster »

lama wrote:call [ds:edx] - is this a wrong way how to perform call?
I'm 99% sure that it does *not* do what you think :wink: (look it up in the intel manuals)
"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 ]
lama
Member
Member
Posts: 83
Joined: Thu Apr 16, 2009 8:41 am

Re: apm bios pmode

Post by lama »

wow that was quick :D well, it will perform a far call , cs is updated to value in ds, right?
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: apm bios pmode

Post by Brendan »

Hi,
lama wrote:wow that was quick :D well, it will perform a far call , cs is updated to value in ds, right?
Wrong.

For "call [ds:edx]" the CPU loads EIP from address "ds:edx". What you're trying to do is "call far ds:edx" (e.g. load CS from DS and load EIP from EDX), but the CPU doesn't support that.

What you'd need to do is something like:

Code: Select all

    mov [foo],edx
    mov [foo+4],ds
   call far [foo]
Also note that "call far [foo]" is different to "call [foo]", and they're both entirely different to "call foo".


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
lama
Member
Member
Posts: 83
Joined: Thu Apr 16, 2009 8:41 am

Re: apm bios pmode

Post by lama »

thanks a lot for the explanation :) i know what does [] stands for,but 'call ds:edx' has nasm rejected..so i thought that call [ds:edx] is the same in this case, but cleary it was a complete nonsense , thanks again :D now i got different gpf - incorrect cs... so i probably have some junk in gdt .. :(
Post Reply