diff options
author | 2015-08-28 09:58:54 +0800 | |
---|---|---|
committer | 2015-09-01 12:44:00 +0800 | |
commit | e44e3482bdb4d0ebde2d8b41830ac2cdb07948fb (patch) | |
tree | 66b09f592c55df2878107a468a91d21506104d3f /qemu/roms/SLOF/clients/net-snk/kernel/init.c | |
parent | 9ca8dbcc65cfc63d6f5ef3312a33184e1d726e00 (diff) |
Add qemu 2.4.0
Change-Id: Ic99cbad4b61f8b127b7dc74d04576c0bcbaaf4f5
Signed-off-by: Yang Zhang <yang.z.zhang@intel.com>
Diffstat (limited to 'qemu/roms/SLOF/clients/net-snk/kernel/init.c')
-rw-r--r-- | qemu/roms/SLOF/clients/net-snk/kernel/init.c | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/qemu/roms/SLOF/clients/net-snk/kernel/init.c b/qemu/roms/SLOF/clients/net-snk/kernel/init.c new file mode 100644 index 000000000..1376b6474 --- /dev/null +++ b/qemu/roms/SLOF/clients/net-snk/kernel/init.c @@ -0,0 +1,67 @@ +/****************************************************************************** + * Copyright (c) 2004, 2008 IBM Corporation + * All rights reserved. + * This program and the accompanying materials + * are made available under the terms of the BSD License + * which accompanies this distribution, and is available at + * http://www.opensource.org/licenses/bsd-license.php + * + * Contributors: + * IBM Corporation - initial implementation + *****************************************************************************/ + +#include <stdint.h> +#include <string.h> +#include <stdlib.h> /* malloc */ +#include <of.h> +#include <pci.h> +#include <kernel.h> +#include <cpu.h> +#include <fileio.h> + +/* Application entry point .*/ +extern int _start(unsigned char *arg_string, long len); +extern int main(int, char**); +int _start_kernel(unsigned long p0, unsigned long p1); +void * malloc_aligned(size_t size, int align); + +unsigned long exception_stack_frame; + +snk_fileio_t fd_array[FILEIO_MAX]; + +extern uint64_t tb_freq; + +extern char __client_start; +extern char __client_end; + +void * malloc_aligned(size_t size, int align) +{ + unsigned long p = (unsigned long) malloc(size + align - 1); + p = p + align - 1; + p = p & ~(align - 1); + + return (void *) p; +} + +int _start_kernel(unsigned long p0, unsigned long p1) +{ + int rc; + unsigned int timebase; + + /* initialize all file descriptor by marking them as empty */ + for(rc=0; rc<FILEIO_MAX; ++rc) + fd_array[rc].type = FILEIO_TYPE_EMPTY; + + /* this is step is e.g. resposible to initialize file descriptor 0 and 1 for STDIO */ + rc = of_glue_init(&timebase, (size_t)(unsigned long)&__client_start, + (size_t)(unsigned long)&__client_end - (size_t)(unsigned long)&__client_start); + if(rc < 0) + return -1; + + tb_freq = (uint64_t) timebase; + rc = _start((unsigned char *) p0, p1); + + of_glue_release(); + return rc; +} + |