Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/zaurus Kernel load address can be changed now.
details: https://anonhg.NetBSD.org/src/rev/b1812aa6bf67
branches: trunk
changeset: 772895:b1812aa6bf67
user: nonaka <nonaka%NetBSD.org@localhost>
date: Fri Jan 20 15:00:27 2012 +0000
description:
Kernel load address can be changed now.
diffstat:
sys/arch/zaurus/conf/Makefile.zaurus.inc | 20 ++++++--
sys/arch/zaurus/conf/ldscript | 79 --------------------------------
sys/arch/zaurus/conf/ldscript.zaurus | 79 ++++++++++++++++++++++++++++++++
sys/arch/zaurus/conf/std.zaurus | 5 +-
sys/arch/zaurus/zaurus/kloader_machdep.c | 22 ++++----
sys/arch/zaurus/zaurus/machdep.c | 15 +++--
6 files changed, 116 insertions(+), 104 deletions(-)
diffs (truncated from 358 to 300 lines):
diff -r 8856f9071b8a -r b1812aa6bf67 sys/arch/zaurus/conf/Makefile.zaurus.inc
--- a/sys/arch/zaurus/conf/Makefile.zaurus.inc Fri Jan 20 14:08:04 2012 +0000
+++ b/sys/arch/zaurus/conf/Makefile.zaurus.inc Fri Jan 20 15:00:27 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.zaurus.inc,v 1.3 2011/05/05 09:07:59 nonaka Exp $
+# $NetBSD: Makefile.zaurus.inc,v 1.4 2012/01/20 15:00:27 nonaka Exp $
MACHINE_ARCH= arm
CPPFLAGS+= -D${MACHINE}
@@ -6,10 +6,6 @@
SYSTEM_FIRST_OBJ= zaurus_start.o
SYSTEM_FIRST_SFILE= ${THISARM}/zaurus/zaurus_start.S
-LINKFLAGS= -T ${THISARM}/conf/ldscript
-
-EXTRA_CLEAN+= netbsd.map assym.d
-
SYSTEM_LD_TAIL_EXTRA+=; \
echo "Checking kernel size..."; \
size=`wc -c "$@" | ${TOOL_AWK} '{ print $$1 }'`; \
@@ -20,3 +16,17 @@
echo "Fatal: kernel size: $$size, max kernel size: $$maxsize"; \
false; \
fi
+
+KERNEL_BASE_VIRT= $(LOADADDRESS)
+
+LINKFLAGS= -T ldscript
+
+EXTRA_CLEAN+= netbsd.map assym.d ldscript tmp
+
+netbsd: ldscript # XXX
+
+# generate ldscript from common template
+ldscript: ${THISARM}/conf/ldscript.zaurus ${THISARM}/conf/Makefile.zaurus.inc Makefile
+ ${TOOL_SED} -e 's/@KERNEL_BASE_PHYS@/${KERNEL_BASE_PHYS}/' \
+ -e 's/@KERNEL_BASE_VIRT@/${KERNEL_BASE_VIRT}/' \
+ ${THISARM}/conf/ldscript.zaurus > tmp && mv tmp $@
diff -r 8856f9071b8a -r b1812aa6bf67 sys/arch/zaurus/conf/ldscript
--- a/sys/arch/zaurus/conf/ldscript Fri Jan 20 14:08:04 2012 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/* $NetBSD: ldscript,v 1.1 2006/12/17 16:07:11 peter Exp $ */
-
-OUTPUT_ARCH(arm)
-ENTRY(KERNEL_BASE_phys)
-SECTIONS
-{
- KERNEL_BASE_phys = 0xa0200000;
- KERNEL_BASE_virt = 0xc0200000;
-
- /* Kernel start: */
- .start (KERNEL_BASE_phys) :
- {
- *(.start)
- } =0
-
- /* Read-only sections, merged into text segment: */
- .text (KERNEL_BASE_virt + SIZEOF(.start)) :
- AT (LOADADDR(.start) + SIZEOF(.start))
- {
- *(.text)
- *(.text.*)
- *(.stub)
- *(.glue_7t) *(.glue_7)
- *(.rodata) *(.rodata.*)
- } =0
- PROVIDE (__etext = .);
- PROVIDE (_etext = .);
- PROVIDE (etext = .);
- /* Adjust the address for the data segment to start on the next page
- boundary. */
- . = ALIGN(0x8000);
- .data :
- AT (LOADADDR(.text) + (ADDR(.data) - ADDR(.text)))
- {
- __data_start = . ;
- *(.data)
- *(.data.*)
- }
- .sdata :
- AT (LOADADDR(.data) + (ADDR(.sdata) - ADDR(.data)))
- {
- *(.sdata)
- *(.sdata.*)
- }
- _edata = .;
- PROVIDE (edata = .);
- __bss_start = .;
- __bss_start__ = .;
- .sbss :
- {
- PROVIDE (__sbss_start = .);
- PROVIDE (___sbss_start = .);
- *(.dynsbss)
- *(.sbss)
- *(.sbss.*)
- *(.scommon)
- PROVIDE (__sbss_end = .);
- PROVIDE (___sbss_end = .);
- }
- .bss :
- {
- *(.dynbss)
- *(.bss)
- *(.bss.*)
- *(COMMON)
- /* Align here to ensure that the .bss section occupies space up to
- _end. Align after .bss to ensure correct alignment even if the
- .bss section disappears because there are no input sections. */
- . = ALIGN(32 / 8);
- }
- . = ALIGN(32 / 8);
- _end = .;
- _bss_end__ = . ; __bss_end__ = . ; __end__ = . ;
- PROVIDE (end = .);
- .note.netbsd.ident :
- {
- KEEP(*(.note.netbsd.ident));
- }
-}
diff -r 8856f9071b8a -r b1812aa6bf67 sys/arch/zaurus/conf/ldscript.zaurus
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/zaurus/conf/ldscript.zaurus Fri Jan 20 15:00:27 2012 +0000
@@ -0,0 +1,79 @@
+/* $NetBSD: ldscript.zaurus,v 1.3 2012/01/20 15:00:27 nonaka Exp $ */
+
+OUTPUT_ARCH(arm)
+ENTRY(KERNEL_BASE_phys)
+SECTIONS
+{
+ KERNEL_BASE_phys = @KERNEL_BASE_PHYS@;
+ KERNEL_BASE_virt = @KERNEL_BASE_VIRT@;
+
+ /* Kernel start: */
+ .start (KERNEL_BASE_phys) :
+ {
+ *(.start)
+ } =0
+
+ /* Read-only sections, merged into text segment: */
+ .text (KERNEL_BASE_virt + SIZEOF(.start)) :
+ AT (LOADADDR(.start) + SIZEOF(.start))
+ {
+ *(.text)
+ *(.text.*)
+ *(.stub)
+ *(.glue_7t) *(.glue_7)
+ *(.rodata) *(.rodata.*)
+ } =0
+ PROVIDE (__etext = .);
+ PROVIDE (_etext = .);
+ PROVIDE (etext = .);
+ /* Adjust the address for the data segment to start on the next page
+ boundary. */
+ . = ALIGN(0x8000);
+ .data :
+ AT (LOADADDR(.text) + (ADDR(.data) - ADDR(.text)))
+ {
+ __data_start = . ;
+ *(.data)
+ *(.data.*)
+ }
+ .sdata :
+ AT (LOADADDR(.data) + (ADDR(.sdata) - ADDR(.data)))
+ {
+ *(.sdata)
+ *(.sdata.*)
+ }
+ _edata = .;
+ PROVIDE (edata = .);
+ __bss_start = .;
+ __bss_start__ = .;
+ .sbss :
+ {
+ PROVIDE (__sbss_start = .);
+ PROVIDE (___sbss_start = .);
+ *(.dynsbss)
+ *(.sbss)
+ *(.sbss.*)
+ *(.scommon)
+ PROVIDE (__sbss_end = .);
+ PROVIDE (___sbss_end = .);
+ }
+ .bss :
+ {
+ *(.dynbss)
+ *(.bss)
+ *(.bss.*)
+ *(COMMON)
+ /* Align here to ensure that the .bss section occupies space up to
+ _end. Align after .bss to ensure correct alignment even if the
+ .bss section disappears because there are no input sections. */
+ . = ALIGN(32 / 8);
+ }
+ . = ALIGN(32 / 8);
+ _end = .;
+ _bss_end__ = . ; __bss_end__ = . ; __end__ = . ;
+ PROVIDE (end = .);
+ .note.netbsd.ident :
+ {
+ KEEP(*(.note.netbsd.ident));
+ }
+}
diff -r 8856f9071b8a -r b1812aa6bf67 sys/arch/zaurus/conf/std.zaurus
--- a/sys/arch/zaurus/conf/std.zaurus Fri Jan 20 14:08:04 2012 +0000
+++ b/sys/arch/zaurus/conf/std.zaurus Fri Jan 20 15:00:27 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: std.zaurus,v 1.3 2008/01/27 12:37:12 chris Exp $
+# $NetBSD: std.zaurus,v 1.4 2012/01/20 15:00:27 nonaka Exp $
#
# standard NetBSD/zaurus options
@@ -13,7 +13,8 @@
# To support easy transit to ../arch/arm/arm32
options ARM32
-#options ARM32_NEW_VM_LAYOUT # Not yet ready for prime-time
+makeoptions KERNEL_BASE_PHYS="0xa0200000"
+makeoptions LOADADDRESS="0xc0200000"
options ARM_INTR_IMPL="<arch/arm/xscale/pxa2x0_intr.h>"
diff -r 8856f9071b8a -r b1812aa6bf67 sys/arch/zaurus/zaurus/kloader_machdep.c
--- a/sys/arch/zaurus/zaurus/kloader_machdep.c Fri Jan 20 14:08:04 2012 +0000
+++ b/sys/arch/zaurus/zaurus/kloader_machdep.c Fri Jan 20 15:00:27 2012 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: kloader_machdep.c,v 1.4 2011/11/20 04:07:50 nonaka Exp $ */
+/* $NetBSD: kloader_machdep.c,v 1.5 2012/01/20 15:00:27 nonaka Exp $ */
/*-
- * Copyright (c) 2009 NONAKA Kimihiro <nonaka%netbsd.org@localhost>
+ * Copyright (c) 2009-2012 NONAKA Kimihiro <nonaka%netbsd.org@localhost>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kloader_machdep.c,v 1.4 2011/11/20 04:07:50 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kloader_machdep.c,v 1.5 2012/01/20 15:00:27 nonaka Exp $");
#include "debug_kloader.h"
@@ -44,9 +44,7 @@
#include <zaurus/zaurus/zaurus_var.h>
-#ifndef KERNEL_BASE
-#define KERNEL_BASE 0xc0000000
-#endif
+#define KERNEL_TEXT_BASE ((vaddr_t)&KERNEL_BASE_virt)
kloader_jumpfunc_t kloader_zaurus_jump __attribute__((__noreturn__));
kloader_bootfunc_t kloader_zaurus_boot __attribute__((__noreturn__));
@@ -78,8 +76,9 @@
struct kloader_bootinfo *kbi, struct kloader_page_tag *tag)
{
extern int kloader_howto;
- void (*bootinfop)(void *, void *) = (void *)(0xc0200000 - PAGE_SIZE);
- uint32_t *bootmagicp = (uint32_t *)(0xc0200000 - BOOTARGS_BUFSIZ);
+ extern char KERNEL_BASE_virt[];
+ void (*bootinfop)(void *, void *);
+ uint32_t *bootmagicp;
vaddr_t top, ptr;
struct bootinfo *bootinfo;
struct btinfo_howto *bi_howto;
@@ -88,11 +87,13 @@
disable_interrupts(I32_bit|F32_bit);
/* copy 2nd boot-loader to va=pa page */
+ bootinfop = (void *)(KERNEL_TEXT_BASE - PAGE_SIZE);
memmove(bootinfop, func, PAGE_SIZE);
/*
* make bootinfo
*/
+ bootmagicp = (uint32_t *)(KERNEL_TEXT_BASE - BOOTARGS_BUFSIZ);
memset(bootmagicp, 0, BOOTARGS_BUFSIZ);
bootinfo = (struct bootinfo *)(bootmagicp + 1);
bootinfo->nentries = 0;
@@ -119,8 +120,7 @@
ptr += bi_rootdv->common.len;
}
- if (bootinfo->nentries > 0)
- *bootmagicp = BOOTARGS_MAGIC;
+ *bootmagicp = BOOTARGS_MAGIC;
cpu_idcache_wbinv_all();
/* jump to 2nd boot-loader */
@@ -140,7 +140,7 @@
vaddr_t va;
int error;
- va = KERNEL_BASE + pa - 0xa0000000UL;
+ va = KERNEL_BASE + pa - PXA2X0_SDRAM0_START;
error = pmap_enter(pmap_kernel(), va, pa, VM_PROT_ALL, 0);
if (error) {
Home |
Main Index |
Thread Index |
Old Index