Deleted Added
full compact
boot1.c (95340) boot1.c (95342)
1/*
2 * Copyright (c) 1998 Robert Nordier
3 * All rights reserved.
4 * Copyright (c) 2001 Robert Drehmel
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms are freely
8 * permitted provided that the above copyright notice and this
9 * paragraph and the following disclaimer are duplicated in all
10 * such forms.
11 *
12 * This software is provided "AS IS" and without any express or
13 * implied warranties, including, without limitation, the implied
14 * warranties of merchantability and fitness for a particular
15 * purpose.
16 *
17 */
18
19#include <sys/cdefs.h>
1/*
2 * Copyright (c) 1998 Robert Nordier
3 * All rights reserved.
4 * Copyright (c) 2001 Robert Drehmel
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms are freely
8 * permitted provided that the above copyright notice and this
9 * paragraph and the following disclaimer are duplicated in all
10 * such forms.
11 *
12 * This software is provided "AS IS" and without any express or
13 * implied warranties, including, without limitation, the implied
14 * warranties of merchantability and fitness for a particular
15 * purpose.
16 *
17 */
18
19#include <sys/cdefs.h>
20__FBSDID("$FreeBSD: head/sys/boot/sparc64/boot1/boot1.c 95340 2002-04-24 02:24:32Z jake $");
20__FBSDID("$FreeBSD: head/sys/boot/sparc64/boot1/boot1.c 95342 2002-04-24 02:50:59Z jake $");
21
22#include <sys/param.h>
23#include <sys/reboot.h>
24#include <sys/diskslice.h>
25#include <sys/disklabel.h>
26#include <sys/dirent.h>
27#include <machine/elf.h>
28#include <machine/stdarg.h>

--- 18 unchanged lines hidden (view full) ---

47struct disk dsk;
48
49extern uint32_t _end;
50
51static char bname[1024]; /* name of the binary to load */
52static uint32_t fs_off;
53
54int main(void);
21
22#include <sys/param.h>
23#include <sys/reboot.h>
24#include <sys/diskslice.h>
25#include <sys/disklabel.h>
26#include <sys/dirent.h>
27#include <machine/elf.h>
28#include <machine/stdarg.h>

--- 18 unchanged lines hidden (view full) ---

47struct disk dsk;
48
49extern uint32_t _end;
50
51static char bname[1024]; /* name of the binary to load */
52static uint32_t fs_off;
53
54int main(void);
55void exit(int);
55static void exit(int);
56static void load(const char *);
57static ino_t lookup(const char *);
58static ssize_t fsread(ino_t, void *, size_t);
59static int dskread(void *, u_int64_t, int);
60static int printf(const char *, ...);
61static int putchar(int);
62
63static void bcopy(const void *src, void *dst, size_t len);

--- 36 unchanged lines hidden (view full) ---

100 ofw_getprop(chosenh, "stdin", &stdinh, sizeof(stdinh));
101 ofw_getprop(chosenh, "stdout", &stdouth, sizeof(stdouth));
102 ofw_getprop(chosenh, "bootpath", bootpath, sizeof(bootpath));
103
104 if ((bootdevh = ofw_open(bootpath)) == -1) {
105 printf("Could not open boot device.\n");
106 }
107
56static void load(const char *);
57static ino_t lookup(const char *);
58static ssize_t fsread(ino_t, void *, size_t);
59static int dskread(void *, u_int64_t, int);
60static int printf(const char *, ...);
61static int putchar(int);
62
63static void bcopy(const void *src, void *dst, size_t len);

--- 36 unchanged lines hidden (view full) ---

100 ofw_getprop(chosenh, "stdin", &stdinh, sizeof(stdinh));
101 ofw_getprop(chosenh, "stdout", &stdouth, sizeof(stdouth));
102 ofw_getprop(chosenh, "bootpath", bootpath, sizeof(bootpath));
103
104 if ((bootdevh = ofw_open(bootpath)) == -1) {
105 printf("Could not open boot device.\n");
106 }
107
108 main();
109 d = d1 = d2 = d3; /* make GCC happy */
108 exit(main());
110}
111
112ofwh_t
113ofw_finddevice(const char *name)
114{
115 ofwcell_t args[] = {
116 (ofwcell_t)"finddevice",
117 1,

--- 121 unchanged lines hidden (view full) ---

239
240 if ((*ofw)(args)) {
241 printf("ofw_seek: devh=0x%x off=0x%lx\n", devh, off);
242 return (1);
243 }
244 return (0);
245}
246
109}
110
111ofwh_t
112ofw_finddevice(const char *name)
113{
114 ofwcell_t args[] = {
115 (ofwcell_t)"finddevice",
116 1,

--- 121 unchanged lines hidden (view full) ---

238
239 if ((*ofw)(args)) {
240 printf("ofw_seek: devh=0x%x off=0x%lx\n", devh, off);
241 return (1);
242 }
243 return (0);
244}
245
246void
247ofw_exit(void)
248{
249 ofwcell_t args[3];
250
251 args[0] = (ofwcell_t)"exit";
252 args[1] = 0;
253 args[2] = 0;
254
255 (*ofw)(args);
256}
257
247static void
248bcopy(const void *dst, void *src, size_t len)
249{
250 const char *d = dst;
251 char *s = src;
252
253 while (len-- != 0)
254 *s++ = *d++;

--- 56 unchanged lines hidden (view full) ---

311 printf(" \n>> FreeBSD/sparc64 boot block\n"
312 " Boot path: %s\n"
313 " Boot loader: %s\n", bootpath, _PATH_LOADER);
314 load(bname);
315 return (1);
316}
317
318static void
258static void
259bcopy(const void *dst, void *src, size_t len)
260{
261 const char *d = dst;
262 char *s = src;
263
264 while (len-- != 0)
265 *s++ = *d++;

--- 56 unchanged lines hidden (view full) ---

322 printf(" \n>> FreeBSD/sparc64 boot block\n"
323 " Boot path: %s\n"
324 " Boot loader: %s\n", bootpath, _PATH_LOADER);
325 load(bname);
326 return (1);
327}
328
329static void
330exit(int code)
331{
332
333 ofw_exit();
334}
335
336static void
319load(const char *fname)
320{
321 Elf64_Ehdr eh;
322 Elf64_Phdr ph;
323 caddr_t p;
324 ino_t ino;
325 int i;
326

--- 227 unchanged lines hidden ---
337load(const char *fname)
338{
339 Elf64_Ehdr eh;
340 Elf64_Phdr ph;
341 caddr_t p;
342 ino_t ino;
343 int i;
344

--- 227 unchanged lines hidden ---