Module Name: src
Committed By: isaki
Date: Sat Jan 18 06:34:30 UTC 2020
Modified Files:
src/sys/arch/x68k/stand/boot_ufs: Makefile boot.S
src/sys/arch/x68k/stand/boot_ustar: Makefile
src/sys/arch/x68k/stand/xxboot: Makefile.xxboot boot.S
Log Message:
Change primary bootloader's load address from 0x0f0000 to 0x003000.
- Moving addresses closer eliminates bunch of this linker errors:
in function `entry0':
relocation truncated to fit: R_68K_16 against `edata'+ffffffffffff8000
:
- By this change, harmful -noinhibit-exec option can also be removed.
Finally, we can break the builds when assemble error occurs!
- Load address of secondary is 0x6000, so that this change limits
text+data+bss 12KB or less. Current actual size is 5~7KB.
I think it should be fine.
- cd9660 can have up to 30KB text+data in its bootarea. Even in this
case, this change limits text+data+bss 12KB or less (currently, it's
about 6KB). However, I take breaking the builds on errors rather than
future size limitation.
There is no user visible changes or interface changes.
To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/x68k/stand/boot_ufs/Makefile
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/x68k/stand/boot_ufs/boot.S
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/x68k/stand/boot_ustar/Makefile
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/x68k/stand/xxboot/Makefile.xxboot \
src/sys/arch/x68k/stand/xxboot/boot.S
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/x68k/stand/boot_ufs/Makefile
diff -u src/sys/arch/x68k/stand/boot_ufs/Makefile:1.33 src/sys/arch/x68k/stand/boot_ufs/Makefile:1.34
--- src/sys/arch/x68k/stand/boot_ufs/Makefile:1.33 Sat Jan 18 05:46:26 2020
+++ src/sys/arch/x68k/stand/boot_ufs/Makefile Sat Jan 18 06:34:29 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.33 2020/01/18 05:46:26 isaki Exp $
+# $NetBSD: Makefile,v 1.34 2020/01/18 06:34:29 isaki Exp $
NOMAN= # defined
@@ -11,7 +11,7 @@ VERSION!= ${TOOL_AWK} -F: '$$1 ~ /^[0-9.
NEWVERSWHAT= "${BOOT}"
# text and bss addresses
-TEXT= 0x0f0000 # Primary (me)
+TEXT= 0x003000 # Primary (me)
BOOT_TEXT= 0x006000 # Secondary (/boot)
PROG= xx$(BOOT)
@@ -44,7 +44,6 @@ CPPFLAGS+= -I${COMMONDIR} -I${LIBIOCS} -
AFLAGS= ${CFLAGS:M-[ID]*}
LINKFLAGS= -n -Bstatic -T ${.CURDIR}/${BOOT}.ldscript -M
LINKFLAGS+= --defsym=TEXTADDR=$(TEXT)
-LINKFLAGS+= -noinhibit-exec # XXX
.include "${.CURDIR}/../Makefile.booters"
.include "${S}/../common/lib/libc/Makefile.inc"
Index: src/sys/arch/x68k/stand/boot_ufs/boot.S
diff -u src/sys/arch/x68k/stand/boot_ufs/boot.S:1.16 src/sys/arch/x68k/stand/boot_ufs/boot.S:1.17
--- src/sys/arch/x68k/stand/boot_ufs/boot.S:1.16 Sat Jan 18 05:56:51 2020
+++ src/sys/arch/x68k/stand/boot_ufs/boot.S Sat Jan 18 06:34:29 2020
@@ -2,14 +2,14 @@
| author: chapuni([email protected])
| ITOH Yasufumi
|
-| $NetBSD: boot.S,v 1.16 2020/01/18 05:56:51 isaki Exp $
+| $NetBSD: boot.S,v 1.17 2020/01/18 06:34:29 isaki Exp $
|
| (1) IPL (or previous stage loader) loads first 1KB of this primary
| bootloader to (*). (*) is 0x2000 (from FD) or 0x2400 (from SASI/SCSI).
|
| (2) The first 1KB loads full primary bootloader (including first 1KB) from
-| the boot partition to 0xf0000. And jump to there.
+| the boot partition to 0x3000. And jump to there.
|
| (3) The full primary bootloader loads the secondary bootloader known as
| /boot from its filesystem to 0x6000. And jump to there.
@@ -24,26 +24,24 @@
| | first 1KB | | first 1KB | | first 1KB |
| +------------+ +------------+ +------------+ (*)+0x400
| : : : : : :
+| : : +------------+ +------------+ 0x003000
+| : : |full primary| |full primary|
+| : : |boot loader | |boot loader |
+| : : +------------+ +------------+
+| : : : : : :
| : : : : +------------+ 0x006000
| : : : : | /boot |
| : : : : +------------+
| : : : : : :
| ~ ~ ~ ~ ~ ~
| : : : :<-SP : :<-SP
-| : : +------------+ +------------+ 0x0f0000
-| : : |full primary| |full primary|
-| : : |boot loader | |boot loader |
-| : : +------------+ +------------+
+| + - - - - - -+ + - - - - - -+ + - - - - - -+ 0x100000
| : : : : : :
|
#include <machine/asm.h>
#include "iocscall.h"
-#define BASEOFF 0x8000
-#define BASEPTR_A (TEXTADDR+BASEOFF)
-#define BASEPTR_R %pc@(top+BASEOFF:W)
-
#define SRAM 0x00ED0000 /* SRAM stat addr */
#define SRAM_MEMSZ (SRAM + 8) /* (L) size of main memory */
#define MINMEM 0x00400000 /* at least 4MB required */
@@ -64,8 +62,8 @@ ASENTRY_NOPROFILE(top)
| d4 �ˤϤ��Ǥ� SCSI ID �����äƤ���
ASENTRY_NOPROFILE(entry0)
moveml %d0-%d7/%a0-%a7,_C_LABEL(startregs)
- lea BASEPTR_A:l,%a5 | set base ptr
-#define _RELOC(adr) %a5@(((adr)-(BASEPTR_A&0xffff)):W)
+ lea TEXTADDR:W,%a5 | set base ptr
+#define _RELOC(adr) %a5@(((adr)-top):W)
#define ASRELOC(var) _RELOC(_ASM_LABEL(var))
#define RELOC(var) _RELOC(_C_LABEL(var))
@@ -89,9 +87,9 @@ clrbss: clrb %a1@+
movel %d4,RELOC(ID) | SCSI ID (if booted from SCSI)
- | set system stack
- lea ASRELOC(top),%a1 | set stack pointer to 0x000F0000
- lea %a1@,%sp | a1 will be used later for IOCS calls
+ lea 0x00100000,%sp | set system stack
+ lea %a5@,%a1 | set load address
+ | a1 will be used later for IOCS calls
| we use 68020 instructions, and check MPU beforehand
|
@@ -383,8 +381,8 @@ raw_read1:
| d3.l: length in bytes
| a1 (=d1): buffer address
- lea BASEPTR_R,%a5 | set base ptr
-#define _RELOC(adr) %a5@(((adr)-(BASEPTR_A&0xffff)):W)
+ lea TEXTADDR:W,%a5 | set base ptr
+#define _RELOC(adr) %a5@(((adr)-top):W)
#define ASRELOC(var) _RELOC(_ASM_LABEL(var))
#define RELOC(var) _RELOC(_C_LABEL(var))
Index: src/sys/arch/x68k/stand/boot_ustar/Makefile
diff -u src/sys/arch/x68k/stand/boot_ustar/Makefile:1.27 src/sys/arch/x68k/stand/boot_ustar/Makefile:1.28
--- src/sys/arch/x68k/stand/boot_ustar/Makefile:1.27 Sat Jan 18 05:46:26 2020
+++ src/sys/arch/x68k/stand/boot_ustar/Makefile Sat Jan 18 06:34:30 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.27 2020/01/18 05:46:26 isaki Exp $
+# $NetBSD: Makefile,v 1.28 2020/01/18 06:34:30 isaki Exp $
NOMAN= # defined
@@ -39,7 +39,6 @@ AFLAGS= ${CFLAGS:M-[ID]*}
AFLAGS+= -Wa,-march=m68000 -Wa,-mcpu=m68000
LINKFLAGS= -n -Bstatic -T ${.CURDIR}/${BOOT}.ldscript -M
LINKFLAGS+= --defsym=TEXTADDR=$(TEXT)
-LINKFLAGS+= -noinhibit-exec # XXX
.include "${.CURDIR}/../Makefile.booters"
.include "${S}/../common/lib/libc/Makefile.inc"
Index: src/sys/arch/x68k/stand/xxboot/Makefile.xxboot
diff -u src/sys/arch/x68k/stand/xxboot/Makefile.xxboot:1.8 src/sys/arch/x68k/stand/xxboot/Makefile.xxboot:1.9
--- src/sys/arch/x68k/stand/xxboot/Makefile.xxboot:1.8 Sat Jan 18 05:46:26 2020
+++ src/sys/arch/x68k/stand/xxboot/Makefile.xxboot Sat Jan 18 06:34:30 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.xxboot,v 1.8 2020/01/18 05:46:26 isaki Exp $
+# $NetBSD: Makefile.xxboot,v 1.9 2020/01/18 06:34:30 isaki Exp $
NOMAN= # defined
@@ -11,9 +11,10 @@ VERSION!= ${TOOL_AWK} -F: '$$1 ~ /^[0-9.
NEWVERSWHAT= "${BOOT}"
# text and bss addresses
-TEXT= 0x0f0000 # Primary (me)
+TEXT= 0x003000 # Primary (me)
TEXTDATASIZE= 0x002000 # 8KB for UFS at maximum
- # 30KB (=(16-1)*2048) for ISO9660 at max.
+ # 30KB (=(16-1)*2048) for ISO9660 at max.
+ # but should use up to 8KB. See boot.S
BOOT_TEXT= 0x006000 # Secondary (/boot)
PROG= $(BOOT)
@@ -41,7 +42,6 @@ AFLAGS= ${CFLAGS:M-[ID]*}
LINKFLAGS= -n -Bstatic -T ${.CURDIR}/../xxboot.ldscript -M
LINKFLAGS+= --defsym=TEXTADDR=$(TEXT)
LINKFLAGS+= --defsym=TEXTDATASIZE=$(TEXTDATASIZE)
-LINKFLAGS+= -noinhibit-exec # XXX
LIBIOCS!= cd $M/stand/libiocs && ${PRINTOBJDIR}
LIBSA!= cd $M/stand/libsa && ${PRINTOBJDIR}
LDLIBS= -L${LIBSA}/lib/sa -lsa -L ${LIBSA}/lib/kern -lkern
Index: src/sys/arch/x68k/stand/xxboot/boot.S
diff -u src/sys/arch/x68k/stand/xxboot/boot.S:1.8 src/sys/arch/x68k/stand/xxboot/boot.S:1.9
--- src/sys/arch/x68k/stand/xxboot/boot.S:1.8 Sat Jan 18 05:56:51 2020
+++ src/sys/arch/x68k/stand/xxboot/boot.S Sat Jan 18 06:34:30 2020
@@ -2,14 +2,14 @@
| author: chapuni([email protected])
| ITOH Yasufumi
|
-| $NetBSD: boot.S,v 1.8 2020/01/18 05:56:51 isaki Exp $
+| $NetBSD: boot.S,v 1.9 2020/01/18 06:34:30 isaki Exp $
|
| (1) IPL (or previous stage loader) loads first 1KB of this primary
| bootloader to (*). (*) is 0x2000 (from FD) or 0x2400 (from SASI/SCSI).
|
| (2) The first 1KB loads full primary bootloader (including first 1KB) from
-| the boot partition to 0xf0000. And jump to there.
+| the boot partition to 0x3000. And jump to there.
|
| (3) The full primary bootloader loads the secondary bootloader known as
| /boot from its filesystem to 0x6000. And jump to there.
@@ -24,16 +24,18 @@
| | first 1KB | | first 1KB | | first 1KB |
| +------------+ +------------+ +------------+ (*)+0x400
| : : : : : :
+| : : +------------+ +------------+ 0x003000
+| : : |full primary| |full primary|
+| : : |boot loader | |boot loader |
+| : : +------------+ +------------+
+| : : : : : :
| : : : : +------------+ 0x006000
| : : : : | /boot |
| : : : : +------------+
| : : : : : :
| ~ ~ ~ ~ ~ ~
| : : : :<-SP : :<-SP
-| : : +------------+ +------------+ 0x0f0000
-| : : |full primary| |full primary|
-| : : |boot loader | |boot loader |
-| : : +------------+ +------------+
+| + - - - - - -+ + - - - - - -+ + - - - - - -+ 0x100000
| : : : : : :
|
@@ -42,10 +44,6 @@
#define SCSI_ADHOC_BOOTPART
-#define BASEOFF 0x8000
-#define BASEPTR_A (TEXTADDR+BASEOFF)
-#define BASEPTR_R %pc@(top+BASEOFF:W)
-
#define SRAM 0x00ED0000 /* SRAM stat addr */
#define SRAM_MEMSZ (SRAM + 8) /* (L) size of main memory */
#define MINMEM 0x00400000 /* at least 4MB required */
@@ -66,8 +64,8 @@ ASENTRY_NOPROFILE(top)
| d4 �ˤϤ��Ǥ� SCSI ID �����äƤ���
ASENTRY_NOPROFILE(entry0)
moveml %d0-%d7/%a0-%a7,_C_LABEL(startregs)
- lea BASEPTR_A:l,%a5 | set base ptr
-#define _RELOC(adr) %a5@(((adr)-(BASEPTR_A&0xffff)):W)
+ lea TEXTADDR:W,%a5 | set base ptr
+#define _RELOC(adr) %a5@(((adr)-top):W)
#define ASRELOC(var) _RELOC(_ASM_LABEL(var))
#define RELOC(var) _RELOC(_C_LABEL(var))
@@ -91,9 +89,9 @@ clrbss: clrb %a1@+
movel %d4,RELOC(ID) | SCSI ID (if booted from SCSI)
- | set system stack
- lea ASRELOC(top),%a1 | set stack pointer to 0x000F0000
- lea %a1@,%sp | a1 will be used later for IOCS calls
+ lea 0x00100000,%sp | set system stack
+ lea %a5@,%a1 | set load address
+ | a1 will be used later for IOCS calls
| we use 68020 instructions, and check MPU beforehand
|
@@ -386,8 +384,8 @@ raw_read1:
| d3.l: length in bytes
| a1 (=d1): buffer address
- lea BASEPTR_R,%a5 | set base ptr
-#define _RELOC(adr) %a5@(((adr)-(BASEPTR_A&0xffff)):W)
+ lea TEXTADDR:W,%a5 | set base ptr
+#define _RELOC(adr) %a5@(((adr)-top):W)
#define ASRELOC(var) _RELOC(_ASM_LABEL(var))
#define RELOC(var) _RELOC(_C_LABEL(var))