summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhpa <hpa>2003-12-04 03:47:57 +0000
committerhpa <hpa>2003-12-04 03:47:57 +0000
commited542ba7c955a9b5dddd70d6627908e5efebdec2 (patch)
treedeb9dfead9be91240ec48a683a0f92d51bd0ea0d
parent36c88b5a0335d83dbe658d68866efbf2ccb5bf9c (diff)
downloadsyslinux-ed542ba7c955a9b5dddd70d6627908e5efebdec2.tar.gz
Rate-limit ARP calls to avoid screwing over people doing automaticsyslinux-2.08-pre7
control via the serial port.
-rw-r--r--conio.inc1
-rw-r--r--isolinux.asm3
-rw-r--r--ldlinux.asm3
-rw-r--r--pxelinux.asm27
-rw-r--r--ui.inc1
5 files changed, 34 insertions, 1 deletions
diff --git a/conio.inc b/conio.inc
index 58c7e3a4..535028b6 100644
--- a/conio.inc
+++ b/conio.inc
@@ -319,6 +319,7 @@ pollchar:
; getchar: Read a character from keyboard or serial port
;
getchar:
+ RESET_IDLE
.again:
DO_IDLE
mov ah,1 ; Poll keyboard
diff --git a/isolinux.asm b/isolinux.asm
index fd67d2e4..086bc5e7 100644
--- a/isolinux.asm
+++ b/isolinux.asm
@@ -43,6 +43,9 @@ SECTORSIZE equ (1 << SECTORSIZE_LG2)
;
; This is what we need to do when idle
;
+%macro RESET_IDLE 0
+ ; Nothing
+%endmacro
%macro DO_IDLE 0
; Nothing
%endmacro
diff --git a/ldlinux.asm b/ldlinux.asm
index 745aec2f..4a9d4755 100644
--- a/ldlinux.asm
+++ b/ldlinux.asm
@@ -48,6 +48,9 @@ retry_count equ 6 ; How patient are we with the disk?
;
; This is what we need to do when idle
;
+%macro RESET_IDLE 0
+ ; Nothing
+%endmacro
%macro DO_IDLE 0
; Nothing
%endmacro
diff --git a/pxelinux.asm b/pxelinux.asm
index 0822992e..8f628a2f 100644
--- a/pxelinux.asm
+++ b/pxelinux.asm
@@ -55,6 +55,9 @@ TFTP_BLOCKSIZE equ (1 << TFTP_BLOCKSIZE_LG2)
;
; This is what we need to do when idle
;
+%macro RESET_IDLE 0
+ call reset_idle
+%endmacro
%macro DO_IDLE 0
call check_for_arp
%endmacro
@@ -264,6 +267,7 @@ IPOptionLen resw 1 ; Length of IPOption
LocalBootType resw 1 ; Local boot return code
RealBaseMem resw 1 ; Amount of DOS memory after freeing
APIVer resw 1 ; PXE API version found
+IdleTimer resw 1 ; Time to check for ARP?
TextAttrBX equ $
TextAttribute resb 1 ; Text attribute for message file
TextPage resb 1 ; Active display page
@@ -2293,8 +2297,28 @@ genipopt:
; ARP messages, but perhaps in the future this can be used to do network
; console.
;
+; hpa sez: people using automatic control on the serial port get very
+; unhappy if we poll for ARP too often (the PXE stack is pretty slow,
+; typically.) Therefore, only poll if at least 4 BIOS timer ticks have
+; passed since the last poll, and reset this when a character is
+; received (RESET_IDLE).
+;
+reset_idle:
+ push ax
+ mov ax,[cs:BIOS_timer]
+ mov [cs:IdleTimer],ax
+ pop ax
+ ret
+
check_for_arp:
- pushad
+ push ax
+ mov ax,[cs:BIOS_timer]
+ sub ax,[cs:IdleTimer]
+ cmp ax,4
+ pop ax
+ jae .need_poll
+ ret
+.need_poll: pushad
push ds
push es
mov ax,cs
@@ -2315,6 +2339,7 @@ check_for_arp:
pop es
pop ds
popad
+ RESET_IDLE
ret
; -----------------------------------------------------------------------------
diff --git a/ui.inc b/ui.inc
index c11c088d..528d5637 100644
--- a/ui.inc
+++ b/ui.inc
@@ -44,6 +44,7 @@ clear_buffer: mov ah,1 ; Check for pending char
jmp short clear_buffer
get_char_time:
call vgashowcursor
+ RESET_IDLE
mov cx,[KbdTimeOut]
and cx,cx
jz get_char ; Timeout == 0 -> no timeout