diff --git a/lboot.S b/lboot.S index 5bc8a75..0b734b0 100644 --- a/lboot.S +++ b/lboot.S @@ -22,6 +22,7 @@ .code16 .set PACKET_SIZE, 512 + .set TX_BUF_SIZE, 4096 .macro pxe_call, opcode push %eax @@ -38,7 +39,8 @@ lcall *pxe_api add $6, %sp - or %ss:(%bx), %ax + mov %ss:(%bx), %cx + or %cx, %ax jnz _pcerr pop %edx @@ -76,6 +78,18 @@ _start: cli call print call enable_a20 + .set PXE_GET_CACHED_INFO, 0x0071 + push $0 + push %cs + push $tx_buf + push $TX_BUF_SIZE + push $2 + push $0 + pxe_call PXE_GET_CACHED_INFO + add $12, %sp + mov tx_buf+20, %eax + mov %eax, server_ip + mov $msg_unreal, %si call print call unreal @@ -92,18 +106,6 @@ _start: cli call print call paging - .set PXE_GET_CACHED_INFO, 0x0071 - push $0 - push %cs - push $tx_buf - push $PACKET_SIZE - push $2 - push $0 - pxe_call PXE_GET_CACHED_INFO - add $12, %sp - mov tx_buf+20, %eax - mov %eax, server_ip - mov $msg_read, %si call print mov $fn_initrd, %esi @@ -432,8 +434,33 @@ long: hang: hlt jmp hang -_pcerr: mov $msg_pcerr, %si +_pcerr: push %cx + + mov $msg_pcerr, %si call print + + pop %cx + push %cx + + xor %bx, %bx + mov %ch, %bl + mov hex_digits(%bx), %bl + mov %bx, tx_buf + mov $tx_buf, %si + call print + + pop %cx + push %cx + + xor %bx, %bx + mov %cl, %bl + mov hex_digits(%bx), %bl + mov %bx, tx_buf + mov $tx_buf, %si + call print + + pop %cx + jmp hang // gdt16: Protected mode / Unreal mode 16-bit GDT @@ -513,7 +540,7 @@ pml4_ptr: .long 0 // Points to the end of the memory map memmap_end: .short 0 -tx_buf: .space PACKET_SIZE +tx_buf: .space TX_BUF_SIZE .code64 // trampo64: Trampoline function to load long-mode segments @@ -579,6 +606,8 @@ type_table: .byte 0 // - Sanitizing the memmap // - Parsing a config file +hex_digits: .ascii "0123456789ABCDEF" + .section .data.bootboot bootboot: .ascii "BOOT" bb_size: .long 128