|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
The following is edited from several messages from Kees Bot dated May 4
|
|
Packit Service |
50ad14 |
and 5, 1998.
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
From: Kees J Bot <kjb=731391@CS.VU.NL>
|
|
Packit Service |
50ad14 |
Subject: Re: 286 protected mode patch
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
Below is a patch to klib88.s for the changes I made after I got hold of
|
|
Packit Service |
50ad14 |
HIMEM.ASM, a somewhat old source of HIMEM.SYS. The A20 en/disable code
|
|
Packit Service |
50ad14 |
is a bit better for the AT, and I also added code to en/disable the A20
|
|
Packit Service |
50ad14 |
line for a PC with an MCA bus, i.e. most PS/2's.
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
So if any of you is running 16-bit Minix on a machine with an MCA bus
|
|
Packit Service |
50ad14 |
then this may be for you to get rid of processor=86.
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
The PS/2 side of the patch is the great unknown, since I don't have a
|
|
Packit Service |
50ad14 |
PS/2 to test it on. Who knows, maybe someone will tell us if it works
|
|
Packit Service |
50ad14 |
this time.
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
Apply the patch like this:
|
|
Packit Service |
50ad14 |
cd /usr/src/kernel
|
|
Packit Service |
50ad14 |
patch klib88.s klib88.dif
|
|
Packit Service |
50ad14 |
cd ../tools
|
|
Packit Service |
50ad14 |
make hdboot
|
|
Packit Service |
50ad14 |
shutdown -x 'unset processor;boot'
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
[Please note that this is experimental, there is another patch in this
|
|
Packit Service |
50ad14 |
directory that attempts to solve the same problems. Neither may be
|
|
Packit Service |
50ad14 |
correct for every machine. -- asw 12.06.98]
|
|
Packit Service |
50ad14 |
_._. .._ _ ._ ._.. ___ _. __. _ .... . _.. ___ _ _ . _.. ._.. .. _. .
|
|
Packit Service |
50ad14 |
*** /save/std/2.0.0/src/kernel/klib88.s Wed Jul 10 20:17:12 1996
|
|
Packit Service |
50ad14 |
--- klib88.s Mon May 04 12:20:59 1998
|
|
Packit Service |
50ad14 |
***************
|
|
Packit Service |
50ad14 |
*** 72,75 ****
|
|
Packit Service |
50ad14 |
--- 72,76 ----
|
|
Packit Service |
50ad14 |
.extern _vid_mask
|
|
Packit Service |
50ad14 |
.extern _level0_func
|
|
Packit Service |
50ad14 |
+ .extern _ps_mca
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
.text
|
|
Packit Service |
50ad14 |
***************
|
|
Packit Service |
50ad14 |
*** 201,205 ****
|
|
Packit Service |
50ad14 |
ltr ax ! set TSS register
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
! movb ah, #0xDF
|
|
Packit Service |
50ad14 |
jmp gate_A20 ! enable the A20 address line
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
--- 202,206 ----
|
|
Packit Service |
50ad14 |
ltr ax ! set TSS register
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
! movb ah, #0x02
|
|
Packit Service |
50ad14 |
jmp gate_A20 ! enable the A20 address line
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
***************
|
|
Packit Service |
50ad14 |
*** 214,224 ****
|
|
Packit Service |
50ad14 |
jae p2r386
|
|
Packit Service |
50ad14 |
p2r286:
|
|
Packit Service |
50ad14 |
! mov _gdt+ES_286_OFFSET+DESC_BASE, #0x0400
|
|
Packit Service |
50ad14 |
movb _gdt+ES_286_OFFSET+DESC_BASE_MIDDLE, #0x00
|
|
Packit Service |
50ad14 |
mov ax, #ES_286_SELECTOR
|
|
Packit Service |
50ad14 |
mov es, ax ! BIOS data segment
|
|
Packit Service |
50ad14 |
! eseg mov 0x0067, #real ! set return from shutdown address
|
|
Packit Service |
50ad14 |
cseg mov ax, kernel_cs
|
|
Packit Service |
50ad14 |
! eseg mov 0x0069, ax
|
|
Packit Service |
50ad14 |
movb al, #0x8F
|
|
Packit Service |
50ad14 |
outb 0x70 ! select CMOS byte 0x0F (disable NMI)
|
|
Packit Service |
50ad14 |
--- 215,225 ----
|
|
Packit Service |
50ad14 |
jae p2r386
|
|
Packit Service |
50ad14 |
p2r286:
|
|
Packit Service |
50ad14 |
! mov _gdt+ES_286_OFFSET+DESC_BASE, #0x0000
|
|
Packit Service |
50ad14 |
movb _gdt+ES_286_OFFSET+DESC_BASE_MIDDLE, #0x00
|
|
Packit Service |
50ad14 |
mov ax, #ES_286_SELECTOR
|
|
Packit Service |
50ad14 |
mov es, ax ! BIOS data segment
|
|
Packit Service |
50ad14 |
! eseg mov 0x0467, #real ! set return from shutdown address
|
|
Packit Service |
50ad14 |
cseg mov ax, kernel_cs
|
|
Packit Service |
50ad14 |
! eseg mov 0x0469, ax
|
|
Packit Service |
50ad14 |
movb al, #0x8F
|
|
Packit Service |
50ad14 |
outb 0x70 ! select CMOS byte 0x0F (disable NMI)
|
|
Packit Service |
50ad14 |
***************
|
|
Packit Service |
50ad14 |
*** 254,273 ****
|
|
Packit Service |
50ad14 |
mov sp, save_sp ! restore stack
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
! movb ah, #0xDD
|
|
Packit Service |
50ad14 |
!jmp gate_A20 ! disable the A20 address line
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
! ! Enable (ah = 0xDF) or disable (ah = 0xDD) the A20 address line.
|
|
Packit Service |
50ad14 |
gate_A20:
|
|
Packit Service |
50ad14 |
call kb_wait
|
|
Packit Service |
50ad14 |
movb al, #0xD1 ! Tell keyboard that a command is coming
|
|
Packit Service |
50ad14 |
outb 0x64
|
|
Packit Service |
50ad14 |
call kb_wait
|
|
Packit Service |
50ad14 |
! movb al, ah ! Enable or disable code
|
|
Packit Service |
50ad14 |
outb 0x60
|
|
Packit Service |
50ad14 |
call kb_wait
|
|
Packit Service |
50ad14 |
! mov ax, #25 ! 25 microsec delay for slow keyboard chip
|
|
Packit Service |
50ad14 |
! 0: out 0xED ! Write to an unused port (1us)
|
|
Packit Service |
50ad14 |
! dec ax
|
|
Packit Service |
50ad14 |
! jne 0b
|
|
Packit Service |
50ad14 |
ret
|
|
Packit Service |
50ad14 |
kb_wait:
|
|
Packit Service |
50ad14 |
--- 255,276 ----
|
|
Packit Service |
50ad14 |
mov sp, save_sp ! restore stack
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
! xorb ah, ah
|
|
Packit Service |
50ad14 |
!jmp gate_A20 ! disable the A20 address line
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
! ! Enable (ah = 0x02) or disable (ah = 0x00) the A20 address line.
|
|
Packit Service |
50ad14 |
gate_A20:
|
|
Packit Service |
50ad14 |
+ cmp _ps_mca, #0 ! PS/2 bus?
|
|
Packit Service |
50ad14 |
+ jnz gate_PS_A20
|
|
Packit Service |
50ad14 |
call kb_wait
|
|
Packit Service |
50ad14 |
movb al, #0xD1 ! Tell keyboard that a command is coming
|
|
Packit Service |
50ad14 |
outb 0x64
|
|
Packit Service |
50ad14 |
call kb_wait
|
|
Packit Service |
50ad14 |
! movb al, #0xDD ! 0xDD = A20 disable code if ah = 0x00
|
|
Packit Service |
50ad14 |
! orb al, ah ! 0xDF = A20 enable code if ah = 0x02
|
|
Packit Service |
50ad14 |
outb 0x60
|
|
Packit Service |
50ad14 |
call kb_wait
|
|
Packit Service |
50ad14 |
! movb al, #0xFF ! Pulse output port
|
|
Packit Service |
50ad14 |
! outb 0x64
|
|
Packit Service |
50ad14 |
! call kb_wait ! Wait for the A20 line to settle down
|
|
Packit Service |
50ad14 |
ret
|
|
Packit Service |
50ad14 |
kb_wait:
|
|
Packit Service |
50ad14 |
***************
|
|
Packit Service |
50ad14 |
*** 275,278 ****
|
|
Packit Service |
50ad14 |
--- 278,293 ----
|
|
Packit Service |
50ad14 |
testb al, #0x02 ! Keyboard input buffer full?
|
|
Packit Service |
50ad14 |
jnz kb_wait ! If so, wait
|
|
Packit Service |
50ad14 |
+ ret
|
|
Packit Service |
50ad14 |
+
|
|
Packit Service |
50ad14 |
+ gate_PS_A20: ! The PS/2 can twiddle A20 using port A
|
|
Packit Service |
50ad14 |
+ inb 0x92 ! Read port A
|
|
Packit Service |
50ad14 |
+ andb al, #0xFD
|
|
Packit Service |
50ad14 |
+ orb al, ah ! Set A20 bit to the required state
|
|
Packit Service |
50ad14 |
+ outb 0x92 ! Write port A
|
|
Packit Service |
50ad14 |
+ jmp .+2 ! Small delay
|
|
Packit Service |
50ad14 |
+ A20ok: inb 0x92 ! Check port A
|
|
Packit Service |
50ad14 |
+ andb al, #0x02
|
|
Packit Service |
50ad14 |
+ cmpb al, ah ! A20 line settled down to the new state?
|
|
Packit Service |
50ad14 |
+ jne A20ok ! If not then wait
|
|
Packit Service |
50ad14 |
ret
|
|
Packit Service |
50ad14 |
|
|
Packit Service |
50ad14 |
|