Trying to debug failing TFTP open
This commit is contained in:
parent
be2d14de91
commit
093969301e
1 changed files with 44 additions and 31 deletions
73
lboot.S
73
lboot.S
|
|
@ -89,6 +89,8 @@ _start: cli
|
||||||
add $12, %sp
|
add $12, %sp
|
||||||
mov tx_buf+20, %eax
|
mov tx_buf+20, %eax
|
||||||
mov %eax, server_ip
|
mov %eax, server_ip
|
||||||
|
mov tx_buf+24, %eax
|
||||||
|
mov %eax, gateway_ip
|
||||||
|
|
||||||
mov $msg_unreal, %si
|
mov $msg_unreal, %si
|
||||||
call print
|
call print
|
||||||
|
|
@ -323,6 +325,11 @@ tftp_open: push %ecx
|
||||||
push %bp
|
push %bp
|
||||||
mov %sp, %bp
|
mov %sp, %bp
|
||||||
|
|
||||||
|
mov %esi, %ebx
|
||||||
|
|
||||||
|
mov $msg_topen, %si
|
||||||
|
call print
|
||||||
|
|
||||||
push $PACKET_SIZE
|
push $PACKET_SIZE
|
||||||
push $69<<8
|
push $69<<8
|
||||||
mov $128, %ecx
|
mov $128, %ecx
|
||||||
|
|
@ -330,9 +337,18 @@ tftp_open: push %ecx
|
||||||
mov %ss, %edi
|
mov %ss, %edi
|
||||||
shl $4, %edi
|
shl $4, %edi
|
||||||
add %esp, %edi
|
add %esp, %edi
|
||||||
|
xor %ax, %ax
|
||||||
|
cld
|
||||||
|
addr32 rep stosb
|
||||||
|
mov %ebx, %esi
|
||||||
|
mov $6, %ecx
|
||||||
|
mov %ss, %edi
|
||||||
|
shl $4, %edi
|
||||||
|
add %esp, %edi
|
||||||
|
cld
|
||||||
addr32 rep movsb
|
addr32 rep movsb
|
||||||
push $0
|
push gateway_ip+2
|
||||||
push $0
|
push gateway_ip
|
||||||
push server_ip+2
|
push server_ip+2
|
||||||
push server_ip
|
push server_ip
|
||||||
push $0
|
push $0
|
||||||
|
|
@ -348,6 +364,9 @@ tftp_open: push %ecx
|
||||||
tftp_close: push %bp
|
tftp_close: push %bp
|
||||||
mov %sp, %bp
|
mov %sp, %bp
|
||||||
|
|
||||||
|
mov $msg_tclose, %si
|
||||||
|
call print
|
||||||
|
|
||||||
push $0
|
push $0
|
||||||
pxe_call PXE_TFTP_CLOSE
|
pxe_call PXE_TFTP_CLOSE
|
||||||
|
|
||||||
|
|
@ -359,6 +378,9 @@ tftp_read: push %ebx
|
||||||
push %bp
|
push %bp
|
||||||
mov %sp, %bp
|
mov %sp, %bp
|
||||||
|
|
||||||
|
mov $msg_tread, %si
|
||||||
|
call print
|
||||||
|
|
||||||
push %cs
|
push %cs
|
||||||
push $tx_buf
|
push $tx_buf
|
||||||
push $0
|
push $0
|
||||||
|
|
@ -377,7 +399,14 @@ out_of_mem: mov $msg_memerr, %si
|
||||||
jmp hang
|
jmp hang
|
||||||
|
|
||||||
// print: print NUL-terminated string pointed to by SI
|
// print: print NUL-terminated string pointed to by SI
|
||||||
print: xor %bx, %bx
|
print: push %eax
|
||||||
|
push %ebx
|
||||||
|
push %edx
|
||||||
|
push %esi
|
||||||
|
push %bp
|
||||||
|
mov %sp, %bp
|
||||||
|
|
||||||
|
xor %bx, %bx
|
||||||
|
|
||||||
_prnext: mov $COM1+5, %dx
|
_prnext: mov $COM1+5, %dx
|
||||||
inb %dx, %al
|
inb %dx, %al
|
||||||
|
|
@ -395,7 +424,12 @@ _prnext: mov $COM1+5, %dx
|
||||||
int $0x10
|
int $0x10
|
||||||
jmp _prnext
|
jmp _prnext
|
||||||
|
|
||||||
_prdone: ret
|
_prdone: leave
|
||||||
|
pop %esi
|
||||||
|
pop %edx
|
||||||
|
pop %ebx
|
||||||
|
pop %eax
|
||||||
|
ret
|
||||||
|
|
||||||
// long: Enter long mode
|
// long: Enter long mode
|
||||||
long:
|
long:
|
||||||
|
|
@ -434,33 +468,8 @@ long:
|
||||||
hang: hlt
|
hang: hlt
|
||||||
jmp hang
|
jmp hang
|
||||||
|
|
||||||
_pcerr: push %cx
|
_pcerr: mov $msg_pcerr, %si
|
||||||
|
|
||||||
mov $msg_pcerr, %si
|
|
||||||
call print
|
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
|
jmp hang
|
||||||
|
|
||||||
// gdt16: Protected mode / Unreal mode 16-bit GDT
|
// gdt16: Protected mode / Unreal mode 16-bit GDT
|
||||||
|
|
@ -522,11 +531,15 @@ msg_long: .asciz " * Long Mode\r\n"
|
||||||
msg_pserr: .asciz "panic: Missing !PXE structure.\r\n"
|
msg_pserr: .asciz "panic: Missing !PXE structure.\r\n"
|
||||||
msg_pcerr: .asciz "panic: PXE call failed.\r\n"
|
msg_pcerr: .asciz "panic: PXE call failed.\r\n"
|
||||||
msg_memerr: .asciz "panic: Out of heap space.\r\n"
|
msg_memerr: .asciz "panic: Out of heap space.\r\n"
|
||||||
|
msg_topen: .asciz "tftp_open\r\n"
|
||||||
|
msg_tclose: .asciz "tftp_close\r\n"
|
||||||
|
msg_tread: .asciz "tftp_read\r\n"
|
||||||
|
|
||||||
fn_initrd: .asciz "initrd"
|
fn_initrd: .asciz "initrd"
|
||||||
|
|
||||||
pxe_api: .long 0
|
pxe_api: .long 0
|
||||||
server_ip: .space 4
|
server_ip: .space 4
|
||||||
|
gateway_ip: .space 4
|
||||||
|
|
||||||
heap_ptr: .long 0
|
heap_ptr: .long 0
|
||||||
heap_end: .long 0
|
heap_end: .long 0
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue