aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2011-04-05 14:07:32 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2011-04-05 14:07:32 -0700
commitb5f98decd092f6358043ff57e18383268b12c1f9 (patch)
tree0a2cb6578ca72c757d06d2926e7f99fb91b0ac0a /core
parent993ffbac4aa266d83602f736a51450345ef92314 (diff)
downloadsyslinux-b5f98decd092f6358043ff57e18383268b12c1f9.tar.gz
syslinux-b5f98decd092f6358043ff57e18383268b12c1f9.tar.xz
syslinux-b5f98decd092f6358043ff57e18383268b12c1f9.zip
core: Move sector 1 to address 0x8000 so it is aligned
Move sector 1 to 0x8000, so that it will be sector-aligned no matter what the sector size is (well, as long as it is <= 32K). This avoids potential conflicts between the 64K "seams" and the sector size. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'core')
-rw-r--r--core/Makefile2
-rw-r--r--core/diskboot.inc2
-rw-r--r--core/diskstart.inc14
3 files changed, 13 insertions, 5 deletions
diff --git a/core/Makefile b/core/Makefile
index 33ad7e95..e89c419a 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -109,7 +109,7 @@ ldlinux.bss: ldlinux.bin
dd if=$< of=$@ bs=512 count=1
ldlinux.sys: ldlinux.bin
- dd if=$< of=$@ bs=512 skip=1
+ dd if=$< of=$@ bs=512 skip=2
codepage.cp: ../codepage/$(CODEPAGE).cp
cp -f $< $@
diff --git a/core/diskboot.inc b/core/diskboot.inc
index 68672e4a..141986e8 100644
--- a/core/diskboot.inc
+++ b/core/diskboot.inc
@@ -278,7 +278,7 @@ Sect1Ptr1 equ $-4
cmp dword [ldlinux_magic+4],LDLINUX_MAGIC^HEXDATE
jne kaboom
- ; Go for it! This also normalizes CS:IP.
+ ; Go for it!
jmp ldlinux_ent
;
diff --git a/core/diskstart.inc b/core/diskstart.inc
index 71cdaee5..01248534 100644
--- a/core/diskstart.inc
+++ b/core/diskstart.inc
@@ -23,6 +23,14 @@ Sect1Ptr1_VAL equ 0xfeedface
%include "diskboot.inc"
; ===========================================================================
+; Padding after the (minimum) 512-byte boot sector so that the rest of
+; the file has aligned sectors, even if they are larger than 512 bytes.
+; ===========================================================================
+
+ section .init
+align_pad zb 512
+
+; ===========================================================================
; Start of LDLINUX.SYS
; ===========================================================================
@@ -424,10 +432,10 @@ safedumpregs:
rl_checkpt equ $ ; Must be <= 8000h
-rl_checkpt_off equ ($-$$)
+rl_checkpt_off equ $-ldlinux_sys
%ifndef DEPEND
- %if rl_checkpt_off > 3F6h ; Need one extent
- %assign rl_checkpt_overflow rl_checkpt_off - 3F6h
+ %if rl_checkpt_off > 512-10 ; Need minimum one extent
+ %assign rl_checkpt_overflow rl_checkpt_off - (512-10)
%error Sector 1 overflow by rl_checkpt_overflow bytes
%endif
%endif