Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 305423
b: refs/heads/master
c: e31be36
h: refs/heads/master
i:
  305421: 965f235
  305419: 4267eee
  305415: cbae9c0
  305407: 41e60bf
v: v3
  • Loading branch information
Matt Fleming authored and H. Peter Anvin committed Mar 26, 2012
1 parent f8bc604 commit c9e4d1d
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2e064b1e131eba262c0ba4268cb79dbc72edeece
refs/heads/master: e31be363df3092821bf179cf4baa076f501b8ae6
14 changes: 11 additions & 3 deletions trunk/arch/x86/boot/compressed/eboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -904,11 +904,19 @@ struct boot_params *efi_main(void *handle, efi_system_table_t *_table)

memset(boot_params, 0x0, 0x4000);

/* Copy first two sectors to boot_params */
memcpy(boot_params, image->image_base, 1024);

hdr = &boot_params->hdr;

/* Copy the second sector to boot_params */
memcpy(&hdr->jump, image->image_base + 512, 512);

/*
* Fill out some of the header fields ourselves because the
* EFI firmware loader doesn't load the first sector.
*/
hdr->root_flags = 1;
hdr->vid_mode = 0xffff;
hdr->boot_flag = 0xAA55;

/*
* The EFI firmware loader could have placed the kernel image
* anywhere in memory, but the kernel has various restrictions
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/x86/boot/header.S
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ optional_header:
# Filled in by build.c
.long 0x0000 # AddressOfEntryPoint

.long 0x0000 # BaseOfCode
.long 0x0200 # BaseOfCode
#ifdef CONFIG_X86_32
.long 0 # data
#endif
Expand Down
25 changes: 22 additions & 3 deletions trunk/arch/x86/boot/tools/build.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,21 +202,34 @@ int main(int argc, char ** argv)

pe_header = *(unsigned int *)&buf[0x3c];

/* Size of code */
*(unsigned int *)&buf[pe_header + 0x1c] = file_sz;

/* Size of image */
*(unsigned int *)&buf[pe_header + 0x50] = file_sz;

/*
* Subtract the size of the first section (512 bytes) which
* includes the header and .reloc section. The remaining size
* is that of the .text section.
*/
file_sz -= 512;

/* Size of code */
*(unsigned int *)&buf[pe_header + 0x1c] = file_sz;

#ifdef CONFIG_X86_32
/* Address of entry point */
*(unsigned int *)&buf[pe_header + 0x28] = i;

/* .text size */
*(unsigned int *)&buf[pe_header + 0xb0] = file_sz;

/* .text vma */
*(unsigned int *)&buf[pe_header + 0xb4] = 0x200;

/* .text size of initialised data */
*(unsigned int *)&buf[pe_header + 0xb8] = file_sz;

/* .text file offset */
*(unsigned int *)&buf[pe_header + 0xbc] = 0x200;
#else
/*
* Address of entry point. startup_32 is at the beginning and
Expand All @@ -228,8 +241,14 @@ int main(int argc, char ** argv)
/* .text size */
*(unsigned int *)&buf[pe_header + 0xc0] = file_sz;

/* .text vma */
*(unsigned int *)&buf[pe_header + 0xc4] = 0x200;

/* .text size of initialised data */
*(unsigned int *)&buf[pe_header + 0xc8] = file_sz;

/* .text file offset */
*(unsigned int *)&buf[pe_header + 0xcc] = 0x200;
#endif /* CONFIG_X86_32 */
#endif /* CONFIG_EFI_STUB */

Expand Down

0 comments on commit c9e4d1d

Please sign in to comment.