[OpenBIOS] r345 - in openbios-devel: arch/sparc32 include/sparc32
svn at openbios.org
svn at openbios.org
Sat Jan 3 14:46:15 CET 2009
Author: blueswirl
Date: 2009-01-03 14:46:15 +0100 (Sat, 03 Jan 2009)
New Revision: 345
Modified:
openbios-devel/arch/sparc32/ldscript
openbios-devel/arch/sparc32/openbios.c
openbios-devel/include/sparc32/io.h
Log:
Allocate Forth memory and dictionary using malloc like PPC
Modified: openbios-devel/arch/sparc32/ldscript
===================================================================
--- openbios-devel/arch/sparc32/ldscript 2009-01-03 13:45:02 UTC (rev 344)
+++ openbios-devel/arch/sparc32/ldscript 2009-01-03 13:46:15 UTC (rev 345)
@@ -10,10 +10,9 @@
*/
BASE_ADDR = 0xffd00000;
-/* 16KB heap and stack */
-HEAP_SIZE = 16384;
+/* 16KB stack */
STACK_SIZE = 16384;
-VMEM_SIZE = 256 * 1024;
+VMEM_SIZE = (256 + 256 + 16) * 1024;
IOMEM_SIZE = 256 * 1024 + 768 * 1024;
SECTIONS
@@ -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/sparc32/openbios.c
===================================================================
--- openbios-devel/arch/sparc32/openbios.c 2009-01-03 13:45:02 UTC (rev 344)
+++ openbios-devel/arch/sparc32/openbios.c 2009-01-03 13:46:15 UTC (rev 345)
@@ -19,6 +19,11 @@
#include "boot.h"
#include "video_subr.h"
+#define MEMORY_SIZE (16*1024) /* 16K ram for hosted system */
+#define DICTIONARY_SIZE (256*1024) /* 256K for the dictionary */
+
+static ucell *memory;
+
int qemu_machine_type;
struct hwdef {
@@ -92,20 +97,20 @@
};
static const struct hwdef *hwdef;
-static unsigned char intdict[256 * 1024];
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((unsigned int)&_heap);
- PUSH((unsigned int)&_eheap);
+ PUSH((ucell)memory);
+ PUSH((ucell)memory + MEMORY_SIZE);
}
static void
@@ -163,7 +168,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);
@@ -195,5 +200,6 @@
enterforth((xt_t)PC);
+ free(dict);
return 0;
}
Modified: openbios-devel/include/sparc32/io.h
===================================================================
--- openbios-devel/include/sparc32/io.h 2009-01-03 13:45:02 UTC (rev 344)
+++ openbios-devel/include/sparc32/io.h 2009-01-03 13:46:15 UTC (rev 345)
@@ -4,9 +4,10 @@
#include "asm/types.h"
extern unsigned int 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)
{
More information about the OpenBIOS
mailing list