* grub-core/loader/i386/linux.c: Remove useless leftover pointer.

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2013-04-14 19:01:23 +02:00
parent b49fe8792a
commit cc2fa5ec1e
2 changed files with 35 additions and 33 deletions

View file

@ -1,3 +1,7 @@
2013-04-14 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/loader/i386/linux.c: Remove useless leftover pointer.
2013-04-14 Vladimir Serbinenko <phcoder@gmail.com> 2013-04-14 Vladimir Serbinenko <phcoder@gmail.com>
Move GRUB out of system area when using xorriso 1.2.9 or later. Move GRUB out of system area when using xorriso 1.2.9 or later.

View file

@ -688,7 +688,6 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
{ {
grub_file_t file = 0; grub_file_t file = 0;
struct linux_kernel_header lh; struct linux_kernel_header lh;
struct linux_kernel_params *params;
grub_uint8_t setup_sects; grub_uint8_t setup_sects;
grub_size_t real_size, prot_size, prot_file_size; grub_size_t real_size, prot_size, prot_file_size;
grub_ssize_t len; grub_ssize_t len;
@ -808,16 +807,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
preferred_address)) preferred_address))
goto fail; goto fail;
params = (struct linux_kernel_params *) &linux_params; grub_memset (&linux_params, 0, sizeof (linux_params));
grub_memset (params, 0, sizeof (*params)); grub_memcpy (&linux_params.setup_sects, &lh.setup_sects, sizeof (lh) - 0x1F1);
grub_memcpy (&params->setup_sects, &lh.setup_sects, sizeof (lh) - 0x1F1);
params->code32_start = prot_mode_target + lh.code32_start - GRUB_LINUX_BZIMAGE_ADDR; linux_params.code32_start = prot_mode_target + lh.code32_start - GRUB_LINUX_BZIMAGE_ADDR;
params->kernel_alignment = (1 << align); linux_params.kernel_alignment = (1 << align);
params->ps_mouse = params->padding10 = 0; linux_params.ps_mouse = linux_params.padding10 = 0;
len = sizeof (*params) - sizeof (lh); len = sizeof (linux_params) - sizeof (lh);
if (grub_file_read (file, (char *) params + sizeof (lh), len) != len) if (grub_file_read (file, (char *) &linux_params + sizeof (lh), len) != len)
{ {
if (!grub_errno) if (!grub_errno)
grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
@ -825,58 +823,58 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
goto fail; goto fail;
} }
params->type_of_loader = GRUB_LINUX_BOOT_LOADER_TYPE; linux_params.type_of_loader = GRUB_LINUX_BOOT_LOADER_TYPE;
/* These two are used (instead of cmd_line_ptr) by older versions of Linux, /* These two are used (instead of cmd_line_ptr) by older versions of Linux,
and otherwise ignored. */ and otherwise ignored. */
params->cl_magic = GRUB_LINUX_CL_MAGIC; linux_params.cl_magic = GRUB_LINUX_CL_MAGIC;
params->cl_offset = 0x1000; linux_params.cl_offset = 0x1000;
params->ramdisk_image = 0; linux_params.ramdisk_image = 0;
params->ramdisk_size = 0; linux_params.ramdisk_size = 0;
params->heap_end_ptr = GRUB_LINUX_HEAP_END_OFFSET; linux_params.heap_end_ptr = GRUB_LINUX_HEAP_END_OFFSET;
params->loadflags |= GRUB_LINUX_FLAG_CAN_USE_HEAP; linux_params.loadflags |= GRUB_LINUX_FLAG_CAN_USE_HEAP;
/* These are not needed to be precise, because Linux uses these values /* These are not needed to be precise, because Linux uses these values
only to raise an error when the decompression code cannot find good only to raise an error when the decompression code cannot find good
space. */ space. */
params->ext_mem = ((32 * 0x100000) >> 10); linux_params.ext_mem = ((32 * 0x100000) >> 10);
params->alt_mem = ((32 * 0x100000) >> 10); linux_params.alt_mem = ((32 * 0x100000) >> 10);
/* Ignored by Linux. */ /* Ignored by Linux. */
params->video_page = 0; linux_params.video_page = 0;
/* Only used when `video_mode == 0x7', otherwise ignored. */ /* Only used when `video_mode == 0x7', otherwise ignored. */
params->video_ega_bx = 0; linux_params.video_ega_bx = 0;
params->font_size = 16; /* XXX */ linux_params.font_size = 16; /* XXX */
#ifdef GRUB_MACHINE_EFI #ifdef GRUB_MACHINE_EFI
#ifdef __x86_64__ #ifdef __x86_64__
if (grub_le_to_cpu16 (params->version) < 0x0208 && if (grub_le_to_cpu16 (linux_params.version) < 0x0208 &&
((grub_addr_t) grub_efi_system_table >> 32) != 0) ((grub_addr_t) grub_efi_system_table >> 32) != 0)
return grub_error(GRUB_ERR_BAD_OS, return grub_error(GRUB_ERR_BAD_OS,
"kernel does not support 64-bit addressing"); "kernel does not support 64-bit addressing");
#endif #endif
if (grub_le_to_cpu16 (params->version) >= 0x0208) if (grub_le_to_cpu16 (linux_params.version) >= 0x0208)
{ {
params->v0208.efi_signature = GRUB_LINUX_EFI_SIGNATURE; linux_params.v0208.efi_signature = GRUB_LINUX_EFI_SIGNATURE;
params->v0208.efi_system_table = (grub_uint32_t) (unsigned long) grub_efi_system_table; linux_params.v0208.efi_system_table = (grub_uint32_t) (unsigned long) grub_efi_system_table;
#ifdef __x86_64__ #ifdef __x86_64__
params->v0208.efi_system_table_hi = (grub_uint32_t) ((grub_uint64_t) grub_efi_system_table >> 32); linux_params.v0208.efi_system_table_hi = (grub_uint32_t) ((grub_uint64_t) grub_efi_system_table >> 32);
#endif #endif
} }
else if (grub_le_to_cpu16 (params->version) >= 0x0206) else if (grub_le_to_cpu16 (linux_params.version) >= 0x0206)
{ {
params->v0206.efi_signature = GRUB_LINUX_EFI_SIGNATURE; linux_params.v0206.efi_signature = GRUB_LINUX_EFI_SIGNATURE;
params->v0206.efi_system_table = (grub_uint32_t) (unsigned long) grub_efi_system_table; linux_params.v0206.efi_system_table = (grub_uint32_t) (unsigned long) grub_efi_system_table;
} }
else if (grub_le_to_cpu16 (params->version) >= 0x0204) else if (grub_le_to_cpu16 (linux_params.version) >= 0x0204)
{ {
params->v0204.efi_signature = GRUB_LINUX_EFI_SIGNATURE_0204; linux_params.v0204.efi_signature = GRUB_LINUX_EFI_SIGNATURE_0204;
params->v0204.efi_system_table = (grub_uint32_t) (unsigned long) grub_efi_system_table; linux_params.v0204.efi_system_table = (grub_uint32_t) (unsigned long) grub_efi_system_table;
} }
#endif #endif
@ -1012,7 +1010,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
} }
else if (grub_memcmp (argv[i], "quiet", sizeof ("quiet") - 1) == 0) else if (grub_memcmp (argv[i], "quiet", sizeof ("quiet") - 1) == 0)
{ {
params->loadflags |= GRUB_LINUX_FLAG_QUIET; linux_params.loadflags |= GRUB_LINUX_FLAG_QUIET;
} }
/* Create kernel command line. */ /* Create kernel command line. */