mirror of
https://gitlab.com/bztsrc/bootboot.git
synced 2023-02-13 20:54:32 -05:00
Do not rely on BIOS, initialize the serial port ourselves
This commit is contained in:
parent
190375cfd6
commit
ef5aa234c5
4 changed files with 41 additions and 9 deletions
BIN
dist/bootboot.bin
vendored
BIN
dist/bootboot.bin
vendored
Binary file not shown.
File diff suppressed because one or more lines are too long
|
@ -3,7 +3,7 @@
|
||||||
#define sizeof_boot_bin 512
|
#define sizeof_boot_bin 512
|
||||||
extern unsigned char binary_boot_bin[512];
|
extern unsigned char binary_boot_bin[512];
|
||||||
#define sizeof_bootboot_bin 13312
|
#define sizeof_bootboot_bin 13312
|
||||||
extern unsigned char binary_bootboot_bin[9299];
|
extern unsigned char binary_bootboot_bin[9329];
|
||||||
#define sizeof_bootboot_efi 103614
|
#define sizeof_bootboot_efi 103614
|
||||||
extern unsigned char binary_bootboot_efi[46348];
|
extern unsigned char binary_bootboot_efi[46348];
|
||||||
#define sizeof_bootboot_img 35344
|
#define sizeof_bootboot_img 35344
|
||||||
|
|
|
@ -302,15 +302,21 @@ realmode_start:
|
||||||
mov byte [cdromdev], al
|
mov byte [cdromdev], al
|
||||||
@@:
|
@@:
|
||||||
;-----initialize serial port COM1,115200,8N1------
|
;-----initialize serial port COM1,115200,8N1------
|
||||||
mov ax, 0401h
|
; mov ax, 0401h
|
||||||
xor bx, bx
|
; xor bx, bx
|
||||||
mov cx, 030Bh
|
; mov cx, 030Bh
|
||||||
xor dx, dx
|
; xor dx, dx
|
||||||
int 14h
|
; int 14h
|
||||||
; if there's no serial, but BIOS incorrectly sets the IO port for it
|
|
||||||
mov dx, word [400h]
|
mov dx, word [400h]
|
||||||
or dx, dx
|
or dx, dx
|
||||||
jz @f
|
jnz @f
|
||||||
|
; if the IO port isn't set, try the default one of COM1
|
||||||
|
mov dx, 3f8h
|
||||||
|
mov word [400h], dx
|
||||||
|
; initialize the serial outselves, because Bochs BIOS is buggy
|
||||||
|
@@: call serialsetup
|
||||||
|
; if there's no serial, but BIOS incorrectly sets the IO port for it
|
||||||
|
mov dx, word [400h]
|
||||||
add dx, 5
|
add dx, 5
|
||||||
in al, dx
|
in al, dx
|
||||||
cmp al, 0FFh
|
cmp al, 0FFh
|
||||||
|
@ -438,6 +444,32 @@ start_of_setup:
|
||||||
jmp 9000h:realmode_start-loader
|
jmp 9000h:realmode_start-loader
|
||||||
; --- end of Linux boot protocol header ---
|
; --- end of Linux boot protocol header ---
|
||||||
|
|
||||||
|
serialsetup:
|
||||||
|
inc dx
|
||||||
|
xor al, al
|
||||||
|
out dx, al ; IER int off
|
||||||
|
mov al, 80h
|
||||||
|
add dx, 2
|
||||||
|
out dx, al ; LCR set divisor mode
|
||||||
|
mov al, 1
|
||||||
|
sub dx, 3
|
||||||
|
out dx, al ; DLL divisor lo 115200
|
||||||
|
xor al, al
|
||||||
|
inc dx
|
||||||
|
out dx, al ; DLH divisor hi
|
||||||
|
inc dx
|
||||||
|
out dx, al ; FCR fifo off
|
||||||
|
mov al, 43h
|
||||||
|
inc dx
|
||||||
|
out dx, al ; LCR 8N1, break on
|
||||||
|
mov al, 8
|
||||||
|
inc dx
|
||||||
|
out dx, al ; MCR Aux out 2
|
||||||
|
xor al, al
|
||||||
|
sub dx, 4
|
||||||
|
in al, dx ; clear receiver/transmitter
|
||||||
|
ret
|
||||||
|
|
||||||
cpuok: DBG dbg_A20
|
cpuok: DBG dbg_A20
|
||||||
|
|
||||||
;-----enable A20-----
|
;-----enable A20-----
|
||||||
|
|
Loading…
Reference in a new issue