Excited! Grub2 finally loads our kernel64.bin after this commit!!
This commit is contained in:
parent
7cc18fac3d
commit
30460c80d9
7
makefile
7
makefile
|
@ -55,11 +55,10 @@ buildiso:
|
|||
sudo mkdir $(OUTPUT_DIR)/temp_iso/HOS
|
||||
sudo mkdir $(OUTPUT_DIR)/temp_iso/boot
|
||||
sudo mkdir $(OUTPUT_DIR)/temp_iso/boot/grub
|
||||
sudo mkdir $(OUTPUT_DIR)/temp_mod
|
||||
sudo mv $(KERNEL_BIN_64) $(OUTPUT_DIR)/temp_mod/kernel64.mod
|
||||
sudo mv $(KERNEL_BIN_32) $(OUTPUT_DIR)/temp_iso/HOS/kernel32.bin
|
||||
sudo mv $(KERNEL_BIN_64) $(OUTPUT_DIR)/temp_iso/HOS/kernel64
|
||||
sudo mv $(KERNEL_BIN_32) $(OUTPUT_DIR)/temp_iso/HOS/kernel32
|
||||
sudo cp $(GRUB_CFG) $(OUTPUT_DIR)/temp_iso/boot/grub/
|
||||
sudo grub-mkrescue --modules="$(OUTPUT_DIR)/temp_mod/kernel64" -o HOS.iso $(OUTPUT_DIR)/temp_iso
|
||||
sudo grub-mkrescue -o HOS.iso $(OUTPUT_DIR)/temp_iso
|
||||
|
||||
$(OUTPUT_DIR)/%_x86.o: $(C_SRC_PATH_32)/%.c
|
||||
sudo $(CC) $(C_FLAGS_32) -o $@ $^
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _HKDEF32_H_
|
||||
#define _HKDEF32_H_
|
||||
#ifndef _KDEF_H_
|
||||
#define _KDEF_H_
|
||||
|
||||
#define HYPKERNEL64
|
||||
|
||||
|
|
|
@ -66,4 +66,6 @@ mov fs,ax
|
|||
mov ax,SLCT_GRAPH_0
|
||||
mov gs,ax
|
||||
|
||||
call hk_main
|
||||
push ebx
|
||||
call hk_main
|
||||
add esp,4
|
|
@ -1,7 +1,7 @@
|
|||
#include "type32.h"
|
||||
#include "kdef32.h"
|
||||
#include "grub.h"
|
||||
#include "mem32.h"
|
||||
#include "type.h"
|
||||
#include "kdef.h"
|
||||
#include "multiboot.h"
|
||||
#include "mem.h"
|
||||
|
||||
uint8 g_gdt[8 * 8];
|
||||
gdt_ptr g_gdt_ptr;
|
||||
|
@ -26,6 +26,7 @@ void HYPKERNEL32 print_str(char *str)
|
|||
|
||||
int32 HYPKERNEL32 hk_main(multiboot_info_t *multiboot_info)
|
||||
{
|
||||
multiboot_info->mods_addr;
|
||||
segment_descriptor desc_dummy = {.DPL = 0, .Pr = 0, .x64 = 0, .Sys = 0, .type = 0, .Sz = 0, .limit = 0, .Gr = 0, .base = 0, .Avl = 0};
|
||||
segment_descriptor desc = {.Gr = 1, .Pr = 1, .Sz = 1, .Avl = 0, .Sys = 1, .x64 = 0, .base = 0, .limit = 0xFFFFF};
|
||||
|
||||
|
@ -50,6 +51,19 @@ int32 HYPKERNEL32 hk_main(multiboot_info_t *multiboot_info)
|
|||
|
||||
hk_load_gdt(&g_gdt_ptr, SEGMENT_SELECTOR(1, 0), SEGMENT_SELECTOR(3, 0));
|
||||
|
||||
if(multiboot_info->mods_count != 1)
|
||||
{
|
||||
print_str("No module loaded...");
|
||||
}
|
||||
else
|
||||
{
|
||||
struct multiboot_mod_list* mod_list = (struct multiboot_mod_list*)multiboot_info->mods_addr;
|
||||
print_str(" - Loaded Module");
|
||||
print_str((char*)mod_list->cmdline);
|
||||
}
|
||||
|
||||
x66:
|
||||
goto x66;
|
||||
char *msg_x64_not_supported = "x64 not supported by CPU, continue in x86.";
|
||||
char *msg_x64_supported = "x64 supported by CPU.";
|
||||
if (hk_support_x64() == 0)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _HKDEF32_H_
|
||||
#define _HKDEF32_H_
|
||||
#ifndef _KDEF_H_
|
||||
#define _KDEF_H_
|
||||
|
||||
#define HYPKERNEL32 __attribute__((cdecl))
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#include "mem32.h"
|
||||
#include "kdef32.h"
|
||||
#include "kdef.h"
|
||||
#include "mem.h"
|
||||
|
||||
int32 HYPKERNEL32 hk_set_segment_descriptor(uint8* const gdt, const segment_descriptor* const seg_desc)
|
||||
{
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef _MEM_32_H_
|
||||
#define _MEM_32_H_
|
||||
#include "type32.h"
|
||||
#include "kdef32.h"
|
||||
#include "type.h"
|
||||
#include "kdef.h"
|
||||
|
||||
typedef struct __attribute__ ((packed))
|
||||
{
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _GRUB_H_
|
||||
#define _GRUB_H_
|
||||
#ifndef _MULTIBOOT_H_
|
||||
#define _MULTIBOOT_H_
|
||||
|
||||
/* How many bytes from the start of the file we search for the header. */
|
||||
#define MULTIBOOT_SEARCH 8192
|
Loading…
Reference in New Issue