2004-12-27 Marco Gerards <metgerards@student.han.nl>
* genmk.rb: Handle the `Program' class in the main loop. Written by Johan Rydberg <jrydberg@gnu.org>. (Program): New class. (programs): New variable. * boot/powerpc/ieee1275/cmain.c: Include <grub/machine/ieee1275.h> instead of "grub/machine/ieee1275.h". Include <grub/kernel.h> instead of "grub/kernel.h". Include <grub/machine/init.h>. (help_arch): Function removed. * conf/powerpc-ieee1275.rmk (grubof_HEADERS): Add `powerpc/libgcc.h' and `loader.h'. (pkgdata_PROGRAMS): New variable. (sbin_UTILITIES): Variable removed. (grub_emu_SOURCES): Added kern/powerpc/cache.S. (grubof_SOURCES): Variable re-defined so it only includes the core functionality. (grubof_CFLAGS): Remove `-DGRUBOF'. (pkgdata_MODULES, fshelp_mod_SOURCES, fshelp_mod_CFLAGS, (fat_mod_SOURCES, fat_mod_CFLAGS, ext2_mod_SOURCES) (ext2_mod_CFLAGS, ufs_mod_SOURCES, ufs_mod_CFLAGS) (minix_mod_SOURCES, minix_mod_CFLAGS, hfs_mod_SOURCES) (hfs_mod_CFLAGS, jfs_mod_SOURCES, jfs_mod_CFLAGS) (iso9660_mod_SOURCES, iso9660_mod_CFLAGS, _linux_mod_SOURCES) (_linux_mod_CFLAGS, linux_mod_SOURCES, linux_mod_CFLAGS) (normal_mod_SOURCES, normal_mod_CFLAGS, normal_mod_ASFLAGS) (hello_mod_SOURCES, hello_mod_CFLAGS, boot_mod_SOURCES) (boot_mod_CFLAGS, terminal_mod_SOURCES, terminal_mod_CFLAGS) (ls_mod_SOURCES, ls_mod_CFLAGS, cmp_mod_SOURCES, cmp_mod_CFLAGS) (cat_mod_SOURCES, cat_mod_CFLAGS, font_mod_SOURCES) (font_mod_CFLAGS, amiga_mod_SOURCES, amiga_mod_CFLAGS) (apple_mod_SOURCES, apple_mod_CFLAGS, pc_mod_SOURCES) (pc_mod_CFLAGS): New variables. * disk/powerpc/ieee1275/ofdisk.c: Include <grub/machine/init.h>. (grub_ofdisk_iterate): Add a prototype for `dev_iterate'. * include/grub/dl.h (grub_arch_dl_sync_caches): New prototype. * include/grub/loader.h (grub_os_area_addr, grub_os_area_size): Moved from here... * include/grub/i386/pc/init.h (grub_os_area_addr) (rub_os_area_size): ... to here. * include/grub/powerpc/ieee1275/ieee1275.h (grub_ieee1275_entry_fn): Export symbol. * include/grub/powerpc/ieee1275/init.h: New file. * include/grub/powerpc/libgcc.h: Likewise. * include/grub/cache.h: Likewise. * kern/powerpc/cache.S: Likewise. Written by Hollis Blanchard <hollis@penguinppc.org>. * kern/dl.c: Include <grub/cache.h>. (grub_dl_flush_cache): New function. (grub_dl_load_core): Call `grub_dl_flush_cache' to flush the cache for this module. * kern/powerpc/ieee1275/init.c (grub_ofdisk_init) (grub_console_init): Removed prototypes. (grub_machine_init): Don't initialize the modules anymore. * kern/powerpc/ieee1275/openfw.c (grub_map): Make the function static. * include/grub/powerpc/types.h (GRUB_HOST_WORDS_LITTLEENDIAN): Macro undef removed. (GRUB_HOST_WORDS_BIGENDIAN): New macro. * kern/powerpc/dl.c (grub_arch_dl_relocate_symbols): Add relocation `R_PPC_REL32'. Return an error when the relocation is unknown. * Makefile.in (DATA): Add `$(pkgdata_PROGRAMS)'. * kern/i386/pc/init.c (grub_arch_sync_caches): New function. * util/misc.c (grub_arch_sync_caches): Likewise.
This commit is contained in:
parent
e4b47e0cd5
commit
924b6140a1
23 changed files with 2131 additions and 658 deletions
14
kern/dl.c
14
kern/dl.c
|
@ -1,7 +1,7 @@
|
|||
/* dl.c - loadable module support */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -28,6 +28,7 @@
|
|||
#include <grub/symbol.h>
|
||||
#include <grub/file.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/cache.h>
|
||||
|
||||
#if GRUB_HOST_SIZEOF_VOID_P == 4
|
||||
|
||||
|
@ -479,6 +480,15 @@ grub_dl_unref (grub_dl_t mod)
|
|||
return --mod->ref_count;
|
||||
}
|
||||
|
||||
static void
|
||||
grub_dl_flush_cache (grub_dl_t mod)
|
||||
{
|
||||
grub_dl_segment_t seg;
|
||||
|
||||
for (seg = mod->segment; seg; seg = seg->next)
|
||||
grub_arch_sync_caches (seg->addr, seg->size);
|
||||
}
|
||||
|
||||
/* Load a module from core memory. */
|
||||
grub_dl_t
|
||||
grub_dl_load_core (void *addr, grub_size_t size)
|
||||
|
@ -515,6 +525,8 @@ grub_dl_load_core (void *addr, grub_size_t size)
|
|||
return 0;
|
||||
}
|
||||
|
||||
grub_dl_flush_cache (mod);
|
||||
|
||||
grub_dl_call_init (mod);
|
||||
|
||||
if (grub_dl_add (mod))
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -46,6 +46,12 @@ grub_addr_t grub_os_area_addr;
|
|||
grub_size_t grub_os_area_size;
|
||||
grub_size_t grub_lower_mem, grub_upper_mem;
|
||||
|
||||
void
|
||||
grub_arch_sync_caches (void *address __attribute__ ((unused)),
|
||||
grub_size_t len __attribute__ ((unused)))
|
||||
{
|
||||
}
|
||||
|
||||
static char *
|
||||
make_install_device (void)
|
||||
{
|
||||
|
|
45
kern/powerpc/cache.S
Normal file
45
kern/powerpc/cache.S
Normal file
|
@ -0,0 +1,45 @@
|
|||
/* cache.S - Flush the processor cache for a specific region. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#define CACHE_LINE_BYTES 32
|
||||
|
||||
.text
|
||||
|
||||
.align 2
|
||||
.globl grub_arch_sync_caches
|
||||
grub_arch_sync_caches:
|
||||
/* Force the dcache lines to memory. */
|
||||
li 5, 0
|
||||
1: dcbst 5, 3
|
||||
addi 5, 5, CACHE_LINE_BYTES
|
||||
cmpw 5, 4
|
||||
blt 1b
|
||||
sync /* Force all dcbsts to complete. */
|
||||
|
||||
/* Invalidate the icache lines. */
|
||||
li 5, 0
|
||||
1: icbi 5, 3
|
||||
addi 5, 5, CACHE_LINE_BYTES
|
||||
cmpw 5, 4
|
||||
blt 1b
|
||||
sync /* Force all icbis to complete. */
|
||||
isync /* Discard partially executed instructions that were
|
||||
loaded from the invalid icache. */
|
||||
blr
|
|
@ -135,6 +135,15 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
|||
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",
|
||||
ELF32_R_TYPE (rel->r_info));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,10 +29,8 @@
|
|||
#include <grub/setjmp.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/misc.h>
|
||||
|
||||
void grub_ofdisk_init (void);
|
||||
void grub_console_init (void);
|
||||
|
||||
#include <grub/machine/init.h>
|
||||
#include <grub/machine/time.h>
|
||||
|
||||
/* XXX: Modules are not yet supported. */
|
||||
grub_addr_t grub_end_addr = -1;
|
||||
|
@ -70,17 +68,8 @@ grub_machine_init (void)
|
|||
}
|
||||
grub_mm_init_region ((void *) heap_start, heap_len);
|
||||
|
||||
/* XXX: Loadable modules are not supported. */
|
||||
grub_env_set ("prefix", "");
|
||||
|
||||
grub_ext2_init ();
|
||||
grub_normal_init ();
|
||||
grub_boot_init ();
|
||||
grub_linux_init ();
|
||||
grub_linux_normal_init ();
|
||||
grub_pc_partition_map_init ();
|
||||
grub_amiga_partition_map_init ();
|
||||
grub_apple_partition_map_init ();
|
||||
grub_ofdisk_init ();
|
||||
}
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ grub_devalias_iterate (int (*hook) (struct grub_ieee1275_devalias *alias))
|
|||
}
|
||||
|
||||
/* Call the "map" method of /chosen/mmu. */
|
||||
int
|
||||
static int
|
||||
grub_map (grub_addr_t phys, grub_addr_t virt, grub_uint32_t size,
|
||||
grub_uint8_t mode)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue