> > The next try was with more console_putchar calls added to the
> > gateA20() code.  This narrowed it down to the loop waiting for an 
> > empty keyboard controller input buffer.
> 
> So how far did you get after that ?

Well, it doesn't hang any more after printing "Loading stage2 ....",
after I added some code [*] to grub's gateA20() function.


grub is now able to load and display the menu.lst file and the splashimage.
grub reports reasonable base and upper memory.


I can type exactly *one* character on the usb keyboard.  When trying to
read a second character from the keyboard, the system hangs.


Or I can wait until the grub menu timeout expires.  This starts loading the
default entry.  multiboot and the boot_archive is loaded.  Text screen is
cleared,  ...., and the system hangs - before printing the 
"SunOS Release 5.xx" copyright string.


[*]

diff -rub ../opensolaris-20060404/usr/src/grub/grub-0.95/stage2/asm.S 
usr/src/grub/grub-0.95/stage2/asm.S
--- ../opensolaris-20060404/usr/src/grub/grub-0.95/stage2/asm.S 2006-04-05 
23:28:21.000000000 +0200
+++ usr/src/grub/grub-0.95/stage2/asm.S 2006-04-10 18:11:44.152925307 +0200
@@ -1787,7 +1787,30 @@
        jnz     3f
        ret

-3:     /* use keyboard controller */
+3:     /*
+        * try to switch gateA20 using PORT92, the "Fast A20 and Init"
+        * register
+        */
+        mov    $0x92, %dx
+        inb    %dx, %al
+       /* skip the port92 code if it's unimplemented (read returns 0xff) */
+       cmpb    $0xff, %al
+       jz      6f
+
+       /* set or clear bit1, the ALT_A20_GATE bit */
+       movb    4(%esp), %ah
+       testb   %ah, %ah
+       jz      4f
+       orb     $2, %al
+       jmp     5f
+4:      and    $0xfd, %al
+
+       /* clear the INIT_NOW bit; don't accidently reset the machine */
+5:     and     $0xfe, %al
+       outb    %al, %dx
+
+
+6:     /* use keyboard controller */
        pushl   %eax

        call    gloop1
@@ -1797,9 +1820,12 @@

 gloopint1:
        inb     $K_STATUS
+       cmpb    $0xff, %al
+       jz      gloopint1_done
        andb    $K_IBUF_FUL, %al
        jnz     gloopint1

+gloopint1_done:
        movb    $KB_OUTPUT_MASK, %al
        cmpb    $0, 0x8(%esp)
        jz      gdoit
@@ -1820,6 +1846,8 @@

 gloop1:
        inb     $K_STATUS
+       cmpb    $0xff, %al
+       jz      gloop2ret
        andb    $K_IBUF_FUL, %al
        jnz     gloop1

_______________________________________________
opensolaris-discuss mailing list
opensolaris-discuss@opensolaris.org

Reply via email to