Bootloader: Clear screen, better memcpy

Clear screen before jumping to kernel. Memcpy now uses ebx as offset
register, so only one register has to updated every loop
This commit is contained in:
Bananymous 2023-11-17 20:31:42 +02:00
parent 41065d2f9a
commit 5f4d81a502
3 changed files with 18 additions and 11 deletions

View File

@ -82,15 +82,20 @@ stage2_main:
call elf_read_kernel_to_memory
cli
# re-enter 80x25 text mode to clear screen
pushw %ax
movb $0x03, %al
movb $0x00, %ah
int $0x10
popw %ax
cli
# setup protected mode
movl %cr0, %ebx
orb $1, %bl
movl %ebx, %cr0
# jump to kernel in protected mode
ljmpl $0x18, $protected_mode

View File

@ -170,7 +170,7 @@ elf_read_kernel_to_memory:
andl $0x7FFFFFFF, %edi
movl (elf_program_header + p_filesz), %ecx
call print_hex32; call print_newline
#call print_hex32; call print_newline
call *%esi

View File

@ -409,13 +409,14 @@ ext2_inode_read_bytes:
addl %edx, %esi
# very dumb memcpy with 32 bit addresses
movl $0, %ebx
.ext2_inode_read_bytes_memcpy_partial:
movb (%esi), %al
movb %al, (%edi)
incl %esi
incl %edi
movb (%esi, %ebx), %al
movb %al, (%edi, %ebx)
incl %ebx
decl %ecx
jnz .ext2_inode_read_bytes_memcpy_partial
addl %ebx, %edi
# check if all sectors are read
cmpl $0, 4(%esp)
@ -441,13 +442,14 @@ ext2_inode_read_bytes:
# very dumb memcpy with 32 bit addresses
movl $ext2_block_buffer, %esi
movl $0, %ebx
.ext2_inode_read_bytes_memcpy:
movb (%esi), %al
movb %al, (%edi)
incl %esi
incl %edi
movb (%esi, %ebx), %al
movb %al, (%edi, %ebx)
incl %ebx
decl %ecx
jnz .ext2_inode_read_bytes_memcpy
addl %ebx, %edi
# read next block if more sectors remaining
cmpl $0, 4(%esp)