The A20 Problem (JOS)

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
gapry
Posts: 10
Joined: Sat Aug 25, 2012 7:42 pm

The A20 Problem (JOS)

Post by gapry »

The snippet code as following is enable A20 for JOS. It has a problem which confuse for me. The "$0xdf" is a command, not data.It should be out to port 0x64, which is command port. In fact, It port to 0x60, which is data port.
Here, exist two methods (Method 3.1 & Method 3.2) : http://www.brokenthorn.com/Resources/OSDev9.html
So, my question is : Why port to 0x60 (outb %al, %0x60) at last ?

Code: Select all

seta20.1:
  inb     $0x64,%al               # Wait for not busy
  testb   $0x2,%al
  jnz     seta20.1

  movb    $0xd1,%al               # 0xd1 -> port 0x64
  outb    %al,$0x64                                                                                

seta20.2:
  inb     $0x64,%al               # Wait for not busy
  testb   $0x2,%al
  jnz     seta20.2

  movb    $0xdf,%al               # 0xdf -> port 0x60
  outb    %al,$0x60
User avatar
iansjack
Member
Member
Posts: 4711
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: The A20 Problem (JOS)

Post by iansjack »

gapry
Posts: 10
Joined: Sat Aug 25, 2012 7:42 pm

Re: The A20 Problem (JOS)

Post by gapry »

Thanks.

Here, it's picture for KBC http://aodfaq.wikispaces.com/mkbc

The port 0x60 is Data Port, 0xD1 and 0xDF is a command, not Data. So, my question become that "Why send the Command (0xD1, 0xDF, 0xDD) to the Data Port (0x60)? It should be Command Port (0x64)."
User avatar
iansjack
Member
Member
Posts: 4711
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: The A20 Problem (JOS)

Post by iansjack »

Writing 0xd1 to the control port tells the controller to write the next byte sent to the data port to the Controller Output Port. Read about the 8042 controller in the Wiki: http://wiki.osdev.org/%228042%22_PS/2_C ... r_IO_Ports
gapry
Posts: 10
Joined: Sat Aug 25, 2012 7:42 pm

Re: The A20 Problem (JOS)

Post by gapry »

Thanks, I wanna confirm my understanding.

"Writing 0xd1 to the control port tells the controller to write the next byte sent to the data port to the Controller Output Port."

The 0xdf is command which can enable the A20. Finally, the A20 can enable successfully.

But, it exist a question for me.

Following above the resource, it exists a method:
http://www.brokenthorn.com/Resources/OSDev9.html

Code: Select all

; Method 3.1: Enables A20 through keyboard controller
mov al, 0xdd	; command 0xdd: enable a20
out 0x64, al	; send command to controller
What is different between them?
User avatar
iansjack
Member
Member
Posts: 4711
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: The A20 Problem (JOS)

Post by iansjack »

As your link says "Not all controllers support this method". The difference is portability.
Post Reply