2003-11-16 Jeroen Dekkers <jeroen@dekkers.cx>
* conf/i386-pc.rmk (pkgdata_MODULES): Add _multiboot.mod. (_multiboot_mod_SOURCES): New variable. (_multiboot_mod_CFLAGS): Likewise. * loader/i386/pc/multiboot.c: New file. * include/pupa/i386/pc/multiboot.h: Likewise. * kern/i386/pc/startup.S: Include pupa/machine/multiboot.h. (pupa_multiboot_real_boot): New function. * include/pupa/i386/pc/loader.h: Include pupa/machine/multiboot.h. (pupa_multiboot_real_boot): New prototype. (pupa_rescue_cmd_multiboot): Likewise (pupa_rescue_cmd_module): Likewise. * kern/loader.c (pupa_loader_set): Continue when pupa_loader_unload_func() fails. (pupa_loader_unset): New function. * include/pupa/loader.h (pupa_loader_unset): New prototype. * kern/misc.c (pupa_stpcpy): New function. * include/pupa/misc.h (pupa_stpcpy): New prototype.
This commit is contained in:
parent
8e72a9c0e3
commit
9a5c1adeaa
11 changed files with 672 additions and 4 deletions
|
@ -3,6 +3,7 @@
|
|||
* Copyright (C) 1999,2000,2001,2002 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2002,2003 Yoshinori K. Okuji <okuji@enbug.org>
|
||||
* Copyright (C) 2003 Marco Gerards <metgerards@student.han.nl>
|
||||
* Copyright (C) 2003 Jeroen Dekkers <jeroen@dekkers.cx>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -52,6 +53,7 @@
|
|||
#include <pupa/machine/console.h>
|
||||
#include <pupa/machine/linux.h>
|
||||
#include <pupa/machine/kernel.h>
|
||||
#include <pupa/machine/multiboot.h>
|
||||
|
||||
#define ABS(x) ((x) - EXT_C(start) + PUPA_BOOT_MACHINE_KERNEL_ADDR + 0x200)
|
||||
|
||||
|
@ -621,6 +623,29 @@ linux_setup_seg:
|
|||
.code32
|
||||
|
||||
|
||||
/*
|
||||
* This starts the multiboot kernel.
|
||||
*/
|
||||
|
||||
FUNCTION(pupa_multiboot_real_boot)
|
||||
/* Push the entry address on the stack. */
|
||||
pushl %eax
|
||||
/* Move the address of the multiboot information structure to ebx. */
|
||||
movl %edx,%ebx
|
||||
|
||||
/* Unload all modules and stop the floppy driver. */
|
||||
call EXT_C(pupa_dl_unload_all)
|
||||
call EXT_C(pupa_stop_floppy)
|
||||
|
||||
/* Interrupts should be disabled. */
|
||||
cli
|
||||
|
||||
/* Move the magic value into eax and jump to the kernel. */
|
||||
movl $PUPA_MB_MAGIC2,%eax
|
||||
popl %ecx
|
||||
jmp *%ecx
|
||||
|
||||
|
||||
/*
|
||||
* int pupa_biosdisk_rw_int13_extensions (int ah, int drive, void *dap)
|
||||
*
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* PUPA -- Preliminary Universal Programming Architecture for GRUB
|
||||
* Copyright (C) 2002 Yoshinori K. Okuji <okuji@enbug.org>
|
||||
* Copyright (C) 2003 Jeroen Dekkers <jeroen@dekkers.cx>
|
||||
*
|
||||
* PUPA is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -32,8 +33,7 @@ pupa_loader_set (pupa_err_t (*boot) (void),
|
|||
pupa_err_t (*unload) (void))
|
||||
{
|
||||
if (pupa_loader_loaded && pupa_loader_unload_func)
|
||||
if (pupa_loader_unload_func () != PUPA_ERR_NONE)
|
||||
return;
|
||||
pupa_loader_unload_func ();
|
||||
|
||||
pupa_loader_boot_func = boot;
|
||||
pupa_loader_unload_func = unload;
|
||||
|
@ -41,6 +41,18 @@ pupa_loader_set (pupa_err_t (*boot) (void),
|
|||
pupa_loader_loaded = 1;
|
||||
}
|
||||
|
||||
void
|
||||
pupa_loader_unset(void)
|
||||
{
|
||||
if (pupa_loader_loaded && pupa_loader_unload_func)
|
||||
pupa_loader_unload_func ();
|
||||
|
||||
pupa_loader_boot_func = 0;
|
||||
pupa_loader_unload_func = 0;
|
||||
|
||||
pupa_loader_loaded = 0;
|
||||
}
|
||||
|
||||
pupa_err_t
|
||||
pupa_loader_boot (void)
|
||||
{
|
||||
|
|
13
kern/misc.c
13
kern/misc.c
|
@ -70,6 +70,19 @@ pupa_strncpy (char *dest, const char *src, int c)
|
|||
return dest;
|
||||
}
|
||||
|
||||
char *
|
||||
pupa_stpcpy (char *dest, const char *src)
|
||||
{
|
||||
char *d = dest;
|
||||
const char *s = src;
|
||||
|
||||
do
|
||||
*d++ = *s;
|
||||
while (*s++ != '\0');
|
||||
|
||||
return d - 1;
|
||||
}
|
||||
|
||||
char *
|
||||
pupa_strcat (char *dest, const char *src)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue