bugfixes. Merge MIPS and MIPSel

This commit is contained in:
phcoder 2009-10-10 14:19:50 +02:00
parent 7dc7e76a56
commit 33dc6f74d2
17 changed files with 77 additions and 5 deletions

View file

@ -84,7 +84,7 @@ grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
grub_emu_LDFLAGS = $(LIBCURSES)
kernel_img_SOURCES = kern/mipsel/qemu-r4k/startup.S \
kernel_img_SOURCES = kern/mips/qemu-r4k/startup.S \
kern/main.c kern/device.c kern/$(target_cpu)/$(target_machine)/init.c \
kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \
kern/misc.c kern/mm.c kern/reader.c kern/term.c \

View file

@ -90,12 +90,15 @@ case "$target_cpu"-"$platform" in
powerpc-ieee1275) ;;
sparc64-ieee1275) ;;
mipsel-qemu-r4k) ;;
mips-qemu-r4k) ;;
*) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
esac
case "$target_cpu" in
i386 | powerpc) target_m32=1 ;;
x86_64 | sparc64) target_m64=1 ;;
mipsel) TARGET_CFLAGS="$TARGET_CFLAGS -DGRUB_CPU_MIPSEL=1"; target_cpu=mips ;;
mips) TARGET_CFLAGS="$TARGET_CFLAGS -DGRUB_CPU_MIPS=1" ;;
esac
case "$host_os" in

27
include/grub/mips/cache.h Normal file
View file

@ -0,0 +1,27 @@
/* 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 <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_CPU_CACHE_H
#define GRUB_CPU_CACHE_H 1
#include <grub/symbol.h>
#include <grub/types.h>
void EXPORT_FUNC(grub_cpu_flush_cache) (void *start, grub_size_t size, int type);
#endif

View file

@ -0,0 +1,26 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
void *EXPORT_FUNC (memset) (void *s, int c, int n) __attribute__ ((weak));
void EXPORT_FUNC (__ashldi3) (void) __attribute__ ((weak));
void EXPORT_FUNC (__ashrdi3) (void) __attribute__ ((weak));
void EXPORT_FUNC (__lshrdi3) (void) __attribute__ ((weak));
void EXPORT_FUNC (__trampoline_setup) (void) __attribute__ ((weak));
void EXPORT_FUNC (__ucmpdi2) (void) __attribute__ ((weak));
void EXPORT_FUNC (__bswapsi2) (void) __attribute__ ((weak));
void EXPORT_FUNC (__bswapdi2) (void) __attribute__ ((weak));

View file

@ -25,7 +25,14 @@
/* The size of long. */
#define GRUB_TARGET_SIZEOF_LONG 4
#ifdef GRUB_CPU_MIPSEL
/* mipsEL is little-endian. */
#undef GRUB_TARGET_WORDS_BIGENDIAN
#elif defined (GRUB_CPU_MIPS)
/* mips is big-endian. */
#define GRUB_TARGET_WORDS_BIGENDIAN
#else
#error Neither GRUB_CPU_MIPS nor GRUB_CPU_MIPSEL is defined
#endif
#endif /* ! GRUB_TYPES_CPU_HEADER */

View file

@ -92,6 +92,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
switch (ELF_R_TYPE (rel->r_info))
{
#if 0
case R_386_32:
*addr += sym->st_value;
break;
@ -100,6 +101,11 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
*addr += (sym->st_value - (Elf_Word) seg->addr
- rel->r_offset);
break;
#endif
default:
grub_printf ("Unknown relocation type %d\n",
ELF_R_TYPE (rel->r_info));
break
}
}
}

View file

@ -135,21 +135,24 @@ grub_getcharwidth (grub_uint32_t code)
int
grub_getkey (void)
{
return (grub_cur_term_input->getkey) ();
while (!(*((grub_uint8_t *)0x140003f8+5) & 0x01));
return *((grub_uint8_t *)0x140003f8);
// return (grub_cur_term_input->getkey) ();
}
int
grub_checkkey (void)
{
return (grub_cur_term_input->checkkey) ();
return !!(*((grub_uint8_t *)0x140003f8+5) & 0x01);
//return (grub_cur_term_input->checkkey) ();
}
int
grub_getkeystatus (void)
{
if (grub_cur_term_input->getkeystatus)
/* if (grub_cur_term_input->getkeystatus)
return (grub_cur_term_input->getkeystatus) ();
else
else*/
return 0;
}

View file