2004-07-29 07:12:51 UTC
previous
next
// $Id: boot.h 17 2003-07-23 03:13:46Z kr4z $
// $HeadURL: http://kryptos.kr4z.com/svn/trunk/kernel/boot/boot.h $
// Video memory attribute byte constants
#define VIDEO_WHITE 0x0F
#define VIDEO_YELLOW 0x0E
#define VIDEO_PURPLE 0x0D
#define VIDEO_RED 0x0C
#define VIDEO_LIGHTTEAL 0x0B
#define VIDEO_GREEN 0x0A
#define VIDEO_BLUE 0x09
#define VIDEO_BLACK 0x08
#define VIDEO_GREY 0x07
#define VIDEO_DARKRED 0x06
#define VIDEO_DARKPURPLE 0x05
// 0x04 is also dark red
#define VIDEO_DARKTEAL 0x03
#define VIDEO_DARKGREEN 0x02
#define VIDEO_DARKBLUE 0x01
// Memory map section from multiboot into
typedef struct mb_mmap_section
{
unsigned long size;
unsigned long long base_addr;
unsigned long long length;
unsigned long type;
} mb_mmap_section_t;
// Module section from multiboot info
typedef struct mb_mod_section
{
unsigned long mod_start;
unsigned long mod_end;
char* string;
unsigned long reserved;
} mb_mod_section_t;
// Multiboot information struct
typedef struct multiboot_info
{
unsigned long flags;
unsigned long mem_lower;
unsigned long mem_upper;
unsigned long boot_device;
char* cmdline;
unsigned long mods_count;
mb_mod_section_t* mods_addr;
unsigned long syms[4];
unsigned long mmap_length;
mb_mmap_section_t* mmap_addr;
unsigned long drives_length;
unsigned long drives_addr;
unsigned long config_table;
char* boot_loader_name;
} multiboot_info_t;
#define MMAP_RESERVED 0
#define MMAP_FREE 1
#define MMAP_MOD 2
typedef struct mmap_section
{
unsigned long long base_addr;
unsigned long long length;
unsigned long status;
char* mod_name;
char* mod_command_line;
struct mmap_section* next;
struct mmap_section* prev;
} mmap_section_t;
typedef struct initmem_info
{
char* command_line;
char* boot_loader_name;
mmap_section_t* mmap_addr;
char got_command_line;
char got_boot_loader_name;
} initmem_info_t;
// Function declarations for boot.c
void start(unsigned long magic, multiboot_info_t* mb_info);
void boot_printf(unsigned char color, char* format_string, ...);
void boot_printf_char(unsigned char color, char character) __attribute__ ((regparm (2)));
void boot_printf_number(char numbertype, char pad_char, unsigned long min_field_width, unsigned char color, unsigned long number);
inline unsigned char inportb(unsigned int port);
inline void outportb(unsigned int port, unsigned char value);
void scroll_screen(void);
void *boot_malloc(unsigned long size);
void boot_free(void* address);
int boot_strlen(char* str);
void boot_strncpy(char *str1, const char *str2, unsigned int count);
char* boot_mallocstring(char* string, unsigned int maxlen);
void boot_make_mmap(multiboot_info_t* mb_info, initmem_info_t* initmem_info);
// Global variable declarations for boot.c
extern char* message_buffer_location;
extern void* video_mem;
// These are actually in entry.asm and not boot.c, but we'll
// put them here anyway...
extern void hang(void);
extern char initmem[55000];