2
* Creation Date: <2010/04/02 13:00:00 mcayland>
3
* Time-stamp: <2010/04/02 13:00:00 mcayland>
7
* C implementation of (init-program) word
9
* Copyright (C) 2010 Mark Cave-Ayland (mark.cave-ayland@siriusit.co.uk)
11
* This program is free software; you can redistribute it and/or
12
* modify it under the terms of the GNU General Public License
18
#include "kernel/kernel.h"
19
#include "libopenbios/bindings.h"
20
#include "libopenbios/initprogram.h"
22
/* Because the a.out loader requires platform-specific headers */
23
#ifdef CONFIG_LOADER_AOUT
24
#include "libopenbios/aout_load.h"
27
#include "libopenbios/bootcode_load.h"
28
#include "libopenbios/bootinfo_load.h"
29
#include "libopenbios/elf_load.h"
30
#include "libopenbios/fcode_load.h"
31
#include "libopenbios/forth_load.h"
32
#include "libopenbios/xcoff_load.h"
35
void init_program(void)
37
/* Get the value of load-base and use it to determine the correct loader
44
#ifdef CONFIG_LOADER_AOUT
45
if (is_aout((struct exec *)cell2pointer(addr))) {
51
#ifdef CONFIG_LOADER_BOOTCODE
52
if (is_bootcode((char *)cell2pointer(addr))) {
53
bootcode_init_program();
58
#ifdef CONFIG_LOADER_BOOTINFO
59
if (is_bootinfo((char *)cell2pointer(addr))) {
60
bootinfo_init_program();
65
#ifdef CONFIG_LOADER_ELF
66
if (is_elf((Elf_ehdr *)cell2pointer(addr))) {
72
#ifdef CONFIG_LOADER_FCODE
73
if (is_fcode((unsigned char *)cell2pointer(addr))) {
79
#ifdef CONFIG_LOADER_FORTH
80
if (is_forth((char *)cell2pointer(addr))) {
86
#ifdef CONFIG_LOADER_XCOFF
87
if (is_xcoff((COFF_filehdr_t *)cell2pointer(addr))) {
95
void init_fcode_context(void)
97
/* Execute FCode payload */
98
printk("Evaluating FCode...\n");
105
void init_forth_context(void)
107
/* Execute Forth payload */
108
printk("Evaluating Forth...\n");
110
feval("load-state >ls.file-size @");
116
/* Switch to the current context */