forked from KolibriOS/kolibrios
grub4kos: print panic messages
git-svn-id: svn://kolibrios.org@4441 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
98dad9f109
commit
75ff73eb60
@ -56,7 +56,7 @@ end virtual
|
|||||||
cld
|
cld
|
||||||
mov esi, mboot
|
mov esi, mboot
|
||||||
mov edi, 0x80000
|
mov edi, 0x80000
|
||||||
mov ecx, 600/4 ;magic value
|
mov ecx, 624/4 ;magic value
|
||||||
rep movsd
|
rep movsd
|
||||||
jmp .check_mbi
|
jmp .check_mbi
|
||||||
|
|
||||||
@ -64,24 +64,26 @@ org $-0x80000
|
|||||||
align 4
|
align 4
|
||||||
.check_mbi:
|
.check_mbi:
|
||||||
cmp eax, 0x2BADB002
|
cmp eax, 0x2BADB002
|
||||||
mov ecx, sz_invboot
|
mov esi, sz_invboot
|
||||||
jne .fault
|
jne .panic
|
||||||
|
|
||||||
bt dword [ebx], 3
|
bt dword [ebx], 3
|
||||||
mov ecx, sz_nomods
|
mov esi, sz_nomods
|
||||||
jnc .fault
|
jnc .panic
|
||||||
|
|
||||||
mov edx, [ebx+20] ;mods_count
|
mov edx, [ebx+20] ;mods_count
|
||||||
mov esi, [ebx+24] ;mods_addr
|
mov edi, [ebx+24] ;mods_addr
|
||||||
cmp edx, 1
|
cmp edx, 1
|
||||||
jne .fault
|
mov esi, sz_nomods
|
||||||
|
jne .panic
|
||||||
|
|
||||||
.scan_mod:
|
.scan_mod:
|
||||||
mov ebp, [esi] ;image start
|
mov ebp, [edi] ;image start
|
||||||
mov ecx, [esi+4] ;image end
|
mov ecx, [edi+4] ;image end
|
||||||
sub ecx, ebp ;image size
|
sub ecx, ebp ;image size
|
||||||
cmp ecx, 512*18*80*2 ;1.44 floppy
|
cmp ecx, 512*18*80*2 ;1.44 floppy
|
||||||
jne .fault
|
mov esi, sz_image
|
||||||
|
jne .panic
|
||||||
|
|
||||||
mov [_image_start], ebp
|
mov [_image_start], ebp
|
||||||
mov [_image_size], ecx
|
mov [_image_size], ecx
|
||||||
@ -133,8 +135,8 @@ align 4
|
|||||||
cmp esi, eax ; end of directory
|
cmp esi, eax ; end of directory
|
||||||
jb .loop_find_dir_entry
|
jb .loop_find_dir_entry
|
||||||
|
|
||||||
mov ecx, sz_kernel
|
mov esi, sz_kernel
|
||||||
jmp .fault
|
jmp .panic
|
||||||
|
|
||||||
; === KERNEL FOUND. LOADING... ===
|
; === KERNEL FOUND. LOADING... ===
|
||||||
|
|
||||||
@ -218,10 +220,28 @@ align 4
|
|||||||
lgdt [.tmp_gdt]
|
lgdt [.tmp_gdt]
|
||||||
jmp far 0x08:.mode_16 and 0xFFFF
|
jmp far 0x08:.mode_16 and 0xFFFF
|
||||||
|
|
||||||
.fault:
|
.panic:
|
||||||
; push ecx
|
mov ebx, sz_halt
|
||||||
; call _lcls
|
mov edx, 0xb8000+160*10+2
|
||||||
; call __bprintf
|
mov ah, 0x07
|
||||||
|
.line:
|
||||||
|
mov edi, edx
|
||||||
|
.print:
|
||||||
|
lodsb
|
||||||
|
test al, al
|
||||||
|
jz .print_next
|
||||||
|
stosw
|
||||||
|
jmp .print
|
||||||
|
|
||||||
|
.print_next:
|
||||||
|
test ebx, ebx
|
||||||
|
jz ._hlt
|
||||||
|
|
||||||
|
mov esi, ebx
|
||||||
|
xor ebx, ebx
|
||||||
|
add edx, 160
|
||||||
|
jmp .line
|
||||||
|
|
||||||
._hlt:
|
._hlt:
|
||||||
hlt
|
hlt
|
||||||
jmp ._hlt
|
jmp ._hlt
|
||||||
@ -253,14 +273,14 @@ use16
|
|||||||
mov fs, ax
|
mov fs, ax
|
||||||
jmp far 0x1000:0000
|
jmp far 0x1000:0000
|
||||||
|
|
||||||
sz_invboot db 'Invalid multiboot loader magic value',cr,lf
|
|
||||||
db 'Halted',0
|
|
||||||
|
|
||||||
sz_nomods db 'No modules loaded',cr,lf
|
sz_invboot db 'Invalid multiboot loader magic value',0
|
||||||
db 'Halted',0
|
sz_nomods db 'No image loaded',0
|
||||||
|
sz_image db 'Image size invalid',0
|
||||||
|
sz_halt db 'Halted',0
|
||||||
|
|
||||||
sz_kernel db cr,lf
|
sz_kernel db cr
|
||||||
kernel_name db 'KERNEL MNT ?',cr,lf,0
|
kernel_name db 'KERNEL MNT ?',0
|
||||||
|
|
||||||
org $+0x80000
|
org $+0x80000
|
||||||
__edata:
|
__edata:
|
||||||
|
Loading…
Reference in New Issue
Block a user