aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Lohoff <flo@rfc822.org>2008-10-04 16:08:49 +0000
committerGuido G√ľnther <agx@sigxcpu.org>2009-04-26 15:26:26 +0200
commit88aacc5ec96304a23c4d33ac3cdc71985f099c72 (patch)
tree414c5902472e83ad988fc3db247188700b4e9f48
parentae4dcabd39938e93afa1fb095ed5421e92c10d7d (diff)
Move memory init, Fatal and Wait into prom specific
Abstract memory initialization into prom specific code. Put Fatal and Wait into prom specific code.
-rw-r--r--arclib/Makefile2
-rw-r--r--arclib/prom.c88
-rw-r--r--common/prom.h9
-rw-r--r--common/subarch.h39
-rw-r--r--ext2load/loader.c154
-rw-r--r--tip22/tftpload.c129
6 files changed, 161 insertions, 260 deletions
diff --git a/arclib/Makefile b/arclib/Makefile
index af16014..8aa4ded 100644
--- a/arclib/Makefile
+++ b/arclib/Makefile
@@ -1,7 +1,7 @@
#
# Copyright 1999 Silicon Graphics, Inc.
#
-CFLAGS += -O2 -Werror -I../common -Wall -mno-abicalls -G 0 -fno-pic
+CFLAGS += -O2 -Werror -I../common -Wall -mno-abicalls -G 0 -fno-pic -DKERNELADDR=$(KERNELADDR) -DMAXLOADSIZE=$(MAXLOADSIZE)
TARGETS = libarc.a
OBJECTS = arc.o prom.o
diff --git a/arclib/prom.c b/arclib/prom.c
index ab3b49a..27a8e69 100644
--- a/arclib/prom.c
+++ b/arclib/prom.c
@@ -3,6 +3,94 @@
#include "arc.h"
#include "prom.h"
+#include <stddef.h>
+#include <stdlib.h>
+#include <subarch.h>
+
+void prom_wait(const char *prompt)
+{
+ int ch;
+
+ if (prompt != NULL)
+ puts(prompt);
+
+ do {
+ ch = getchar();
+ } while ((ch != EOF) && (((char) ch) != ' '));
+}
+
+
+void prom_fatal(const CHAR * message, ...)
+{
+ va_list ap;
+
+ if (message != NULL) {
+ printf("FATAL ERROR: ");
+ va_start(ap, message);
+ vprintf(message, ap);
+ va_end(ap);
+ }
+
+ prom_wait("\n\r--- Press <spacebar> to enter ARC interactive mode ---");
+ ArcEnterInteractiveMode();
+}
+
+void prom_init_malloc(void)
+{
+ MEMORYDESCRIPTOR *current = NULL;
+ unsigned long stack = (unsigned long) &current;
+#ifdef DEBUG
+ printf("stack starts at: 0x%lx\n\r", stack);
+#endif
+
+ current = ArcGetMemoryDescriptor(current);
+ if(!current ) {
+ prom_fatal("Can't find any valid memory descriptors!\n\r");
+ }
+ while (current != NULL) {
+ /*
+ * The spec says we should have an adjacent FreeContiguous
+ * memory area that includes our stack. It would be much
+ * easier to just look for that and give it to malloc, but
+ * the Indy only shows FreeMemory areas, no FreeContiguous.
+ * Oh well.
+ */
+ if (current->Type == FreeMemory) {
+ unsigned long start = KSEG0ADDR(current->BasePage * PAGE_SIZE);
+ unsigned long end =
+ start + (current->PageCount * PAGE_SIZE);
+#if DEBUG
+ printf("Free Memory(%u) segment found at (0x%lx,0x%lx).\n\r",
+ current->Type, start, end);
+#endif
+
+ /* Leave some space for our stack */
+ if ((stack >= start) && (stack < end))
+ end =
+ (stack -
+ (STACK_PAGES *
+ PAGE_SIZE)) & ~(PAGE_SIZE - 1);
+
+ /* Don't use memory from reserved region */
+ if ((start >= KERNELADDR)
+ && (start < (KERNELADDR + MAXLOADSIZE)))
+ start = KERNELADDR + MAXLOADSIZE;
+ if ((end > KERNELADDR)
+ && (end <= (KERNELADDR + MAXLOADSIZE)))
+ end = KERNELADDR;
+ if (end > start) {
+#ifdef DEBUG
+ printf("Adding %lu bytes at 0x%lx to the list of available memory\n\r",
+ end-start, start);
+#endif
+ malloc_area_add(start, end - start);
+ }
+ }
+ current = ArcGetMemoryDescriptor(current);
+ }
+}
+
+
int prom_open(char *name, int mode, FILE *stream) {
/* Translate mode to Arc variant */
int amode=OpenReadOnly;
diff --git a/common/prom.h b/common/prom.h
index b347d36..053652c 100644
--- a/common/prom.h
+++ b/common/prom.h
@@ -1,4 +1,13 @@
+void prom_fatal(const char *message, ...);
+void prom_wait(const char *prompt);
+
+/*
+ * Gets called shortly after prom_init to intialize the malloc
+ * subsystem based on the proms information about memory layout
+ *
+ */
+void prom_init_malloc(void );
/*
* Open may be used to open "partitions" passed in by name from the prom. It is the
diff --git a/common/subarch.h b/common/subarch.h
index 788cc8d..28e2d1d 100644
--- a/common/subarch.h
+++ b/common/subarch.h
@@ -9,43 +9,6 @@
#define PAGE_SIZE 4096
#define STACK_PAGES 16
-
-/* supported subarches */
-#define IP22 0
-#define IP32 1
-
-/*
- * Reserve this memory for loading kernel
- * Don't put loader structures there because they would be overwritten
- *
- * We put the loader right after the kernel so you won't have the
- * full reserved space since the prom puts the stack right below
- * the loader.
- */
-struct kernel_load_block {
- uint32_t base;
- uint32_t reserved;
-};
-
-struct kernel_load_block kernel_load[] = {
- { /* IP22 */
- .base = 0x88002000,
- .reserved = 0x1700000,
- },
- { /* IP32 */
- .base = 0x80004000,
- .reserved = 0x1400000,
- },
-};
-
-/* we filter these out of the command line */
-char* env_vars[] = { "ConsoleIn=",
- "ConsoleOut=",
- "OSLoader=",
- "OSLoadPartition=",
- "OSLoadFilename=",
- "OSLoadOptions=",
- };
-#define NENTS(foo) ((sizeof((foo)) / (sizeof((foo[0])))))
+#define KSEG0ADDR(addr) (((addr) & 0x1fffffff) | 0x80000000)
#endif
diff --git a/ext2load/loader.c b/ext2load/loader.c
index 75fa4cc..f4c06c6 100644
--- a/ext2load/loader.c
+++ b/ext2load/loader.c
@@ -11,6 +11,7 @@
#include <stdint.h>
#include <arc.h>
+#include <prom.h>
#include <elf.h>
#include <sys/types.h>
@@ -43,93 +44,18 @@ typedef union {
Elf64_Ehdr header64;
} Elf_Ehdr;
-static void Wait(const char *prompt)
-{
- int ch;
-
- if (prompt != NULL)
- puts(prompt);
-
- do {
- ch = getchar();
- } while ((ch != EOF) && (((char) ch) != ' '));
-}
-
-
-void Fatal(const CHAR * message, ...)
-{
- va_list ap;
-
- if (message != NULL) {
- printf("FATAL ERROR: ");
- va_start(ap, message);
- vprintf(message, ap);
- va_end(ap);
- }
-
- Wait("\n\r--- Press <spacebar> to enter ARC interactive mode ---");
- ArcEnterInteractiveMode();
-}
-
-
-void InitMalloc(void)
-{
- MEMORYDESCRIPTOR *current = NULL;
- ULONG stack = (ULONG) &current;
-#ifdef DEBUG
- printf("stack starts at: 0x%lx\n\r", stack);
-#endif
-
- current = ArcGetMemoryDescriptor(current);
- if(! current ) {
- Fatal("Can't find any valid memory descriptors!\n\r");
- }
- while (current != NULL) {
- /*
- * The spec says we should have an adjacent FreeContiguous
- * memory area that includes our stack. It would be much
- * easier to just look for that and give it to malloc, but
- * the Indy only shows FreeMemory areas, no FreeContiguous.
- * Oh well.
- */
- if (current->Type == FreeMemory) {
- ULONG start = KSEG0ADDR(current->BasePage * PAGE_SIZE);
- ULONG end =
- start + (current->PageCount * PAGE_SIZE);
-#if DEBUG
- printf("Free Memory(%u) segment found at (0x%lx,0x%lx).\n\r",
- current->Type, start, end);
-#endif
+/* we filter these out of the command line */
+static char* env_vars[] = { "ConsoleIn=",
+ "ConsoleOut=",
+ "OSLoader=",
+ "OSLoadPartition=",
+ "OSLoadFilename=",
+ "OSLoadOptions=",
+ };
+#define NENTS(foo) ((sizeof((foo)) / (sizeof((foo[0])))))
- /* Leave some space for our stack */
- if ((stack >= start) && (stack < end))
- end =
- (stack -
- (STACK_PAGES *
- PAGE_SIZE)) & ~(PAGE_SIZE - 1);
- /* Don't use memory from reserved region */
- if ((start >= kernel_load[SUBARCH].base )
- && (start < (kernel_load[SUBARCH].base
- + kernel_load[SUBARCH].reserved )))
- start = kernel_load[SUBARCH].base
- + kernel_load[SUBARCH].reserved;
- if ((end > kernel_load[SUBARCH].base)
- && (end <= (kernel_load[SUBARCH].base
- + kernel_load[SUBARCH].reserved )))
- end = kernel_load[SUBARCH].base;
- if (end > start) {
-#ifdef DEBUG
- printf("Adding %lu bytes at 0x%lx to the list of available memory\n\r",
- end-start, start);
-#endif
- malloc_area_add(start, end - start);
- }
- }
- current = ArcGetMemoryDescriptor(current);
- }
-}
-int isEnvVar(const char* arg)
+static int isEnvVar(const char* arg)
{
unsigned int i;
@@ -159,7 +85,7 @@ int ProcessArguments(LONG argc, CHAR * argv[])
/* Copy options to local memory to avoid overwrite later */
OSLoadOptions = strdup(equals + 1);
if (OSLoadOptions == NULL)
- Fatal ("Cannot allocate memory for options string\n\r");
+ prom_fatal("Cannot allocate memory for options string\n\r");
}
}
}
@@ -211,7 +137,7 @@ int LoadProgramSegments32(ext2_file_t file, Elf_Ehdr * header, void *segments)
EXT2_SEEK_SET, NULL);
if (status != 0) {
print_ext2fs_error(status);
- Fatal("Cannot seek to program segment\n\r");
+ prom_fatal("Cannot seek to program segment\n\r");
}
arc_do_progress = 1;
@@ -223,7 +149,7 @@ int LoadProgramSegments32(ext2_file_t file, Elf_Ehdr * header, void *segments)
arc_do_progress = 0;
if (status != 0) {
print_ext2fs_error(status);
- Fatal("Cannot read program segment\n\r");
+ prom_fatal("Cannot read program segment\n\r");
}
size = segment->p_memsz - segment->p_filesz;
@@ -279,7 +205,7 @@ int LoadProgramSegments64(ext2_file_t file, Elf_Ehdr * header, void *segments)
EXT2_SEEK_SET, NULL);
if (status != 0) {
print_ext2fs_error(status);
- Fatal("Cannot seek to program segment\n\r");
+ prom_fatal("Cannot seek to program segment\n\r");
}
arc_do_progress = 1;
@@ -290,7 +216,7 @@ int LoadProgramSegments64(ext2_file_t file, Elf_Ehdr * header, void *segments)
arc_do_progress = 0;
if (status != 0) {
print_ext2fs_error(status);
- Fatal("Cannot read program segment\n\r");
+ prom_fatal("Cannot read program segment\n\r");
}
size = (ULONG)segment->p_memsz - (ULONG)segment->p_filesz;
@@ -329,11 +255,11 @@ void LoadProgramSegments(ext2_file_t file, Elf_Ehdr * header)
header->header64.e_phnum);
if (size <= 0)
- Fatal("No program segments\n\r");
+ prom_fatal("No program segments\n\r");
segments = malloc(size);
if (segments == NULL)
- Fatal("Cannot allocate memory for segment headers\n\r");
+ prom_fatal("Cannot allocate memory for segment headers\n\r");
else
printf("Allocated 0x%x bytes for segments\n\r",size);
@@ -348,13 +274,13 @@ void LoadProgramSegments(ext2_file_t file, Elf_Ehdr * header)
}
if (status != 0) {
print_ext2fs_error(status);
- Fatal("Cannot seek to program segment headers\n\r");
+ prom_fatal("Cannot seek to program segment headers\n\r");
}
status = ext2fs_file_read(file, segments, size, NULL);
if (status != 0) {
print_ext2fs_error(status);
- Fatal("Cannot read program segment headers\n\r");
+ prom_fatal("Cannot read program segment headers\n\r");
}
if(header->e_ident[EI_CLASS] == ELFCLASS32)
@@ -363,7 +289,7 @@ void LoadProgramSegments(ext2_file_t file, Elf_Ehdr * header)
loaded = LoadProgramSegments64(file, header, segments);
if (!loaded)
- Fatal("No loadable program segments found\n\r");
+ prom_fatal("No loadable program segments found\n\r");
free(segments);
}
@@ -379,42 +305,42 @@ Elf64_Addr LoadKernelFile(ext2_file_t file)
ext2fs_file_read(file, (void *) &header, sizeof(header), NULL);
if (status != 0) {
print_ext2fs_error(status);
- Fatal("Can't read file header\n\r");
+ prom_fatal("Can't read file header\n\r");
}
if (memcmp(&(header.e_ident[EI_MAG0]), ELFMAG, SELFMAG) != 0)
- Fatal("Not an ELF file\n\r");
+ prom_fatal("Not an ELF file\n\r");
if (header.e_ident[EI_CLASS] != ELFCLASS32 &&
header.e_ident[EI_CLASS] != ELFCLASS64)
- Fatal("Not a 32-bit or 64-bit file\n\r");
+ prom_fatal("Not a 32-bit or 64-bit file\n\r");
if (header.e_ident[EI_DATA] != ELFDATA2MSB)
- Fatal("Not a big-endian file\n\r");
+ prom_fatal("Not a big-endian file\n\r");
if (header.e_ident[EI_VERSION] != EV_CURRENT)
- Fatal("Wrong ELF version\n\r");
+ prom_fatal("Wrong ELF version\n\r");
if (header.e_ident[EI_CLASS]==ELFCLASS32) {
if (header.header32.e_type != ET_EXEC)
- Fatal("Not an executable file\n\r");
+ prom_fatal("Not an executable file\n\r");
if (header.header32.e_machine != EM_MIPS)
- Fatal("Unsupported machine type\n\r");
+ prom_fatal("Unsupported machine type\n\r");
if (header.header32.e_version != EV_CURRENT)
- Fatal("Wrong ELF version\n\r");
+ prom_fatal("Wrong ELF version\n\r");
entry = (Elf64_Addr) header.header32.e_entry;
} else {
if (header.header64.e_type != ET_EXEC)
- Fatal("Not an executable file\n\r");
+ prom_fatal("Not an executable file\n\r");
if (header.header64.e_machine != EM_MIPS)
- Fatal("Unsupported machine type\n\r");
+ prom_fatal("Unsupported machine type\n\r");
if (header.header64.e_version != EV_CURRENT)
- Fatal("Wrong ELF version\n\r");
+ prom_fatal("Wrong ELF version\n\r");
entry = header.header64.e_entry;
}
@@ -460,7 +386,7 @@ Elf64_Addr LoadKernel(const char *partition, const char *filename)
ext2_file_t file;
if(!OpenFile( partition, filename, &file ))
- Fatal("Can't load kernel!\n\r");
+ prom_fatal("Can't load kernel!\n\r");
return LoadKernelFile(file);
}
@@ -472,14 +398,14 @@ void LoadInitrd(const char *partition, const char *filename, int *argc, char **a
int status;
if (!OpenFile(partition, filename, &file))
- Fatal("Can't load initrd!\n\r");
+ prom_fatal("Can't load initrd!\n\r");
initrd_sz = ext2fs_file_get_size(file);
initrd_addr = (ULONG)malloc(initrd_sz + max_page_size);
if (initrd_addr == 0) {
- Fatal("Cannot allocate memory for initrd\n\r");
+ prom_fatal("Cannot allocate memory for initrd\n\r");
}
initrd_addr = (initrd_addr + max_page_size) & ~(max_page_size - 1);
@@ -492,7 +418,7 @@ void LoadInitrd(const char *partition, const char *filename, int *argc, char **a
arc_do_progress = 0;
if (status != 0) {
print_ext2fs_error(status);
- Fatal("Cannot read initrd\n\r");
+ prom_fatal("Cannot read initrd\n\r");
}
/* Add rd_start=, rd_size= */
@@ -542,7 +468,7 @@ void _start(LONG argc, CHAR *argv[], CHAR *envp[])
printf(ANSI_CLEAR "\n\rarcsboot: ARCS Linux ext2fs loader "
__ARCSBOOT_VERSION__ "\n\n\r");
- InitMalloc();
+ prom_init_malloc();
nopt = ProcessArguments(argc, argv);
@@ -559,7 +485,7 @@ void _start(LONG argc, CHAR *argv[], CHAR *envp[])
OSLoadFilename = "Linux";
if (OSLoadPartition == NULL)
- Fatal("Invalid load partition\n\r");
+ prom_fatal("Invalid load partition\n\r");
#if DEBUG
printf("OSLoadPartition: %s\n\r", OSLoadPartition);
printf("OSLoadFilename: %s\n\r", OSLoadFilename);
@@ -607,7 +533,7 @@ void _start(LONG argc, CHAR *argv[], CHAR *envp[])
printCmdLine(nargc, nargv);
printf("Kernel entry: 0x%lx %lx\n\r",
(long)(kernel_entry64>>32),(long)(kernel_entry64&0xffffffff));
- Wait("\n\r--- Debug: press <spacebar> to boot kernel ---");
+ prom_wait("\n\r--- Debug: press <spacebar> to boot kernel ---");
#endif
if( kernel_entry64 ) {
if(is64==0){
@@ -625,6 +551,6 @@ void _start(LONG argc, CHAR *argv[], CHAR *envp[])
}
/* Not likely to get back here in a functional state, but what the heck */
- Wait("\n\r--- Press <spacebar> to restart ---");
+ prom_wait("\n\r--- Press <spacebar> to restart ---");
ArcRestart();
}
diff --git a/tip22/tftpload.c b/tip22/tftpload.c
index 36465bf..c438401 100644
--- a/tip22/tftpload.c
+++ b/tip22/tftpload.c
@@ -12,6 +12,7 @@
#include <types.h>
#include <arc.h>
+#include <prom.h>
#include <elf.h>
#include <sys/types.h>
@@ -30,92 +31,6 @@ extern void* __kernel_end;
extern void* __rd_start;
extern void* __rd_end;
-static void Wait(const char *prompt)
-{
- int ch;
-
- if (prompt != NULL)
- puts(prompt);
-
- do {
- ch = getchar();
- } while ((ch != EOF) && (((char) ch) != ' '));
-}
-
-
-static void Fatal(const CHAR * message, ...)
-{
- va_list ap;
-
- if (message != NULL) {
- printf("FATAL ERROR: ");
- va_start(ap, message);
- vprintf(message, ap);
- va_end(ap);
- }
-
- Wait("\n\r--- Press <spacebar> to enter ARC interactive mode ---");
- ArcEnterInteractiveMode();
-}
-
-
-static void InitMalloc(void)
-{
- MEMORYDESCRIPTOR *current = NULL;
- ULONG stack = (ULONG) & current;
-#ifdef DEBUG
- printf("stack starts at: 0x%lx\n\r", stack);
-#endif
-
- current = ArcGetMemoryDescriptor(current);
- if(! current ) {
- Fatal("Can't find any valid memory descriptors!\n\r");
- }
- while (current != NULL) {
- /*
- * The spec says we should have an adjacent FreeContiguous
- * memory area that includes our stack. It would be much
- * easier to just look for that and give it to malloc, but
- * the Indy only shows FreeMemory areas, no FreeContiguous.
- * Oh well.
- */
- if (current->Type == FreeMemory) {
- ULONG start = KSEG0ADDR(current->BasePage * PAGE_SIZE);
- ULONG end =
- start + (current->PageCount * PAGE_SIZE);
-#if DEBUG
- printf("Free Memory(%u) segment found at (0x%lx,0x%lx).\n\r",
- current->Type, start, end);
-#endif
-
- /* Leave some space for our stack */
- if ((stack >= start) && (stack < end))
- end =
- (stack -
- (STACK_PAGES *
- PAGE_SIZE)) & ~(PAGE_SIZE - 1);
- /* Don't use memory from reserved region */
- if ((start >= kernel_load[SUBARCH].base )
- && (start < (kernel_load[SUBARCH].base
- + kernel_load[SUBARCH].reserved )))
- start = kernel_load[SUBARCH].base
- + kernel_load[SUBARCH].reserved;
- if ((end > kernel_load[SUBARCH].base)
- && (end <= (kernel_load[SUBARCH].base
- + kernel_load[SUBARCH].reserved )))
- end = kernel_load[SUBARCH].base;
- if (end > start) {
-#ifdef DEBUG
- printf("Adding %lu bytes at 0x%lx to the list of available memory\n\r",
- end-start, start);
-#endif
- malloc_area_add(start, end - start);
- }
- }
- current = ArcGetMemoryDescriptor(current);
- }
-}
-
/* convert an offset in the kernel image to an address in the loaded tftpboot image */
static void* offset2addr(unsigned long offset)
{
@@ -133,11 +48,11 @@ static ULONG CopyProgramSegments32(Elf32_Ehdr * header)
ULONG kernel_end=0L;
if (size <= 0)
- Fatal("No program segments\n\r");
+ prom_fatal("No program segments\n\r");
segments = malloc(size);
if (segments == NULL)
- Fatal("Cannot allocate memory for segment headers\n\r");
+ prom_fatal("Cannot allocate memory for segment headers\n\r");
segments = (Elf32_Phdr*)offset2addr(header->e_phoff);
@@ -172,7 +87,7 @@ static ULONG CopyProgramSegments32(Elf32_Ehdr * header)
}
if (!loaded)
- Fatal("No loadable program segments found\n\r");
+ prom_fatal("No loadable program segments found\n\r");
free(segments);
return kernel_end;
@@ -187,11 +102,11 @@ static ULONG CopyProgramSegments64(Elf64_Ehdr * header)
ULONG kernel_end=0L;
if (size <= 0)
- Fatal("No program segments\n\r");
+ prom_fatal("No program segments\n\r");
segments = malloc(size);
if (segments == NULL)
- Fatal("Cannot allocate memory for segment headers\n\r");
+ prom_fatal("Cannot allocate memory for segment headers\n\r");
segments = (Elf64_Phdr*)offset2addr(header->e_phoff);
@@ -229,7 +144,7 @@ static ULONG CopyProgramSegments64(Elf64_Ehdr * header)
}
if (!loaded)
- Fatal("No loadable program segments found\n\r");
+ prom_fatal("No loadable program segments found\n\r");
free(segments);
return kernel_end;
@@ -241,19 +156,19 @@ static ULONG CopyKernel(ULONG* kernel_end)
Elf64_Ehdr *header64 = (Elf64_Ehdr*)header;
if (memcmp(&(header->e_ident[EI_MAG0]), ELFMAG, SELFMAG) != 0)
- Fatal("Not an ELF file\n\r");
+ prom_fatal("Not an ELF file\n\r");
if (header->e_ident[EI_CLASS] == ELFCLASS32) {
if (header->e_ident[EI_DATA] != ELFDATA2MSB)
- Fatal("Not a big-endian file\n\r");
+ prom_fatal("Not a big-endian file\n\r");
if (header->e_ident[EI_VERSION] != EV_CURRENT)
- Fatal("Wrong ELF version\n\r");
+ prom_fatal("Wrong ELF version\n\r");
if (header->e_type != ET_EXEC)
- Fatal("Not an executable file\n\r");
+ prom_fatal("Not an executable file\n\r");
if (header->e_machine != EM_MIPS)
- Fatal("Unsupported machine type\n\r");
+ prom_fatal("Unsupported machine type\n\r");
if (header->e_version != EV_CURRENT)
- Fatal("Wrong ELF version\n\r");
+ prom_fatal("Wrong ELF version\n\r");
(*kernel_end) = CopyProgramSegments32(header);
@@ -262,15 +177,15 @@ static ULONG CopyKernel(ULONG* kernel_end)
return KSEG0ADDR(header->e_entry);
} else if (header->e_ident[EI_CLASS] == ELFCLASS64) {
if (header64->e_ident[EI_DATA] != ELFDATA2MSB)
- Fatal("Not a big-endian file\n\r");
+ prom_fatal("Not a big-endian file\n\r");
if (header64->e_ident[EI_VERSION] != EV_CURRENT)
- Fatal("Wrong ELF version\n\r");
+ prom_fatal("Wrong ELF version\n\r");
if (header64->e_type != ET_EXEC)
- Fatal("Not an executable file\n\r");
+ prom_fatal("Not an executable file\n\r");
if (header64->e_machine != EM_MIPS)
- Fatal("Unsupported machine type\n\r");
+ prom_fatal("Unsupported machine type\n\r");
if (header64->e_version != EV_CURRENT)
- Fatal("Wrong ELF version\n\r");
+ prom_fatal("Wrong ELF version\n\r");
(*kernel_end) = CopyProgramSegments64(header64);
@@ -278,7 +193,7 @@ static ULONG CopyKernel(ULONG* kernel_end)
((ULONG)KSEG0ADDR(header64->e_entry)));
return KSEG0ADDR(header64->e_entry);
} else
- Fatal("Neither an ELF32 nor an ELF64 kernel\n\r");
+ prom_fatal("Neither an ELF32 nor an ELF64 kernel\n\r");
return 0L;
}
@@ -308,7 +223,7 @@ void _start(LONG argc, CHAR * argv[], CHAR * envp[])
printf(ANSI_CLEAR "\n\rtip32: IP32 Linux tftpboot loader " __ARCSBOOT_VERSION__ "\n\r");
#endif
- InitMalloc();
+ prom_init_malloc();
/* copy kernel and ramdisk to its load addresses */
#ifdef DEBUG
@@ -347,7 +262,7 @@ void _start(LONG argc, CHAR * argv[], CHAR * envp[])
printf("Arguments passed to kernel:\n\r");
for(i = 0; i < nargc; i++ )
printf("%u: %s\n\r", i, nargv[i]);
- Wait("\n\r--- Debug: press <spacebar> to boot kernel ---");
+ prom_wait("\n\r--- Debug: press <spacebar> to boot kernel ---");
#endif
/* Finally jump into the kernel */
printf("Starting kernel...\n\r");
@@ -359,6 +274,6 @@ void _start(LONG argc, CHAR * argv[], CHAR * envp[])
/* Not likely to get back here in a functional state,
* but what the heck */
- Wait("\n\r--- Press <spacebar> to restart ---");
+ prom_wait("\n\r--- Press <spacebar> to restart ---");
ArcRestart();
}