For some reason here I’m very confused why its jumping to putsc16 after returning from puts32_done? I Tried investigating this heavily but so far no bite, would appreciate some guidance. All code is here: https://github.com/amanuel2/boot_temp
These are the relevant parts:
Link
Code:
movl %cr0, %eax
orl $1, %eax
movl %eax, %cr0 # (we are now in protected mode)
# Far jump to stage2
ljmpl $CODE_SEG32, $pmode_entry
.code32
.align 4
pmode_entry:
cli # Make sure to disable interupts before protected mode or triple fault
movw $DATA_SEG32, %ax
movw %ax, %ds
movw %ax, %es
movw %ax, %fs
movw %ax, %gs
movw %ax, %ss
# Set up a stack (make sure this area is writable)
# Debug: Write directly to video memory
movl $0x0f, %eax # 'PP' in white on black
movl $0xb8000, %edi
movl %eax, (%edi)
Link
Code:
puts32:
pushl %ebp
movl %esp, %ebp
pushl %ebx
movl 8(%ebp), %ebx # Get string address from stack
movl $0xb8000, %edx # Video memory address
movb $0x0f, %ah # White on black attribute
puts32_loop:
movb (%ebx), %al
testb %al, %al
jz puts32_done
movw %ax, (%edx)
addl $1, %ebx
addl $2, %edx
jmp puts32_loop
puts32_done:
popl %ebx
leave
ret