Rev 33 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 33 | Rev 34 | ||
---|---|---|---|
Line 114... | Line 114... | ||
114 | PACKED (struct) fsentry_file_s // when (mode & S_IFMT) == S_IFREG |
114 | PACKED (struct) fsentry_file_s // when (mode & S_IFMT) == S_IFREG |
115 | { |
115 | { |
116 | uint32_t offset; // offset from header |
116 | uint32_t offset; // offset from header |
117 | uint32_t size; |
117 | uint32_t size; |
118 | char *path; // null terminated path (no leading slash) |
118 | char *path; // null terminated path (no leading slash) |
119 | uint8_t *UNSAVED_databuf; // file data blob buffer (convenience pointer, NOT SAVED IN THE IFS) |
- | |
120 | } file; |
119 | } file; |
121 | PACKED (struct) fsentry_dir_s // when (mode & S_IFMT) == S_IFDIR |
120 | PACKED (struct) fsentry_dir_s // when (mode & S_IFMT) == S_IFDIR |
122 | { |
121 | { |
123 | char *path; // null terminated path (no leading slash) |
122 | char *path; // null terminated path (no leading slash) |
124 | } dir; |
123 | } dir; |
Line 134... | Line 133... | ||
134 | uint32_t dev; |
133 | uint32_t dev; |
135 | uint32_t rdev; |
134 | uint32_t rdev; |
136 | char *path; // null terminated path (no leading slash) |
135 | char *path; // null terminated path (no leading slash) |
137 | } device; |
136 | } device; |
138 | } u; |
137 | } u; |
- | 138 | uint8_t *UNSAVED_databuf; // file data blob buffer (convenience pointer, NOT SAVED IN THE IFS) |
|
- | 139 | int UNSAVED_lineno; // line in the IFS build file at which this entry was defined (convenience member, NOT SAVED IN THE IFS) |
|
139 | bool UNSAVED_was_data_written; // whether this entry's data was written to the image (convenience member, NOT SAVED IN THE IFS) |
140 | bool UNSAVED_was_data_written; // whether this entry's data was written to the image (convenience member, NOT SAVED IN THE IFS) |
140 | } fsentry_t; |
141 | } fsentry_t; |
141 | END_OF_PACKED_STRUCT () // restore default alignment |
142 | END_OF_PACKED_STRUCT () // restore default alignment |
142 | 143 | ||
143 | 144 | ||
Line 242... | Line 243... | ||
242 | } bootargs_entry_t; |
243 | } bootargs_entry_t; |
243 | END_OF_PACKED_STRUCT () // restore default alignment |
244 | END_OF_PACKED_STRUCT () // restore default alignment |
244 | 245 | ||
245 | 246 | ||
246 | START_OF_PACKED_STRUCT () // we need byte-alignment for this struct |
247 | START_OF_PACKED_STRUCT () // we need byte-alignment for this struct |
247 | typedef PACKED (struct) uefi64_header_s |
248 | typedef PACKED (struct) uefi64_header_s |
248 | { |
249 | { |
249 | PACKED (struct) dos_header_s // size 64 bytes |
250 | PACKED (struct) dos_header_s // size 64 bytes |
250 | { |
251 | { |
251 | uint8_t signature[2]; // magic number, "MZ" |
252 | uint8_t signature[2]; // magic number, "MZ" |
252 | uint16_t bytes_in_last_page; // number of bytes on last 512-byte page of file (144 in our case) |
253 | uint16_t bytes_in_last_page; // number of bytes on last 512-byte page of file (144 in our case) |
Line 283... | Line 284... | ||
283 | PACKED (struct) pe_image_optional_header64_s |
284 | PACKED (struct) pe_image_optional_header64_s |
284 | { |
285 | { |
285 | uint8_t signature[2]; // magic value, "\x0b\x02" |
286 | uint8_t signature[2]; // magic value, "\x0b\x02" |
286 | uint8_t linker_version_major; // major version of the Microsoft linker used to produce this file (zero in our case) |
287 | uint8_t linker_version_major; // major version of the Microsoft linker used to produce this file (zero in our case) |
287 | uint8_t linker_version_minor; // minor version of the Microsoft linker used to produce this file (zero in our case) |
288 | uint8_t linker_version_minor; // minor version of the Microsoft linker used to produce this file (zero in our case) |
288 | uint32_t code_size; // size of the code section, in bytes, or the sum of all such sections if there are multiple code sections (total size of IFS minus 512 bytes for the UEFI boot |
289 | uint32_t code_size; // size of the code section, in bytes, or the sum of all such sections if there are multiple code sections (total size of IFS minus 512 bytes for the UEFI boot header with padding, i.e. size of startup blob plus size of image) |
289 | uint32_t size_of_initialized_data; // size of the initialized data section, in bytes, or the sum of all such sections if there are multiple initialized data sections (zero in our case) |
290 | uint32_t size_of_initialized_data; // size of the initialized data section, in bytes, or the sum of all such sections if there are multiple initialized data sections (zero in our case) |
290 | uint32_t size_of_uninitialized_data; // size of the uninitialized data section, in bytes, or the sum of all such sections if there are multiple uninitialized data sections (zero in our case) |
291 | uint32_t size_of_uninitialized_data; // size of the uninitialized data section, in bytes, or the sum of all such sections if there are multiple uninitialized data sections (zero in our case) |
291 | uint32_t entrypoint_address; // offset to the entry point function, relative to the image base address |
292 | uint32_t entrypoint_address; // offset to the entry point function, relative to the image base address |
292 | uint32_t code_base; // offset to the beginning of the code section, relative to the image base (zero in our case) |
293 | uint32_t code_base; // offset to the beginning of the code section, relative to the image base (zero in our case) |
293 | uint64_t image_base; // preferred address of the first byte of the image when it is loaded in memory, multiple of 64K bytes |
294 | uint64_t image_base; // preferred address of the first byte of the image when it is loaded in memory, multiple of 64K bytes |
294 | uint32_t section_alignment; // alignment of sections loaded in memory in bytes ; must be greater than or equal to file_alignment, defaults to system page size (4096 for AMD64) |
295 | uint32_t section_alignment; // alignment of sections loaded in memory in bytes ; must be greater than or equal to file_alignment, defaults to system page size (4096 for AMD64) |
295 | uint32_t file_alignment; // alignment of the raw data of sections in the image file, in bytes ; should be a power of 2 between 512 and 64K (inclusive) corresponding I suppose to to the minimal supported underlying filesystem block size (mkifs sets 512 here) |
296 | uint32_t file_alignment; // alignment of the raw data of sections in the image file, in bytes ; should be a power of 2 between 512 and 64K (inclusive) corresponding I suppose to to the minimal supported underlying filesystem block size (mkifs sets 512 here) |
296 | uint16_t os_version_major; // major version number of the required operating system (zero for UEFI) |
297 | uint16_t os_version_major; // major version number of the required operating system (zero for UEFI) |
297 | uint16_t os_version_minor; // minor version number of the required operating system (zero for UEFI) |
298 | uint16_t os_version_minor; // minor version number of the required operating system (zero for UEFI) |
298 | uint16_t image_version_major; // major version number of this image (mkifs sets zero here) |
299 | uint16_t image_version_major; // major version number of this image (mkifs sets zero here) |
Line 328... | Line 329... | ||
328 | uint32_t offset_to_linenos; // offset to the beginning of the line-number entries in this section (zero in our case) |
329 | uint32_t offset_to_linenos; // offset to the beginning of the line-number entries in this section (zero in our case) |
329 | uint16_t relocation_count; // number of relocation entries in this section (zero in our case) |
330 | uint16_t relocation_count; // number of relocation entries in this section (zero in our case) |
330 | uint16_t lineno_count; // number of line number entries in this section (zero in our case) |
331 | uint16_t lineno_count; // number of line number entries in this section (zero in our case) |
331 | uint32_t characteristics_bitmap; // bitmapped PE section characteristics (0x60, or 96 decimal, for: image contains code, image contains initialized data) |
332 | uint32_t characteristics_bitmap; // bitmapped PE section characteristics (0x60, or 96 decimal, for: image contains code, image contains initialized data) |
332 | } unique_section; |
333 | } unique_section; |
333 | uint8_t trailing_padding[80]; // zerofill |
- | |
334 | } uefi64_header_t; |
334 | } uefi64_header_t; |
335 | END_OF_PACKED_STRUCT () // restore default alignment |
335 | END_OF_PACKED_STRUCT () // restore default alignment |
336 | #define UEFI_DOS_STUB_PROGRAM_BYTES "\x0E\x1F\xBA\x0E\x00\xB4\x09\xCD\x21\xB8\x01\x4C\xCD\x21" "This program cannot be run in DOS mode.\r\r\n" "\x24\x00\x00\x00\x00\x00\x00\x00" // 64 bytes |
336 | #define UEFI_DOS_STUB_PROGRAM_BYTES "\x0E\x1F\xBA\x0E\x00\xB4\x09\xCD\x21\xB8\x01\x4C\xCD\x21" "This program cannot be run in DOS mode.\r\r\n" "\x24\x00\x00\x00\x00\x00\x00\x00" // 64 bytes |
337 | 337 | ||
338 | 338 | ||
339 | // undefine the helpers we no longer need |
339 | // undefine the helpers we no longer need |