Page 2 of 2

Re: PML4 on Core2Duo or VirtualBox issue

Posted: Thu Apr 11, 2013 4:05 pm
by Owen
gusc wrote:00:00:07.201562 Guest paging mode: AMD64 (changed 6 times), A20 disabled (changed 1 times)

Re: PML4 on Core2Duo or VirtualBox issue

Posted: Thu Apr 11, 2013 4:09 pm
by gusc
Owen wrote:
gusc wrote:00:00:07.201562 Guest paging mode: AMD64 (changed 6 times), A20 disabled (changed 1 times)
FFFUUUUUUUUUUUUUUU! (rage)

Thanks man! That means, it was in a totaly opposite direction :D Now I have to figure out why this does not work:

Code: Select all

  ; Enable A20 Gate
  in al, 0x92                 ; read from io port 0x92
  test al, 0x02               ; do some test
  out 0x90, al                ; write to io port 0x90

Re: PML4 on Core2Duo or VirtualBox issue

Posted: Thu Apr 11, 2013 4:17 pm
by Combuster
copying port 0x92 to 0x90 doesn't do anything with A20, but setting bit 1 of port 0x92 does:

Code: Select all

                IN AL, 0x92         ; A20, using fast A20 gate
                MOV CL, AL
                AND CL, 2
                JNZ skip            ; if a20 bit seems set, don't touch it
                OR AL, 2
                OUT 0x92, AL

Re: PML4 on Core2Duo or VirtualBox issue

Posted: Thu Apr 11, 2013 4:26 pm
by gusc
Combuster wrote:copying port 0x92 to 0x90 doesn't do anything with A20, but setting bit 1 of port 0x92 does:

Code: Select all

                IN AL, 0x92         ; A20, using fast A20 gate
                MOV CL, AL
                AND CL, 2
                JNZ skip            ; if a20 bit seems set, don't touch it
                OR AL, 2
                OUT 0x92, AL
It's alive! Funny, but this "Fast A20" worked in Bochs and Qemu, but not on the real hardware. And, yes, I had a typo, so it's 0x92 after all not 0x90.

Re: PML4 on Core2Duo or VirtualBox issue

Posted: Thu Apr 11, 2013 4:30 pm
by Combuster
Bochs *boots* with A20 enabled, so any code that tries to enable it again is obviously going to appear successful :wink:.

Also, computers are not quantummechanic devices. TEST doesn't change its subjects, so what do you think it's been doing there?

Re: PML4 on Core2Duo or VirtualBox issue

Posted: Thu Apr 11, 2013 7:20 pm
by Opcode
I've said it before and I'll say it again: Why do people who target x64 fiddle with the A20 this way? If you know you're 64bit, then gogo BIOS.

Code: Select all

	mov	ax, 0x2401
	int	0x15
	jc	.a20Error
	cmp	ah, 0
	jne	.a20Error

Re: PML4 on Core2Duo or VirtualBox issue

Posted: Thu Apr 11, 2013 8:46 pm
by Mikemk
I use three methods for enabling, along with some self modifying code.

Re: PML4 on Core2Duo or VirtualBox issue

Posted: Thu Apr 11, 2013 9:41 pm
by bluemoon
gusc wrote:
Combuster wrote:copying port 0x92 to 0x90 doesn't do anything with A20, but setting bit 1 of port 0x92 does:

Code: Select all

                IN AL, 0x92         ; A20, using fast A20 gate
                MOV CL, AL
                AND CL, 2
                JNZ skip            ; if a20 bit seems set, don't touch it
                OR AL, 2
                OUT 0x92, AL
It's alive! Funny, but this "Fast A20" worked in Bochs and Qemu, but not on the real hardware. And, yes, I had a typo, so it's 0x92 after all not 0x90.
This will not work on macbook since it does not have PS2 controller at all, not even emulation. It's best to detect if it exist before sending IOs, or just simply call BIOS (for uEFI, A20, if there is still such idea at all, is already enabled).

Re: PML4 on Core2Duo or VirtualBox issue

Posted: Thu Apr 11, 2013 11:56 pm
by dozniak
bluemoon wrote:This will not work on macbook since it does not have PS2 controller at all, not even emulation.
It will not just "not work", it will hang the machine dead.

Re: PML4 on Core2Duo or VirtualBox issue

Posted: Fri Apr 12, 2013 2:11 am
by Combuster
I could've provided the cheap answer, but that's not going to further most people's debugging skills. Still, for A20, this is the most thorough method I've come up with and it shouldn't get even close to the 0x92 code on a Mac.

While we're at it, does the read from 0x92 crash the mac or the write? (and if it's the write, what's the value returned by the read - I don't have a macbook or bootcamp to try)

Re: PML4 on Core2Duo or VirtualBox issue

Posted: Fri Apr 12, 2013 5:17 am
by Owen
Combuster wrote:While we're at it, does the read from 0x92 crash the mac or the write? (and if it's the write, what's the value returned by the read - I don't have a macbook or bootcamp to try)
I don't know, and it may be model dependent. Is anyone sure 0x92 actually crashes a Mac? I know the keyboard controller ports do, but 0x92?

EDIT: GRUB2's process is
  • Try the BIOS, else
  • Port 0x92, else
  • Keyboard controller

Re: PML4 on Core2Duo or VirtualBox issue

Posted: Fri Apr 12, 2013 5:59 am
by bluemoon
I'll put the KBC code, prepare the USB and test it tonight.
I didn't check the cause last time, it may be fallen into an infinite loop on the "io wait" or it may be actually crashed, I'll check it out.

Re: PML4 on Core2Duo or VirtualBox issue

Posted: Fri Apr 12, 2013 9:30 pm
by bluemoon
Sorry guys, I found the most difficult part of this test is to find the damn usb stick, it just disappeared out of thin air.
I'd probably do the test when it pop out later.