j
: Next unread message k
: Previous unread message j a
: Jump to all threads
j l
: Jump to MailingList overview
Author: blueswirl Date: 2009-01-04 15:47:11 +0100 (Sun, 04 Jan 2009) New Revision: 347
Modified: openbios-devel/arch/sparc64/ldscript openbios-devel/arch/sparc64/lib.c openbios-devel/arch/sparc64/openbios.c openbios-devel/include/sparc64/io.h Log: Allocate Forth memory and dictionary using malloc like PPC (cf. r345)
Modified: openbios-devel/arch/sparc64/ldscript =================================================================== --- openbios-devel/arch/sparc64/ldscript 2009-01-04 12:53:26 UTC (rev 346) +++ openbios-devel/arch/sparc64/ldscript 2009-01-04 14:47:11 UTC (rev 347) @@ -10,8 +10,7 @@ */ BASE_ADDR = 0x00000000ffd00000;
-/* 512KB heap and 16KB stack */ -HEAP_SIZE = 512 * 1024; +/* 16KB stack */ STACK_SIZE = 16384; VMEM_SIZE = 128 * 1024; IOMEM_SIZE = 256 * 1024 + 768 * 1024; @@ -52,15 +51,6 @@ *(.bss.*) *(COMMON)
- /* Put heap and stack here, so they are included in PT_LOAD segment - * and the bootloader is aware of it. */ - - . = ALIGN(16); - _heap = .; - . += HEAP_SIZE; - . = ALIGN(16); - _eheap = .; - . = ALIGN(4096); _vmem = .; . += VMEM_SIZE;
Modified: openbios-devel/arch/sparc64/lib.c =================================================================== --- openbios-devel/arch/sparc64/lib.c 2009-01-04 12:53:26 UTC (rev 346) +++ openbios-devel/arch/sparc64/lib.c 2009-01-04 14:47:11 UTC (rev 347) @@ -32,7 +32,7 @@ return i; }
-#define MEMSIZE 128*1024 +#define MEMSIZE ((128 + 256 + 512) * 1024) static char memory[MEMSIZE]; static void *memptr=memory; static int memsize=MEMSIZE;
Modified: openbios-devel/arch/sparc64/openbios.c =================================================================== --- openbios-devel/arch/sparc64/openbios.c 2009-01-04 12:53:26 UTC (rev 346) +++ openbios-devel/arch/sparc64/openbios.c 2009-01-04 14:47:11 UTC (rev 347) @@ -37,8 +37,11 @@ #define PCI_CONFIG (APB_SPECIAL_BASE + 0x1000000ULL) #define APB_MEM_BASE 0x1ff00000000ULL
-static unsigned char intdict[256 * 1024]; +#define MEMORY_SIZE (512*1024) /* 512K ram for hosted system */ +#define DICTIONARY_SIZE (256*1024) /* 256K for the dictionary */
+static ucell *memory; + // XXX #define NVRAM_SIZE 0x2000 #define NVRAM_IDPROM 0x1fd8 @@ -437,16 +440,17 @@
static void init_memory(void) { + memory = malloc(MEMORY_SIZE); + if (!memory) + printk("panic: not enough memory on host system.\n");
- /* push start and end of available memory to the stack - * so that the forth word QUIT can initialize memory - * management. For now we use hardcoded memory between - * 0x10000 and 0x9ffff (576k). If we need more memory - * than that we have serious bloat. - */ + /* 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 + */
- PUSH((ucell)&_heap); - PUSH((ucell)&_eheap); + PUSH((ucell)memory); + PUSH((ucell)memory + (ucell)MEMORY_SIZE); }
static void @@ -508,7 +512,7 @@
collect_sys_info(&sys_info);
- dict=intdict; + dict = malloc(DICTIONARY_SIZE); load_dictionary((char *)sys_info.dict_start, (unsigned long)sys_info.dict_end - (unsigned long)sys_info.dict_start); @@ -540,5 +544,6 @@
enterforth((xt_t)PC); printk("falling off...\n"); + free(dict); return 0; }
Modified: openbios-devel/include/sparc64/io.h =================================================================== --- openbios-devel/include/sparc64/io.h 2009-01-04 12:53:26 UTC (rev 346) +++ openbios-devel/include/sparc64/io.h 2009-01-04 14:47:11 UTC (rev 347) @@ -4,8 +4,8 @@ #include "asm/types.h"
extern unsigned long va_shift; // Set in entry.S -extern char _start, _data, _heap, _eheap, _stack, _estack, _end, - _vmem, _evmem,_iomem; // Defined in ldscript +// Defined in ldscript +extern char _start, _data, _stack, _estack, _end, _vmem, _evmem, _iomem;
static inline unsigned long va2pa(unsigned long va)