From d1444761a3c1fbecdc4f5f739226da6137033738 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Fri, 17 Nov 2023 20:31:42 +0200 Subject: [PATCH] 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 --- bootloader/boot.S | 9 +++++++-- bootloader/elf.S | 2 +- bootloader/ext2.S | 18 ++++++++++-------- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/bootloader/boot.S b/bootloader/boot.S index 4e12bbde0d..e5ae1f1818 100644 --- a/bootloader/boot.S +++ b/bootloader/boot.S @@ -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 diff --git a/bootloader/elf.S b/bootloader/elf.S index 059c458117..14d9ea4c92 100644 --- a/bootloader/elf.S +++ b/bootloader/elf.S @@ -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 diff --git a/bootloader/ext2.S b/bootloader/ext2.S index 6937f2666e..c42e587d99 100644 --- a/bootloader/ext2.S +++ b/bootloader/ext2.S @@ -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)