PML4 on Core2Duo or VirtualBox issue

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.
User avatar
Owen
Member
Member
Posts: 1700
Joined: Fri Jun 13, 2008 3:21 pm
Location: Cambridge, United Kingdom
Contact:

Re: PML4 on Core2Duo or VirtualBox issue

Post by Owen »

gusc wrote:00:00:07.201562 Guest paging mode: AMD64 (changed 6 times), A20 disabled (changed 1 times)
gusc
Member
Member
Posts: 50
Joined: Tue Feb 05, 2013 1:42 pm

Re: PML4 on Core2Duo or VirtualBox issue

Post 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
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: PML4 on Core2Duo or VirtualBox issue

Post 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
"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 ]
gusc
Member
Member
Posts: 50
Joined: Tue Feb 05, 2013 1:42 pm

Re: PML4 on Core2Duo or VirtualBox issue

Post 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.
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: PML4 on Core2Duo or VirtualBox issue

Post 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?
"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 ]
Opcode
Member
Member
Posts: 29
Joined: Mon Apr 01, 2013 2:50 pm

Re: PML4 on Core2Duo or VirtualBox issue

Post 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
Mikemk
Member
Member
Posts: 409
Joined: Sat Oct 22, 2011 12:27 pm

Re: PML4 on Core2Duo or VirtualBox issue

Post by Mikemk »

I use three methods for enabling, along with some self modifying code.
Programming is 80% Math, 20% Grammar, and 10% Creativity <--- Do not make fun of my joke!
If you're new, check this out.
User avatar
bluemoon
Member
Member
Posts: 1761
Joined: Wed Dec 01, 2010 3:41 am
Location: Hong Kong

Re: PML4 on Core2Duo or VirtualBox issue

Post 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).
User avatar
dozniak
Member
Member
Posts: 723
Joined: Thu Jul 12, 2012 7:29 am
Location: Tallinn, Estonia

Re: PML4 on Core2Duo or VirtualBox issue

Post 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.
Learn to read.
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: PML4 on Core2Duo or VirtualBox issue

Post 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)
"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 ]
User avatar
Owen
Member
Member
Posts: 1700
Joined: Fri Jun 13, 2008 3:21 pm
Location: Cambridge, United Kingdom
Contact:

Re: PML4 on Core2Duo or VirtualBox issue

Post 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
User avatar
bluemoon
Member
Member
Posts: 1761
Joined: Wed Dec 01, 2010 3:41 am
Location: Hong Kong

Re: PML4 on Core2Duo or VirtualBox issue

Post 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.
User avatar
bluemoon
Member
Member
Posts: 1761
Joined: Wed Dec 01, 2010 3:41 am
Location: Hong Kong

Re: PML4 on Core2Duo or VirtualBox issue

Post 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.
Post Reply