OLD | NEW |
1 /* BFD back-end for PPCbug boot records. | 1 /* BFD back-end for PPCbug boot records. |
2 Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, | 2 Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, |
3 2007, 2008, 2009, 2011 Free Software Foundation, Inc. | 3 2007, 2008, 2009, 2011, 2012 Free Software Foundation, Inc. |
4 Written by Michael Meissner, Cygnus Support, <meissner@cygnus.com> | 4 Written by Michael Meissner, Cygnus Support, <meissner@cygnus.com> |
5 | 5 |
6 This file is part of BFD, the Binary File Descriptor library. | 6 This file is part of BFD, the Binary File Descriptor library. |
7 | 7 |
8 This program is free software; you can redistribute it and/or modify | 8 This program is free software; you can redistribute it and/or modify |
9 it under the terms of the GNU General Public License as published by | 9 it under the terms of the GNU General Public License as published by |
10 the Free Software Foundation; either version 3 of the License, or | 10 the Free Software Foundation; either version 3 of the License, or |
11 (at your option) any later version. | 11 (at your option) any later version. |
12 | 12 |
13 This program is distributed in the hope that it will be useful, | 13 This program is distributed in the hope that it will be useful, |
(...skipping 19 matching lines...) Expand all Loading... |
33 instead to indicate the number of zeroes to skip at the start of | 33 instead to indicate the number of zeroes to skip at the start of |
34 the file. objcopy cooperates by specially setting the start | 34 the file. objcopy cooperates by specially setting the start |
35 address to zero by default. */ | 35 address to zero by default. */ |
36 | 36 |
37 #include "sysdep.h" | 37 #include "sysdep.h" |
38 #include "safe-ctype.h" | 38 #include "safe-ctype.h" |
39 #include "bfd.h" | 39 #include "bfd.h" |
40 #include "libbfd.h" | 40 #include "libbfd.h" |
41 | 41 |
42 /* PPCbug location structure */ | 42 /* PPCbug location structure */ |
43 typedef struct ppcboot_location { | 43 typedef struct ppcboot_location |
| 44 { |
44 bfd_byte ind; | 45 bfd_byte ind; |
45 bfd_byte head; | 46 bfd_byte head; |
46 bfd_byte sector; | 47 bfd_byte sector; |
47 bfd_byte cylinder; | 48 bfd_byte cylinder; |
48 } ppcboot_location_t; | 49 } ppcboot_location_t; |
49 | 50 |
50 /* PPCbug partition table layout */ | 51 /* PPCbug partition table layout */ |
51 typedef struct ppcboot_partition { | 52 typedef struct ppcboot_partition |
| 53 { |
52 ppcboot_location_t partition_begin; /* partition begin */ | 54 ppcboot_location_t partition_begin; /* partition begin */ |
53 ppcboot_location_t partition_end; /* partition end */ | 55 ppcboot_location_t partition_end; /* partition end */ |
54 bfd_byte sector_begin[4]; /* 32-bit start RBA (zero-based)
, little endian */ | 56 bfd_byte sector_begin[4]; /* 32-bit start RBA (zero-based)
, little endian */ |
55 bfd_byte sector_length[4]; /* 32-bit RBA count (one-based),
little endian */ | 57 bfd_byte sector_length[4]; /* 32-bit RBA count (one-based),
little endian */ |
56 } ppcboot_partition_t; | 58 } ppcboot_partition_t; |
57 | 59 |
58 /* PPCbug boot layout. */ | 60 /* PPCbug boot layout. */ |
59 typedef struct ppcboot_hdr { | 61 typedef struct ppcboot_hdr |
| 62 { |
60 bfd_byte pc_compatibility[446]; /* x86 instruction field */ | 63 bfd_byte pc_compatibility[446]; /* x86 instruction field */ |
61 ppcboot_partition_t partition[4]; /* partition information */ | 64 ppcboot_partition_t partition[4]; /* partition information */ |
62 bfd_byte signature[2]; /* 0x55 and 0xaa */ | 65 bfd_byte signature[2]; /* 0x55 and 0xaa */ |
63 bfd_byte entry_offset[4]; /* entry point offset, little en
dian */ | 66 bfd_byte entry_offset[4]; /* entry point offset, little en
dian */ |
64 bfd_byte length[4]; /* load image length, little end
ian */ | 67 bfd_byte length[4]; /* load image length, little end
ian */ |
65 bfd_byte flags; /* flag field */ | 68 bfd_byte flags; /* flag field */ |
66 bfd_byte os_id; /* OS_ID */ | 69 bfd_byte os_id; /* OS_ID */ |
67 char partition_name[32]; /* partition name */ | 70 char partition_name[32]; /* partition name */ |
68 bfd_byte reserved1[470]; /* reserved */ | 71 bfd_byte reserved1[470]; /* reserved */ |
69 } | 72 } |
70 #ifdef __GNUC__ | 73 #ifdef __GNUC__ |
71 __attribute__ ((packed)) | 74 __attribute__ ((packed)) |
72 #endif | 75 #endif |
73 ppcboot_hdr_t; | 76 ppcboot_hdr_t; |
74 | 77 |
75 /* Signature bytes for last 2 bytes of the 512 byte record */ | 78 /* Signature bytes for last 2 bytes of the 512 byte record */ |
76 #define SIGNATURE0 0x55 | 79 #define SIGNATURE0 0x55 |
77 #define SIGNATURE1 0xaa | 80 #define SIGNATURE1 0xaa |
78 | 81 |
79 /* PowerPC boot type */ | 82 /* PowerPC boot type */ |
80 #define PPC_IND 0x41 | 83 #define PPC_IND 0x41 |
81 | 84 |
82 /* Information needed for ppcboot header */ | 85 /* Information needed for ppcboot header */ |
83 typedef struct ppcboot_data { | 86 typedef struct ppcboot_data |
| 87 { |
84 ppcboot_hdr_t header; /* raw header */ | 88 ppcboot_hdr_t header; /* raw header */ |
85 asection *sec; /* single section */ | 89 asection *sec; /* single section */ |
86 } ppcboot_data_t; | 90 } ppcboot_data_t; |
87 | 91 |
88 /* Any bfd we create by reading a ppcboot file has three symbols: | 92 /* Any bfd we create by reading a ppcboot file has three symbols: |
error: old chunk mismatch |
None
OLD | NEW |