Print this page
loader: pass args along to unix in C
There's no reason why we can't pass the args gotten from the bootloader to
unix in C.
Note: loader's _start sets the ATAG pointer to 0x100.  This change simply
propagates it to unix.
   1 /*
   2  * This file and its contents are supplied under the terms of the
   3  * Common Development and Distribution License ("CDDL"), version 1.0.
   4  * You may only use this file in accordance with the terms of version
   5  * 1.0 of the CDDL.
   6  *
   7  * A full copy of the text of the CDDL should have accompanied this
   8  * source.  A copy of the CDDL is also available via the Internet at
   9  * http://www.illumos.org/license/CDDL.
  10  */
  11 
  12 /*
  13  * Copyright (c) 2013 Joyent, Inc.  All rights reserved.

  14  */
  15 
  16 #ifndef _FAKELOADER_H
  17 #define _FAKELOADER_H
  18 
  19 /*
  20  * The hacky version of arm uniboot that is exactly for a few systems.
  21  */
  22 
  23 #include <sys/stdint.h>
  24 #include <sys/atag.h>
  25 
  26 #ifdef __cplusplus
  27 extern "C" {
  28 #endif
  29 
  30 typedef struct fakeloader_hdr {
  31         unsigned char fh_magic[4];      /* Magic! */
  32         uint32_t fh_unix_size;          /* How large is unix */
  33         uint32_t fh_unix_offset;        /* Offset from start to unix */


  36 } fakeloader_hdr_t;
  37 
  38 #define FH_MAGIC0       'i'
  39 #define FH_MAGIC1       'f'
  40 #define FH_MAGIC2       'b'
  41 #define FH_MAGIC3       'h'
  42 
  43 /*
  44  * Backend operations, eg. what a given board must implement at the moment
  45  */
  46 extern void fakeload_backend_init(void);
  47 extern void fakeload_backend_putc(int);
  48 extern void fakeload_backend_addmaps(atag_header_t *);
  49 
  50 /*
  51  * ASM operations
  52  */
  53 extern void fakeload_unaligned_enable(void);
  54 extern void fakeload_mmu_enable(void);
  55 extern void fakeload_pt_setup(uintptr_t);
  56 extern void fakeload_exec(uintptr_t);
  57 
  58 extern void armv6_dcache_disable(void);
  59 extern void armv6_dcache_enable(void);
  60 extern void armv6_dcache_inval(void);
  61 extern void armv6_dcache_flush(void);
  62 
  63 extern void armv6_icache_disable(void);
  64 extern void armv6_icache_enable(void);
  65 extern void armv6_icache_inval(void);
  66 
  67 #ifdef __cplusplus
  68 }
  69 #endif
  70 
  71 #endif /* _FAKELOADER_H */
   1 /*
   2  * This file and its contents are supplied under the terms of the
   3  * Common Development and Distribution License ("CDDL"), version 1.0.
   4  * You may only use this file in accordance with the terms of version
   5  * 1.0 of the CDDL.
   6  *
   7  * A full copy of the text of the CDDL should have accompanied this
   8  * source.  A copy of the CDDL is also available via the Internet at
   9  * http://www.illumos.org/license/CDDL.
  10  */
  11 
  12 /*
  13  * Copyright (c) 2013 Joyent, Inc.  All rights reserved.
  14  * Copyright (c) 2015 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
  15  */
  16 
  17 #ifndef _FAKELOADER_H
  18 #define _FAKELOADER_H
  19 
  20 /*
  21  * The hacky version of arm uniboot that is exactly for a few systems.
  22  */
  23 
  24 #include <sys/stdint.h>
  25 #include <sys/atag.h>
  26 
  27 #ifdef __cplusplus
  28 extern "C" {
  29 #endif
  30 
  31 typedef struct fakeloader_hdr {
  32         unsigned char fh_magic[4];      /* Magic! */
  33         uint32_t fh_unix_size;          /* How large is unix */
  34         uint32_t fh_unix_offset;        /* Offset from start to unix */


  37 } fakeloader_hdr_t;
  38 
  39 #define FH_MAGIC0       'i'
  40 #define FH_MAGIC1       'f'
  41 #define FH_MAGIC2       'b'
  42 #define FH_MAGIC3       'h'
  43 
  44 /*
  45  * Backend operations, eg. what a given board must implement at the moment
  46  */
  47 extern void fakeload_backend_init(void);
  48 extern void fakeload_backend_putc(int);
  49 extern void fakeload_backend_addmaps(atag_header_t *);
  50 
  51 /*
  52  * ASM operations
  53  */
  54 extern void fakeload_unaligned_enable(void);
  55 extern void fakeload_mmu_enable(void);
  56 extern void fakeload_pt_setup(uintptr_t);
  57 extern void fakeload_exec(void *, void *, atag_header_t *, uintptr_t);
  58 
  59 extern void armv6_dcache_disable(void);
  60 extern void armv6_dcache_enable(void);
  61 extern void armv6_dcache_inval(void);
  62 extern void armv6_dcache_flush(void);
  63 
  64 extern void armv6_icache_disable(void);
  65 extern void armv6_icache_enable(void);
  66 extern void armv6_icache_inval(void);
  67 
  68 #ifdef __cplusplus
  69 }
  70 #endif
  71 
  72 #endif /* _FAKELOADER_H */