mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-23 07:39:22 +00:00
2010-01-03 Robert Millan <rmh.grub@aybabtu.com>
* boot/i386/pc/diskboot.S: Fix inaccurate comment. * util/i386/pc/grub-setup.c: Include `<assert.h>'. (struct boot_blocklist): Move from here ... * include/grub/i386/pc/boot.h [ASM_FILE] (struct grub_boot_blocklist): ... to here. Update all users. (setup): Only initialize `start' member of `first_block' structure. Add assert() calls to verify the other members. * util/i386/pc/grub-mkimage.c: Include `<assert.h>'. (generate_image): Fix broken blocklist length initialization. Add assert() call to verify blocklist `segment' field.
This commit is contained in:
1 parent
ab0eeb0c33
commit
3a73dcb6f5
5 files changed
+53
-24
No files matched your search
@@ -33,6 +33,7 @@
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
#define _GNU_SOURCE 1
|
||||
#include <getopt.h>
|
||||
@@ -212,10 +213,17 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
|
||||
|
||||
boot_img = grub_util_read_image (boot_path);
|
||||
|
||||
/* i386 is a little endian architecture. */
|
||||
*((grub_uint16_t *) (boot_img + GRUB_DISK_SECTOR_SIZE
|
||||
- GRUB_BOOT_MACHINE_LIST_SIZE + 8))
|
||||
= grub_cpu_to_le16 (num);
|
||||
{
|
||||
struct grub_boot_blocklist *block;
|
||||
block = (struct grub_boot_blocklist *) (boot_img
|
||||
+ GRUB_DISK_SECTOR_SIZE
|
||||
- sizeof (*block));
|
||||
block->len = grub_host_to_target16 (num);
|
||||
|
||||
/* This is filled elsewhere. Verify it just in case. */
|
||||
assert (block->segment == grub_host_to_target16 (GRUB_BOOT_MACHINE_KERNEL_SEG
|
||||
+ (GRUB_DISK_SECTOR_SIZE >> 4)));
|
||||
}
|
||||
|
||||
grub_util_write_image (boot_img, boot_size, out);
|
||||
free (boot_img);
|
||||
|
||||
Reference in new issue
Block a user