|
|
1.1 ! root 1: /* tag: openbios forth environment, executable code ! 2: * ! 3: * Copyright (C) 2003 Patrick Mauritz, Stefan Reinauer ! 4: * ! 5: * See the file "COPYING" for further information about ! 6: * the copyright and warranty status of this work. ! 7: */ ! 8: ! 9: #include "config.h" ! 10: #include "libopenbios/openbios.h" ! 11: #include "libopenbios/bindings.h" ! 12: #include "asm/types.h" ! 13: #include "dict.h" ! 14: #include "kernel/kernel.h" ! 15: #include "kernel/stack.h" ! 16: #include "libopenbios/sys_info.h" ! 17: #include "openbios.h" ! 18: #include "relocate.h" ! 19: ! 20: void boot(void); ! 21: ! 22: #define DICTIONARY_SIZE (256*1024) /* 256K for the dictionary */ ! 23: static char intdict[DICTIONARY_SIZE]; ! 24: ! 25: static void init_memory(void) ! 26: { ! 27: /* push start and end of available memory to the stack ! 28: * so that the forth word QUIT can initialize memory ! 29: * management. For now we use hardcoded memory between ! 30: * 0x10000 and 0x9ffff (576k). If we need more memory ! 31: * than that we have serious bloat. ! 32: */ ! 33: ! 34: PUSH(0x10000); ! 35: PUSH(0x9FFFF); ! 36: } ! 37: ! 38: static void ! 39: arch_init( void ) ! 40: { ! 41: void setup_timers(void); ! 42: ! 43: openbios_init(); ! 44: modules_init(); ! 45: #ifdef CONFIG_DRIVER_IDE ! 46: setup_timers(); ! 47: ob_ide_init("/pci/pci-ata", 0x1f0, 0x3f4, 0x170, 0x374); ! 48: #endif ! 49: device_end(); ! 50: bind_func("platform-boot", boot ); ! 51: } ! 52: ! 53: int openbios(void) ! 54: { ! 55: #ifdef CONFIG_DEBUG_CONSOLE ! 56: #ifdef CONFIG_DEBUG_CONSOLE_SERIAL ! 57: uart_init(CONFIG_SERIAL_PORT, CONFIG_SERIAL_SPEED); ! 58: #endif ! 59: /* Clear the screen. */ ! 60: cls(); ! 61: #endif ! 62: ! 63: collect_sys_info(&sys_info); ! 64: ! 65: dict=intdict; ! 66: dictlimit = DICTIONARY_SIZE; ! 67: ! 68: load_dictionary((char *)sys_info.dict_start, ! 69: sys_info.dict_end-sys_info.dict_start); ! 70: forth_init(); ! 71: ! 72: relocate(&sys_info); ! 73: ! 74: #ifdef CONFIG_DEBUG_CONSOLE ! 75: video_init(); ! 76: #endif ! 77: #ifdef CONFIG_DEBUG_BOOT ! 78: printk("forth started.\n"); ! 79: printk("initializing memory..."); ! 80: #endif ! 81: ! 82: init_memory(); ! 83: ! 84: #ifdef CONFIG_DEBUG_BOOT ! 85: printk("done\n"); ! 86: #endif ! 87: ! 88: PUSH_xt( bind_noname_func(arch_init) ); ! 89: fword("PREPOST-initializer"); ! 90: ! 91: PC = (ucell)findword("initialize-of"); ! 92: ! 93: if (!PC) { ! 94: printk("panic: no dictionary entry point.\n"); ! 95: return -1; ! 96: } ! 97: #ifdef CONFIG_DEBUG_DICTIONARY ! 98: printk("done (%d bytes).\n", dicthead); ! 99: printk("Jumping to dictionary...\n"); ! 100: #endif ! 101: ! 102: enterforth((xt_t)PC); ! 103: ! 104: return 0; ! 105: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.