|
|
1.1 ! root 1: /* ! 2: * Creation Date: <2010/06/25 20:00:00 mcayland> ! 3: * Time-stamp: <2010/06/25 20:00:00 mcayland> ! 4: * ! 5: * <load.c> ! 6: * ! 7: * C implementation of load ! 8: * ! 9: * Copyright (C) 2010 Mark Cave-Ayland ([email protected]) ! 10: * ! 11: * This program is free software; you can redistribute it and/or ! 12: * modify it under the terms of the GNU General Public License ! 13: * version 2 ! 14: * ! 15: */ ! 16: ! 17: #include "config.h" ! 18: #include "kernel/kernel.h" ! 19: #include "libopenbios/bindings.h" ! 20: #include "libopenbios/sys_info.h" ! 21: #include "libopenbios/load.h" ! 22: ! 23: #ifdef CONFIG_LOADER_ELF ! 24: #include "libopenbios/elf_load.h" ! 25: #endif ! 26: ! 27: #ifdef CONFIG_LOADER_AOUT ! 28: #include "libopenbios/aout_load.h" ! 29: #endif ! 30: ! 31: #ifdef CONFIG_LOADER_FCODE ! 32: #include "libopenbios/fcode_load.h" ! 33: #endif ! 34: ! 35: #ifdef CONFIG_LOADER_FORTH ! 36: #include "libopenbios/forth_load.h" ! 37: #endif ! 38: ! 39: ! 40: struct sys_info sys_info; ! 41: void *elf_boot_notes = NULL; ! 42: ! 43: void load(ihandle_t dev) ! 44: { ! 45: /* Invoke the loaders on the specified device */ ! 46: char *param; ! 47: ucell valid; ! 48: ! 49: #ifdef CONFIG_LOADER_ELF ! 50: ! 51: /* Grab the boot arguments */ ! 52: push_str("bootargs"); ! 53: push_str("/chosen"); ! 54: fword("(find-dev)"); ! 55: POP(); ! 56: fword("get-package-property"); ! 57: POP(); ! 58: param = pop_fstr_copy(); ! 59: ! 60: elf_load(&sys_info, dev, param, &elf_boot_notes); ! 61: feval("state-valid @"); ! 62: valid = POP(); ! 63: if (valid) { ! 64: return; ! 65: } ! 66: #endif ! 67: ! 68: #ifdef CONFIG_LOADER_AOUT ! 69: aout_load(&sys_info, dev); ! 70: feval("state-valid @"); ! 71: valid = POP(); ! 72: if (valid) { ! 73: return; ! 74: } ! 75: #endif ! 76: ! 77: #ifdef CONFIG_LOADER_FCODE ! 78: fcode_load(dev); ! 79: feval("state-valid @"); ! 80: valid = POP(); ! 81: if (valid) { ! 82: return; ! 83: } ! 84: #endif ! 85: ! 86: #ifdef CONFIG_LOADER_FORTH ! 87: forth_load(dev); ! 88: feval("state-valid @"); ! 89: valid = POP(); ! 90: if (valid) { ! 91: return; ! 92: } ! 93: #endif ! 94: ! 95: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.