main.c (177152) | main.c (182723) |
---|---|
1/*- 2 * Copyright (c) 2000 Benno Rice <benno@jeamland.net> 3 * Copyright (c) 2000 Stephane Potvin <sepotvin@videotron.ca> 4 * Copyright (c) 2007 Semihalf, Rafal Jaworowski <raj@semihalf.com> 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 13 unchanged lines hidden (view full) --- 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 */ 28 29#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2000 Benno Rice <benno@jeamland.net> 3 * Copyright (c) 2000 Stephane Potvin <sepotvin@videotron.ca> 4 * Copyright (c) 2007 Semihalf, Rafal Jaworowski <raj@semihalf.com> 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 13 unchanged lines hidden (view full) --- 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 */ 28 29#include <sys/cdefs.h> |
30__FBSDID("$FreeBSD: head/sys/boot/uboot/common/main.c 177152 2008-03-13 17:54:21Z obrien $"); | 30__FBSDID("$FreeBSD: head/sys/boot/uboot/common/main.c 182723 2008-09-03 15:39:50Z raj $"); |
31 32#include <stand.h> 33 34#include "api_public.h" 35#include "bootstrap.h" 36#include "glue.h" 37#include "libuboot.h" 38 39struct uboot_devdesc currdev; 40struct arch_switch archsw; /* MI/MD interface boundary */ 41int devs_no; 42 43extern char end[]; 44extern char bootprog_name[]; 45extern char bootprog_rev[]; 46extern char bootprog_date[]; 47extern char bootprog_maker[]; 48 | 31 32#include <stand.h> 33 34#include "api_public.h" 35#include "bootstrap.h" 36#include "glue.h" 37#include "libuboot.h" 38 39struct uboot_devdesc currdev; 40struct arch_switch archsw; /* MI/MD interface boundary */ 41int devs_no; 42 43extern char end[]; 44extern char bootprog_name[]; 45extern char bootprog_rev[]; 46extern char bootprog_date[]; 47extern char bootprog_maker[]; 48 |
49static char bootargs[128]; 50 | |
51extern unsigned char _etext[]; 52extern unsigned char _edata[]; 53extern unsigned char __bss_start[]; 54extern unsigned char __sbss_start[]; 55extern unsigned char __sbss_end[]; 56extern unsigned char _end[]; 57 58void dump_si(struct sys_info *si) --- 46 unchanged lines hidden (view full) --- 105 size += (si->mr[i].size); 106 107 return (size); 108} 109 110int 111main(void) 112{ | 49extern unsigned char _etext[]; 50extern unsigned char _edata[]; 51extern unsigned char __bss_start[]; 52extern unsigned char __sbss_start[]; 53extern unsigned char __sbss_end[]; 54extern unsigned char _end[]; 55 56void dump_si(struct sys_info *si) --- 46 unchanged lines hidden (view full) --- 103 size += (si->mr[i].size); 104 105 return (size); 106} 107 108int 109main(void) 110{ |
113 char **bargv; 114 char *ch; 115 int bargc, i; | |
116 struct api_signature *sig = NULL; | 111 struct api_signature *sig = NULL; |
112 int i; |
|
117 118 if (!api_search_sig(&sig)) 119 return -1; 120 121 syscall_ptr = sig->syscall; 122 if (syscall_ptr == NULL) 123 return -2; 124 --- 4 unchanged lines hidden (view full) --- 129 bzero(__sbss_start, __sbss_end - __sbss_start); 130 bzero(__bss_start, _end - __bss_start); 131 132 /* 133 * Set up console. 134 */ 135 cons_probe(); 136 | 113 114 if (!api_search_sig(&sig)) 115 return -1; 116 117 syscall_ptr = sig->syscall; 118 if (syscall_ptr == NULL) 119 return -2; 120 --- 4 unchanged lines hidden (view full) --- 125 bzero(__sbss_start, __sbss_end - __sbss_start); 126 bzero(__bss_start, _end - __bss_start); 127 128 /* 129 * Set up console. 130 */ 131 cons_probe(); 132 |
137 printf("Compatible API signature found @%x\n", sig); | 133 printf("Compatible API signature found @%x\n", (uint32_t)sig); |
138 139 dump_sig(sig); 140 dump_addr_info(); 141 142 /* 143 * Initialise the heap as early as possible. Once this is done, 144 * alloc() is usable. The stack is buried inside us, so this is 145 * safe. --- 54 unchanged lines hidden (view full) --- 200 return 0; 201} 202 203 204COMMAND_SET(heap, "heap", "show heap usage", command_heap); 205static int 206command_heap(int argc, char *argv[]) 207{ | 134 135 dump_sig(sig); 136 dump_addr_info(); 137 138 /* 139 * Initialise the heap as early as possible. Once this is done, 140 * alloc() is usable. The stack is buried inside us, so this is 141 * safe. --- 54 unchanged lines hidden (view full) --- 196 return 0; 197} 198 199 200COMMAND_SET(heap, "heap", "show heap usage", command_heap); 201static int 202command_heap(int argc, char *argv[]) 203{ |
208 printf("heap base at %p, top at %p, used %ld\n", end, sbrk(0), | 204 205 printf("heap base at %p, top at %p, used %d\n", end, sbrk(0), |
209 sbrk(0) - end); 210 211 return(CMD_OK); 212} 213 214COMMAND_SET(reboot, "reboot", "reboot the system", command_reboot); 215static int 216command_reboot(int argc, char *argv[]) 217{ 218 printf("Resetting...\n"); 219 ub_reset(); 220 221 printf("Reset failed!\n"); 222 while(1); 223} | 206 sbrk(0) - end); 207 208 return(CMD_OK); 209} 210 211COMMAND_SET(reboot, "reboot", "reboot the system", command_reboot); 212static int 213command_reboot(int argc, char *argv[]) 214{ 215 printf("Resetting...\n"); 216 ub_reset(); 217 218 printf("Reset failed!\n"); 219 while(1); 220} |