first shot of legacybios emulation.

does not work yet.. sorry :-(


git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1119 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Stefan Reinauer
2003-09-18 14:16:08 +00:00
parent 59549598c0
commit dcdbdfb46e
51 changed files with 27688 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
/* I/O implementation
*
* Copyright (C) 2003 Stefan Reinauer
*
* See the file "COPYING" for further information about
* the copyright and warranty status of this work.
*
* this code is inspired by the linux kernel
*
*/
#ifndef IO_H
#define IO_H
#include <types.h>
#define __EXTERN__ extern
__EXTERN__ inline u8 inb(u32 port)
{
u8 result;
__asm__ __volatile__ ( "inb %w1,%0" :"=a" (result) :"Nd" (port));
return result;
}
__EXTERN__ inline u16 inw(u32 port)
{
u16 result;
__asm__ __volatile__ ( "inw %w1,%0" :"=a" (result) :"Nd" (port));
return result;
}
__EXTERN__ inline u32 inl(u32 port)
{
u32 result;
__asm__ __volatile__ ( "inl %w1,%0" :"=a" (result) :"Nd" (port));
return result;
}
__EXTERN__ inline void outb (u32 port, u8 value)
{
__asm__ __volatile__ ( "outb %b0,%w1" : :"a" (value), "Nd" (port));
}
__EXTERN__ inline void outw (u32 port, u16 value)
{
__asm__ __volatile__ ( "outw %w0,%w1" : :"a" (value), "Nd" (port));
}
__EXTERN__ inline void outl (u32 port, u32 value)
{
__asm__ __volatile__ ( "outl %0,%w1" : :"a" (value), "Nd" (port));
}
#endif /* IO_H */

View File

@@ -0,0 +1,96 @@
/* multiboot.h
* header for multiboot
*
* Copyright (C) 2003 Stefan Reinauer
*
* See the file "COPYING" for further information about
* the copyright and warranty status of this work.
*/
/* magic number for multiboot header */
#define MULTIBOOT_HEADER_MAGIC 0x1BADB002
/* flags for multiboot header */
#define MULTIBOOT_HEADER_FLAGS 0x00010003
/* magic number passed by multiboot-compliant boot loader. */
#define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002
/* The size of our stack (8KB). */
#define STACK_SIZE 0x2000
/* C symbol format. HAVE_ASM_USCORE is defined by configure. */
#ifdef HAVE_ASM_USCORE
# define EXT_C(sym) _ ## sym
#else
# define EXT_C(sym) sym
#endif
#ifndef ASM
/* We don't want these declarations in boot.S */
/* multiboot header */
typedef struct multiboot_header {
unsigned long magic;
unsigned long flags;
unsigned long checksum;
unsigned long header_addr;
unsigned long load_addr;
unsigned long load_end_addr;
unsigned long bss_end_addr;
unsigned long entry_addr;
} multiboot_header_t;
/* symbol table for a.out */
typedef struct aout_symbol_table {
unsigned long tabsize;
unsigned long strsize;
unsigned long addr;
unsigned long reserved;
} aout_symbol_table_t;
/* section header table for ELF */
typedef struct elf_section_header_table {
unsigned long num;
unsigned long size;
unsigned long addr;
unsigned long shndx;
} elf_section_header_table_t;
/* multiboot information */
typedef struct multiboot_info {
unsigned long flags;
unsigned long mem_lower;
unsigned long mem_upper;
unsigned long boot_device;
unsigned long cmdline;
unsigned long mods_count;
unsigned long mods_addr;
union {
aout_symbol_table_t aout_sym;
elf_section_header_table_t elf_sec;
} u;
unsigned long mmap_length;
unsigned long mmap_addr;
} multiboot_info_t;
/* module structure */
typedef struct module {
unsigned long mod_start;
unsigned long mod_end;
unsigned long string;
unsigned long reserved;
} module_t;
/* memory map. Be careful that the offset 0 is base_addr_low
but no size. */
typedef struct memory_map {
unsigned long size;
unsigned long base_addr_low;
unsigned long base_addr_high;
unsigned long length_low;
unsigned long length_high;
unsigned long type;
} memory_map_t;
#endif /* ! ASM */