diff --git a/ChangeLog b/ChangeLog index 284be912a..07f8dfb96 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-12-08 Vladimir Serbinenko + + Fix mips-emu compilation. + 2013-12-08 Vladimir Serbinenko * configure.ac: Check for freetype library usability. diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am index f69da18c3..5b804c7d4 100644 --- a/grub-core/Makefile.am +++ b/grub-core/Makefile.am @@ -169,7 +169,6 @@ endif if COND_mips_qemu_mips KERNEL_HEADER_FILES += $(top_builddir)/include/grub/keyboard_layouts.h KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/cpu/cache.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/serial.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h @@ -181,7 +180,6 @@ if COND_mips_loongson KERNEL_HEADER_FILES += $(top_builddir)/include/grub/keyboard_layouts.h KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/time.h -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/cpu/cache.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video_fb.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/gfxterm.h diff --git a/grub-core/kern/emu/cache.c b/grub-core/kern/emu/cache.c index 4a701f44a..b6f6faca2 100644 --- a/grub-core/kern/emu/cache.c +++ b/grub-core/kern/emu/cache.c @@ -1,6 +1,7 @@ +#include + #if defined(__ia64__) || defined (__arm__) || defined (__aarch64__) -#include void __clear_cache (char *beg, char *end); @@ -9,5 +10,15 @@ grub_arch_sync_caches (void *address, grub_size_t len) { __clear_cache (address, (char *) address + len); } + +#elif defined (__mips__) +void _flush_cache (void *address, grub_size_t len, int type); + +void +grub_arch_sync_caches (void *address, grub_size_t len) +{ + return _flush_cache (address, len, 0); +} + #endif diff --git a/grub-core/kern/emu/cache_s.S b/grub-core/kern/emu/cache_s.S index 7fbebb80d..76cf7560d 100644 --- a/grub-core/kern/emu/cache_s.S +++ b/grub-core/kern/emu/cache_s.S @@ -6,24 +6,9 @@ /* Nothing is necessary. */ #elif defined(__sparc__) #include "../sparc64/cache.S" -#elif defined(__mips__) -/* On MIPS we must go through standard functions. */ -#include - -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__) #include "../powerpc/cache.S" -#elif defined(__ia64__) || defined(__arm__) || defined(__aarch64__) +#elif defined(__ia64__) || defined(__arm__) || defined(__aarch64__) || defined(__mips__) #else #error "No target cpu type is defined" #endif diff --git a/grub-core/kern/mips/cache.S b/grub-core/kern/mips/cache.S index cca4b30fe..78e40bcea 100644 --- a/grub-core/kern/mips/cache.S +++ b/grub-core/kern/mips/cache.S @@ -4,7 +4,6 @@ .set noreorder .set nomacro -FUNCTION (grub_cpu_flush_cache) FUNCTION (grub_arch_sync_caches) #include "cache_flush.S" j $ra diff --git a/include/grub/cache.h b/include/grub/cache.h index 292830566..c6a0b0ba4 100644 --- a/include/grub/cache.h +++ b/include/grub/cache.h @@ -23,10 +23,6 @@ #include #include -#ifdef _mips -#include -#endif - #if defined (__i386__) || defined (__x86_64__) static inline void grub_arch_sync_caches (void *address __attribute__ ((unused)), @@ -37,6 +33,7 @@ grub_arch_sync_caches (void *address __attribute__ ((unused)), void EXPORT_FUNC(grub_arch_sync_caches) (void *address, grub_size_t len); #endif +#ifndef GRUB_MACHINE_EMU #ifdef _mips void EXPORT_FUNC(grub_arch_sync_dma_caches) (void *address, grub_size_t len); #else @@ -46,5 +43,6 @@ grub_arch_sync_dma_caches (void *address __attribute__ ((unused)), { } #endif +#endif #endif /* ! GRUB_CACHE_HEADER */ diff --git a/include/grub/mips/cache.h b/include/grub/mips/cache.h deleted file mode 100644 index c3470571e..000000000 --- a/include/grub/mips/cache.h +++ /dev/null @@ -1,27 +0,0 @@ -/* cache.h - Flush the processor's cache. */ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2004,2007 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 3 of the License, or - * (at your option) any later version. - * - * GRUB 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, see . - */ - -#ifndef GRUB_CPU_CACHE_H -#define GRUB_CPU_CACHE_H 1 - -#include -#include - -void EXPORT_FUNC(grub_cpu_flush_cache) (void *start, grub_size_t size, int type); -#endif diff --git a/include/grub/misc.h b/include/grub/misc.h index d80da3349..be74d9082 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h @@ -429,7 +429,7 @@ void __attribute__ ((noreturn)) EXPORT_FUNC (abort) (void); /* Halt the system, using APM if possible. If NO_APM is true, don't * use APM even if it is available. */ void grub_halt (int no_apm) __attribute__ ((noreturn)); -#elif defined (__mips__) +#elif defined (__mips__) && !defined (GRUB_MACHINE_EMU) void EXPORT_FUNC (grub_halt) (void) __attribute__ ((noreturn)); #else void grub_halt (void) __attribute__ ((noreturn)); diff --git a/include/grub/time.h b/include/grub/time.h index 949452680..64ac99a12 100644 --- a/include/grub/time.h +++ b/include/grub/time.h @@ -21,7 +21,14 @@ #include #include +#ifndef GRUB_MACHINE_EMU #include +#else +static inline void +grub_cpu_idle(void) +{ +} +#endif void EXPORT_FUNC(grub_millisleep) (grub_uint32_t ms); grub_uint64_t EXPORT_FUNC(grub_get_time_ms) (void);