aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2012-02-06 12:12:26 -0800
committerH. Peter Anvin <hpa@zytor.com>2012-02-06 12:12:26 -0800
commit5780e22f62b5700d3f0b1715148aa791ba364469 (patch)
tree0927393e6c16263cd89cc889a6672fde11c9c9a1
parent3b92a929326bb6bf28886892f5994a310a8b2f94 (diff)
downloadsyslinux-5780e22f62b5700d3f0b1715148aa791ba364469.tar.gz
syslinux-5780e22f62b5700d3f0b1715148aa791ba364469.tar.xz
syslinux-5780e22f62b5700d3f0b1715148aa791ba364469.zip
bootsect.inc: try to catch obvious .0 problems
A typical Linux kernel will be way, way too big for the low memory bootstrap area, so throw an error message if we end up in the bootstrap path with something that cannot possibly fit below 640K. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--core/bootsect.inc16
1 files changed, 15 insertions, 1 deletions
diff --git a/core/bootsect.inc b/core/bootsect.inc
index 6c204096..9e47e1a5 100644
--- a/core/bootsect.inc
+++ b/core/bootsect.inc
@@ -1,7 +1,7 @@
;; -----------------------------------------------------------------------
;;
;; Copyright 1994-2009 H. Peter Anvin - All Rights Reserved
-;; Copyright 2009 Intel Corporation; author: H. Peter Anvin
+;; Copyright 2009-2012 Intel Corporation; author: H. Peter Anvin
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
@@ -38,6 +38,7 @@ SuperSize equ $+1
load_bootsec:
mov edi,free_high_memory
mov [trackbuf+4],edi ; Copy from this address
+ mov eax,0xA0000 ; Maximum load
xor dx,dx ; No padding
mov bx,abort_check ; Don't print dots, but allow abort
call load_high
@@ -45,6 +46,9 @@ load_bootsec:
sub edi,free_high_memory
mov [trackbuf+8],edi ; Save length
+ cmp edi,0xA0000-7C00h
+ ja bs_too_big
+
mov eax,7C00h ; Entry point
mov [trackbuf],eax ; Copy to this address
@@ -237,3 +241,13 @@ replace_stub:
.csip equ $-4
section .text16
+bs_too_big:
+ call close
+ mov si,err_bs_too_big
+ jmp abort_load
+
+ section .data16
+err_bs_too_big db "Too large for a bootstrap (need LINUX instead of KERNEL?)"
+ db CR, LF, 0
+
+ section .text16