Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x68k/stand Change primary bootloader's load address...



details:   https://anonhg.NetBSD.org/src/rev/58c58d9c5084
branches:  trunk
changeset: 467240:58c58d9c5084
user:      isaki <isaki%NetBSD.org@localhost>
date:      Sat Jan 18 06:34:29 2020 +0000

description:
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.

diffstat:

 sys/arch/x68k/stand/boot_ufs/Makefile      |   5 +--
 sys/arch/x68k/stand/boot_ufs/boot.S        |  32 ++++++++++++++---------------
 sys/arch/x68k/stand/boot_ustar/Makefile    |   3 +-
 sys/arch/x68k/stand/xxboot/Makefile.xxboot |   8 +++---
 sys/arch/x68k/stand/xxboot/boot.S          |  32 ++++++++++++++---------------
 5 files changed, 37 insertions(+), 43 deletions(-)

diffs (250 lines):

diff -r 7c1b6b0591a0 -r 58c58d9c5084 sys/arch/x68k/stand/boot_ufs/Makefile
--- a/sys/arch/x68k/stand/boot_ufs/Makefile     Sat Jan 18 06:03:02 2020 +0000
+++ b/sys/arch/x68k/stand/boot_ufs/Makefile     Sat Jan 18 06:34:29 2020 +0000
@@ -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 @@
 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 @@
 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"
diff -r 7c1b6b0591a0 -r 58c58d9c5084 sys/arch/x68k/stand/boot_ufs/boot.S
--- a/sys/arch/x68k/stand/boot_ufs/boot.S       Sat Jan 18 06:03:02 2020 +0000
+++ b/sys/arch/x68k/stand/boot_ufs/boot.S       Sat Jan 18 06:34:29 2020 +0000
@@ -2,14 +2,14 @@
 | author: chapuni(webmaster%chapuni.com@localhost)
 |         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 @@
 | 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 @@
 
                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 @@
                | 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))
 
diff -r 7c1b6b0591a0 -r 58c58d9c5084 sys/arch/x68k/stand/boot_ustar/Makefile
--- a/sys/arch/x68k/stand/boot_ustar/Makefile   Sat Jan 18 06:03:02 2020 +0000
+++ b/sys/arch/x68k/stand/boot_ustar/Makefile   Sat Jan 18 06:34:29 2020 +0000
@@ -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+=   -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"
diff -r 7c1b6b0591a0 -r 58c58d9c5084 sys/arch/x68k/stand/xxboot/Makefile.xxboot
--- a/sys/arch/x68k/stand/xxboot/Makefile.xxboot        Sat Jan 18 06:03:02 2020 +0000
+++ b/sys/arch/x68k/stand/xxboot/Makefile.xxboot        Sat Jan 18 06:34:29 2020 +0000
@@ -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 @@
 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 @@
 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
diff -r 7c1b6b0591a0 -r 58c58d9c5084 sys/arch/x68k/stand/xxboot/boot.S
--- a/sys/arch/x68k/stand/xxboot/boot.S Sat Jan 18 06:03:02 2020 +0000
+++ b/sys/arch/x68k/stand/xxboot/boot.S Sat Jan 18 06:34:29 2020 +0000
@@ -2,14 +2,14 @@
 | author: chapuni(webmaster%chapuni.com@localhost)
 |         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 @@
 | 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 @@
 
                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 @@
                | 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))
 



Home | Main Index | Thread Index | Old Index