Author: mcayland Date: Tue Apr 9 20:32:53 2013 New Revision: 1114 URL: http://tracker.coreboot.org/trac/openbios/changeset/1114
Log: SPARC32: Move Forth dictionary location to a fixed location.
Instead of using the automatic allocator to determine the location of the Forth dictionary, allocate it at a fixed location just underneath the ROM itself at 0xffd00000.
This patch also prevents corruption within the RAM of the Forth machine by ensuring that we allocate virtual memory outside of OpenBIOS itself, plus reduces the size of the Forth dictionary to 128K so that it meets the memory constraints required to boot Linux and also kadb from older versions of SunOS (as reported by Artyom Tarasenko).
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk
Modified: trunk/openbios-devel/arch/sparc32/ofmem_sparc32.c trunk/openbios-devel/arch/sparc32/openbios.c trunk/openbios-devel/include/arch/sparc32/ofmem_sparc32.h
Modified: trunk/openbios-devel/arch/sparc32/ofmem_sparc32.c ============================================================================== --- trunk/openbios-devel/arch/sparc32/ofmem_sparc32.c Tue Apr 9 20:32:49 2013 (r1113) +++ trunk/openbios-devel/arch/sparc32/ofmem_sparc32.c Tue Apr 9 20:32:53 2013 (r1114) @@ -61,7 +61,7 @@
ucell ofmem_arch_get_virt_top(void) { - return (ucell)TOP_OF_RAM; + return (ucell)OFMEM_VIRT_TOP; }
phys_addr_t ofmem_arch_get_phys_top(void)
Modified: trunk/openbios-devel/arch/sparc32/openbios.c ============================================================================== --- trunk/openbios-devel/arch/sparc32/openbios.c Tue Apr 9 20:32:49 2013 (r1113) +++ trunk/openbios-devel/arch/sparc32/openbios.c Tue Apr 9 20:32:53 2013 (r1114) @@ -25,9 +25,9 @@ #include "packages/video.h" #define NO_QEMU_PROTOS #include "arch/common/fw_cfg.h" -#include "libopenbios/ofmem.h" +#include "arch/sparc32/ofmem_sparc32.h"
-#define MEMORY_SIZE (512*1024) /* 512K ram for hosted system */ +#define MEMORY_SIZE (128*1024) /* 128K ram for hosted system */ #define UUID_FMT "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x" #define FW_CFG_SUN4M_DEPTH (FW_CFG_ARCH_LOCAL + 0x00)
@@ -813,13 +813,16 @@ if (!phys) printk("panic: not enough physical memory on host system.\n");
- virt = ofmem_claim_virt(-1, MEMORY_SIZE, PAGE_SIZE); + virt = ofmem_claim_virt(OF_CODE_START - MEMORY_SIZE, MEMORY_SIZE, 0); if (!virt) printk("panic: not enough virtual memory on host system.\n");
/* Generate the mapping (and lock translation into the TLBs) */ ofmem_map(phys, virt, MEMORY_SIZE, ofmem_arch_default_translation_mode(phys));
+ /* Mark everything up until OFMEM_VIRT_TOP as in use */ + ofmem_claim_virt(OFMEM_VIRT_TOP, OF_CODE_START - MEMORY_SIZE - OFMEM_VIRT_TOP, 0); + /* we push start and end of memory to the stack * so that it can be used by the forth word QUIT * to initialize the memory allocator
Modified: trunk/openbios-devel/include/arch/sparc32/ofmem_sparc32.h ============================================================================== --- trunk/openbios-devel/include/arch/sparc32/ofmem_sparc32.h Tue Apr 9 20:32:49 2013 (r1113) +++ trunk/openbios-devel/include/arch/sparc32/ofmem_sparc32.h Tue Apr 9 20:32:53 2013 (r1114) @@ -16,6 +16,9 @@
#include "libopenbios/ofmem.h"
+#define OF_CODE_START 0xffd00000 +#define OFMEM_VIRT_TOP 0xfe000000 + struct mem; extern struct mem cdvmem;