remove all trailing whitespace

This commit is contained in:
fzielcke 2009-06-10 21:04:23 +00:00
parent d2d4966571
commit b39f9d20a9
222 changed files with 3286 additions and 3286 deletions

View file

@ -117,7 +117,7 @@ grub_mini_print_devices (const char *name)
}
static int
grub_mini_print_files (const char *filename,
grub_mini_print_files (const char *filename,
const struct grub_dirhook_info *info)
{
grub_printf ("%s%s ", filename, info->dir ? "/" : "");

View file

@ -41,11 +41,11 @@ grub_device_open (const char *name)
goto fail;
}
}
dev = grub_malloc (sizeof (*dev));
if (! dev)
goto fail;
/* Try to open a disk. */
disk = grub_disk_open (name);
if (! disk)
@ -59,7 +59,7 @@ grub_device_open (const char *name)
fail:
if (disk)
grub_disk_close (disk);
grub_free (dev);
return 0;
@ -82,7 +82,7 @@ grub_device_iterate (int (*hook) (const char *name))
auto int iterate_disk (const char *disk_name);
auto int iterate_partition (grub_disk_t disk,
const grub_partition_t partition);
struct part_ent
{
struct part_ent *next;
@ -95,11 +95,11 @@ grub_device_iterate (int (*hook) (const char *name))
if (hook (disk_name))
return 1;
dev = grub_device_open (disk_name);
if (! dev)
return 0;
if (dev->disk && dev->disk->has_partitions)
{
struct part_ent *p;
@ -127,12 +127,12 @@ grub_device_iterate (int (*hook) (const char *name))
grub_device_close (dev);
return 0;
}
int iterate_partition (grub_disk_t disk, const grub_partition_t partition)
{
char *partition_name;
struct part_ent *p;
partition_name = grub_partition_get_name (partition);
if (! partition_name)
return 1;

View file

@ -132,7 +132,7 @@ grub_disk_cache_fetch (unsigned long dev_id, unsigned long disk_id,
#if 0
grub_disk_cache_misses++;
#endif
return 0;
}
@ -157,19 +157,19 @@ grub_disk_cache_store (unsigned long dev_id, unsigned long disk_id,
{
unsigned index;
struct grub_disk_cache *cache;
index = grub_disk_cache_get_index (dev_id, disk_id, sector);
cache = grub_disk_cache_table + index;
cache->lock = 1;
grub_free (cache->data);
cache->data = 0;
cache->lock = 0;
cache->data = grub_malloc (GRUB_DISK_SECTOR_SIZE << GRUB_DISK_CACHE_BITS);
if (! cache->data)
return grub_errno;
grub_memcpy (cache->data, data,
GRUB_DISK_SECTOR_SIZE << GRUB_DISK_CACHE_BITS);
cache->dev_id = dev_id;
@ -194,7 +194,7 @@ void
grub_disk_dev_unregister (grub_disk_dev_t dev)
{
grub_disk_dev_t *p, q;
for (p = &grub_disk_dev_list, q = *p; q; p = &(q->next), q = q->next)
if (q == dev)
{
@ -255,12 +255,12 @@ grub_disk_open (const char *name)
disk->name = grub_strdup (name);
if (! disk->name)
goto fail;
p = find_part_sep (name);
if (p)
{
grub_size_t len = p - name;
raw = grub_malloc (len + 1);
if (! raw)
goto fail;
@ -290,7 +290,7 @@ grub_disk_open (const char *name)
grub_error (GRUB_ERR_BAD_DEVICE, "no partition on this disk");
goto fail;
}
disk->dev = dev;
if (p)
@ -310,11 +310,11 @@ grub_disk_open (const char *name)
if (current_time > (grub_last_time
+ GRUB_CACHE_TIMEOUT * 1000))
grub_disk_cache_invalidate_all ();
grub_last_time = current_time;
fail:
if (raw && raw != name)
grub_free (raw);
@ -357,7 +357,7 @@ grub_disk_adjust_range (grub_disk_t disk, grub_disk_addr_t *sector,
{
*sector += *offset >> GRUB_DISK_SECTOR_BITS;
*offset &= GRUB_DISK_SECTOR_SIZE - 1;
if (disk->partition)
{
grub_disk_addr_t start;
@ -391,7 +391,7 @@ grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector,
unsigned real_offset;
grub_dprintf ("disk", "Reading `%s'...\n", disk->name);
/* First of all, check if the region is within the disk. */
if (grub_disk_adjust_range (disk, &sector, &offset, size) != GRUB_ERR_NONE)
{
@ -403,7 +403,7 @@ grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector,
}
real_offset = offset;
/* Allocate a temporary buffer. */
tmp_buf = grub_malloc (GRUB_DISK_SECTOR_SIZE << GRUB_DISK_CACHE_BITS);
if (! tmp_buf)
@ -454,7 +454,7 @@ grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector,
goto finish;
tmp_buf = p;
if ((disk->dev->read) (disk, sector, num, tmp_buf))
{
grub_error_push ();
@ -493,33 +493,33 @@ grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector,
{
grub_disk_addr_t s = sector;
grub_size_t l = len;
while (l)
{
(disk->read_hook) (s, real_offset,
((l > GRUB_DISK_SECTOR_SIZE)
? GRUB_DISK_SECTOR_SIZE
: l));
if (l < GRUB_DISK_SECTOR_SIZE - real_offset)
break;
s++;
l -= GRUB_DISK_SECTOR_SIZE - real_offset;
real_offset = 0;
}
}
sector = start_sector + GRUB_DISK_CACHE_SIZE;
buf = (char *) buf + len;
size -= len;
real_offset = 0;
}
finish:
grub_free (tmp_buf);
return grub_errno;
}
@ -528,21 +528,21 @@ grub_disk_write (grub_disk_t disk, grub_disk_addr_t sector,
grub_off_t offset, grub_size_t size, const void *buf)
{
unsigned real_offset;
grub_dprintf ("disk", "Writing `%s'...\n", disk->name);
if (grub_disk_adjust_range (disk, &sector, &offset, size) != GRUB_ERR_NONE)
return -1;
real_offset = offset;
while (size)
{
if (real_offset != 0 || (size < GRUB_DISK_SECTOR_SIZE && size != 0))
{
char tmp_buf[GRUB_DISK_SECTOR_SIZE];
grub_size_t len;
if (grub_disk_read (disk, sector, 0, GRUB_DISK_SECTOR_SIZE, tmp_buf)
!= GRUB_ERR_NONE)
goto finish;
@ -550,7 +550,7 @@ grub_disk_write (grub_disk_t disk, grub_disk_addr_t sector,
len = GRUB_DISK_SECTOR_SIZE - real_offset;
if (len > size)
len = size;
grub_memcpy (tmp_buf + real_offset, buf, len);
grub_disk_cache_invalidate (disk->dev->id, disk->id, sector);
@ -570,7 +570,7 @@ grub_disk_write (grub_disk_t disk, grub_disk_addr_t sector,
len = size & ~(GRUB_DISK_SECTOR_SIZE - 1);
n = size >> GRUB_DISK_SECTOR_BITS;
if ((disk->dev->write) (disk, sector, n, buf) != GRUB_ERR_NONE)
goto finish;
@ -587,7 +587,7 @@ grub_disk_write (grub_disk_t disk, grub_disk_addr_t sector,
return grub_errno;
}
grub_uint64_t
grub_uint64_t
grub_disk_get_size (grub_disk_t disk)
{
if (disk->partition)

View file

@ -72,7 +72,7 @@ grub_dl_add (grub_dl_t mod)
if (grub_dl_get (mod->name))
return grub_error (GRUB_ERR_BAD_MODULE,
"`%s' is already loaded", mod->name);
l = (grub_dl_list_t) grub_malloc (sizeof (*l));
if (! l)
return grub_errno;
@ -169,7 +169,7 @@ grub_dl_register_symbol (const char *name, void *addr, grub_dl_t mod)
{
grub_symbol_t sym;
unsigned k;
sym = (grub_symbol_t) grub_malloc (sizeof (*sym));
if (! sym)
return grub_errno;
@ -185,10 +185,10 @@ grub_dl_register_symbol (const char *name, void *addr, grub_dl_t mod)
}
else
sym->name = name;
sym->addr = addr;
sym->mod = mod;
k = grub_symbol_hash (name);
sym->next = grub_symtab[k];
grub_symtab[k] = sym;
@ -204,7 +204,7 @@ grub_dl_unregister_symbols (grub_dl_t mod)
if (! mod)
grub_fatal ("core symbols cannot be unregistered");
for (i = 0; i < GRUB_SYMTAB_SIZE; i++)
{
grub_symbol_t sym, *p, q;
@ -266,7 +266,7 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e)
{
unsigned i;
Elf_Shdr *s;
for (i = 0, s = (Elf_Shdr *)((char *) e + e->e_shoff);
i < e->e_shnum;
i++, s = (Elf_Shdr *)((char *) s + e->e_shentsize))
@ -278,7 +278,7 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e)
seg = (grub_dl_segment_t) grub_malloc (sizeof (*seg));
if (! seg)
return grub_errno;
if (s->sh_size)
{
void *addr;
@ -323,7 +323,7 @@ grub_dl_resolve_symbols (grub_dl_t mod, Elf_Ehdr *e)
Elf_Sym *sym;
const char *str;
Elf_Word size, entsize;
for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff);
i < e->e_shnum;
i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize))
@ -336,7 +336,7 @@ grub_dl_resolve_symbols (grub_dl_t mod, Elf_Ehdr *e)
sym = (Elf_Sym *) ((char *) e + s->sh_offset);
size = s->sh_size;
entsize = s->sh_entsize;
s = (Elf_Shdr *) ((char *) e + e->e_shoff + e->e_shentsize * s->sh_link);
str = (char *) e + s->sh_offset;
@ -347,7 +347,7 @@ grub_dl_resolve_symbols (grub_dl_t mod, Elf_Ehdr *e)
unsigned char type = ELF_ST_TYPE (sym->st_info);
unsigned char bind = ELF_ST_BIND (sym->st_info);
const char *name = str + sym->st_name;
switch (type)
{
case STT_NOTYPE:
@ -377,7 +377,7 @@ grub_dl_resolve_symbols (grub_dl_t mod, Elf_Ehdr *e)
if (bind != STB_LOCAL)
if (grub_dl_register_symbol (name, (void *) sym->st_value, mod))
return grub_errno;
if (grub_strcmp (name, "grub_mod_init") == 0)
mod->init = (void (*) (grub_dl_t)) sym->st_value;
else if (grub_strcmp (name, "grub_mod_fini") == 0)
@ -445,7 +445,7 @@ grub_dl_resolve_dependencies (grub_dl_t mod, Elf_Ehdr *e)
s = (Elf_Shdr *) ((char *) e + e->e_shoff + e->e_shstrndx * e->e_shentsize);
str = (char *) e + s->sh_offset;
for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff);
i < e->e_shnum;
i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize))
@ -458,21 +458,21 @@ grub_dl_resolve_dependencies (grub_dl_t mod, Elf_Ehdr *e)
{
grub_dl_t m;
grub_dl_dep_t dep;
m = grub_dl_load (name);
if (! m)
return grub_errno;
grub_dl_ref (m);
dep = (grub_dl_dep_t) grub_malloc (sizeof (*dep));
if (! dep)
return grub_errno;
dep->mod = m;
dep->next = mod->dep;
mod->dep = dep;
name += grub_strlen (name) + 1;
}
}
@ -488,7 +488,7 @@ grub_dl_ref (grub_dl_t mod)
for (dep = mod->dep; dep; dep = dep->next)
grub_dl_ref (dep->mod);
return ++mod->ref_count;
}
@ -499,7 +499,7 @@ grub_dl_unref (grub_dl_t mod)
for (dep = mod->dep; dep; dep = dep->next)
grub_dl_unref (dep->mod);
return --mod->ref_count;
}
#endif
@ -590,7 +590,7 @@ grub_dl_load_file (const char *filename)
grub_ssize_t size;
void *core = 0;
grub_dl_t mod = 0;
file = grub_file_open (filename);
if (! file)
return 0;
@ -621,7 +621,7 @@ grub_dl_load_file (const char *filename)
grub_free (core);
return 0;
}
mod->ref_count = 0;
return mod;
}
@ -637,7 +637,7 @@ grub_dl_load (const char *name)
mod = grub_dl_get (name);
if (mod)
return mod;
if (! grub_dl_dir) {
grub_error (GRUB_ERR_FILE_NOT_FOUND, "\"prefix\" is not set");
return 0;
@ -647,17 +647,17 @@ grub_dl_load (const char *name)
+ grub_strlen (name) + 4 + 1);
if (! filename)
return 0;
grub_sprintf (filename, "%s/%s.mod", grub_dl_dir, name);
mod = grub_dl_load_file (filename);
grub_free (filename);
if (! mod)
return 0;
if (grub_strcmp (mod->name, name) != 0)
grub_error (GRUB_ERR_BAD_MODULE, "mismatched names");
return mod;
}
@ -673,17 +673,17 @@ grub_dl_unload (grub_dl_t mod)
if (mod->fini)
(mod->fini) ();
grub_dl_remove (mod);
grub_dl_unregister_symbols (mod);
for (dep = mod->dep; dep; dep = depn)
{
depn = dep->next;
if (! grub_dl_unref (dep->mod))
grub_dl_unload (dep->mod);
grub_free (dep);
}
@ -693,7 +693,7 @@ grub_dl_unload (grub_dl_t mod)
grub_free (seg->addr);
grub_free (seg);
}
grub_free (mod->name);
grub_free (mod);
return 1;
@ -706,7 +706,7 @@ grub_dl_unload_unneeded (void)
/* Because grub_dl_remove modifies the list of modules, this
implementation is tricky. */
grub_dl_list_t p = grub_dl_head;
while (p)
{
if (grub_dl_unload (p->mod))
@ -726,7 +726,7 @@ grub_dl_unload_all (void)
while (grub_dl_head)
{
grub_dl_list_t p;
grub_dl_unload_unneeded ();
/* Force to decrement the ref count. This will purge pre-loaded

View file

@ -42,12 +42,12 @@ grub_efi_locate_protocol (grub_efi_guid_t *protocol, void *registration)
{
void *interface;
grub_efi_status_t status;
status = efi_call_3 (grub_efi_system_table->boot_services->locate_protocol,
protocol, registration, &interface);
if (status != GRUB_EFI_SUCCESS)
return 0;
return interface;
}
@ -64,11 +64,11 @@ grub_efi_locate_handle (grub_efi_locate_search_type_t search_type,
grub_efi_status_t status;
grub_efi_handle_t *buffer;
grub_efi_uintn_t buffer_size = 8 * sizeof (grub_efi_handle_t);
buffer = grub_malloc (buffer_size);
if (! buffer)
return 0;
b = grub_efi_system_table->boot_services;
status = efi_call_5 (b->locate_handle, search_type, protocol, search_key,
&buffer_size, buffer);
@ -78,7 +78,7 @@ grub_efi_locate_handle (grub_efi_locate_search_type_t search_type,
buffer = grub_malloc (buffer_size);
if (! buffer)
return 0;
status = efi_call_5 (b->locate_handle, search_type, protocol, search_key,
&buffer_size, buffer);
}
@ -101,7 +101,7 @@ grub_efi_open_protocol (grub_efi_handle_t handle,
grub_efi_boot_services_t *b;
grub_efi_status_t status;
void *interface;
b = grub_efi_system_table->boot_services;
status = efi_call_6 (b->open_protocol, handle,
protocol,
@ -126,7 +126,7 @@ grub_efi_set_text_mode (int on)
/* No console control protocol instance available, assume it is
already in text mode. */
return 1;
if (efi_call_4 (c->get_mode, c, &mode, 0, 0) != GRUB_EFI_SUCCESS)
return 0;
@ -181,7 +181,7 @@ grub_efi_exit_boot_services (grub_efi_uintn_t map_key)
{
grub_efi_boot_services_t *b;
grub_efi_status_t status;
b = grub_efi_system_table->boot_services;
status = efi_call_2 (b->exit_boot_services, grub_efi_image_handle, map_key);
return status == GRUB_EFI_SUCCESS;
@ -215,7 +215,7 @@ grub_arch_modules_addr (void)
struct grub_pe32_section_table *section;
struct grub_module_info *info;
grub_uint16_t i;
image = grub_efi_get_loaded_image (grub_efi_image_handle);
if (! image)
return 0;
@ -250,7 +250,7 @@ char *
grub_efi_get_filename (grub_efi_device_path_t *dp)
{
char *name = 0;
while (1)
{
grub_efi_uint8_t type = GRUB_EFI_DEVICE_PATH_TYPE (dp);
@ -274,7 +274,7 @@ grub_efi_get_filename (grub_efi_device_path_t *dp)
}
else
size = 0;
len = ((GRUB_EFI_DEVICE_PATH_LENGTH (dp) - 4)
/ sizeof (grub_efi_char16_t));
p = grub_realloc (name, size + len * 4 + 1);
@ -420,17 +420,17 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
grub_efi_expanded_acpi_device_path_t eacpi;
grub_memcpy (&eacpi, dp, sizeof (eacpi));
grub_printf ("/ACPI(");
if (GRUB_EFI_EXPANDED_ACPI_HIDSTR (dp)[0] == '\0')
grub_printf ("%x,", (unsigned) eacpi.hid);
else
grub_printf ("%s,", GRUB_EFI_EXPANDED_ACPI_HIDSTR (dp));
if (GRUB_EFI_EXPANDED_ACPI_UIDSTR (dp)[0] == '\0')
grub_printf ("%x,", (unsigned) eacpi.uid);
else
grub_printf ("%s,", GRUB_EFI_EXPANDED_ACPI_UIDSTR (dp));
if (GRUB_EFI_EXPANDED_ACPI_CIDSTR (dp)[0] == '\0')
grub_printf ("%x)", (unsigned) eacpi.cid);
else
@ -727,7 +727,7 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
return;
break;
}
if (GRUB_EFI_END_ENTIRE_DEVICE_PATH (dp))
break;
@ -749,7 +749,7 @@ grub_efi_finish_boot_services (void)
return 0;
mmap_buf = grub_malloc (mmap_size);
if (grub_efi_get_memory_map (&mmap_size, mmap_buf, &map_key,
&desc_size, &desc_version) <= 0)
return 0;

View file

@ -43,7 +43,7 @@ void
grub_efi_set_prefix (void)
{
grub_efi_loaded_image_t *image;
image = grub_efi_get_loaded_image (grub_efi_image_handle);
if (image)
{
@ -52,12 +52,12 @@ grub_efi_set_prefix (void)
device = grub_efidisk_get_device_name (image->device_handle);
file = grub_efi_get_filename (image->file_path);
if (device && file)
{
char *p;
char *prefix;
/* Get the directory. */
p = grub_strrchr (file, '/');
if (p)
@ -72,7 +72,7 @@ grub_efi_set_prefix (void)
grub_free (prefix);
}
}
grub_free (device);
grub_free (file);
}

View file

@ -64,7 +64,7 @@ grub_efi_allocate_pages (grub_efi_physical_address_t address,
if (address > 0xffffffff)
return 0;
#endif
#if GRUB_TARGET_SIZEOF_VOID_P < 8 || defined (MCMODEL_SMALL)
if (address == 0)
{
@ -95,7 +95,7 @@ grub_efi_allocate_pages (grub_efi_physical_address_t address,
if (status != GRUB_EFI_SUCCESS)
return 0;
}
if (allocated_pages)
{
unsigned i;
@ -111,7 +111,7 @@ grub_efi_allocate_pages (grub_efi_physical_address_t address,
if (i == MAX_ALLOCATED_PAGES)
grub_fatal ("too many page allocations");
}
return (void *) ((grub_addr_t) address);
}
@ -127,7 +127,7 @@ grub_efi_free_pages (grub_efi_physical_address_t address,
!= address))
{
unsigned i;
for (i = 0; i < MAX_ALLOCATED_PAGES; i++)
if (allocated_pages[i].addr == address)
{
@ -135,7 +135,7 @@ grub_efi_free_pages (grub_efi_physical_address_t address,
break;
}
}
b = grub_efi_system_table->boot_services;
efi_call_2 (b->free_pages, address, pages);
}
@ -159,7 +159,7 @@ grub_efi_get_memory_map (grub_efi_uintn_t *memory_map_size,
map_key = &key;
if (! descriptor_version)
descriptor_version = &version;
b = grub_efi_system_table->boot_services;
status = efi_call_5 (b->get_memory_map, memory_map_size, memory_map, map_key,
descriptor_size, descriptor_version);
@ -179,13 +179,13 @@ sort_memory_map (grub_efi_memory_descriptor_t *memory_map,
{
grub_efi_memory_descriptor_t *d1;
grub_efi_memory_descriptor_t *d2;
for (d1 = memory_map;
d1 < memory_map_end;
d1 = NEXT_MEMORY_DESCRIPTOR (d1, desc_size))
{
grub_efi_memory_descriptor_t *max_desc = d1;
for (d2 = NEXT_MEMORY_DESCRIPTOR (d1, desc_size);
d2 < memory_map_end;
d2 = NEXT_MEMORY_DESCRIPTOR (d2, desc_size))
@ -227,7 +227,7 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map,
&& desc->num_pages != 0)
{
grub_memcpy (filtered_desc, desc, desc_size);
/* Avoid less than 1MB, because some loaders seem to be confused. */
if (desc->physical_start < 0x100000)
{
@ -235,7 +235,7 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map,
- desc->physical_start);
desc->physical_start = 0x100000;
}
#if GRUB_TARGET_SIZEOF_VOID_P < 8 || defined (MCMODEL_SMALL)
if (BYTES_TO_PAGES (filtered_desc->physical_start)
+ filtered_desc->num_pages
@ -244,10 +244,10 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map,
= (BYTES_TO_PAGES (0x100000000LL)
- BYTES_TO_PAGES (filtered_desc->physical_start));
#endif
if (filtered_desc->num_pages == 0)
continue;
filtered_desc = NEXT_MEMORY_DESCRIPTOR (filtered_desc, desc_size);
}
}
@ -263,7 +263,7 @@ get_total_pages (grub_efi_memory_descriptor_t *memory_map,
{
grub_efi_memory_descriptor_t *desc;
grub_efi_uint64_t total = 0;
for (desc = memory_map;
desc < memory_map_end;
desc = NEXT_MEMORY_DESCRIPTOR (desc, desc_size))
@ -280,7 +280,7 @@ add_memory_regions (grub_efi_memory_descriptor_t *memory_map,
grub_efi_uint64_t required_pages)
{
grub_efi_memory_descriptor_t *desc;
for (desc = memory_map;
desc < memory_map_end;
desc = NEXT_MEMORY_DESCRIPTOR (desc, desc_size))
@ -323,7 +323,7 @@ print_memory_map (grub_efi_memory_descriptor_t *memory_map,
{
grub_efi_memory_descriptor_t *desc;
int i;
for (desc = memory_map, i = 0;
desc < memory_map_end;
desc = NEXT_MEMORY_DESCRIPTOR (desc, desc_size), i++)
@ -354,7 +354,7 @@ grub_efi_mm_init (void)
grub_fatal ("cannot allocate memory");
grub_memset (allocated_pages, 0, ALLOCATED_PAGES_SIZE);
/* Prepare a memory region to store two memory maps. */
memory_map = grub_efi_allocate_pages (0,
2 * BYTES_TO_PAGES (MEMORY_MAP_SIZE));
@ -370,10 +370,10 @@ grub_efi_mm_init (void)
grub_fatal ("cannot get memory map");
memory_map_end = NEXT_MEMORY_DESCRIPTOR (memory_map, map_size);
filtered_memory_map_end = filter_memory_map (memory_map, filtered_memory_map,
desc_size, memory_map_end);
/* By default, request a quarter of the available memory. */
total_pages = get_total_pages (filtered_memory_map, desc_size,
filtered_memory_map_end);
@ -403,7 +403,7 @@ grub_efi_mm_init (void)
NEXT_MEMORY_DESCRIPTOR (memory_map, map_size));
grub_abort ();
#endif
/* Release the memory maps. */
grub_efi_free_pages ((grub_addr_t) memory_map,
2 * BYTES_TO_PAGES (MEMORY_MAP_SIZE));

View file

@ -29,7 +29,7 @@ struct grub_env_context
{
/* A hash table for variables. */
struct grub_env_var *vars[HASHSZ];
/* One level deeper on the stack. */
struct grub_env_context *prev;
};
@ -92,7 +92,7 @@ grub_env_context_open (int export)
for (i = 0; i < HASHSZ; i++)
{
struct grub_env_var *var;
for (var = context->prev->vars[i]; var; var = var->next)
{
if (export && var->type == GRUB_ENV_VAR_GLOBAL)
@ -106,7 +106,7 @@ grub_env_context_open (int export)
}
}
}
return GRUB_ERR_NONE;
}
@ -118,12 +118,12 @@ grub_env_context_close (void)
if (! current_context->prev)
grub_fatal ("cannot close the initial context");
/* Free the variables associated with this context. */
for (i = 0; i < HASHSZ; i++)
{
struct grub_env_var *p, *q;
for (p = current_context->vars[i]; p; p = q)
{
q = p->next;
@ -192,7 +192,7 @@ grub_env_set (const char *name, const char *val)
var->value = var->write_hook (var, val);
else
var->value = grub_strdup (val);
if (! var->value)
{
var->value = old;
@ -207,17 +207,17 @@ grub_env_set (const char *name, const char *val)
var = grub_malloc (sizeof (*var));
if (! var)
return grub_errno;
grub_memset (var, 0, sizeof (*var));
/* This is not necessary, because GRUB_ENV_VAR_LOCAL == 0. But leave
this for readability. */
var->type = GRUB_ENV_VAR_LOCAL;
var->name = grub_strdup (name);
if (! var->name)
goto fail;
var->value = grub_strdup (val);
if (! var->value)
goto fail;
@ -238,7 +238,7 @@ char *
grub_env_get (const char *name)
{
struct grub_env_var *var;
var = grub_env_find (name);
if (! var)
return 0;
@ -253,7 +253,7 @@ void
grub_env_unset (const char *name)
{
struct grub_env_var *var;
var = grub_env_find (name);
if (! var)
return;
@ -277,12 +277,12 @@ grub_env_iterate (int (*func) (struct grub_env_var *var))
struct grub_env_sorted_var *sorted_list = 0;
struct grub_env_sorted_var *sorted_var;
int i;
/* Add variables associated with this context into a sorted list. */
for (i = 0; i < HASHSZ; i++)
{
struct grub_env_var *var;
for (var = current_context->vars[i]; var; var = var->next)
{
struct grub_env_sorted_var *p, **q;
@ -290,7 +290,7 @@ grub_env_iterate (int (*func) (struct grub_env_var *var))
/* Ignore data slots. */
if (var->type == GRUB_ENV_VAR_DATA)
continue;
sorted_var = grub_malloc (sizeof (*sorted_var));
if (! sorted_var)
goto fail;
@ -302,7 +302,7 @@ grub_env_iterate (int (*func) (struct grub_env_var *var))
if (grub_strcmp (p->var->name, var->name) > 0)
break;
}
sorted_var->next = *q;
*q = sorted_var;
}
@ -336,11 +336,11 @@ grub_register_variable_hook (const char *name,
{
if (grub_env_set (name, "") != GRUB_ERR_NONE)
return grub_errno;
var = grub_env_find (name);
/* XXX Insert an assertion? */
}
var->read_hook = read_hook;
var->write_hook = write_hook;
@ -355,7 +355,7 @@ mangle_data_slot_name (const char *name)
mangled_name = grub_malloc (grub_strlen (name) + 2);
if (! mangled_name)
return 0;
grub_sprintf (mangled_name, "\e%s", name);
return mangled_name;
}
@ -382,7 +382,7 @@ grub_env_set_data_slot (const char *name, const void *ptr)
var = grub_malloc (sizeof (*var));
if (! var)
goto fail;
grub_memset (var, 0, sizeof (*var));
var->type = GRUB_ENV_VAR_DATA;
@ -404,7 +404,7 @@ grub_env_get_data_slot (const char *name)
{
char *mangled_name;
void *ptr = 0;
mangled_name = mangle_data_slot_name (name);
if (! mangled_name)
goto fail;
@ -413,7 +413,7 @@ grub_env_get_data_slot (const char *name)
grub_free (mangled_name);
fail:
return ptr;
}
@ -421,7 +421,7 @@ void
grub_env_unset_data_slot (const char *name)
{
char *mangled_name;
mangled_name = mangle_data_slot_name (name);
if (! mangled_name)
return;

View file

@ -40,7 +40,7 @@ grub_err_t
grub_error (grub_err_t n, const char *fmt, ...)
{
va_list ap;
grub_errno = n;
va_start (ap, fmt);
@ -73,7 +73,7 @@ grub_error_push (void)
grub_memcpy (grub_error_stack_items[grub_error_stack_pos].errmsg,
grub_errmsg,
sizeof (grub_errmsg));
/* Advance to next error stack position. */
grub_error_stack_pos++;
}
@ -96,19 +96,19 @@ grub_error_pop (void)
{
/* Pop error message from error stack to current active error. */
grub_error_stack_pos--;
grub_errno = grub_error_stack_items[grub_error_stack_pos].errno;
grub_memcpy (grub_errmsg,
grub_error_stack_items[grub_error_stack_pos].errmsg,
sizeof (grub_errmsg));
return 1;
}
else
{
/* There is no more items on error stack, reset to no error state. */
grub_errno = GRUB_ERR_NONE;
return 0;
}
}
@ -122,9 +122,9 @@ grub_print_error (void)
{
if (grub_errno != GRUB_ERR_NONE)
grub_err_printf ("error: %s\n", grub_errmsg);
}
}
while (grub_error_pop ());
/* If there was an assert while using error stack, report about it. */
if (grub_error_stack_assert)
{

View file

@ -32,7 +32,7 @@ grub_file_get_device_name (const char *name)
{
char *p = grub_strchr (name, ')');
char *ret;
if (! p)
{
grub_error (GRUB_ERR_BAD_FILENAME, "missing `)'");
@ -42,7 +42,7 @@ grub_file_get_device_name (const char *name)
ret = (char *) grub_malloc (p - name);
if (! ret)
return 0;
grub_memcpy (ret, name + 1, p - name - 1);
ret[p - name - 1] = '\0';
return ret;
@ -74,16 +74,16 @@ grub_file_open (const char *name)
grub_free (device_name);
if (! device)
goto fail;
file = (grub_file_t) grub_malloc (sizeof (*file));
if (! file)
goto fail;
file->device = device;
file->offset = 0;
file->data = 0;
file->read_hook = 0;
if (device->disk && file_name[0] != '/')
/* This is a block list. */
file->fs = &grub_fs_blocklist;
@ -106,7 +106,7 @@ grub_file_open (const char *name)
/* if (net) grub_net_close (net); */
grub_free (file);
return 0;
}
@ -114,17 +114,17 @@ grub_ssize_t
grub_file_read (grub_file_t file, char *buf, grub_size_t len)
{
grub_ssize_t res;
if (len == 0 || len > file->size - file->offset)
len = file->size - file->offset;
/* Prevent an overflow. */
if ((grub_ssize_t) len < 0)
len >>= 1;
if (len == 0)
return 0;
res = (file->fs->read) (file, buf, len);
if (res > 0)
file->offset += res;
@ -155,7 +155,7 @@ grub_file_seek (grub_file_t file, grub_off_t offset)
"attempt to seek outside of the file");
return -1;
}
old = file->offset;
file->offset = offset;
return old;

View file

@ -65,7 +65,7 @@ grub_fs_t
grub_fs_probe (grub_device_t device)
{
grub_fs_t p;
auto int dummy_func (const char *filename,
auto int dummy_func (const char *filename,
const struct grub_dirhook_info *info);
int dummy_func (const char *filename __attribute__ ((unused)),
@ -100,24 +100,24 @@ grub_fs_probe (grub_device_t device)
if (grub_fs_autoload_hook && count == 0)
{
count++;
while (grub_fs_autoload_hook ())
{
p = grub_fs_list;
(p->dir) (device, "/", dummy_func);
if (grub_errno == GRUB_ERR_NONE)
{
count--;
return p;
}
if (grub_errno != GRUB_ERR_BAD_FS)
{
count--;
return 0;
}
grub_errno = GRUB_ERR_NONE;
}
@ -149,7 +149,7 @@ grub_fs_blocklist_open (grub_file_t file, const char *name)
unsigned i;
grub_disk_t disk = file->device->disk;
struct grub_fs_block *blocks;
/* First, count the number of blocks. */
do
{
@ -198,14 +198,14 @@ grub_fs_blocklist_open (grub_file_t file, const char *name)
grub_error (GRUB_ERR_BAD_FILENAME, "beyond the total sectors");
goto fail;
}
file->size += (blocks[i].length << GRUB_DISK_SECTOR_BITS);
p++;
}
blocks[i].length = 0;
file->data = blocks;
return GRUB_ERR_NONE;
fail:
@ -236,11 +236,11 @@ grub_fs_blocklist_read (grub_file_t file, char *buf, grub_size_t len)
if (((size + offset + GRUB_DISK_SECTOR_SIZE - 1)
>> GRUB_DISK_SECTOR_BITS) > p->length - sector)
size = ((p->length - sector) << GRUB_DISK_SECTOR_BITS) - offset;
if (grub_disk_read (file->device->disk, p->offset + sector, offset,
size, buf) != GRUB_ERR_NONE)
return -1;
ret += size;
len -= size;
sector -= ((size + offset) >> GRUB_DISK_SECTOR_BITS);

View file

@ -29,9 +29,9 @@ grub_millisleep (grub_uint32_t ms)
start = grub_get_time_ms ();
/* Instead of setting an end time and looping while the current time is
/* Instead of setting an end time and looping while the current time is
less than that, comparing the elapsed sleep time with the desired sleep
time handles the (unlikely!) case that the timer would wrap around
time handles the (unlikely!) case that the timer would wrap around
during the sleep. */
while (grub_get_time_ms () - start < ms)

View file

@ -26,8 +26,8 @@
grub_uint64_t
grub_rtc_get_time_ms (void)
{
/* By dimensional analysis:
/* By dimensional analysis:
1000 ms N rtc ticks 1 s
------- * ----------- * ----------- = 1000*N/T ms
1 s 1 T rtc ticks

View file

@ -56,7 +56,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
if (i == e->e_shnum)
return grub_error (GRUB_ERR_BAD_MODULE, "no symtab found");
symtab = (Elf32_Sym *) ((char *) e + s->sh_offset);
entsize = s->sh_entsize;
@ -75,7 +75,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
if (seg)
{
Elf32_Rel *rel, *max;
for (rel = (Elf32_Rel *) ((char *) e + s->sh_offset),
max = rel + s->sh_size / s->sh_entsize;
rel < max;
@ -83,15 +83,15 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
{
Elf32_Word *addr;
Elf32_Sym *sym;
if (seg->size < rel->r_offset)
return grub_error (GRUB_ERR_BAD_MODULE,
"reloc offset is out of the segment");
addr = (Elf32_Word *) ((char *) seg->addr + rel->r_offset);
sym = (Elf32_Sym *) ((char *) symtab
+ entsize * ELF32_R_SYM (rel->r_info));
switch (ELF32_R_TYPE (rel->r_info))
{
case R_386_32:

View file

@ -25,7 +25,7 @@ grub_stop_floppy (void)
{
}
void
void
grub_arch_sync_caches (void *address __attribute__ ((unused)),
grub_size_t len __attribute__ ((unused)))
{

View file

@ -46,7 +46,7 @@ static int num_regions;
grub_addr_t grub_os_area_addr;
grub_size_t grub_os_area_size;
void
void
grub_arch_sync_caches (void *address __attribute__ ((unused)),
grub_size_t len __attribute__ ((unused)))
{
@ -64,20 +64,20 @@ make_install_device (void)
to the boot drive. */
if (grub_root_drive == 0xFF)
grub_root_drive = grub_boot_drive;
grub_sprintf (dev, "(%cd%u", (grub_root_drive & 0x80) ? 'h' : 'f',
grub_root_drive & 0x7f);
if (grub_install_dos_part >= 0)
grub_sprintf (dev + grub_strlen (dev), ",%u", grub_install_dos_part + 1);
if (grub_install_bsd_part >= 0)
grub_sprintf (dev + grub_strlen (dev), ",%c", grub_install_bsd_part + 'a');
grub_sprintf (dev + grub_strlen (dev), ")%s", grub_prefix);
grub_strcpy (grub_prefix, dev);
}
return grub_prefix;
}
@ -115,7 +115,7 @@ compact_mem_regions (void)
if (mem_regions[i].addr + mem_regions[i].size >= mem_regions[i + 1].addr)
{
j = i + 1;
if (mem_regions[i].addr + mem_regions[i].size
< mem_regions[j].addr + mem_regions[j].size)
mem_regions[i].size = (mem_regions[j].addr + mem_regions[j].size
@ -133,12 +133,12 @@ grub_machine_init (void)
{
int i;
int grub_lower_mem;
/* Initialize the console as early as possible. */
grub_console_init ();
grub_lower_mem = grub_get_memsize (0) << 10;
/* Sanity check. */
if (grub_lower_mem < GRUB_MEMORY_MACHINE_RESERVED_END)
grub_fatal ("too small memory");
@ -157,7 +157,7 @@ grub_machine_init (void)
add_mem_region (GRUB_MEMORY_MACHINE_RESERVED_END,
grub_lower_mem - GRUB_MEMORY_MACHINE_RESERVED_END);
#endif
auto int NESTED_FUNC_ATTR hook (grub_uint64_t, grub_uint64_t, grub_uint32_t);
int NESTED_FUNC_ATTR hook (grub_uint64_t addr, grub_uint64_t size, grub_uint32_t type)
{
@ -166,16 +166,16 @@ grub_machine_init (void)
{
if (size <= 0x100000 - addr)
return 0;
size -= 0x100000 - addr;
addr = 0x100000;
}
/* Ignore >4GB. */
if (addr <= 0xFFFFFFFF && type == GRUB_MACHINE_MEMORY_AVAILABLE)
{
grub_size_t len;
len = (grub_size_t) ((addr + size > 0xFFFFFFFF)
? 0xFFFFFFFF - addr
: size);
@ -186,7 +186,7 @@ grub_machine_init (void)
}
grub_machine_mmap_iterate (hook);
compact_mem_regions ();
/* Add the memory regions to free memory, except for the region starting
@ -204,7 +204,7 @@ grub_machine_init (void)
}
else
grub_mm_init_region ((void *) mem_regions[i].addr, mem_regions[i].size);
if (! grub_os_area_addr)
grub_fatal ("no upper memory");

View file

@ -16,7 +16,7 @@
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* This code was stolen from the files enter.sh, leave.sh, lzo1x_d.sh,
* lzo1x_f.s and lzo_asm.h in LZO version 1.08, and was heavily modified
@ -37,7 +37,7 @@
#define MOVSL(r1,r2,x) movl (r1), x ; addl $4, r1 ; movl x, (r2) ; addl $4, r2
#define COPYL_C(r1,r2,x,rc) 9: MOVSL(r1,r2,x) ; decl rc ; jnz 9b
#define COPYL(r1,r2,x) COPYL_C(r1,r2,x,%ecx)
lzo1x_decompress:
pushl %ebp
pushl %edi
@ -50,7 +50,7 @@ lzo1x_decompress:
movl OUTP, %edi
movl $3, %ebp
xorl %eax, %eax
xorl %ebx, %ebx /* high bits 9-32 stay 0 */
lodsb
@ -283,7 +283,7 @@ lzo1x_decompress:
.L_leave:
negl %eax
jnz 1f
subl OUTP, %edi /* write back the uncompressed size */
movl %edi, %eax

View file

@ -27,7 +27,7 @@ grub_machine_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uin
grub_uint32_t cont;
struct grub_machine_mmap_entry *entry
= (struct grub_machine_mmap_entry *) GRUB_MEMORY_MACHINE_SCRATCH_ADDR;
/* Check if grub_get_mmap_entry works. */
cont = grub_get_mmap_entry (entry, 0);

View file

@ -21,7 +21,7 @@
* Note: These functions defined in this file may be called from C.
* Be careful of that you must not modify some registers. Quote
* from gcc-2.95.2/gcc/config/i386/i386.h:
1 for registers not available across function calls.
These must include the FIXED_REGISTERS and also any
registers that can be used without being saved.
@ -52,9 +52,9 @@
#include <grub/term.h>
#include <multiboot.h>
#include <multiboot2.h>
#define ABS(x) ((x) - _start + GRUB_BOOT_MACHINE_KERNEL_ADDR + 0x200)
.file "startup.S"
.text
@ -140,7 +140,7 @@ multiboot_header:
.long 0
/* entry addr */
.long multiboot_entry - _start + 0x100000 + 0x200
multiboot_entry:
.code32
/* obtain the boot device */
@ -157,7 +157,7 @@ multiboot_entry:
/* jump to the real address */
movl $multiboot_trampoline, %eax
jmp *%eax
multiboot_trampoline:
/* fill the boot information */
movl %edx, %eax
@ -178,7 +178,7 @@ multiboot_trampoline:
/* enter the usual booting */
call prot_to_real
.code16
/* the real mode code continues... */
codestart:
cli /* we're not safe here! */
@ -201,7 +201,7 @@ codestart:
/* reset disk system (%ah = 0) */
int $0x13
/* transition to protected mode */
DATA32 call real_to_prot
@ -210,7 +210,7 @@ codestart:
incl %eax
call EXT_C(grub_gate_a20)
#if defined(ENABLE_LZO)
/* decompress the compressed part and put the result at 1MB */
movl $GRUB_MEMORY_MACHINE_DECOMPRESSION_ADDR, %esi
@ -260,7 +260,7 @@ codestart:
rep
movsb
#endif
#ifdef APPLE_CC
/* clean out the bss */
bss_start_abs = ABS (bss_start)
@ -279,13 +279,13 @@ codestart:
movl $END_SYMBOL, %ecx
subl %edi, %ecx
#endif
/* clean out */
xorl %eax, %eax
cld
rep
stosb
/*
* Call the start of main body of C code.
*/
@ -304,7 +304,7 @@ VARIABLE(grub_root_drive)
.byte 0
.p2align 2 /* force 4-byte alignment */
/*
* These next two routines, "real_to_prot" and "prot_to_real" are structured
* in a very specific way. Be very careful when changing them.
@ -375,7 +375,7 @@ protcseg:
FUNCTION(grub_gate_a20)
movl %eax, %edx
gate_a20_test_current_state:
gate_a20_test_current_state:
/* first of all, test if already in a good state */
call gate_a20_check_state
cmpb %al, %dl
@ -402,7 +402,7 @@ gate_a20_try_bios:
cmpb %al, %dl
jnz gate_a20_try_system_control_port_a
ret
gate_a20_try_system_control_port_a:
/*
* In macbook, the keyboard test would hang the machine, so we move
@ -430,7 +430,7 @@ gate_a20_flush_keyboard_buffer:
inb $0x64
andb $0x02, %al
jnz gate_a20_flush_keyboard_buffer
2:
2:
inb $0x64
andb $0x01, %al
jz 3f
@ -438,14 +438,14 @@ gate_a20_flush_keyboard_buffer:
jmp 2b
3:
ret
gate_a20_try_keyboard_controller:
gate_a20_try_keyboard_controller:
/* third, try the keyboard controller */
call gate_a20_flush_keyboard_buffer
movb $0xd1, %al
outb $0x64
4:
4:
inb $0x64
andb $0x02, %al
jnz 4b
@ -467,18 +467,18 @@ gate_a20_try_keyboard_controller:
/* everything failed, so restart from the beginning */
jnz gate_a20_try_bios
ret
gate_a20_check_state:
/* iterate the checking for a while */
movl $100, %ecx
1:
1:
call 3f
cmpb %al, %dl
jz 2f
loop 1b
2:
ret
3:
3:
pushl %ebx
pushl %ecx
xorl %eax, %eax
@ -567,7 +567,7 @@ FUNCTION(grub_exit)
int $0x18
jmp cold_reboot
.code32
/*
* grub_reboot()
*
@ -576,13 +576,13 @@ FUNCTION(grub_exit)
FUNCTION(grub_reboot)
call prot_to_real
.code16
cold_reboot:
cold_reboot:
/* cold boot */
movw $0x0472, %di
movw %ax, (%di)
ljmp $0xFFFF, $0x0000
.code32
/*
* grub_halt(int no_apm)
*
@ -596,7 +596,7 @@ FUNCTION(grub_halt)
call prot_to_real
.code16
/* detect APM */
movw $0x5300, %ax
xorw %bx, %bx
@ -621,7 +621,7 @@ FUNCTION(grub_halt)
movw $0x0101, %cx
int $0x15
jc EXT_C(grub_hard_stop)
/* set the power state to off */
movw $0x5307, %ax
movw $1, %bx
@ -631,8 +631,8 @@ FUNCTION(grub_halt)
/* shouldn't reach here */
jmp EXT_C(grub_hard_stop)
.code32
/*
* void grub_chainloader_real_boot (int drive, void *part_addr)
*
@ -683,7 +683,7 @@ FUNCTION(grub_biosdisk_rw_int13_extensions)
movb %al, %dh
/* enter real mode */
call prot_to_real
.code16
movb %dh, %ah
movw %cx, %ds
@ -699,7 +699,7 @@ FUNCTION(grub_biosdisk_rw_int13_extensions)
popl %ebp
ret
/*
* int grub_biosdisk_rw_standard (int ah, int drive, int coff, int hoff,
* int soff, int nsec, int segment)
@ -735,7 +735,7 @@ FUNCTION(grub_biosdisk_rw_standard)
movw %ax, %di
/* save SEGMENT in %bx */
movw 0x14(%ebp), %bx
/* enter real mode */
call prot_to_real
@ -744,7 +744,7 @@ FUNCTION(grub_biosdisk_rw_standard)
xorw %bx, %bx
movw $3, %si /* attempt at least three times */
1:
1:
movw %di, %ax
int $0x13 /* do the operation */
jnc 2f /* check if successful */
@ -753,19 +753,19 @@ FUNCTION(grub_biosdisk_rw_standard)
/* if fail, reset the disk system */
xorw %ax, %ax
int $0x13
decw %si
cmpw $0, %si
je 2f
xorb %bl, %bl
jmp 1b /* retry */
2:
2:
/* back to protected mode */
DATA32 call real_to_prot
.code32
movb %bl, %al /* return value in %eax */
popl %esi
popl %edi
popl %ebx
@ -794,7 +794,7 @@ FUNCTION(grub_biosdisk_check_int13_extensions)
movb $0x41, %ah
movw $0x55aa, %bx
int $0x13 /* do the operation */
/* check the result */
jc 1f
cmpw $0xaa55, %bx
@ -805,7 +805,7 @@ FUNCTION(grub_biosdisk_check_int13_extensions)
/* check if AH=0x42 is supported */
andw $1, %cx
jnz 2f
1:
xorb %bl, %bl
2:
@ -870,13 +870,13 @@ FUNCTION(grub_biosdisk_get_diskinfo_int13_extensions)
popl %esi
popl %ebx
popl %ebp
ret
/*
* int grub_biosdisk_get_diskinfo_standard (int drive,
* unsigned long *cylinders,
* unsigned long *cylinders,
* unsigned long *heads,
* unsigned long *sectors)
*
@ -894,7 +894,7 @@ FUNCTION(grub_biosdisk_get_diskinfo_standard)
/* push HEADS */
pushl %ecx
/* SECTORS is on the stack */
/* drive */
movb %al, %dl
/* enter real mode */
@ -936,7 +936,7 @@ FUNCTION(grub_biosdisk_get_diskinfo_standard)
andb $0x3f, %cl
movzbl %cl, %eax
movl %eax, (%edi)
xorl %eax, %eax
movb %bl, %al /* return value in %eax */
@ -955,20 +955,20 @@ FUNCTION(grub_biosdisk_get_num_floppies)
xorl %edx, %edx
call prot_to_real
.code16
/* reset the disk system first */
int $0x13
1:
stc
/* call GET DISK TYPE */
movb $0x15, %ah
int $0x13
jc 2f
/* check if this drive exists */
/* check if this drive exists */
testb $0x3, %ah
jz 2f
@ -982,8 +982,8 @@ FUNCTION(grub_biosdisk_get_num_floppies)
movl %edx, %eax
popl %ebp
ret
/*
*
* grub_get_memsize(i) : return the memory size in KB. i == 0 for conventional
@ -1080,7 +1080,7 @@ FUNCTION(grub_get_mmap_entry)
/* push ADDR */
pushl %eax
/* place address (+4) in ES:DI */
addl $4, %eax
movl %eax, %edi
@ -1148,7 +1148,7 @@ xsmap:
popl %ebp
ret
/*
* void grub_console_real_putchar (int c)
*
@ -1167,7 +1167,7 @@ FUNCTION(grub_console_real_putchar)
movl %eax, %edx
pusha
movb EXT_C(grub_console_cur_color), %bl
call prot_to_real
.code16
movb %dl, %al
@ -1186,7 +1186,7 @@ FUNCTION(grub_console_real_putchar)
/* save the character and the attribute on the stack */
pushw %ax
pushw %bx
/* get the current position */
movb $0x3, %ah
int $0x10
@ -1194,22 +1194,22 @@ FUNCTION(grub_console_real_putchar)
/* check the column with the width */
cmpb $79, %dl
jl 2f
/* print CR and LF, if next write will exceed the width */
/* print CR and LF, if next write will exceed the width */
movw $0x0e0d, %ax
int $0x10
movb $0x0a, %al
int $0x10
/* get the current position */
movb $0x3, %ah
int $0x10
2:
2:
/* restore the character and the attribute */
popw %bx
popw %ax
/* write the character with the attribute */
movb $0x9, %ah
movw $1, %cx
@ -1225,13 +1225,13 @@ FUNCTION(grub_console_real_putchar)
1: movw $1, %bx
movb $0xe, %ah
int $0x10
3: DATA32 call real_to_prot
.code32
popa
ret
/*
* int grub_console_getkey (void)
@ -1254,7 +1254,7 @@ translation_table:
.word GRUB_CONSOLE_KEY_PPAGE, GRUB_TERM_PPAGE
.word GRUB_CONSOLE_KEY_NPAGE, GRUB_TERM_NPAGE
.word 0
/*
* translate_keycode translates the key code %dx to an ascii code.
*/
@ -1263,14 +1263,14 @@ translation_table:
translate_keycode:
pushw %bx
pushw %si
#ifdef APPLE_CC
translation_table_abs = ABS (translation_table) - 0x10000
movw $(translation_table_abs), %si
#else
movw $ABS(translation_table), %si
#endif
1: lodsw
/* check if this is the end */
testw %ax, %ax
@ -1289,7 +1289,7 @@ translate_keycode:
ret
.code32
FUNCTION(grub_console_getkey)
pushl %ebp
@ -1317,7 +1317,7 @@ FUNCTION(grub_console_getkey)
movw %ax, %dx /* real_to_prot uses %eax */
call translate_keycode
DATA32 call real_to_prot
.code32
@ -1343,7 +1343,7 @@ FUNCTION(grub_console_getkey)
FUNCTION(grub_console_checkkey)
pushl %ebp
xorl %edx, %edx
call prot_to_real /* enter real mode */
.code16
@ -1351,7 +1351,7 @@ FUNCTION(grub_console_checkkey)
int $0x16
jz notpending
movw %ax, %dx
DATA32 jmp pending
@ -1367,7 +1367,7 @@ pending:
popl %ebp
ret
/*
* grub_uint16_t grub_console_getxy (void)
* BIOS call "INT 10H Function 03h" to get cursor position
@ -1433,7 +1433,7 @@ FUNCTION(grub_console_gotoxy)
popl %ebp
ret
/*
* void grub_console_cls (void)
* BIOS call "INT 10H Function 09h" to write character and attribute
@ -1474,7 +1474,7 @@ FUNCTION(grub_console_cls)
popl %ebp
ret
/*
* void grub_console_setcursor (int on)
* BIOS call "INT 10H Function 01h" to set cursor type
@ -1487,14 +1487,14 @@ console_cursor_state:
.byte 1
console_cursor_shape:
.word 0
FUNCTION(grub_console_setcursor)
pushl %ebp
pushl %ebx
/* push ON */
pushl %eax
/* check if the standard cursor shape has already been saved */
movw console_cursor_shape, %ax
testw %ax, %ax
@ -1518,12 +1518,12 @@ FUNCTION(grub_console_setcursor)
testl %eax, %eax
jz 2f
movw console_cursor_shape, %cx
2:
2:
call prot_to_real
.code16
movb $0x1, %ah
int $0x10
int $0x10
DATA32 call real_to_prot
.code32
@ -1531,7 +1531,7 @@ FUNCTION(grub_console_setcursor)
popl %ebx
popl %ebp
ret
/*
* grub_getrtsecs()
* if a seconds value can be read, read it and return it (BCD),
@ -1572,7 +1572,7 @@ gottime:
popl %ebp
ret
/*
* grub_get_rtc()
* return the real time in ticks, of which there are about
@ -1669,7 +1669,7 @@ FUNCTION(grub_vbe_bios_get_controller_info)
xorw %ax, %ax
shrl $4, %eax
mov %eax, %edx /* prot_to_real destroys %eax. */
call prot_to_real
.code16
@ -1688,7 +1688,7 @@ FUNCTION(grub_vbe_bios_get_controller_info)
movl %edx, %eax
andl $0x0FFFF, %eax /* Return value in %eax. */
pop %edx
popl %edi
popl %ebp
@ -1770,7 +1770,7 @@ FUNCTION(grub_vbe_bios_set_mode)
DATA32 call real_to_prot
.code32
movw %dx, %ax
andl $0xFFFF, %eax /* Return value in %eax. */
@ -1841,7 +1841,7 @@ FUNCTION(grub_vbe_bios_set_memory_window)
DATA32 call real_to_prot
.code32
movw %dx, %ax
andl $0xFFFF, %eax /* Return value in %eax. */
@ -1914,7 +1914,7 @@ FUNCTION(grub_vbe_bios_set_scanline_length)
DATA32 call real_to_prot
.code32
movw %dx, %ax
andl $0xFFFF, %eax /* Return value in %eax. */
@ -1977,7 +1977,7 @@ FUNCTION(grub_vbe_bios_set_display_start)
.code16
movw $0x4f07, %ax
movw $0x0080, %bx /* BL = 80h, Set Display Start
movw $0x0080, %bx /* BL = 80h, Set Display Start
during Vertical Retrace. */
int $0x10
@ -1985,7 +1985,7 @@ FUNCTION(grub_vbe_bios_set_display_start)
DATA32 call real_to_prot
.code32
movw %dx, %ax
andl $0xFFFF, %eax /* Return value in %eax. */
@ -2075,7 +2075,7 @@ FUNCTION(grub_vbe_bios_set_palette_data)
DATA32 call real_to_prot
.code32
movw %dx, %ax
andl $0xFFFF, %eax /* Return value in %eax. */

View file

@ -21,7 +21,7 @@
* Note: These functions defined in this file may be called from C.
* Be careful of that you must not modify some registers. Quote
* from gcc-2.95.2/gcc/config/i386/i386.h:
1 for registers not available across function calls.
These must include the FIXED_REGISTERS and also any
registers that can be used without being saved.
@ -84,7 +84,7 @@ gdt:
/* -- data segment --
* base = 0x00000000, limit 0xFFFFF (4 KiB Granularity), present
* type = 32 bit data read/write, DPL = 0
* type = 32 bit data read/write, DPL = 0
*/
.word 0xFFFF, 0
.byte 0, 0x92, 0xCF, 0

View file

@ -1,6 +1,6 @@
/* kern/i386/tsc.c - x86 TSC time source implementation
* Requires Pentium or better x86 CPU that supports the RDTSC instruction.
* This module uses the RTC (via grub_get_rtc()) to calibrate the TSC to
* This module uses the RTC (via grub_get_rtc()) to calibrate the TSC to
* real time.
*
* GRUB -- GRand Unified Bootloader

View file

@ -125,7 +125,7 @@ grub_ieee1275_next_property (grub_ieee1275_phandle_t phandle, char *prev_prop,
}
int
grub_ieee1275_get_property_length (grub_ieee1275_phandle_t phandle,
grub_ieee1275_get_property_length (grub_ieee1275_phandle_t phandle,
const char *prop, grub_ssize_t *length)
{
struct get_property_args
@ -164,7 +164,7 @@ grub_ieee1275_instance_to_package (grub_ieee1275_ihandle_t ihandle,
INIT_IEEE1275_COMMON (&args.common, "instance-to-package", 1, 1);
args.ihandle = ihandle;
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
return -1;
*phandlep = args.phandle;
@ -192,7 +192,7 @@ grub_ieee1275_package_to_path (grub_ieee1275_phandle_t phandle,
args.phandle = phandle;
args.buf = (grub_ieee1275_cell_t) path;
args.buflen = (grub_ieee1275_cell_t) len;
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
return -1;
if (actual)
@ -221,7 +221,7 @@ grub_ieee1275_instance_to_path (grub_ieee1275_ihandle_t ihandle,
args.ihandle = ihandle;
args.buf = (grub_ieee1275_cell_t) path;
args.buflen = (grub_ieee1275_cell_t) len;
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
return -1;
if (actual)
@ -232,7 +232,7 @@ grub_ieee1275_instance_to_path (grub_ieee1275_ihandle_t ihandle,
}
int
grub_ieee1275_write (grub_ieee1275_ihandle_t ihandle, void *buffer,
grub_ieee1275_write (grub_ieee1275_ihandle_t ihandle, void *buffer,
grub_size_t len, grub_ssize_t *actualp)
{
struct write_args
@ -517,7 +517,7 @@ grub_ieee1275_release (grub_addr_t addr, grub_size_t size)
INIT_IEEE1275_COMMON (&args.common, "release", 2, 0);
args.addr = addr;
args.size = size;
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
return -1;
return 0;

View file

@ -39,7 +39,7 @@ grub_module_iterate (int (*hook) (struct grub_module_header *header))
modbase = grub_arch_modules_addr ();
modinfo = (struct grub_module_info *) modbase;
/* Check if there are any modules. */
if ((modinfo == 0) || modinfo->magic != GRUB_MODULE_MAGIC)
return;
@ -100,7 +100,7 @@ grub_env_write_root (struct grub_env_var *var __attribute__ ((unused)),
{
/* XXX Is it better to check the existence of the device? */
grub_size_t len = grub_strlen (val);
if (val[0] == '(' && val[len - 1] == ')')
return grub_strndup (val + 1, len - 2);
@ -115,9 +115,9 @@ grub_set_root_dev (void)
grub_register_variable_hook ("root", 0, grub_env_write_root);
grub_env_export ("root");
prefix = grub_env_get ("prefix");
if (prefix)
{
char *dev;
@ -137,7 +137,7 @@ grub_load_normal_mode (void)
{
/* Load the module. */
grub_dl_load ("normal");
/* Something went wrong. Print errors here to let user know why we're entering rescue mode. */
grub_print_error ();
grub_errno = 0;
@ -170,7 +170,7 @@ grub_main (void)
grub_register_core_commands ();
grub_register_rescue_parser ();
grub_register_rescue_reader ();
grub_load_config ();
grub_load_normal_mode ();
grub_reader_loop (0);

View file

@ -37,11 +37,11 @@ grub_memmove (void *dest, const void *src, grub_size_t n)
{
d += n;
s += n;
while (n--)
*--d = *--s;
}
return dest;
}
@ -77,7 +77,7 @@ char *
grub_strncpy (char *dest, const char *src, int c)
{
char *p = dest;
while ((*p++ = *src++) != '\0' && --c)
;
@ -138,13 +138,13 @@ grub_printf (const char *fmt, ...)
{
va_list ap;
int ret;
va_start (ap, fmt);
ret = grub_vprintf (fmt, ap);
va_end (ap);
return ret;
}
}
#if defined (APPLE_CC) && ! defined (GRUB_UTIL)
int
@ -152,13 +152,13 @@ grub_err_printf (const char *fmt, ...)
{
va_list ap;
int ret;
va_start (ap, fmt);
ret = grub_vprintf (fmt, ap);
va_end (ap);
return ret;
}
}
#endif
#if ! defined (APPLE_CC) && ! defined (GRUB_UTIL)
@ -172,10 +172,10 @@ grub_real_dprintf (const char *file, const int line, const char *condition,
{
va_list args;
const char *debug = grub_env_get ("debug");
if (! debug)
return;
if (grub_strword (debug, "all") || grub_strword (debug, condition))
{
grub_printf ("%s:%d: ", file, line);
@ -200,7 +200,7 @@ grub_memcmp (const void *s1, const void *s2, grub_size_t n)
{
const char *t1 = s1;
const char *t2 = s2;
while (n--)
{
if (*t1 != *t2)
@ -224,7 +224,7 @@ grub_strcmp (const char *s1, const char *s2)
{
if (*s1 != *s2)
break;
s1++;
s2++;
}
@ -237,12 +237,12 @@ grub_strncmp (const char *s1, const char *s2, grub_size_t n)
{
if (n == 0)
return 0;
while (*s1 && *s2 && --n)
{
if (*s1 != *s2)
break;
s1++;
s2++;
}
@ -275,7 +275,7 @@ grub_strncasecmp (const char *s1, const char *s2, grub_size_t n)
{
if (grub_tolower (*s1) != grub_tolower (*s2))
break;
s1++;
s2++;
}
@ -326,7 +326,7 @@ grub_strstr (const char *haystack, const char *needle)
/* Speed up the following searches of needle by caching its first
character. */
char b = *needle++;
for (;; haystack++)
{
if (*haystack == '\0')
@ -460,11 +460,11 @@ grub_strtoull (const char *str, char **end, int base)
{
unsigned long long num = 0;
int found = 0;
/* Skip white spaces. */
while (*str && grub_isspace (*str))
str++;
/* Guess the base, if not specified. The prefix `0x' means 16, and
the prefix `0' means 8. */
if (str[0] == '0')
@ -480,7 +480,7 @@ grub_strtoull (const char *str, char **end, int base)
else if (base == 0 && str[1] >= '0' && str[1] <= '7')
base = 8;
}
if (base == 0)
base = 10;
@ -514,7 +514,7 @@ grub_strtoull (const char *str, char **end, int base)
grub_error (GRUB_ERR_BAD_NUMBER, "unrecognized number");
return 0;
}
if (end)
*end = (char *) str;
@ -526,7 +526,7 @@ grub_strdup (const char *s)
{
grub_size_t len;
char *p;
len = grub_strlen (s) + 1;
p = (char *) grub_malloc (len);
if (! p)
@ -540,14 +540,14 @@ grub_strndup (const char *s, grub_size_t n)
{
grub_size_t len;
char *p;
len = grub_strlen (s);
if (len > n)
len = n;
p = (char *) grub_malloc (len + 1);
if (! p)
return 0;
grub_memcpy (p, s, len);
p[len] = '\0';
return p;
@ -616,17 +616,17 @@ grub_divmod64 (grub_uint64_t n, grub_uint32_t d, grub_uint32_t *r)
return ((grub_uint32_t) n) / d;
}
while (bits--)
{
m <<= 1;
if (n & (1ULL << 63))
m |= 1;
q <<= 1;
n <<= 1;
if (m >= d)
{
q |= 1;
@ -636,7 +636,7 @@ grub_divmod64 (grub_uint64_t n, grub_uint32_t d, grub_uint32_t *r)
if (r)
*r = m;
return q;
}
@ -647,7 +647,7 @@ grub_lltoa (char *str, int c, unsigned long long n)
{
unsigned base = (c == 'x') ? 16 : 10;
char *p;
if ((long long) n < 0 && c == 'd')
{
n = (unsigned long long) (-((long long) n));
@ -668,12 +668,12 @@ grub_lltoa (char *str, int c, unsigned long long n)
do
{
unsigned m;
n = grub_divmod64 (n, 10, &m);
*p++ = m + '0';
}
while (n);
*p = 0;
grub_reverse (str);
@ -688,7 +688,7 @@ grub_vsprintf (char *str, const char *fmt, va_list args)
auto void write_char (unsigned char ch);
auto void write_str (const char *s);
auto void write_fill (const char ch, int n);
void write_char (unsigned char ch)
{
if (str)
@ -711,7 +711,7 @@ grub_vsprintf (char *str, const char *fmt, va_list args)
for (i = 0; i < n; i++)
write_char (ch);
}
while ((c = *fmt++) != 0)
{
if (c != '%')
@ -825,7 +825,7 @@ grub_vsprintf (char *str, const char *fmt, va_list args)
if (rightfill && grub_strlen (tmp) < format1)
write_fill (zerofill, format1 - grub_strlen (tmp));
break;
case 'c':
n = va_arg (args, int);
write_char (n & 0xff);
@ -836,7 +836,7 @@ grub_vsprintf (char *str, const char *fmt, va_list args)
grub_uint32_t code = va_arg (args, grub_uint32_t);
int shift;
unsigned mask;
if (code <= 0x7f)
{
shift = 0;
@ -875,7 +875,7 @@ grub_vsprintf (char *str, const char *fmt, va_list args)
}
write_char (mask | (code >> shift));
for (shift -= 6; shift >= 0; shift -= 6)
write_char (0x80 | (0x3f & (code >> shift)));
}
@ -901,7 +901,7 @@ grub_vsprintf (char *str, const char *fmt, va_list args)
}
else
write_str ("(null)");
break;
default:
@ -916,7 +916,7 @@ grub_vsprintf (char *str, const char *fmt, va_list args)
if (count && !str)
grub_refresh ();
return count;
}
@ -925,7 +925,7 @@ grub_sprintf (char *str, const char *fmt, ...)
{
va_list ap;
int ret;
va_start (ap, fmt);
ret = grub_vsprintf (str, fmt, ap);
va_end (ap);
@ -950,7 +950,7 @@ grub_utf16_to_utf8 (grub_uint8_t *dest, grub_uint16_t *src,
{
/* Surrogate pair. */
code = ((code_high - 0xD800) << 12) + (code - 0xDC00) + 0x10000;
*dest++ = (code >> 18) | 0xF0;
*dest++ = ((code >> 12) & 0x3F) | 0x80;
*dest++ = ((code >> 6) & 0x3F) | 0x80;
@ -1009,7 +1009,7 @@ grub_utf8_to_ucs4 (grub_uint32_t *dest, grub_size_t destsize,
grub_uint32_t *p = dest;
int count = 0;
grub_uint32_t code = 0;
if (srcend)
*srcend = src;
@ -1036,7 +1036,7 @@ grub_utf8_to_ucs4 (grub_uint32_t *dest, grub_size_t destsize,
{
if (c == 0)
break;
if ((c & 0x80) == 0x00)
code = c;
else if ((c & 0xe0) == 0xc0)

View file

@ -74,7 +74,7 @@ grub_parser_cmdline_state (grub_parser_state_t state, char c, char *result)
if (transition->input == c)
break;
if (transition->input == ' ' && ! grub_isalpha (c)
if (transition->input == ' ' && ! grub_isalpha (c)
&& ! grub_isdigit (c) && c != '_')
break;
@ -136,7 +136,7 @@ grub_parser_split_cmdline (const char *cmdline, grub_reader_getline_t getline,
vp = varname;
if (! val)
return;
/* Insert the contents of the variable in the buffer. */
for (; *val; val++)
*(bp++) = *val;
@ -156,7 +156,7 @@ grub_parser_split_cmdline (const char *cmdline, grub_reader_getline_t getline,
{
grub_parser_state_t newstate;
char use;
newstate = grub_parser_cmdline_state (state, *rd, &use);
/* If a variable was being processed and this character does
@ -193,14 +193,14 @@ grub_parser_split_cmdline (const char *cmdline, grub_reader_getline_t getline,
/* A special case for when the last character was part of a
variable. */
add_var (GRUB_PARSER_STATE_TEXT);
/* Reserve memory for the return values. */
args = grub_malloc (bp - buffer);
if (! args)
return grub_errno;
grub_memcpy (args, buffer, bp - buffer);
*argv = grub_malloc (sizeof (char *) * (*argc + 1));
if (! *argv)
{

View file

@ -33,7 +33,7 @@ void
grub_partition_map_unregister (grub_partition_map_t partmap)
{
grub_partition_map_t *p, q;
for (p = &grub_partition_map_list, q = *p; q; p = &(q->next), q = q->next)
if (q == partmap)
{
@ -90,7 +90,7 @@ grub_partition_iterate (struct grub_disk *disk,
{
grub_partition_map_t partmap = 0;
int ret = 0;
auto int part_map_iterate (const grub_partition_map_t p);
auto int part_map_iterate_hook (grub_disk_t d,
const grub_partition_t partition);
@ -100,7 +100,7 @@ grub_partition_iterate (struct grub_disk *disk,
{
return 1;
}
int part_map_iterate (const grub_partition_map_t p)
{
grub_dprintf ("partition", "Detecting %s...\n", p->name);
@ -122,7 +122,7 @@ grub_partition_iterate (struct grub_disk *disk,
grub_partition_map_iterate (part_map_iterate);
if (partmap)
ret = partmap->iterate (disk, hook);
return ret;
}

View file

@ -47,7 +47,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
Elf32_Sym *symtab;
Elf32_Word entsize;
unsigned i;
/* Find a symbol table. */
for (i = 0, s = (Elf32_Shdr *) ((char *) e + e->e_shoff);
i < e->e_shnum;
@ -57,10 +57,10 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
if (i == e->e_shnum)
return grub_error (GRUB_ERR_BAD_MODULE, "no symtab found");
symtab = (Elf32_Sym *) ((char *) e + s->sh_offset);
entsize = s->sh_entsize;
for (i = 0, s = (Elf32_Shdr *) ((char *) e + e->e_shoff);
i < e->e_shnum;
i++, s = (Elf32_Shdr *) ((char *) s + e->e_shentsize))
@ -76,7 +76,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
if (seg)
{
Elf32_Rela *rel, *max;
for (rel = (Elf32_Rela *) ((char *) e + s->sh_offset),
max = rel + s->sh_size / s->sh_entsize;
rel < max;
@ -85,15 +85,15 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
Elf32_Word *addr;
Elf32_Sym *sym;
grub_uint32_t value;
if (seg->size < rel->r_offset)
return grub_error (GRUB_ERR_BAD_MODULE,
"reloc offset is out of the segment");
addr = (Elf32_Word *) ((char *) seg->addr + rel->r_offset);
sym = (Elf32_Sym *) ((char *) symtab
+ entsize * ELF32_R_SYM (rel->r_info));
/* On the PPC the value does not have an explicit
addend, add it. */
value = sym->st_value + rel->r_addend;
@ -102,29 +102,29 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
case R_PPC_ADDR16_LO:
*(Elf32_Half *) addr = value;
break;
case R_PPC_REL24:
{
Elf32_Sword delta = value - (Elf32_Word) addr;
if (delta << 6 >> 6 != delta)
return grub_error (GRUB_ERR_BAD_MODULE, "Relocation overflow");
*addr = (*addr & 0xfc000003) | (delta & 0x3fffffc);
break;
}
case R_PPC_ADDR16_HA:
*(Elf32_Half *) addr = (value + 0x8000) >> 16;
break;
case R_PPC_ADDR32:
*addr = value;
break;
case R_PPC_REL32:
*addr = value - (Elf32_Word) addr;
break;
default:
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"This relocation (%d) is not implemented yet",
@ -133,6 +133,6 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
}
}
}
return GRUB_ERR_NONE;
}

View file

@ -47,7 +47,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
Elf64_Sym *symtab;
Elf64_Word entsize;
unsigned i;
/* Find a symbol table. */
for (i = 0, s = (Elf64_Shdr *) ((char *) e + e->e_shoff);
i < e->e_shnum;
@ -57,10 +57,10 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
if (i == e->e_shnum)
return grub_error (GRUB_ERR_BAD_MODULE, "no symtab found");
symtab = (Elf64_Sym *) ((char *) e + s->sh_offset);
entsize = s->sh_entsize;
for (i = 0, s = (Elf64_Shdr *) ((char *) e + e->e_shoff);
i < e->e_shnum;
i++, s = (Elf64_Shdr *) ((char *) s + e->e_shentsize))
@ -76,7 +76,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
if (seg)
{
Elf64_Rela *rel, *max;
for (rel = (Elf64_Rela *) ((char *) e + s->sh_offset),
max = rel + s->sh_size / s->sh_entsize;
rel < max;
@ -85,11 +85,11 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
Elf64_Word *addr;
Elf64_Sym *sym;
Elf64_Addr value;
if (seg->size < rel->r_offset)
return grub_error (GRUB_ERR_BAD_MODULE,
"reloc offset is out of the segment");
addr = (Elf64_Word *) ((char *) seg->addr + rel->r_offset);
sym = (Elf64_Sym *) ((char *) symtab
+ entsize * ELF64_R_SYM (rel->r_info));
@ -139,6 +139,6 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
}
}
}
return GRUB_ERR_NONE;
}

View file

@ -35,12 +35,12 @@ struct grub_handler_class grub_term_input_class =
{
.name = "terminal_input"
};
struct grub_handler_class grub_term_output_class =
{
.name = "terminal_output"
};
#define grub_cur_term_input grub_term_get_current_input ()
#define grub_cur_term_output grub_term_get_current_output ()
@ -53,16 +53,16 @@ grub_putcode (grub_uint32_t code)
if (code == '\t' && grub_cur_term_output->getxy)
{
int n;
n = 8 - ((grub_getxy () >> 8) & 7);
while (n--)
grub_putcode (' ');
return;
}
(grub_cur_term_output->putchar) (code);
if (code == '\n')
{
grub_putcode ('\r');
@ -81,12 +81,12 @@ grub_putcode (grub_uint32_t code)
grub_setcolorstate (GRUB_TERM_COLOR_STANDARD);
key = grub_getkey ();
/* Remove the message. */
grub_gotoxy (1, height - 1);
grub_printf (" ");
grub_gotoxy (pos >> 8, pos & 0xFF);
/* Scroll one lines or an entire page, depending on the key. */
if (key == '\r' || key =='\n')
grub_more_lines--;
@ -108,7 +108,7 @@ grub_putchar (int c)
buf[size++] = c;
ret = grub_utf8_to_ucs4 (&code, 1, buf, size, 0);
if (ret > 0)
{
size = 0;
@ -201,7 +201,7 @@ grub_setcursor (int on)
(grub_cur_term_output->setcursor) (on);
cursor_state = on;
}
return ret;
}