Hello from mipsel

This commit is contained in:
phcoder 2009-10-10 13:30:14 +02:00
parent e27fbc80e4
commit de75aa3d67
8 changed files with 66 additions and 12 deletions

View file

@ -149,29 +149,45 @@ grub_load_normal_mode (void)
void
grub_main (void)
{
*((grub_uint8_t *)0x140003f8) = '1';
/* First of all, initialize the machine. */
grub_machine_init ();
*((grub_uint8_t *)0x140003f8) = '2';
/* Hello. */
grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT);
*((grub_uint8_t *)0x140003f8) = 'a';
grub_printf ("Welcome to GRUB!\n\n");
*((grub_uint8_t *)0x140003f8) = 'b';
grub_setcolorstate (GRUB_TERM_COLOR_STANDARD);
*((grub_uint8_t *)0x140003f8) = '3';
/* Load pre-loaded modules and free the space. */
grub_register_exported_symbols ();
grub_load_modules ();
*((grub_uint8_t *)0x140003f8) = '4';
/* It is better to set the root device as soon as possible,
for convenience. */
grub_machine_set_prefix ();
grub_env_export ("prefix");
grub_set_root_dev ();
*((grub_uint8_t *)0x140003f8) = '5';
grub_register_core_commands ();
grub_register_rescue_parser ();
grub_register_rescue_reader ();
*((grub_uint8_t *)0x140003f8) = '6';
grub_load_config ();
*((grub_uint8_t *)0x140003f8) = '7';
grub_load_normal_mode ();
*((grub_uint8_t *)0x140003f8) = '8';
grub_reader_loop (0);
}

View file

@ -1,5 +1,5 @@
#include <grub/symbol.h>
FUNCTION (grub_arch_sync_caches)
FUNCTION (_flush_cache)
FUNCTION (grub_cpu_flush_cache)
j $31

View file

@ -4,9 +4,13 @@
#include <grub/time.h>
#include <grub/types.h>
#include <grub/misc.h>
#include <grub/mm.h>
#include <grub/machine/kernel.h>
#include <grub/machine/memory.h>
#include <grub/cpu/kernel.h>
#define RAMSIZE (*(grub_uint32_t *) ((16 << 20) - 264))
grub_uint32_t
grub_get_rtc (void)
{
@ -17,6 +21,8 @@ grub_get_rtc (void)
void
grub_machine_init (void)
{
grub_mm_init_region ((void *) GRUB_MACHINE_MEMORY_STACK_HIGH,
RAMSIZE - GRUB_MACHINE_MEMORY_STACK_HIGH);
}
void
@ -56,3 +62,13 @@ grub_arch_modules_addr (void)
{
return ALIGN_UP((grub_addr_t) _end + GRUB_MOD_GAP, GRUB_MOD_ALIGN);
}
grub_err_t
grub_machine_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t,
grub_uint64_t,
grub_uint32_t))
{
hook (0, RAMSIZE,
GRUB_MACHINE_MEMORY_AVAILABLE);
return GRUB_ERR_NONE;
}

View file

@ -598,7 +598,7 @@ grub_vsprintf (char *str, const char *fmt, va_list args)
if (str)
*str++ = ch;
else
grub_putchar (ch);
grub_putchar (ch);
count++;
}

View file

@ -48,8 +48,9 @@ struct grub_handler_class grub_term_output_class =
void
grub_putcode (grub_uint32_t code)
{
int height = grub_getwh () & 255;
// int height = grub_getwh () & 255;
#if 0
if (code == '\t' && grub_cur_term_output->getxy)
{
int n;
@ -60,13 +61,15 @@ grub_putcode (grub_uint32_t code)
return;
}
#endif
(grub_cur_term_output->putchar) (code);
// (grub_cur_term_output->putchar) (code);
*((grub_uint8_t *)0x140003f8) = code;
if (code == '\n')
{
grub_putcode ('\r');
#if 0
grub_more_lines++;
if (grub_more && grub_more_lines == height - 1)
@ -93,6 +96,7 @@ grub_putcode (grub_uint32_t code)
else
grub_more_lines = 0;
}
#endif
}
}
@ -182,14 +186,14 @@ grub_cls (void)
void
grub_setcolorstate (grub_term_color_state state)
{
if (grub_cur_term_output->setcolorstate)
if (grub_cur_term_output && grub_cur_term_output->setcolorstate)
(grub_cur_term_output->setcolorstate) (state);
}
void
grub_setcolor (grub_uint8_t normal_color, grub_uint8_t highlight_color)
{
if (grub_cur_term_output->setcolor)
if (grub_cur_term_output && grub_cur_term_output->setcolor)
(grub_cur_term_output->setcolor) (normal_color, highlight_color);
}