Skip to content

Commit

Permalink
. 0x8205 bit 5 = 1: enable HLT instruction for checkkey idle loop.
Browse files Browse the repository at this point in the history
  • Loading branch information
yaya committed Nov 5, 2016
1 parent 485bfd3 commit 4cdcd3c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions stage2/asm.S
Expand Up @@ -74,6 +74,7 @@ ENTRY(main)
* bit 2 = 1: disable the "unconditional command-line entrance" feature * bit 2 = 1: disable the "unconditional command-line entrance" feature
* bit 3 = 1: disable geometry tune * bit 3 = 1: disable geometry tune
* bit 4 = 1: disable startup cdrom drive look-up. * bit 4 = 1: disable startup cdrom drive look-up.
* bit 5 = 1: enable HLT instruction for checkkey idle loop.
*/ */
.byte 0 .byte 0


Expand Down Expand Up @@ -923,7 +924,18 @@ ENTRY(stop)
hard_stop: hard_stop:
sti sti
//hlt //hlt
call conditional_hlt
jmp hard_stop jmp hard_stop

conditional_hlt:
//DS should already be 0, but ...
pushw $0
popw %ds // just in case DS changed by buggy BIOS
testb $0x20, 0x8205 // Enable HLT?
jz 1f // No. Skip the HLT instruction.
hlt // Yes. Execute the HLT instruction.
1:
ret // on return, DS=0


.code32 .code32


Expand Down Expand Up @@ -15021,6 +15033,7 @@ ENTRY(console_getkey)
1: 1:
sti /* getkey needs interrupt on */ sti /* getkey needs interrupt on */
// hlt // hlt
call conditional_hlt


#; work around for Apple BIOS getkey bug #; work around for Apple BIOS getkey bug
#; check the keyboard buffer, until there is a keypress. #; check the keyboard buffer, until there is a keypress.
Expand Down Expand Up @@ -15159,6 +15172,7 @@ ENTRY(console_checkkey)


sti /* checkkey needs interrupt on */ sti /* checkkey needs interrupt on */
// hlt // hlt
call conditional_hlt


cmpl 0x46c, %eax /* timer counter changed by int 8? */ cmpl 0x46c, %eax /* timer counter changed by int 8? */
loopz 1b /* no change, wait a timer interrupt */ loopz 1b /* no change, wait a timer interrupt */
Expand Down

0 comments on commit 4cdcd3c

Please sign in to comment.