From: Struan Bartlett <struan@praguespringpeople.org>
To: qemu-devel@nongnu.org
Subject: Re: APM bug Re: [Qemu-devel] Re: Suggestion - trap window-close of VM
Date: Thu, 31 Mar 2005 19:56:59 +0200 [thread overview]
Message-ID: <424C39EB.6020203@praguespringpeople.org> (raw)
In-Reply-To: <424BD31A.5020300@praguespringpeople.org>
From http://www.microsoft.com/whdc/archive/apm.mspx:
"APM support must be enabled in the BIOS when Windows 2000 is installed.
Although APM can be disabled on many mobile systems, a non-ACPI system
that has APM disabled in the BIOS will not have power-management
capabilities installed under Windows 2000."
The way to test for this apparently is looking in the Registry at
HKEY_LOCAL_MACHINE\ HARDWARE\ Description\ System\ MultifunctionAdapter:
"If the Windows 2000 Ntdetect module finds an APM BIOS on the system, it
creates a MultifunctionAdapter subkey with an entry for APM."
So to get APM working with Windows 2000 I surmise one would need to: a.
get the 16-bit protected mode interface function working correctly; b.
install Windows 2000 from scratch.
Struan
Struan Bartlett wrote:
> Having reviewed some of the APM1.2 specification, first impression is
> that the APM bios is required to provide not only a real-mode and
> protected 32-bit mode interface to its functions, but also a 16-bit
> protected mode interface, which the apmbios.S code apparently does not
> have.
>
> I've tried adding one - although I'm not sure it's correct - and
> adjusting function 0x00 (APM installation check) to return 0x03 in cx
> (instead of 0x02 to signify the availability of this 16-bit interface)
> what's interesting is the debug statements immediately become slightly
> more promising:
>
> APM: EAX=00005300
> APM: EAX=00005301
> APM: EAX=0000530e
> APM: EAX=00005300
> APM: EAX=00005304
> APM: EAX=00005302 [16-bit protected mode interface connect]
> APM: EAX=0000530e
>
> As we can see, after having disconnected the real-mode interface the
> Windows APM driver seems to try to connect to the 16-bit protected
> mode interface (function 0x02). It then calls the APM driver version
> function (0x0e). But this isn't good enough. Windows 2000 still
> appears to call no further APM functions as it boots and shuts down.
> So, what's next?
>
> If it's fair to assume that the Windows 2000 APM driver needs to
> interface with the APM bios using the 16-bit protected-mode interface
> (instead of the 32-bit interface) then the first thing that seems
> worth checking is my implementation of function 0x02, which I think it
> could well be returning the wrong code and data segment addresses.
> Here's the code:
>
> ;-----------------
> ; APM 16 bit protected mode interface connect
> APMSYM(02):
> cmp al, #0x02
> jne APMSYM(03)
>
> mov ax, #0xffff // 16 bit code segment base
> mov bx, #_apm16_entry
> mov cx, #0xf000 // data segment address
> // 16 bit code segment size
> mov si, #0xfff0
> mov di, #0xfff0 // data segment length
> jmp APMSYM(ok)
>
> ;-----------------
> ; APM 32 bit protected mode interface connect
> APMSYM(03):
> cmp al, #0x03
> jne APMSYM(04)
> mov ax, #0xf000 // 32 bit code segment base
> mov ebx, #_apm32_entry
> mov cx, #0xf000 // 16 bit code segment base
> // 32 bit code segment size (low 16 bits)
> // 16 bit code segment size (high 16 bits)
> mov esi, #0xfff0fff0
> mov dx, #0xf000 // data segment address
> mov di, #0xfff0 // data segment length
> jmp APMSYM(ok)
>
> Can anyone advise?
>
> Struan
>
> Struan Bartlett wrote:
>
>> Paul Brook wrote:
>>
>>> In theory windows should be able to "turn off" qemu using APM, like
>>> it does on real machines. However there seem to be bugs in the qemu
>>> implementation that stop this working.
>>
>>
>> I thought I'd have a little look into why Windows 2000 doesn't turn
>> off qemu using APM properly. I enabled DEBUG_BIOS in hw/pc.c then
>> downloaded the latest Debian source for the Bochs bios v1.121 and
>> defined DEBUG_ROMBIOS and DEBUG_APM both to be 1. I recompiled and
>> installed the bios and ran qemu to load up Windows 2000. What we get
>> seems interesting. By the time Qemu boots Windows 2000 to its first
>> progress-bar, it has printed the following debug statements (with my
>> explanation added in square brackets):
>>
>> APM: EAX=00005300 [53 is the int 15h identifier for APM checked for
>> in rombios.c. 00 is the APM installation check function]
>> APM: EAX=00005301 [01 is the APM real mode interface connect]
>> APM: EAX=0000530e [0e appears to request APM driver version]
>> APM: EAX=00005300 [00, again, is the APM installation check - why is
>> this called twice?]
>> APM: EAX=00005304 [04 is APM interface disconnect]
>>
>> Then, while Windows 2000 boots and until shutdown is complete, I get
>> no more debug statements. My question is, why not? I'm no APM expert
>> but, judging from the 'apmbios.S' comments I might expect to see APM:
>> EAX=00005303 [03 is APM 32 bit protected mode interface connect]. I
>> could speculate that the return code from APM function 0e does not
>> satisfy Windows 2000 for some reason, so it does another installation
>> check and then disconnects the APM interface entirely - hence no APM
>> functionality in Windows 2000.
>>
>> If I get more time I may research the APM functions more fully. In
>> the meantime, if anyone can suggest any alternative theories or how
>> to test them, I'd be curious.
>>
>> Struan
>>
>>
>>
>> _______________________________________________
>> Qemu-devel mailing list
>> Qemu-devel@nongnu.org
>> http://lists.nongnu.org/mailman/listinfo/qemu-devel
>
>
>
>
> _______________________________________________
> Qemu-devel mailing list
> Qemu-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/qemu-devel
next prev parent reply other threads:[~2005-03-31 18:17 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-27 3:49 [Qemu-devel] Suggestion - trap window-close of VM Ryan Rempel
2005-03-27 18:30 ` Struan Bartlett
2005-03-28 11:34 ` [patch] " Struan Bartlett
2005-03-28 12:51 ` Asko Kauppi
2005-03-28 13:04 ` Paul Brook
2005-03-29 22:37 ` [Qemu-devel] " Ryan Rempel
2005-03-29 22:52 ` Paul Brook
2005-03-30 1:17 ` Ryan Rempel
2005-03-30 12:20 ` Struan Bartlett
2005-03-30 12:48 ` Lennert Buytenhek
2005-03-30 13:26 ` Struan Bartlett
2005-03-30 18:22 ` Lennert Buytenhek
2005-03-30 20:16 ` Leonardo E. Reiter
2005-03-30 21:22 ` Lennert Buytenhek
2005-03-30 21:43 ` Struan Bartlett
2005-03-31 9:32 ` John R. Hogerhuis
2005-03-31 12:31 ` Lennert Buytenhek
2005-03-30 13:21 ` APM bug " Struan Bartlett
2005-03-31 10:38 ` Struan Bartlett
2005-03-31 17:56 ` Struan Bartlett [this message]
2005-04-03 22:00 ` A Fix " Struan Bartlett
2005-04-04 9:53 ` Struan Bartlett
2005-04-04 17:12 ` Struan Bartlett
2005-04-04 22:26 ` Iain McFarlane
2005-04-05 16:34 ` Volker Ruppert
2005-04-05 21:05 ` Iain McFarlane
2005-04-05 21:33 ` [Qemu-devel] Re: Windows 2000 SP4 (was Re: APM bug) Leonardo E. Reiter
2005-04-05 22:57 ` Hetz Ben Hamo
2005-04-05 23:03 ` Leonardo E. Reiter
2005-04-05 23:48 ` Hetz Ben Hamo
2005-04-06 0:28 ` Leonardo E. Reiter
2005-04-06 0:52 ` [Qemu-devel] Re: Windows 2000 SP4 Leonardo E. Reiter
2005-04-06 20:25 ` [Qemu-devel] Re: Windows 2000 SP4 (was Re: APM bug) Fabrice Bellard
2005-04-06 22:47 ` Hetz Ben Hamo
2005-04-07 7:17 ` Jonas Maebe
2005-04-07 11:56 ` Flavio Visentin
2005-04-05 23:40 ` Derek Fawcus
2005-04-07 16:42 ` A Fix Re: APM bug Re: [Qemu-devel] Re: Suggestion - trap window-closeof VM Andreas Bollhalder
2005-04-05 13:55 ` APM bug Re: [Qemu-devel] Re: Suggestion - trap window-close of VM Alex Beregszaszi
2005-03-31 16:38 ` Andreas Bollhalder
2005-03-31 17:32 ` Jason Gress
2005-05-07 16:30 ` [patch] on-quit-v0.21 with resume/suspend/power-off dialog Re: [patch] Re: [Qemu-devel] " Struan Bartlett
2005-05-09 15:43 ` Ryan Rempel
2005-05-09 22:25 ` Struan Bartlett
2005-05-09 23:19 ` Flavio Visentin
2005-05-10 8:40 ` Struan Bartlett
2005-07-29 0:07 ` [patch] " Struan Bartlett
2005-03-28 15:04 ` Mark Williamson
2005-03-28 19:13 ` Joshua Kugler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=424C39EB.6020203@praguespringpeople.org \
--to=struan@praguespringpeople.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.