mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 11:07:45 +00:00
Kernel: Print CPU check errors by writing to VRAM
This commit is contained in:
parent
c488f5a59d
commit
52621093c7
1 changed files with 22 additions and 19 deletions
|
@ -120,28 +120,31 @@ print_and_halt:
|
||||||
.equ REAL_MODE_CODE, 0x500
|
.equ REAL_MODE_CODE, 0x500
|
||||||
.equ PROTECTED_MODE_16_BIT_CODE, 0x600
|
.equ PROTECTED_MODE_16_BIT_CODE, 0x600
|
||||||
movl %esp, %ebp
|
movl %esp, %ebp
|
||||||
movl 4(%ebp), %edi
|
movl 4(%ebp), %esi
|
||||||
|
|
||||||
/* Copy string to low memory section */
|
mov $0xb8000, %ecx /* VRAM address. */
|
||||||
movl %edi, %esi
|
mov $0x07, %ah /* grey-on-black text. */
|
||||||
xor %ecx, %ecx
|
|
||||||
|
|
||||||
pushl %eax
|
.print_str_loop:
|
||||||
pushl %edi
|
lodsb /* Loads a byte from address at %esi into %al and increments %esi. */
|
||||||
check_string_length:
|
|
||||||
movb (%edi), %ah
|
|
||||||
cmp $0, %ah
|
|
||||||
je check_string_length_exit
|
|
||||||
inc %ecx
|
|
||||||
inc %edi
|
|
||||||
jmp check_string_length
|
|
||||||
check_string_length_exit:
|
|
||||||
popl %edi
|
|
||||||
popl %eax
|
|
||||||
|
|
||||||
/* source address of the code is ESI */
|
test %al, %al
|
||||||
movw %cx, (COPIED_STRING_LOCATION)
|
jz .print_str_end
|
||||||
mov $COPIED_STRING_LOCATION + 2, %edi /* destination address of the code */
|
|
||||||
|
movw %ax, (%ecx)
|
||||||
|
add $2, %ecx
|
||||||
|
|
||||||
|
jmp .print_str_loop
|
||||||
|
.print_str_end:
|
||||||
|
|
||||||
|
/* Calculate string length into %ecx */
|
||||||
|
mov %esi, %ecx
|
||||||
|
sub 4(%ebp), %ecx
|
||||||
|
movw %cx, (COPIED_STRING_LOCATION) /* Store string length for later use. */
|
||||||
|
|
||||||
|
/* Copy string into lower memory */
|
||||||
|
mov 4(%ebp), %esi
|
||||||
|
mov $COPIED_STRING_LOCATION + 2, %edi
|
||||||
rep movsb
|
rep movsb
|
||||||
|
|
||||||
/* Copy gdt_table_real_mode to low memory section */
|
/* Copy gdt_table_real_mode to low memory section */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue