than just pressing Enter.
* Fix bugs in the COMBOOT/COM32 command-line parsing. APPEND
now works with COMBOOT/COM32 images.
+ * PXELINUX: Poll for ARP requests while sitting at the
+ prompt. This makes some boot servers a lot less unhappy.
+ * PXELINUX: Actually free sockets when we get a failure
+ (including file not found.) This bug would cause us to run
+ out of sockets and thus "go deaf" after a while.
Changes in 2.07:
* MEMDISK: Workaround for BIOSes which go into a snit when
%assign USE_PXE_PROVIDED_STACK 1 ; Use stack provided by PXE?
;
+; This is what we need to do when idle
+;
+%macro DO_IDLE 0
+ call check_for_arp
+%endmacro
+
+;
; TFTP operation codes
;
TFTP_RRQ equ htons(1) ; Read request
mov [pxe_udp_read_pkt.status],byte 0
mov [pxe_udp_read_pkt.buffer],di
mov [pxe_udp_read_pkt.buffer+2],ds
- mov di,packet_buf_size
- mov [pxe_udp_read_pkt.buffersize],di
+ mov word [pxe_udp_read_pkt.buffersize],packet_buf_size
mov eax,[MyIP]
mov [pxe_udp_read_pkt.dip],eax
mov [pxe_udp_read_pkt.lport],bx
and eax,eax ; Set ZF depending on file size
pop bp ; Junk
pop bp ; Junk (retry counter)
+ jz .error_si ; ZF = 1 need to free the socket
pop bp
pop es
ret
call writestr
jmp kaboom
-.bailnow: add sp,byte 8 ; Immediate error - no retry
- jmp short .error
+.bailnow: mov word [bp-2],1 ; Immediate error - no retry
.failure: pop bx ; Junk
pop bx
dec ax ; Retry counter
jnz .sendreq ; Try again
-.error: xor si,si ; ZF <- 1
+.error: mov si,bx ; Socket pointer
+.error_si: ; Socket pointer already in SI
+ call free_socket ; ZF <- 1, SI <- 0
pop bp
pop es
ret
ret
;
+; Free socket: socket in SI; return SI = 0, ZF = 1 for convenience
+;
+free_socket:
+ push es
+ pusha
+ xor ax,ax
+ mov es,ax
+ mov di,si
+ mov cx,tftp_clear_words
+ rep stosw
+ popa
+ pop es
+ xor si,si
+ ret
+
+;
; strcpy: Copy DS:SI -> ES:DI up to and including a null byte
;
strcpy: push ax
; The socket is closed and the buffer drained
; Close socket structure and re-init for next user
- push es
- push ds
- pop es
- mov di,si
- ; ax = 0
- mov cx,tftp_clear_words
- rep stosw
- pop es
- xor si,si
+ call free_socket
stc
.bytes_left:
ret
popad
ret
+;
+; Call the receive loop while idle. This is done mostly so we can respond to
+; ARP messages, but perhaps in the future this can be used to do network
+; console.
+;
+check_for_arp:
+ pushad
+ push ds
+ push es
+ mov ax,cs
+ mov ds,ax
+ mov es,ax
+ mov di,packet_buf
+ mov [pxe_udp_read_pkt.status],al ; 0
+ mov [pxe_udp_read_pkt.buffer],di
+ mov [pxe_udp_read_pkt.buffer+2],ds
+ mov word [pxe_udp_read_pkt.buffersize],packet_buf_size
+ mov eax,[MyIP]
+ mov [pxe_udp_read_pkt.dip],eax
+ mov [pxe_udp_read_pkt.lport],ax ; 0
+ mov di,pxe_udp_read_pkt
+ mov bx,PXENV_UDP_READ
+ call pxenv
+ ; Ignore result...
+ pop es
+ pop ds
+ popad
+ ret
+
; -----------------------------------------------------------------------------
; Common modules
; -----------------------------------------------------------------------------