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:
marco_g 2004-12-27 13:46:20 +00:00
parent e4b47e0cd5
commit 924b6140a1
23 changed files with 2131 additions and 658 deletions

View file

@ -1,3 +1,69 @@
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.
2004-12-19 Marco Gerards <metgerards@student.han.nl>
* conf/powerpc-ieee1275.rmk (MOSTLYCLEANFILES): Remove

View file

@ -113,7 +113,7 @@ DISTFILES = $(COMMON_DISTFILES) $(BOOT_DISTFILES) $(CONF_DISTFILES) \
$(KERN_DISTFILES) $(LOADER_DISTFILES) $(TERM_DISTFILES) \
$(UTIL_DISTFILES)
DATA = $(pkgdata_IMAGES) $(pkgdata_MODULES)
DATA = $(pkgdata_IMAGES) $(pkgdata_MODULES) $(pkgdata_PROGRAMS)
PROGRAMS = $(bin_UTILITIES) $(sbin_UTILITIES)
SCRIPTS =

View file

@ -21,8 +21,9 @@
#include <alloca.h>
#include <stdint.h>
#include "grub/machine/ieee1275.h"
#include "grub/kernel.h"
#include <grub/machine/ieee1275.h>
#include <grub/kernel.h>
#include <grub/machine/init.h>
struct module_info
{
@ -37,15 +38,6 @@ intptr_t (*grub_ieee1275_entry_fn) (void *);
grub_uint32_t grub_ieee1275_flags;
/* Return a help text for this architecture. */
const char *
help_arch (void)
{
/* No special information. */
return "";
}
/* Setup the argument vector and pass control over to the main
function. */

File diff suppressed because it is too large Load diff

View file

@ -11,7 +11,7 @@ DEFSYMFILES += kernel_syms.lst
grubof_HEADERS = arg.h boot.h device.h disk.h dl.h elf.h env.h err.h \
file.h fs.h kernel.h misc.h mm.h net.h rescue.h symbol.h \
term.h types.h machine/biosdisk.h \
term.h types.h machine/biosdisk.h powerpc/libgcc.h loader.h \
partition.h pc_partition.h machine/time.h machine/ieee1275.h
grubof_symlist.c: $(addprefix include/grub/,$(grubof_HEADERS)) gensymlist.sh
@ -20,8 +20,10 @@ grubof_symlist.c: $(addprefix include/grub/,$(grubof_HEADERS)) gensymlist.sh
kernel_syms.lst: $(addprefix include/grub/,$(grubof_HEADERS)) genkernsyms.sh
sh $(srcdir)/genkernsyms.sh $(filter %h,$^) > $@
# Programs
pkgdata_PROGRAMS = grubof
# Utilities.
sbin_UTILITIES = grubof
bin_UTILITIES = grub-emu
noinst_UTILITIES = genmoddep
@ -36,23 +38,20 @@ grub_emu_SOURCES = kern/main.c kern/device.c \
normal/arg.c kern/partition.c \
util/console.c util/grub-emu.c util/misc.c util/i386/pc/getroot.c \
kern/env.c commands/ls.c \
commands/terminal.c commands/boot.c commands/cmp.c commands/cat.c
commands/terminal.c commands/boot.c commands/cmp.c commands/cat.c \
kern/powerpc/cache.S
grub_emu_LDFLAGS = -lncurses
grubof_SOURCES = boot/powerpc/ieee1275/crt0.S boot/powerpc/ieee1275/cmain.c \
boot/powerpc/ieee1275/ieee1275.c kern/main.c kern/device.c \
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c fs/fshelp.c \
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
kern/misc.c kern/mm.c kern/loader.c kern/rescue.c kern/term.c \
kern/powerpc/ieee1275/init.c term/powerpc/ieee1275/ofconsole.c \
kern/powerpc/ieee1275/openfw.c fs/ext2.c fs/ufs.c fs/minix.c fs/hfs.c \
fs/jfs.c normal/cmdline.c normal/command.c normal/main.c normal/menu.c \
disk/powerpc/ieee1275/ofdisk.c partmap/amiga.c partmap/pc.c \
partmap/apple.c kern/partition.c \
kern/env.c normal/arg.c loader/powerpc/ieee1275/linux.c \
loader/powerpc/ieee1275/linux_normal.c commands/boot.c \
normal/powerpc/setjmp.S kern/powerpc/dl.c grubof_symlist.c
kern/powerpc/ieee1275/openfw.c disk/powerpc/ieee1275/ofdisk.c \
kern/partition.c kern/env.c kern/powerpc/dl.c grubof_symlist.c \
kern/powerpc/cache.S
grubof_HEADERS = grub/powerpc/ieee1275/ieee1275.h
grubof_CFLAGS = $(COMMON_CFLAGS) -DGRUBOF
grubof_CFLAGS = $(COMMON_CFLAGS)
grubof_ASFLAGS = $(COMMON_ASFLAGS)
grubof_LDFLAGS = -nostdlib -static-libgcc -lgcc -Wl,-N,-S,-Ttext,0x200000,-Bstatic
@ -60,3 +59,92 @@ grubof_LDFLAGS = -nostdlib -static-libgcc -lgcc -Wl,-N,-S,-Ttext,0x200000,-Bstat
genmoddep_SOURCES = util/genmoddep.c
# Modules.
pkgdata_MODULES = _linux.mod linux.mod fat.mod ufs.mod ext2.mod minix.mod \
hfs.mod jfs.mod normal.mod hello.mod font.mod \
boot.mod cmp.mod cat.mod terminal.mod fshelp.mod amiga.mod apple.mod pc.mod
# For fshelp.mod.
fshelp_mod_SOURCES = fs/fshelp.c
fshelp_mod_CFLAGS = $(COMMON_CFLAGS)
# For fat.mod.
fat_mod_SOURCES = fs/fat.c
fat_mod_CFLAGS = $(COMMON_CFLAGS)
# For ext2.mod.
ext2_mod_SOURCES = fs/ext2.c
ext2_mod_CFLAGS = $(COMMON_CFLAGS)
# For ufs.mod.
ufs_mod_SOURCES = fs/ufs.c
ufs_mod_CFLAGS = $(COMMON_CFLAGS)
# For minix.mod.
minix_mod_SOURCES = fs/minix.c
minix_mod_CFLAGS = $(COMMON_CFLAGS)
# For hfs.mod.
hfs_mod_SOURCES = fs/hfs.c
hfs_mod_CFLAGS = $(COMMON_CFLAGS)
# For jfs.mod.
jfs_mod_SOURCES = fs/jfs.c
jfs_mod_CFLAGS = $(COMMON_CFLAGS)
# For iso9660.mod.
iso9660_mod_SOURCES = fs/iso9660.c
iso9660_mod_CFLAGS = $(COMMON_CFLAGS)
# For _linux.mod.
_linux_mod_SOURCES = loader/powerpc/ieee1275/linux.c
_linux_mod_CFLAGS = $(COMMON_CFLAGS)
# For linux.mod.
linux_mod_SOURCES = loader/powerpc/ieee1275/linux_normal.c
linux_mod_CFLAGS = $(COMMON_CFLAGS)
# For normal.mod.
normal_mod_SOURCES = normal/cmdline.c normal/command.c normal/main.c \
normal/menu.c normal/arg.c normal/powerpc/setjmp.S
normal_mod_CFLAGS = $(COMMON_CFLAGS)
normal_mod_ASFLAGS = $(COMMON_ASFLAGS)
# For hello.mod.
hello_mod_SOURCES = hello/hello.c
hello_mod_CFLAGS = $(COMMON_CFLAGS)
# For boot.mod.
boot_mod_SOURCES = commands/boot.c
boot_mod_CFLAGS = $(COMMON_CFLAGS)
# For terminal.mod.
terminal_mod_SOURCES = commands/terminal.c
terminal_mod_CFLAGS = $(COMMON_CFLAGS)
# For ls.mod.
ls_mod_SOURCES = commands/ls.c
ls_mod_CFLAGS = $(COMMON_CFLAGS)
# For cmp.mod.
cmp_mod_SOURCES = commands/cmp.c
cmp_mod_CFLAGS = $(COMMON_CFLAGS)
# For cat.mod.
cat_mod_SOURCES = commands/cat.c
cat_mod_CFLAGS = $(COMMON_CFLAGS)
# For font.mod.
font_mod_SOURCES = font/manager.c
font_mod_CFLAGS = $(COMMON_CFLAGS)
# For amiga.mod
amiga_mod_SOURCES = partmap/amiga.c
amiga_mod_CFLAGS = $(COMMON_CFLAGS)
# For apple.mod
apple_mod_SOURCES = partmap/apple.c
apple_mod_CFLAGS = $(COMMON_CFLAGS)
# For pc.mod
pc_mod_SOURCES = partmap/pc.c
pc_mod_CFLAGS = $(COMMON_CFLAGS)

839
configure vendored

File diff suppressed because it is too large Load diff

View file

@ -22,10 +22,13 @@
#include <grub/disk.h>
#include <grub/mm.h>
#include <grub/machine/ieee1275.h>
#include <grub/machine/init.h>
static int
grub_ofdisk_iterate (int (*hook) (const char *name))
{
auto int dev_iterate (struct grub_ieee1275_devalias *alias);
int dev_iterate (struct grub_ieee1275_devalias *alias)
{
if (! grub_strcmp (alias->type, "block"))

View file

@ -1,6 +1,6 @@
#! /usr/bin/ruby -w
#
# Copyright (C) 2002,2003 Free Software Foundation, Inc.
# Copyright (C) 2002,2003,2004 Free Software Foundation, Inc.
#
# This genmk.rb is free software; the author
# gives unlimited permission to copy and/or distribute it,
@ -205,9 +205,55 @@ MOSTLYCLEANFILES += #{deps_str}
end
end
class Program
def initialize(dir, name)
@dir = dir
@name = name
end
attr_reader :dir, :name
def rule(sources)
prefix = @name.to_var
objs = sources.collect do |src|
raise "unknown source file `#{src}'" if /\.[cS]$/ !~ src
prefix + '-' + src.to_obj
end
objs_str = objs.join(' ');
deps = objs.collect {|obj| obj.suffix('d')}
deps_str = deps.join(' ');
"CLEANFILES += #{@name} #{objs_str}
MOSTLYCLEANFILES += #{deps_str}
#{@name}: #{objs_str}
$(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(#{prefix}_LDFLAGS)
" + objs.collect_with_index do |obj, i|
src = sources[i]
fake_obj = File.basename(src).suffix('o')
dep = deps[i]
dir = File.dirname(src)
"#{obj}: #{src}
$(CC) -I#{dir} -I$(srcdir)/#{dir} $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(#{prefix}_CFLAGS) -c -o $@ $<
#{dep}: #{src}
set -e; \
$(CC) -I#{dir} -I$(srcdir)/#{dir} $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(#{prefix}_CFLAGS) -M $< \
| sed 's,#{Regexp.quote(fake_obj)}[ :]*,#{obj} $@ : ,g' > $@; \
[ -s $@ ] || rm -f $@
-include #{dep}
"
end.join('')
end
end
images = []
utils = []
pmodules = []
programs = []
cont = false
s = nil
@ -245,6 +291,11 @@ while l = gets
Utility.new(prefix, util)
end
when 'PROGRAMS'
programs += args.split(/\s+/).collect do |util|
Program.new(prefix, util)
end
when 'SOURCES'
if img = images.detect() {|i| i.name.to_var == prefix}
print img.rule(args.split(/\s+/))
@ -252,6 +303,8 @@ while l = gets
print pmod.rule(args.split(/\s+/))
elsif util = utils.detect() {|u| u.name.to_var == prefix}
print util.rule(args.split(/\s+/))
elsif program = programs.detect() {|u| u.name.to_var == prefix}
print program.rule(args.split(/\s+/))
end
end
end

29
include/grub/cache.h Normal file
View file

@ -0,0 +1,29 @@
/* cache.h - Flush the processor's cache. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 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
* 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 GRUB; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef GRUB_CACHE_H
#define GRUB_CACHE_H 1
#include <grub/symbol.h>
#include <grub/types.h>
void EXPORT_FUNC(grub_arch_sync_caches) (void *address, grub_size_t len);
#endif /* ! GRUB_CACHE_HEADER */

View file

@ -1,7 +1,7 @@
/* dl.h - types and prototypes for loadable module support */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002 Free Software Foundation, Inc.
* Copyright (C) 2002, 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

View file

@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002 Free Software Foundation, Inc.
* Copyright (C) 2002, 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
@ -27,6 +27,9 @@
extern grub_size_t EXPORT_VAR(grub_lower_mem);
extern grub_size_t EXPORT_VAR(grub_upper_mem);
extern grub_addr_t EXPORT_VAR(grub_os_area_addr);
extern grub_size_t EXPORT_VAR(grub_os_area_size);
/* Get the memory size in KB. If EXTENDED is zero, return conventional
memory, otherwise return extended memory. */
grub_uint16_t grub_get_memsize (int extended);

View file

@ -26,9 +26,6 @@
#include <grub/err.h>
#include <grub/types.h>
extern grub_addr_t EXPORT_VAR(grub_os_area_addr);
extern grub_size_t EXPORT_VAR(grub_os_area_size);
int EXPORT_FUNC(grub_loader_is_loaded) (void);
void EXPORT_FUNC(grub_loader_set) (grub_err_t (*boot) (void),
grub_err_t (*unload) (void));

View file

@ -39,7 +39,7 @@ struct grub_ieee1275_mem_region
unsigned int size;
};
extern intptr_t (*grub_ieee1275_entry_fn) (void *);
extern intptr_t(* EXPORT_VAR(grub_ieee1275_entry_fn)) (void *);
#ifndef IEEE1275_CALL_ENTRY_FN
#define IEEE1275_CALL_ENTRY_FN(args) (*grub_ieee1275_entry_fn) (args)

View file

@ -0,0 +1,28 @@
/* ieee1275.h - Access the Open Firmware client interface. */
/*
* 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.
*/
#ifndef GRUB_INIT_MACHINE_HEADER
#define GRUB_INIT_MACHINE_HEADER 1
void cmain (uint32_t r3, uint32_t r4 __attribute__((unused)), uint32_t r5);
void grub_ofdisk_init (void);
void grub_console_init (void);
#endif /* ! GRUB_INIT_MACHINE_HEADER */

View file

@ -0,0 +1,42 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 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
* 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 GRUB; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
void EXPORT_FUNC (memset) (void);
void EXPORT_FUNC (__adddf3) (void);
void EXPORT_FUNC (__addsf3) (void);
void EXPORT_FUNC (__ashldi3) (void);
void EXPORT_FUNC (__bss_start) (void);
void EXPORT_FUNC (__extendsfdf2) (void);
void EXPORT_FUNC (__fixunsdfsi) (void);
void EXPORT_FUNC (__floatsidf) (void);
void EXPORT_FUNC (__floatsisf) (void);
void EXPORT_FUNC (__lshrdi3) (void);
void EXPORT_FUNC (__make_dp) (void);
void EXPORT_FUNC (__make_fp) (void);
void EXPORT_FUNC (__muldf3) (void);
void EXPORT_FUNC (__pack_d) (void);
void EXPORT_FUNC (__pack_f) (void);
void EXPORT_FUNC (__subdf3) (void);
void EXPORT_FUNC (__subsf3) (void);
void EXPORT_FUNC (__thenan_df) (void);
void EXPORT_FUNC (__thenan_sf) (void);
void EXPORT_FUNC (__trampoline_setup) (void);
void EXPORT_FUNC (__truncdfsf2) (void);
void EXPORT_FUNC (__unpack_d) (void);
void EXPORT_FUNC (__unpack_f) (void);

View file

@ -26,7 +26,8 @@
/* The size of long. */
#define GRUB_HOST_SIZEOF_LONG 4
/* powerpc is little-endian. */
#undef GRUB_HOST_WORDS_LITTLEENDIAN
/* powerpc is big-endian. */
#define GRUB_HOST_WORDS_BIGENDIAN 1
#endif /* ! GRUB_TYPES_CPU_HEADER */

View file

@ -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))

View file

@ -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
View 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

View file

@ -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));
}
}
}

View file

@ -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 ();
}

View file

@ -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)
{

View file

@ -226,3 +226,9 @@ grub_get_rtc (void)
return times (&currtime);
}
void
grub_arch_sync_caches (void *address __attribute__ ((unused)),
grub_size_t len __attribute__ ((unused)))
{
}