Fix emu on mipsel.

* conf/Makefile.common (CFLAGS_PLATFORM): Add -mflush-func
	=grub_cpu_flush_cache on all mips and not only yeeloong.
	* configure.ac (COND_mips): New conditional.
	* grub-core/Makefile.am (KERNEL_HEADER_FILES): Add libgcc on all
	platforms.
	* grub-core/kern/emu/cache.S (__mips__): Use _flush_cache.
	* grub-core/kern/emu/full.c (grub_arch_dl_init_linker)
	[GRUB_LINKER_HAVE_INIT]: New function.
	(grub_emu_post_init): Likewise.
	* grub-core/kern/emu/lite.c (grub_emu_post_init): Likewise.
	* grub-core/kern/emu/main.c: Use grub_emu_post_init.
	* include/grub/cache.h (_mips): Include mips/cache.h.
	* include/grub/disk.h [GRUB_UTIL || GRUB_MACHINE_EMU]: Add missing
	LVM and RAID prototypes.
	* include/grub/emu/misc.h (grub_emu_post_init): New proto.
	* include/grub/mips/time.h (grub_cpu_idle) [GRUB_MACHINE_EMU]: New
	function.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-09-11 16:58:06 +02:00
parent 5ed7d816b4
commit 050abaeaa8
12 changed files with 94 additions and 16 deletions

View file

@ -1,3 +1,25 @@
2010-09-11 Vladimir Serbinenko <phcoder@gmail.com>
Fix emu on mipsel.
* conf/Makefile.common (CFLAGS_PLATFORM): Add -mflush-func
=grub_cpu_flush_cache on all mips and not only yeeloong.
* configure.ac (COND_mips): New conditional.
* grub-core/Makefile.am (KERNEL_HEADER_FILES): Add libgcc on all
platforms.
* grub-core/kern/emu/cache.S (__mips__): Use _flush_cache.
* grub-core/kern/emu/full.c (grub_arch_dl_init_linker)
[GRUB_LINKER_HAVE_INIT]: New function.
(grub_emu_post_init): Likewise.
* grub-core/kern/emu/lite.c (grub_emu_post_init): Likewise.
* grub-core/kern/emu/main.c: Use grub_emu_post_init.
* include/grub/cache.h (_mips): Include mips/cache.h.
* include/grub/disk.h [GRUB_UTIL || GRUB_MACHINE_EMU]: Add missing
LVM and RAID prototypes.
* include/grub/emu/misc.h (grub_emu_post_init): New proto.
* include/grub/mips/time.h (grub_cpu_idle) [GRUB_MACHINE_EMU]: New
function.
2010-09-10 Colin Watson <cjwatson@ubuntu.com> 2010-09-10 Colin Watson <cjwatson@ubuntu.com>
* util/grub-install.in: Don't try to verify core.img until after * util/grub-install.in: Don't try to verify core.img until after

View file

@ -1,8 +1,10 @@
# -*- makefile -*- # -*- makefile -*-
CFLAGS_PLATFORM=
# Platform specific options # Platform specific options
if COND_i386_pc if COND_i386_pc
CFLAGS_PLATFORM = -mrtd -mregparm=3 CFLAGS_PLATFORM += -mrtd -mregparm=3
endif endif
if COND_i386_efi if COND_i386_efi
LDFLAGS_PLATFORM = -melf_i386 LDFLAGS_PLATFORM = -melf_i386
@ -11,21 +13,24 @@ if COND_x86_64_efi
LDFLAGS_PLATFORM = -melf_x86_64 LDFLAGS_PLATFORM = -melf_x86_64
endif endif
if COND_i386_qemu if COND_i386_qemu
CFLAGS_PLATFORM = -mrtd -mregparm=3 CFLAGS_PLATFORM += -mrtd -mregparm=3
endif endif
if COND_i386_coreboot if COND_i386_coreboot
CFLAGS_PLATFORM = -mrtd -mregparm=3 CFLAGS_PLATFORM += -mrtd -mregparm=3
endif endif
if COND_i386_ieee1275 if COND_i386_ieee1275
CFLAGS_PLATFORM = -mrtd -mregparm=3 CFLAGS_PLATFORM += -mrtd -mregparm=3
endif endif
if COND_mips_yeeloong if COND_mips_yeeloong
CFLAGS_PLATFORM = -march=mips3 -mexplicit-relocs -mflush-func=grub_cpu_flush_cache CFLAGS_PLATFORM += -march=mips3 -mexplicit-relocs
CPPFLAGS_PLATFORM = -DUSE_ASCII_FAILBACK CPPFLAGS_PLATFORM = -DUSE_ASCII_FAILBACK
CCASFLAGS_PLATFORM = -march=mips3 CCASFLAGS_PLATFORM = -march=mips3
endif endif
if COND_mips
CFLAGS_PLATFORM += -mflush-func=grub_cpu_flush_cache
endif
if COND_sparc64_ieee1275 if COND_sparc64_ieee1275
CFLAGS_PLATFORM = -mno-app-regs CFLAGS_PLATFORM += -mno-app-regs
LDFLAGS_PLATFORM = -melf64_sparc -mno-relax LDFLAGS_PLATFORM = -melf64_sparc -mno-relax
endif endif

View file

@ -900,6 +900,7 @@ AM_CONDITIONAL([COND_mips_yeeloong], [test x$target_cpu = xmips -a x$platform =
AM_CONDITIONAL([COND_mips_qemu_mips], [test x$target_cpu = xmips -a x$platform = xqemu_mips]) AM_CONDITIONAL([COND_mips_qemu_mips], [test x$target_cpu = xmips -a x$platform = xqemu_mips])
AM_CONDITIONAL([COND_sparc64_ieee1275], [test x$target_cpu = xsparc64 -a x$platform = xieee1275]) AM_CONDITIONAL([COND_sparc64_ieee1275], [test x$target_cpu = xsparc64 -a x$platform = xieee1275])
AM_CONDITIONAL([COND_powerpc_ieee1275], [test x$target_cpu = xpowerpc -a x$platform = xieee1275]) AM_CONDITIONAL([COND_powerpc_ieee1275], [test x$target_cpu = xpowerpc -a x$platform = xieee1275])
AM_CONDITIONAL([COND_mips], [test x$target_cpu = xmips])
AM_CONDITIONAL([COND_HOST_HURD], [test x$host_kernel = xhurd]) AM_CONDITIONAL([COND_HOST_HURD], [test x$host_kernel = xhurd])
AM_CONDITIONAL([COND_HOST_LINUX], [test x$host_kernel = xlinux]) AM_CONDITIONAL([COND_HOST_LINUX], [test x$host_kernel = xlinux])

View file

@ -74,6 +74,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/term.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/time.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/time.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/mm_private.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/mm_private.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libgcc.h
if COND_i386_pc if COND_i386_pc
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h
@ -132,7 +133,6 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/font.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bitmap_scale.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bitmap_scale.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bufio.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bufio.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libgcc.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/cs5536.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/cs5536.h
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/pci.h KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/pci.h
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/serial.h KERNEL_HEADER_FILES += $(top_builddir)/include/grub/serial.h
@ -140,11 +140,9 @@ endif
if COND_powerpc_ieee1275 if COND_powerpc_ieee1275
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libgcc.h
endif endif
if COND_sparc64_ieee1275 if COND_sparc64_ieee1275
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libgcc.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/sparc64/ieee1275/ieee1275.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/sparc64/ieee1275/ieee1275.h
endif endif

View file

@ -7,7 +7,20 @@
#elif defined(__sparc__) #elif defined(__sparc__)
#include "../sparc64/cache.S" #include "../sparc64/cache.S"
#elif defined(__mips__) #elif defined(__mips__)
#include "../mips/cache.S" /* On MIPS we must go through standard functions. */
#include <grub/symbol.h>
FUNCTION (grub_cpu_flush_cache)
FUNCTION (grub_arch_sync_caches)
.set nomacro
.set noreorder
lui $t0, %hi(_flush_cache)
addui $t0, $t0, %lo(_flush_cache)
move $a3, $zero
jr $t0
nop
.set reorder
.set macro
#elif defined(__powerpc__) #elif defined(__powerpc__)
#include "../powerpc/cache.S" #include "../powerpc/cache.S"
#else #else

View file

@ -22,6 +22,7 @@
#include <grub/kernel.h> #include <grub/kernel.h>
#include <grub/misc.h> #include <grub/misc.h>
#include <grub/emu/misc.h> #include <grub/emu/misc.h>
#include <grub/disk.h>
void void
grub_register_exported_symbols (void) grub_register_exported_symbols (void)
@ -48,3 +49,21 @@ grub_emu_init (void)
{ {
grub_no_autoload = 1; grub_no_autoload = 1;
} }
#ifdef GRUB_LINKER_HAVE_INIT
void
grub_arch_dl_init_linker (void)
{
}
#endif
void
grub_emu_post_init (void)
{
grub_lvm_fini ();
grub_mdraid_fini ();
grub_raid_fini ();
grub_raid_init ();
grub_mdraid_init ();
grub_lvm_init ();
}

View file

@ -38,3 +38,8 @@ grub_emu_init (void)
{ {
return; return;
} }
void
grub_emu_post_init (void)
{
}

View file

@ -197,12 +197,7 @@ main (int argc, char *argv[])
grub_init_all (); grub_init_all ();
grub_lvm_fini (); grub_emu_post_init ();
grub_mdraid_fini ();
grub_raid_fini ();
grub_raid_init ();
grub_mdraid_init ();
grub_lvm_init ();
/* Make sure that there is a root device. */ /* Make sure that there is a root device. */
if (! root_dev) if (! root_dev)

View file

@ -23,6 +23,10 @@
#include <grub/symbol.h> #include <grub/symbol.h>
#include <grub/types.h> #include <grub/types.h>
#ifdef _mips
#include <grub/mips/cache.h>
#endif
#if defined (__i386__) || defined (__x86_64__) #if defined (__i386__) || defined (__x86_64__)
static inline void static inline void
grub_arch_sync_caches (void *address __attribute__ ((unused)), grub_arch_sync_caches (void *address __attribute__ ((unused)),

View file

@ -177,4 +177,13 @@ struct grub_disk_ata_pass_through_parms
extern grub_err_t (* EXPORT_VAR(grub_disk_ata_pass_through)) (grub_disk_t, extern grub_err_t (* EXPORT_VAR(grub_disk_ata_pass_through)) (grub_disk_t,
struct grub_disk_ata_pass_through_parms *); struct grub_disk_ata_pass_through_parms *);
#if defined (GRUB_UTIL) || defined (GRUB_MACHINE_EMU)
void grub_lvm_init (void);
void grub_mdraid_init (void);
void grub_raid_init (void);
void grub_lvm_fini (void);
void grub_mdraid_fini (void);
void grub_raid_fini (void);
#endif
#endif /* ! GRUB_DISK_HEADER */ #endif /* ! GRUB_DISK_HEADER */

View file

@ -45,6 +45,7 @@ extern const char *program_name;
void grub_emu_init (void); void grub_emu_init (void);
void grub_init_all (void); void grub_init_all (void);
void grub_fini_all (void); void grub_fini_all (void);
void grub_emu_post_init (void);
void grub_find_zpool_from_dir (const char *dir, void grub_find_zpool_from_dir (const char *dir,
char **poolname, char **poolfs); char **poolname, char **poolfs);

View file

@ -0,0 +1,6 @@
#ifdef GRUB_MACHINE_EMU
static inline void
grub_cpu_idle(void)
{
}
#endif