1 /******************************************************************************
2 * Copyright (c) 2004, 2008 IBM Corporation
4 * This program and the accompanying materials
5 * are made available under the terms of the BSD License
6 * which accompanies this distribution, and is available at
7 * http://www.opensource.org/licenses/bsd-license.php
10 * IBM Corporation - initial implementation
11 *****************************************************************************/
15 #include <stdlib.h> /* malloc */
22 /* Application entry point .*/
23 extern int _start(unsigned char *arg_string, long len);
24 extern int main(int, char**);
25 int _start_kernel(unsigned long p0, unsigned long p1);
26 void * malloc_aligned(size_t size, int align);
28 unsigned long exception_stack_frame;
30 snk_fileio_t fd_array[FILEIO_MAX];
32 extern uint64_t tb_freq;
34 extern char __client_start;
35 extern char __client_end;
37 void * malloc_aligned(size_t size, int align)
39 unsigned long p = (unsigned long) malloc(size + align - 1);
46 int _start_kernel(unsigned long p0, unsigned long p1)
49 unsigned int timebase;
51 /* initialize all file descriptor by marking them as empty */
52 for(rc=0; rc<FILEIO_MAX; ++rc)
53 fd_array[rc].type = FILEIO_TYPE_EMPTY;
55 /* this is step is e.g. resposible to initialize file descriptor 0 and 1 for STDIO */
56 rc = of_glue_init(&timebase, (size_t)(unsigned long)&__client_start,
57 (size_t)(unsigned long)&__client_end - (size_t)(unsigned long)&__client_start);
61 tb_freq = (uint64_t) timebase;
62 rc = _start((unsigned char *) p0, p1);