gptboot.c (163765) | gptboot.c (163914) |
---|---|
1/*- 2 * Copyright (c) 1998 Robert Nordier 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms are freely 6 * permitted provided that the above copyright notice and this 7 * paragraph and the following disclaimer are duplicated in all 8 * such forms. 9 * 10 * This software is provided "AS IS" and without any express or 11 * implied warranties, including, without limitation, the implied 12 * warranties of merchantability and fitness for a particular 13 * purpose. 14 */ 15 16#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1998 Robert Nordier 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms are freely 6 * permitted provided that the above copyright notice and this 7 * paragraph and the following disclaimer are duplicated in all 8 * such forms. 9 * 10 * This software is provided "AS IS" and without any express or 11 * implied warranties, including, without limitation, the implied 12 * warranties of merchantability and fitness for a particular 13 * purpose. 14 */ 15 16#include <sys/cdefs.h> |
17__FBSDID("$FreeBSD: head/sys/boot/i386/gptboot/gptboot.c 163765 2006-10-29 14:50:58Z ru $"); | 17__FBSDID("$FreeBSD: head/sys/boot/i386/gptboot/gptboot.c 163914 2006-11-02 17:28:38Z ru $"); |
18 19#include <sys/param.h> 20#include <sys/disklabel.h> 21#include <sys/diskmbr.h> 22#include <sys/dirent.h> 23#include <sys/reboot.h> 24 25#include <machine/bootinfo.h> --- 303 unchanged lines hidden (view full) --- 329 fmt = 0; 330 else if (IS_ELF(hdr.eh)) 331 fmt = 1; 332 else { 333 printf("Invalid %s\n", "format"); 334 return; 335 } 336 if (fmt == 0) { | 18 19#include <sys/param.h> 20#include <sys/disklabel.h> 21#include <sys/diskmbr.h> 22#include <sys/dirent.h> 23#include <sys/reboot.h> 24 25#include <machine/bootinfo.h> --- 303 unchanged lines hidden (view full) --- 329 fmt = 0; 330 else if (IS_ELF(hdr.eh)) 331 fmt = 1; 332 else { 333 printf("Invalid %s\n", "format"); 334 return; 335 } 336 if (fmt == 0) { |
337 addr = hdr.ex.a_entry & 0x3fffffff; | 337 addr = hdr.ex.a_entry & 0xffffff; |
338 p = PTOV(addr); 339 fs_off = PAGE_SIZE; 340 if (xfsread(ino, p, hdr.ex.a_text)) 341 return; 342 p += roundup2(hdr.ex.a_text, PAGE_SIZE); 343 if (xfsread(ino, p, hdr.ex.a_data)) 344 return; 345 p += hdr.ex.a_data + roundup2(hdr.ex.a_bss, PAGE_SIZE); --- 17 unchanged lines hidden (view full) --- 363 fs_off = hdr.eh.e_phoff; 364 for (j = i = 0; i < hdr.eh.e_phnum && j < 2; i++) { 365 if (xfsread(ino, ep + j, sizeof(ep[0]))) 366 return; 367 if (ep[j].p_type == PT_LOAD) 368 j++; 369 } 370 for (i = 0; i < 2; i++) { | 338 p = PTOV(addr); 339 fs_off = PAGE_SIZE; 340 if (xfsread(ino, p, hdr.ex.a_text)) 341 return; 342 p += roundup2(hdr.ex.a_text, PAGE_SIZE); 343 if (xfsread(ino, p, hdr.ex.a_data)) 344 return; 345 p += hdr.ex.a_data + roundup2(hdr.ex.a_bss, PAGE_SIZE); --- 17 unchanged lines hidden (view full) --- 363 fs_off = hdr.eh.e_phoff; 364 for (j = i = 0; i < hdr.eh.e_phnum && j < 2; i++) { 365 if (xfsread(ino, ep + j, sizeof(ep[0]))) 366 return; 367 if (ep[j].p_type == PT_LOAD) 368 j++; 369 } 370 for (i = 0; i < 2; i++) { |
371 p = PTOV(ep[i].p_paddr & 0x3fffffff); | 371 p = PTOV(ep[i].p_paddr & 0xffffff); |
372 fs_off = ep[i].p_offset; 373 if (xfsread(ino, p, ep[i].p_filesz)) 374 return; 375 } 376 p += roundup2(ep[1].p_memsz, PAGE_SIZE); 377 bootinfo.bi_symtab = VTOP(p); 378 if (hdr.eh.e_shnum == hdr.eh.e_shstrndx + 3) { 379 fs_off = hdr.eh.e_shoff + sizeof(es[0]) * --- 4 unchanged lines hidden (view full) --- 384 memcpy(p, &es[i].sh_size, sizeof(es[i].sh_size)); 385 p += sizeof(es[i].sh_size); 386 fs_off = es[i].sh_offset; 387 if (xfsread(ino, p, es[i].sh_size)) 388 return; 389 p += es[i].sh_size; 390 } 391 } | 372 fs_off = ep[i].p_offset; 373 if (xfsread(ino, p, ep[i].p_filesz)) 374 return; 375 } 376 p += roundup2(ep[1].p_memsz, PAGE_SIZE); 377 bootinfo.bi_symtab = VTOP(p); 378 if (hdr.eh.e_shnum == hdr.eh.e_shstrndx + 3) { 379 fs_off = hdr.eh.e_shoff + sizeof(es[0]) * --- 4 unchanged lines hidden (view full) --- 384 memcpy(p, &es[i].sh_size, sizeof(es[i].sh_size)); 385 p += sizeof(es[i].sh_size); 386 fs_off = es[i].sh_offset; 387 if (xfsread(ino, p, es[i].sh_size)) 388 return; 389 p += es[i].sh_size; 390 } 391 } |
392 addr = hdr.eh.e_entry & 0x3fffffff; | 392 addr = hdr.eh.e_entry & 0xffffff; |
393 } 394 bootinfo.bi_esymtab = VTOP(p); 395 bootinfo.bi_kernelname = VTOP(kname); 396 bootinfo.bi_bios_dev = dsk.drive; 397 __exec((caddr_t)addr, RB_BOOTINFO | (opts & RBX_MASK), 398 MAKEBOOTDEV(dev_maj[dsk.type], 0, dsk.slice, dsk.unit, dsk.part), 399 0, 0, 0, VTOP(&bootinfo)); 400} --- 282 unchanged lines hidden --- | 393 } 394 bootinfo.bi_esymtab = VTOP(p); 395 bootinfo.bi_kernelname = VTOP(kname); 396 bootinfo.bi_bios_dev = dsk.drive; 397 __exec((caddr_t)addr, RB_BOOTINFO | (opts & RBX_MASK), 398 MAKEBOOTDEV(dev_maj[dsk.type], 0, dsk.slice, dsk.unit, dsk.part), 399 0, 0, 0, VTOP(&bootinfo)); 400} --- 282 unchanged lines hidden --- |