Import backup from 2004-07-12

This commit is contained in:
Josh Holtrop 2004-07-12 22:00:00 -04:00
parent 872d562d6a
commit dfb71cc759
17 changed files with 717 additions and 30 deletions

BIN
hos.flp Normal file

Binary file not shown.

View File

@ -1,2 +0,0 @@
clean:
- rm *~

View File

@ -1,7 +1,7 @@
# Makefile for HOS # Makefile for HOS
# Josh Holtrop # Josh Holtrop
# Created: 07/08/04 # Created: 07/08/04
# Modified: 07/09/04 # Modified: 07/11/04
# Assembler Information: # Assembler Information:
NASM=nasm NASM=nasm
@ -16,18 +16,20 @@ LD=ld
LD_FLAGS=-nodefaultlibs -nostdlib --no-demangle -T link.ld LD_FLAGS=-nodefaultlibs -nostdlib --no-demangle -T link.ld
all: Asm_Kernel C_Kernel all: Asm_Kernel C_Kernel
$(LD) $(LD_FLAGS) -Map boot.map boot.o kernel.o -o kernel.bin $(LD) $(LD_FLAGS) -Map boot.map boot.o kernel.o asmfuncs.o mm.o -o kernel.bin
Asm_Kernel: Asm_Kernel:
$(NASM) $(NASM_FLAGS) -l boot.lst boot.asm -o boot.o $(NASM) $(NASM_FLAGS) -l boot.lst boot.asm -o boot.o
$(NASM) $(NASM_FLAGS) -l asmfuncs.lst lang/asmfuncs.asm -o asmfuncs.o
C_Kernel: C_Kernel:
$(CC) $(CC_FLAGS) -c kernel.c -o kernel.o $(CC) $(CC_FLAGS) -c kernel.c -o kernel.o
$(CC) $(CC_FLAGS) -c mm/mm.c -o mm.o
################################################# #################################################
# Clean up the source directory of any binaries # # Clean up the source directory of any binaries #
################################################# #################################################
clean: clean:
- rm *.s *.S *.o *.bin *~ *.map *.lst - rm -r *.o *.bin *~ *.map *.lst

27
kernel/asmfuncs.h Normal file
View File

@ -0,0 +1,27 @@
// asmfuncs.h
// Author: Josh Holtrop
// Created: 02/26/04
// Modified: 07/11/04
#ifndef __HOS_ASMFUNCS__
#define __HOS_ASMFUNCS__ __HOS_ASMFUNCS__
u32_t write_cr0(u32_t cr0);
u32_t read_cr0();
u32_t write_cr3(u32_t cr3);
u32_t read_cr2();
u32_t read_cr3();
void writeCursorPosition(u32_t pos);
u32_t getCursorPosition();
void strcpy(char *dest, const char *src);
void memcpy(void *dest, const void *src, u32_t n);
void memcpyd(void *dest, const void *src, u32_t n);
void *memset(void *buffer, int c, int num);
void *memsetw(void *buffer, int c, int num);
void *memsetd(void *buffer, int c, int num);
u32_t strlen(const char *str);
void invlpg_(u32_t addr);
#endif

53
kernel/block/rd.c Normal file
View File

@ -0,0 +1,53 @@
#include "block/rd.h"
#include "kernel.h"
ramdisk_t ramdisks[256];
char rd_refs[256]; //number of references to each ramdisk
void rd_init()
{
}
int rd_register(byte *ramdisk, u32_t size)
{
int i;
for (i = 0; i < 256; i++)
{
if (!rd_refs[i])
{
rd_refs[i]++;
ramdisks[i].start = ramdisk;
ramdisks[i].size = size;
return i;
}
}
return -1;
}
int rd_remove(minor_t minor)
{
if (rd_refs[minor] <= 0)
return -1;
rd_refs[minor]--;
if (!rd_refs[minor])
free(ramdisks[minor].start);
}
int rd_read_block(minor_t minor, u32_t blockNum, u32_t count, byte *buffer)
{
if (rd_refs[minor] <= 0)
return -1;
byte *copyFrom = ramdisks[minor] + (blockNum << 9);
if (copyFrom > ramdisks[minor].start + ramdisks[minor].size)
return -1;
}
int rd_write_block(minor_t minor, u32_t blockNum, u32_t count, byte *buffer)
{
}

21
kernel/block/rd.h Normal file
View File

@ -0,0 +1,21 @@
#ifndef __HOS_RD_H__
#define __HOS_RD_H__ __HOS_RD_H__
#include "kernel.h"
#include "devices.h"
typedef struct {
byte *start;
u32_t size;
} ramdisk_t;
void rd_init();
int rd_register(byte *ramdisk, u32_t size);
int rd_remove(minor_t minor);
int rd_read_block(minor_t minor, u32_t blockNum, u32_t count, byte *buffer);
int rd_write_block(minor_t minor, u32_t blockNum, u32_t count, byte *buffer);
#endif

View File

@ -56,12 +56,12 @@ multiboot_entry:
lgdt [gdtrbs32-VIRT_OFFSET] lgdt [gdtrbs32-VIRT_OFFSET]
jmp KERNEL_CODE_BS32:segmented_start jmp KERNEL_CODE_BS32:segmented_start
segmented_start: segmented_start:
mov ax, KERNEL_DATA_BS32 mov cx, KERNEL_DATA_BS32
mov ss, ax mov ss, cx
mov ds, ax mov ds, cx
mov es, ax mov es, cx
mov gs, ax mov gs, cx
mov fs, ax mov fs, cx
mov esp, STACK_V+0x1000 ;ok, now we can access our data mov esp, STACK_V+0x1000 ;ok, now we can access our data
;aloop: ;aloop:

21
kernel/fs/devices.c Normal file
View File

@ -0,0 +1,21 @@
#include "fs/devices.h"
#include "kernel.h"
dev_driver_t drivers[256];
char drivers_registered[256]; //0 (unregistered), 'b', 'c'
void dev_init()
{
}
int dev_register_major(major_t major, dev_driver_t *dev)
{
if (registered[major])
return -1; //driver already registered
drivers[major] = *dev;
return 0;
}

20
kernel/fs/devices.h Normal file
View File

@ -0,0 +1,20 @@
#ifndef __HOS_DEVICES_H__
#define __HOS_DEVICES_H__ __HOS_DEVICES_H__
typedef unsigned char major_t;
typedef unsigned char minor_t;
typedef struct {
int (*block_read)(u32_t blockStart, u32_t blocks, void *buffer);
int (*block_write)(u32_t blockStart, u32_t blocks, void *buffer);
int (*char_read)(u64_t position);
int (*char_write)(u64_t position, int value);
} dev_driver_t;
void dev_init();
int dev_register_major(major_t major, dev_driver_t *dev);
#endif

22
kernel/hos_defines.h Normal file
View File

@ -0,0 +1,22 @@
#ifndef __HOS_DEFINES_H__
#define __HOS_DEFINES_H__ __HOS_DEFINES_H__
#define VIRT_OFFSET 0xC0000000
#define PHYS_LOAD 0x00108000
#define MAX_MODULES 16
#define MAX_MMAP 16
typedef unsigned long long u64_t;
typedef unsigned int u32_t;
typedef unsigned short u16_t;
typedef unsigned char u8_t;
typedef unsigned char byte;
extern u32_t _end;
extern u32_t _bss;
extern u32_t start;
#endif

View File

@ -2,9 +2,12 @@
#include "kernel.h" #include "kernel.h"
#include "multiboot.h" #include "multiboot.h"
#include "module.h" #include "module.h"
#include "asmfuncs.h"
#include "mm/mm.h"
mb_info_t mb_info_block; mb_info_t mb_info_block;
mb_mmap_t mb_mmap[MAX_MMAP]; mb_mmap_t mb_mmap[MAX_MMAP];
u32_t mmap_entries;
mb_module_t mb_modules[MAX_MODULES]; mb_module_t mb_modules[MAX_MODULES];
mb_apm_t mb_apm_table; mb_apm_t mb_apm_table;
char mb_cmdline[256]; char mb_cmdline[256];
@ -14,6 +17,7 @@ char mb_cmdline[256];
must be manually adjusted by VIRT_OFFSET to become valid linear addresses. */ must be manually adjusted by VIRT_OFFSET to become valid linear addresses. */
int k_mbsave(mb_info_t *mbinfo, unsigned int mb_magic) int k_mbsave(mb_info_t *mbinfo, unsigned int mb_magic)
{ {
int retVal = 0;
if (mb_magic != MULTIBOOT_BOOTLOADER_MAGIC) if (mb_magic != MULTIBOOT_BOOTLOADER_MAGIC)
{ {
char *msg = "Bad multiboot magic identifier!"; char *msg = "Bad multiboot magic identifier!";
@ -29,7 +33,7 @@ int k_mbsave(mb_info_t *mbinfo, unsigned int mb_magic)
if (mb_info_block.flags & MB_BOOTLOADER_COMMAND_LINE) if (mb_info_block.flags & MB_BOOTLOADER_COMMAND_LINE)
{ {
mb_info_block.cmdline += VIRT_OFFSET; mb_info_block.cmdline += VIRT_OFFSET;
memcpy(mb_cmdline, mb_info_block.cmdline, 256); memcpy(mb_cmdline, (void *)mb_info_block.cmdline, 256);
mb_cmdline[255] = 0; mb_cmdline[255] = 0;
} }
if (mb_info_block.flags & MB_BOOTLOADER_MODS) if (mb_info_block.flags & MB_BOOTLOADER_MODS)
@ -39,6 +43,11 @@ int k_mbsave(mb_info_t *mbinfo, unsigned int mb_magic)
for (i = 0; i < mb_info_block.mods_count && i < MAX_MODULES; i++) for (i = 0; i < mb_info_block.mods_count && i < MAX_MODULES; i++)
{ {
mb_modules[i] = ((mb_module_t *)mb_info_block.mods_addr)[i]; mb_modules[i] = ((mb_module_t *)mb_info_block.mods_addr)[i];
mb_modules[i].mod_start += VIRT_OFFSET;
mb_modules[i].mod_end += VIRT_OFFSET;
hos_module_header_t *mod = (hos_module_header_t *)mb_modules[i].mod_start;
if (mod->mod_type == MOD_REAL_MODE)
retVal = 1;
} }
} }
if (mb_info_block.flags & MB_BOOTLOADER_MMAP) if (mb_info_block.flags & MB_BOOTLOADER_MMAP)
@ -51,6 +60,7 @@ int k_mbsave(mb_info_t *mbinfo, unsigned int mb_magic)
sz += mmap->size; sz += mmap->size;
mb_mmap[i] = *mmap; mb_mmap[i] = *mmap;
mmap = (mb_mmap_t *)(((u32_t) mmap) + mmap->size); mmap = (mb_mmap_t *)(((u32_t) mmap) + mmap->size);
mmap_entries++;
} }
} }
if (mb_info_block.flags & MB_BOOTLOADER_APM) if (mb_info_block.flags & MB_BOOTLOADER_APM)
@ -58,19 +68,27 @@ int k_mbsave(mb_info_t *mbinfo, unsigned int mb_magic)
mb_info_block.apm_table += VIRT_OFFSET; mb_info_block.apm_table += VIRT_OFFSET;
mb_apm_table = *(mb_apm_t *)mb_info_block.apm_table; mb_apm_table = *(mb_apm_t *)mb_info_block.apm_table;
} }
return 0; return retVal;
} }
/* Main kernel initialization routine */
void k_init() void k_init()
{ {
mm_init();
// vmm_init();
// dev_init();
for (;;) for (;;)
{ {
(*(char*)0xC00B8000)++; (*(char*)0xC00B8000)++;
} }
} }
void isr() void isr(u32_t num)
{ {
for (;;) ; for (;;) ;
switch (num)
{
}
} }

View File

@ -2,16 +2,9 @@
#ifndef __HOS_KERNEL_H__ #ifndef __HOS_KERNEL_H__
#define __HOS_KERNEL_H__ __HOS_KERNEL_H__ #define __HOS_KERNEL_H__ __HOS_KERNEL_H__
#include "hos_defines.h"
#include "multiboot.h" #include "multiboot.h"
#define VIRT_OFFSET 0xC0000000
#define MAX_MODULES 16
#define MAX_MMAP 16
typedef unsigned int u32_t;
typedef unsigned short u16_t;
typedef unsigned char u8_t;
/* returns true to callee if we should jump to a real mode module */ /* returns true to callee if we should jump to a real mode module */
int k_mbsave(mb_info_t *mbinfo, unsigned int mb_magic); int k_mbsave(mb_info_t *mbinfo, unsigned int mb_magic);

328
kernel/lang/asmfuncs.asm Normal file
View File

@ -0,0 +1,328 @@
; asmfuncs.asm
; Josh Holtrop
; Created: 10/23/03
; Modified: 07/11/04
%macro jzfar 1
jnz %%skip
jmp %1
%%skip:
%endmacro
;stores the parameter to the CR0 register
;extern dword write_cr0(dword cr0);
[global _write_cr0]
_write_cr0:
push ebp
mov ebp, esp
mov eax, [ebp+8]
mov cr0, eax
pop ebp
ret
;returns the value in the CR0 register
;extern dword read_cr0();
[global _read_cr0]
_read_cr0:
mov eax, cr0;
ret
;stores the parameter to the CR3 register
;extern dword write_cr3(dword cr3);
[global _write_cr3]
_write_cr3:
push ebp
mov ebp, esp
mov eax, [ebp+8]
mov cr3, eax
pop ebp
ret
;returns the value in the CR2 register
;extern dword read_cr2();
[global _read_cr2]
_read_cr2:
mov eax, cr2;
ret
;returns the value in the CR3 register
;extern dword read_cr3();
[global _read_cr3]
_read_cr3:
mov eax, cr3;
ret
;compares one string to another
;returns 0 if the strings are different
;extern dword strcmp(char *str1, char *str2);
[global _strcmp]
_strcmp:
push ebp
mov ebp, esp
push esi
push edi
mov esi, [ebp+8]
mov edi, [ebp+12]
strcmp_loop1:
lodsb
mov ah, [edi]
inc edi
cmp ah, al
jnz strcmp_ne
or al, al
jz strcmp_e
jmp strcmp_loop1
strcmp_e:
mov eax, 1
jmp short strcmp_done
strcmp_ne:
xor eax, eax
strcmp_done:
pop edi
pop esi
pop ebp
ret
;copies a string from the source to the destination parameter
;extern void strcpy(char *dest, char *src);
[global _strcpy]
_strcpy:
push ebp
mov ebp, esp
push esi
push edi
mov edi, [ebp+8]
mov esi, [ebp+12]
strcpyloop:
lodsb
stosb
or al, al
jnz strcpyloop
pop edi
pop esi
pop ebp
ret
;copies memory of n bytes from src to destination
;void memcpy(void *dest, void *src, dword n);
[global _memcpy]
_memcpy:
push ebp
mov ebp, esp
push esi
push edi
push ecx
mov edi, [ebp+8]
mov esi, [ebp+12]
mov ecx, [ebp+16]
cld
rep movsb
pop ecx
pop edi
pop esi
pop ebp
ret
;copies memory of n dwords (n*4 bytes) from src to destination
;void memcpyd(void *dest, void *src, dword n);
[global _memcpyd]
_memcpyd:
push ebp
mov ebp, esp
push esi
push edi
push ecx
mov edi, [ebp+8]
mov esi, [ebp+12]
mov ecx, [ebp+16]
cld
rep movsd
pop ecx
pop edi
pop esi
pop ebp
ret
;sets num bytes at buffer to the value of c
;void *memset(void *buffer, int c, int num);
[global _memset]
_memset:
push ebp
mov ebp, esp
push edi
push ecx
mov edi, [ebp+8]
push edi ;save for return address
mov eax, [ebp+12]
mov ecx, [ebp+16]
rep stosb
pop eax
pop ecx
pop edi
pop ebp
ret
;sets num words at buffer to the value of c
;void *memsetw(void *buffer, int c, int num);
[global _memsetw]
_memsetw:
push ebp
mov ebp, esp
push edi
push ecx
mov edi, [ebp+8]
push edi ;save for return address
mov eax, [ebp+12]
mov ecx, [ebp+16]
rep stosw
pop eax
pop ecx
pop edi
pop ebp
ret
;sets num dwords at buffer to the value of c
;void *memsetd(void *buffer, int c, int num);
[global _memsetd]
_memsetd:
push ebp
mov ebp, esp
push edi
push ecx
mov edi, [ebp+8]
push edi ;save for return address
mov eax, [ebp+12]
mov ecx, [ebp+16]
rep stosd
pop eax
pop ecx
pop edi
pop ebp
ret
;returns the number of characters in a string
;extern dword strlen(char *str);
[global _strlen]
_strlen:
push ebp
mov ebp, esp
push esi
push ebx
mov esi, [ebp+8]
xor ebx, ebx
strlenloop:
lodsb
or al, al
jz strlendone
inc ebx
jmp strlenloop
strlendone:
mov eax, ebx
pop ebx
pop esi
pop ebp
ret
;this function invalidates the page directory/table entry that
; would be used to access the memory address given in the parameter
;extern void invlpg_(dword addr);
[global _invlpg_]
_invlpg_:
mov eax, [esp+4]
invlpg [eax]
ret
;
;void writeCursorPosition(word pos)
;
[global _writeCursorPosition]
_writeCursorPosition:
push ebp
mov ebp, esp
push eax
push ebx
push edx
mov eax, [ebp+8] ;cursor position in ax
mov bl, al
mov dx, 0x03D4
mov al, 0x0E
out dx, al
inc dx
mov al, ah
out dx, al
dec dx
mov al, 0x0F
out dx, al
inc dx
mov al, bl
out dx, al
pop edx
pop ebx
pop eax
pop ebp
ret
;
;word getCursorPosition()
;
[global _getCursorPosition]
_getCursorPosition:
push ebx
push edx
xor eax, eax
mov dx, 0x03D4
mov al, 0x0E
out dx, al
inc dx
in al, dx
mov bl, al
dec dx
mov al, 0x0F
out dx, al
inc dx
in al, dx
mov ah, bl
pop edx
pop ebx
ret

157
kernel/mm/mm.c Normal file
View File

@ -0,0 +1,157 @@
// mm.c
// Author: Josh Holtrop
// Created: 09/01/03
// Modified: 07/12/04
#include "kernel.h"
#include "mm/mm.h"
#include "multiboot.h"
#include "hos_defines.h"
u32_t mm_totalmem;
u32_t mm_megabytes;
u32_t mm_freepages;
u32_t mm_first_free_byte;
extern mb_info_t mb_info_block;
extern mb_mmap_t mb_mmap[MAX_MMAP];
extern u32_t mmap_entries;
extern mb_module_t mb_modules[MAX_MODULES];
byte page_bitmap[BITMAP_SIZE]; //used to store a bit for each page that is used, 0 if available
//0x20000*(8 bits/byte)=0x100000 pages in 4gb total
//This function initializes the memory manager's linked list, filling it with the
// memory areas returned by bios interrupt 0x8E20
void mm_init()
{
u32_t a;
for (a = 0; a < BITMAP_SIZE; a++) //mark all pages used
{
page_bitmap[a] = 0xFF;
}
for (a = 0; a < mmap_entries; a++) //free BIOS #1 areas
{
if (mb_mmap[a].type == 1) // (1) mem free to OS
{
mm_totalmem += mb_mmap[a].length;
u32_t freethis = mb_mmap[a].base;
u32_t limit = mb_mmap[a].base + mb_mmap[a].length - 4096;
while (freethis <= limit)
{
if (freethis >= PHYS_LOAD) //above physical kernel load point
mm_pfree(freethis);
freethis += 4096;
}
}
}
mm_preserven(PHYS_LOAD, ((u32_t)&_end - (u32_t)&start) >> 12); //reserve kernel memory
int i;
for (i = 0; i < mb_info_block.mods_count; i++) //reserve module memory
{
mm_preserven(mb_modules[i].mod_start - VIRT_OFFSET, (mb_modules[i].mod_end - mb_modules[i].mod_start) >> 12);
}
if (mm_totalmem % 0x100000)
mm_megabytes = (mm_totalmem >> 20) + 1;
else
mm_megabytes = mm_totalmem >> 20;
}
// This function frees a certain number of pages starting at the address
// specified in base for a length of pages pages
void mm_pfreen(u32_t base, u32_t pages)
{
u32_t a;
u32_t max = base + (pages << 12);
for (a = base; a < max; a += 4096)
{
mm_pfree(a);
}
}
// This function frees a single page
void mm_pfree(u32_t base)
{
// u32_t pageNumber = base >> 12; // >>12 == /4096
u32_t byteNumber = base >> 15; //pageNumber >> 3; //pageNumber/8
u32_t bitNumber = (base >> 12) & 0x07; //pageNumber % 8;
page_bitmap[byteNumber] = page_bitmap[byteNumber] & ((0x01 << bitNumber) ^ 0xFF);
mm_freepages++;
if (mm_first_free_byte > byteNumber)
mm_first_free_byte = byteNumber;
}
// This function reserves a certain number of pages starting at the address
// specified in base for a length of pages pages
void mm_preserven(u32_t base, u32_t pages)
{
u32_t a;
u32_t max = base + (pages << 12);
for (a = base; a < max; a += 4096)
{
mm_preserve(a);
}
}
// This function reserves a single page
void mm_preserve(u32_t base)
{
// u32_t pageNumber = base >> 12; // >>12 == /4096
u32_t byteNumber = base >> 15; //pageNumber >> 3; //pageNumber/8
u32_t bitNumber = (base >> 12) & 0x07; //pageNumber % 8;
page_bitmap[byteNumber] = page_bitmap[byteNumber] | (0x01 << bitNumber);
mm_freepages--;
}
// This function allocates a single page, returning its physical address
void *mm_palloc()
{
u32_t bite;
for (bite = mm_first_free_byte; bite < BITMAP_SIZE; bite++)
{
if (page_bitmap[bite] != 0xFF) //there is an available page within this 8-page region
{
int bit;
for (bit = 0; bit < 8; bit++)
{
if (!(page_bitmap[bite] & (1 << bit))) //this bite/bit combination is available
{
mm_first_free_byte = bite; //start searching from here next time
mm_freepages--;
page_bitmap[bite] = page_bitmap[bite] | (1 << bit); //set page as used
return (void *)((bite << 15) | (bit << 12));
}
}
}
}
return 0; //no free page
}
// This function reports the number of bytes of free physical memory
u32_t mm_freemem()
{
return mm_freepages << 12;
}
u32_t mm_getTotalMem()
{
return mm_totalmem;
}
u32_t mm_getTotalMegs()
{
return mm_megabytes;
}

26
kernel/mm/mm.h Normal file
View File

@ -0,0 +1,26 @@
// mm.c
// Author: Josh Holtrop
// Created: 09/01/03
// Modified: 03/08/04
#ifndef __HOS_MM__
#define __HOS_MM__ __HOS_MM__
#include "kernel.h"
//The total amount of physical memory available (bytes, 1 bit per page)
#define BITMAP_SIZE 0x20000
void mm_init();
void mm_pfreen(u32_t base, u32_t pages);
void mm_pfree(u32_t base);
void mm_preserven(u32_t base, u32_t pages);
void mm_preserve(u32_t base);
void *mm_palloc();
u32_t mm_freemem();
u32_t mm_getTotalMem();
u32_t mm_getTotalMegs();
#endif

View File

@ -6,7 +6,7 @@
#define MOD_KERNEL 2 #define MOD_KERNEL 2
typedef struct { typedef struct {
unsigned int mod_magic; // "HOSM" = 0x484F534D unsigned int mod_magic; // "HOSM" = dword value 0x4D534F48
unsigned int mod_type; // module type unsigned int mod_type; // module type
void (*init) (); // address of void initialization function void (*init) (); // address of void initialization function
unsigned int reserved; unsigned int reserved;

View File

@ -2,6 +2,8 @@
#ifndef __HOS_MULTIBOOT_H__ #ifndef __HOS_MULTIBOOT_H__
#define __HOS_MULTIBOOT_H__ __HOS_MULTIBOOT_H__ #define __HOS_MULTIBOOT_H__ __HOS_MULTIBOOT_H__
#include "hos_defines.h"
/* The magic number for the Multiboot header. */ /* The magic number for the Multiboot header. */
#define MULTIBOOT_HEADER_MAGIC 0x1BADB002 #define MULTIBOOT_HEADER_MAGIC 0x1BADB002
@ -10,7 +12,6 @@
#define MB_HEADER_VIDEO_INFO 0x04 #define MB_HEADER_VIDEO_INFO 0x04
#define MB_HEADER_KLUDGE_OFFSETS 0x10000 #define MB_HEADER_KLUDGE_OFFSETS 0x10000
/* The magic number passed by a Multiboot-compliant boot loader. */ /* The magic number passed by a Multiboot-compliant boot loader. */
#define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002 #define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002
@ -26,11 +27,9 @@
#define MB_BOOTLOADER_APM 0x0200 #define MB_BOOTLOADER_APM 0x0200
#define MB_BOOTLOADER_GRAPHICS 0x0400 #define MB_BOOTLOADER_GRAPHICS 0x0400
#define MB_DRIVE_MODE_CHS 0 #define MB_DRIVE_MODE_CHS 0
#define MB_DRIVE_MODE_LBA 1 #define MB_DRIVE_MODE_LBA 1
/* The Multiboot header. */ /* The Multiboot header. */
typedef struct typedef struct
{ {
@ -106,10 +105,12 @@ typedef struct
typedef struct typedef struct
{ {
unsigned int size; //offset -4 unsigned int size; //offset -4
unsigned int base_addr_low; //offset 0 // unsigned int base_addr_low; //offset 0
unsigned int base_addr_high; // unsigned int base_addr_high;
unsigned int length_low; // unsigned int length_low;
unsigned int length_high; // unsigned int length_high;
u64_t base;
u64_t length;
unsigned int type; unsigned int type;
} mb_mmap_t; } mb_mmap_t;