Jens Nerche wrote:
> Perhaps define some interfaces the plugins can rely on.
Yes, that's what we want to do.
PS, do we really need multiboot compliance ?
Eventually, you'll be able to use GRUB from within FreeMWare,
and until then we only want to run our own testkernels anyway.
It seems to me like a rather useless feature... unless you've
been trying to boot FIASCO already ;)
> ? patch8.cvsdiff
> ? guest/virtcode/keyboard.c
> ? guest/virtcode/minishell.c
> ? guest/virtcode/helper.c
> ? user/multiboot.h
> ? user/oskit_types.h
These files were not included in the patch... I think cvs diff
isn't such a good idea.
BTW, using multiboot.h is okay but please don't add oskit_types.h,
that's just extra useless header stuff that clutters up the tree.
Just hardcode the types in the multiboot header (I attached a
multiboot header that I personally use, in case you don't feel
like doing this).
> void
> -plugin_abort (void)
> +plugin_abort (config_info_t *conf)
> {
> - vm_abort ();
> + vm_abort (conf);
> return;
> }
Perhaps it would be useful to have *some* global variables...
having to pass conf every time as a parameter is terribly
awkward, because most functions now only use it to pass
it on to other functions, etc. This is what global variables
were made for !!
> + case EMU_INSTR_REP_INS_8:
> + for(i = (context.ecx & 0xffff);i--;)
> + {
> + plugin_emulate(EVT_INPORT,context.edx & 0xffff,1,1,&value);
This is not the way you want to use it... you want to emulate
the whole REP INS in one go, something like:
[completely at the beginning]
int mask = (((context.event_info >> 16) & 0xff) == 32) ? -1 :
0xffff;
[in the case:]
<leave out the for() loop>
plugin_emulate(EVT_INPORT,context.edx & 0xffff,1,
context.ecx & 0xffff,(int *)(ptr+context.edi&mask));
if(context.eflags & 0x400) context.edi+=2*context.ecx & 0xffff;
else context.edi-=2*context.ecx & 0xffff;
Something similar for the REP OUTS.
I'll fix this this weekend, if nobody else does.
> +void
> +init_configuration(int argc, char **argv, config_info_t *conf)
I think functions like these can go into a different file.
I'll clean up this weekend.
> +void
> +load_guest(config_info_t *conf)
Same goes for this one. And the memory dump routine.
> -#define VERSION "0.0.1-unstable"
> +#define VERSION "0.1.1-unstable"
Okay, I forgot to ask about this one last time ---
I added VERSION when I cleaned up user.c (once again ;)),
but we never actually did discuss our versioning conventions.
We should think about this one...
-- Ramon
/*
* multiboot.h: Definitions for the Multiboot standard
*
* This file contains the defentions needed to boot and run
* multiboot-compatible kernels.
*
* HISTORY
* Date Author Rev Notes
* 29/05/99 ramon 1.0 First release
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 1996 Erich Boleyn <[EMAIL PROTECTED]>
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __MULTIBOOT_H
#define __MULTIBOOT_H
/*
* The structure type "mod_list" is used by the "multiboot_info" structure.
*/
struct mod_list {
/* Memory used goes from bytes 'mod_start' to 'mod_end-1' */
unsigned int mod_start;
unsigned int mod_end;
/* Module command line */
char *cmdline;
/* padding to take it to 16 bytes (must be zero) */
unsigned int pad;
};
/*
* INT-15, AX=E820 style "AddressRangeDescriptor"
* ...with a "size" parameter on the front which is the structure size - 4,
* pointing to the next one, up until the full buffer length of the memory
* map has been reached.
*/
struct AddrRangeDesc {
unsigned int size;
unsigned int BaseAddrLow;
unsigned int BaseAddrHigh;
unsigned int LengthLow;
unsigned int LengthHigh;
unsigned int Type;
};
/* Usable memory "Type", all others are reserved */
#define MB_ARD_MEMORY 1
/*
* MultiBoot Info description
*
* This is the struct passed to the boot image. This is done by placing
* its address in the EAX register.
*/
struct multiboot_info {
/* MultiBoot info version number */
unsigned int flags;
/* Available memory from BIOS */
unsigned int mem_lower;
unsigned int mem_upper;
/* "root" partition */
unsigned int boot_device;
/* Kernel command line */
char *cmdline;
/* Boot-Module list */
unsigned int mods_count;
unsigned int mods_addr;
union {
struct {
/* (a.out) Kernel symbol table info */
unsigned int tabsize;
unsigned int strsize;
unsigned int addr;
unsigned int pad;
} a;
struct {
/* (ELF) Kernel section header table */
unsigned int num;
unsigned int size;
unsigned int addr;
unsigned int shndx;
} e;
} syms;
/* Memory Mapping buffer */
unsigned int mmap_length;
unsigned int mmap_addr;
};
/*
* Flags to be set in the 'flags' parameter above
*/
/* Is there basic lower/upper memory information? */
#define MB_INFO_MEMORY 0x1
/* Is there a boot device set? */
#define MB_INFO_BOOTDEV 0x2
/* Is the command-line defined? */
#define MB_INFO_CMDLINE 0x4
/* Are there modules to do something with? */
#define MB_INFO_MODS 0x8
/* These next two are mutually exclusive */
/* Is there a symbol table loaded? */
#define MB_INFO_AOUT_SYMS 0x10
/* Is there an ELF section header table? */
#define MB_INFO_ELF_SHDR 0x20
/* Is there a full memory map? */
#define MB_INFO_MEM_MAP 0x40
/*
* The following value must be present in the EAX register.
*/
#define MULTIBOOT_VALID 0x2BADB002
/**********************************************************************/
/*
* MultiBoot Header description
*/
struct multiboot_header {
/* Must be MULTIBOOT_MAGIC - see below */
unsigned int magic;
/* Feature flags - see below */
unsigned int flags;
/* Checksum: The above fields plus this one must equal 0 mod 2^32 */
unsigned int checksum;
/* These are only valid if MULTIBOOT_AOUT_KLUDGE is set */
unsigned int header_addr;
unsigned int load_addr;
unsigned int load_end_addr;
unsigned int bss_end_addr;
unsigned int entry_addr;
};
/*
* The entire multiboot_header must be contained
* within the first MULTIBOOT_SEARCH bytes of the kernel image.
*/
#define MULTIBOOT_SEARCH 8192
#define MULTIBOOT_MAGIC 0x1BADB002
#define MULTIBOOT_FOUND(addr, len) \
(!((addr) & 0x3) && ((len) >= 12) && \
(*((DATA *)(addr)) == MULTIBOOT_MAGIC) && \
!(*((UDATA *)(addr)) + *((UDATA *)(addr+4)) + *((UDATA *)(addr+8))) && \
(!(MULTIBOOT_AOUT_KLUDGE & *((DATA *)(addr+4))) || ((len) >= 32)))
/*
* Features flags for 'flags'.
*/
/* If a set flag in MULTIBOOT_MUSTKNOW is unsupported we should fail */
#define MULTIBOOT_MUSTKNOW 0x0000FFFF
/* currently unsupported flags... this is a kind of version number */
#define MULTIBOOT_UNSUPPORTED 0x0000FFFC
/* Align all boot modules on i386 page (4KB) boundaries */
#define MULTIBOOT_PAGE_ALIGN 0x00000001
/* Must pass memory information to OS */
#define MULTIBOOT_MEMORY_INFO 0x00000002
/* This flag indicates the use of the other fields in the header */
#define MULTIBOOT_AOUT_KLUDGE 0x00010000
#endif /* __MULTIBOOT_H */