106 lines
2.2 KiB
C
106 lines
2.2 KiB
C
#include <VasEBoot/kernel.h>
|
|
#include <VasEBoot/misc.h>
|
|
#include <VasEBoot/env.h>
|
|
#include <VasEBoot/time.h>
|
|
#include <VasEBoot/types.h>
|
|
#include <VasEBoot/misc.h>
|
|
#include <VasEBoot/mm.h>
|
|
#include <VasEBoot/time.h>
|
|
#include <VasEBoot/machine/memory.h>
|
|
#include <VasEBoot/machine/kernel.h>
|
|
#include <VasEBoot/machine/console.h>
|
|
#include <VasEBoot/cpu/memory.h>
|
|
#include <VasEBoot/memory.h>
|
|
#include <VasEBoot/video.h>
|
|
#include <VasEBoot/terminfo.h>
|
|
#include <VasEBoot/keyboard_layouts.h>
|
|
#include <VasEBoot/serial.h>
|
|
#include <VasEBoot/loader.h>
|
|
#include <VasEBoot/at_keyboard.h>
|
|
|
|
static inline int
|
|
probe_mem (VasEBoot_addr_t addr)
|
|
{
|
|
volatile VasEBoot_uint8_t *ptr = (VasEBoot_uint8_t *) (0xa0000000 | addr);
|
|
VasEBoot_uint8_t c = *ptr;
|
|
*ptr = 0xAA;
|
|
if (*ptr != 0xAA)
|
|
return 0;
|
|
*ptr = 0x55;
|
|
if (*ptr != 0x55)
|
|
return 0;
|
|
*ptr = c;
|
|
return 1;
|
|
}
|
|
|
|
void
|
|
VasEBoot_machine_init (void)
|
|
{
|
|
VasEBoot_addr_t modend;
|
|
|
|
if (VasEBoot_arch_memsize == 0)
|
|
{
|
|
int i;
|
|
|
|
for (i = 27; i >= 0; i--)
|
|
if (probe_mem (VasEBoot_arch_memsize | (1 << i)))
|
|
VasEBoot_arch_memsize |= (1 << i);
|
|
VasEBoot_arch_memsize++;
|
|
}
|
|
|
|
/* FIXME: measure this. */
|
|
VasEBoot_arch_cpuclock = 200000000;
|
|
|
|
modend = VasEBoot_modules_get_end ();
|
|
VasEBoot_mm_init_region ((void *) modend, VasEBoot_arch_memsize
|
|
- (modend - VAS_EBOOT_ARCH_LOWMEMVSTART));
|
|
|
|
VasEBoot_install_get_time_ms (VasEBoot_rtc_get_time_ms);
|
|
|
|
VasEBoot_keylayouts_init ();
|
|
VasEBoot_at_keyboard_init ();
|
|
|
|
VasEBoot_qemu_init_cirrus ();
|
|
VasEBoot_vga_text_init ();
|
|
|
|
VasEBoot_terminfo_init ();
|
|
VasEBoot_serial_init ();
|
|
|
|
VasEBoot_boot_init ();
|
|
}
|
|
|
|
void
|
|
VasEBoot_machine_fini (int flags __attribute__ ((unused)))
|
|
{
|
|
}
|
|
|
|
void
|
|
VasEBoot_exit (void)
|
|
{
|
|
VasEBoot_halt ();
|
|
}
|
|
|
|
void
|
|
VasEBoot_halt (void)
|
|
{
|
|
VasEBoot_outl (42, 0xbfbf0004);
|
|
while (1);
|
|
}
|
|
|
|
VasEBoot_err_t
|
|
VasEBoot_machine_mmap_iterate (VasEBoot_memory_hook_t hook, void *hook_data)
|
|
{
|
|
hook (0, VasEBoot_arch_memsize, VAS_EBOOT_MEMORY_AVAILABLE, hook_data);
|
|
return VAS_EBOOT_ERR_NONE;
|
|
}
|
|
|
|
void
|
|
VasEBoot_machine_get_bootlocation (char **device __attribute__ ((unused)),
|
|
char **path __attribute__ ((unused)))
|
|
{
|
|
}
|
|
|
|
extern char _end[];
|
|
VasEBoot_addr_t VasEBoot_modbase = (VasEBoot_addr_t) _end;
|
|
|