Identity mapping in 64 bit mode and ++output directory
This commit is contained in:
parent
f625215412
commit
7dabcecb92
6
.gitignore
vendored
6
.gitignore
vendored
@ -1,8 +1,4 @@
|
||||
.idea
|
||||
cmake-build-debug
|
||||
*.o
|
||||
*.a
|
||||
CMakeLists.txt
|
||||
*.iso
|
||||
*.elf
|
||||
*.dmp
|
||||
out/
|
||||
|
78
Makefile
78
Makefile
@ -6,50 +6,50 @@ DAS = $(CROSS_DIR)/x86_64-elf-objdump
|
||||
|
||||
INCLUDE_DIR = include
|
||||
MK = mk
|
||||
OUT = out
|
||||
|
||||
LD_SCRIPT = $(MK)/linker.ld
|
||||
GRUB_CFG = $(MK)/grub.cfg
|
||||
C_WARNINGS = -Wall \
|
||||
-Werror \
|
||||
-Wextra \
|
||||
-Wpedantic \
|
||||
-Winit-self \
|
||||
-Wunused-parameter \
|
||||
-Wuninitialized \
|
||||
-Wfloat-equal \
|
||||
-Wshadow \
|
||||
-Wcast-qual \
|
||||
-Wcast-align \
|
||||
-Wstrict-prototypes \
|
||||
-Wpointer-arith \
|
||||
-Wno-comment
|
||||
|
||||
C_WARNINGS = -Wall \
|
||||
-Werror \
|
||||
-Wextra \
|
||||
-Wpedantic \
|
||||
-Winit-self \
|
||||
-Wunused-parameter \
|
||||
-Wuninitialized \
|
||||
-Wfloat-equal \
|
||||
-Wshadow \
|
||||
-Wcast-qual \
|
||||
-Wcast-align \
|
||||
-Wstrict-prototypes \
|
||||
-Wpointer-arith \
|
||||
-Wno-comment
|
||||
C_FLAGS = -std=c11 \
|
||||
-g \
|
||||
-c \
|
||||
-O2 \
|
||||
-mcmodel=kernel \
|
||||
-fno-exceptions \
|
||||
-ffreestanding \
|
||||
-mno-red-zone \
|
||||
-mno-mmx \
|
||||
-mno-sse \
|
||||
-mno-sse2 \
|
||||
-masm=intel \
|
||||
$(C_WARNINGS) \
|
||||
$(addprefix -I, $(INCLUDE_DIR))
|
||||
|
||||
C_FLAGS = -std=c11 \
|
||||
-g \
|
||||
-c \
|
||||
-O2 \
|
||||
-mcmodel=kernel \
|
||||
-fno-exceptions \
|
||||
-ffreestanding \
|
||||
-mno-red-zone \
|
||||
-mno-mmx \
|
||||
-mno-sse \
|
||||
-mno-sse2 \
|
||||
-masm=intel \
|
||||
$(C_WARNINGS) \
|
||||
$(addprefix -I, $(INCLUDE_DIR))
|
||||
|
||||
AS_FLAGS = -w+all \
|
||||
-f elf64 \
|
||||
-F dwarf \
|
||||
-g \
|
||||
$(addprefix -I, $(INCLUDE_DIR)/)
|
||||
AS_FLAGS = -w+all \
|
||||
-w+error \
|
||||
-f elf64 \
|
||||
-F dwarf \
|
||||
-g \
|
||||
$(addprefix -I, $(INCLUDE_DIR)/)
|
||||
|
||||
LD_FLAGS = -lgcc \
|
||||
-nodefaultlibs \
|
||||
-nodefaultlibs \
|
||||
-nostartfiles \
|
||||
-nostdlib \
|
||||
-mno-red-zone \
|
||||
-Wl,-n \
|
||||
-Wl,--build-id=none
|
||||
|
||||
@ -65,13 +65,13 @@ PREP_FLAGS = -E \
|
||||
GDEP_FLAGS = $(PREP_FLAGS) \
|
||||
-MMD \
|
||||
-MT $@
|
||||
|
||||
|
||||
MKDIR = mkdir -p $(dir $@)
|
||||
COMP = $(CC) $(C_FLAGS) $< -o $@
|
||||
COMPAS = $(AS) $(AS_FLAGS) $< -o $@
|
||||
LINK = $(LD) $(LD_FLAGS) $^ -o $@
|
||||
DUMP = $(DAS) $(DUMP_FLAGS) $< > $@
|
||||
PREP = $(CC) $(PREP_FLAGS) $< > $@
|
||||
GDEP = $(CC) $(GDEP_FLAGS) -MF $*.d $< > /dev/null
|
||||
GDEP = $(CC) $(GDEP_FLAGS) -MF $(addsuffix .d, $@) $< > /dev/null
|
||||
|
||||
include Rules.top
|
12
Rules.top
12
Rules.top
@ -15,11 +15,14 @@ include $(dir)/Rules.mk
|
||||
dir := mk
|
||||
include $(dir)/Rules.mk
|
||||
|
||||
TGT := secxkrnl.elf
|
||||
DMP := secxkrnl.dmp
|
||||
ISO := secxkrnl.iso
|
||||
LD_SCRIPT = $(OUT)/$(MK)/linker.ld
|
||||
GRUB_CFG = $(OUT)/$(MK)/grub.cfg
|
||||
TGT := $(OUT)/secxkrnl.elf
|
||||
DMP := $(OUT)/secxkrnl.dmp
|
||||
ISO := $(OUT)/secxkrnl.iso
|
||||
|
||||
$(TGT): $(OBJ) $(LD_SCRIPT)
|
||||
$(LD) $(LD_FLAGS) -print-libgcc-file-name
|
||||
$(LINK) -T $(LD_SCRIPT)
|
||||
|
||||
$(DMP): $(TGT)
|
||||
@ -28,6 +31,7 @@ $(DMP): $(TGT)
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f $(CLEAN) $(TGT) $(DMP) $(ISO)
|
||||
find $(OUT) -empty -type d -delete
|
||||
|
||||
.PHONY: compile
|
||||
compile: $(TGT)
|
||||
@ -36,7 +40,7 @@ compile: $(TGT)
|
||||
dump: $(DMP)
|
||||
|
||||
.PHONY: iso
|
||||
iso: $(TGT)
|
||||
iso: $(TGT) $(GRUB_CFG)
|
||||
mkdir -p temp/secX
|
||||
mkdir -p temp/boot
|
||||
mkdir -p temp/boot/grub
|
||||
|
15
hal/Rules.mk
15
hal/Rules.mk
@ -3,14 +3,23 @@ include $(MK)/prologue.mk
|
||||
SRC_$(d) := $(d)/boot.c \
|
||||
$(d)/intr.c \
|
||||
$(d)/mem.c \
|
||||
$(d)/print.c
|
||||
$(d)/print.c
|
||||
|
||||
SRCAS_$(d) := $(d)/boot.asm \
|
||||
$(d)/cpu.asm \
|
||||
SRCAS_$(d) := $(d)/cpu.asm \
|
||||
$(d)/intr.asm
|
||||
|
||||
SRCIN_$(d) := $(d)/boot.asm.in
|
||||
|
||||
#special rules for boot.asm
|
||||
#no dependencies for ASM objects
|
||||
$(OUT)/$(d)/boot.a: $(OUT)/$(d)/boot.asm
|
||||
$(MKDIR)
|
||||
$(COMPAS)
|
||||
|
||||
OBJ := $(OBJ) $(OUT)/$(d)/boot.a
|
||||
CLEAN := $(CLEAN) $(OUT)/$(d)/boot.a
|
||||
|
||||
# include this at last
|
||||
include $(MK)/stdrules.mk
|
||||
|
||||
include $(MK)/epilogue.mk
|
@ -1,6 +1,8 @@
|
||||
#include "kernel/hal/memdef.h"
|
||||
#define ASM_FILE
|
||||
#include "kernel/hal/mem.h"
|
||||
#include "hal/multiboot2.h"
|
||||
|
||||
%define GET_PADDR(x) ((x) - KERNEL_IMAGE_VADDR)
|
||||
%define GET_PADDR(x) ((x) - KERNEL_IMAGE_VADDR + KERNEL_IMAGE_PADDR)
|
||||
%define BOCHS_BREAK xchg bx,bx
|
||||
|
||||
extern hal_main
|
||||
@ -9,42 +11,37 @@ global hal_entry_32
|
||||
|
||||
section .multiboot_header
|
||||
bits 32
|
||||
MULTIBOOT_TAG_ALIGNMENT equ 8
|
||||
MULTIBOOT_HEADER_ALIGNMENT equ 8
|
||||
MULTIBOOT_LOADED_MAGIC equ 0x36d76289
|
||||
MULTIBOOT_MAGIC_NUMBER equ 0xE85250D6
|
||||
MULTIBOOT_ARCH equ 0
|
||||
MULTIBOOT_CHECK_SUM equ (0xFFFFFFFF - (MULTIBOOT_MAGIC_NUMBER + MULTIBOOT_HEADER_SIZE + MULTIBOOT_ARCH) + 1)
|
||||
MULTIBOOT_CHECK_SUM equ (0xFFFFFFFF - (MULTIBOOT2_HEADER_MAGIC + MULTIBOOT_HEADER_SIZE + MULTIBOOT_ARCH) + 1)
|
||||
MULTIBOOT_REQ_LOADERNAME equ 2
|
||||
MULTIBOOT_REQ_MMAP equ 6
|
||||
MULTIBOOT_REQ_ACPI_RSDP equ 15
|
||||
;====================
|
||||
;header tag
|
||||
align MULTIBOOT_HEADER_ALIGNMENT
|
||||
align MULTIBOOT_HEADER_ALIGN
|
||||
multiboot_header_tag:
|
||||
dd MULTIBOOT_MAGIC_NUMBER
|
||||
dd MULTIBOOT2_HEADER_MAGIC
|
||||
dd MULTIBOOT_ARCH
|
||||
dd MULTIBOOT_HEADER_SIZE
|
||||
dd MULTIBOOT_CHECK_SUM
|
||||
;====================
|
||||
;INFO_REQUEST_TAG
|
||||
align MULTIBOOT_TAG_ALIGNMENT
|
||||
align MULTIBOOT_INFO_ALIGN
|
||||
multiboot_info_tag:
|
||||
dw 0x1 ; type=1
|
||||
dw 0x0 ; flag=0
|
||||
dd MULTIBOOT_INFO_TAG_SIZE
|
||||
dd MULTIBOOT_REQ_LOADERNAME
|
||||
dd MULTIBOOT_REQ_MMAP
|
||||
dd MULTIBOOT_REQ_ACPI_RSDP
|
||||
MULTIBOOT_INFO_TAG_SIZE equ ($ - multiboot_info_tag)
|
||||
;====================
|
||||
;MODULE ALIGNMENT TAG
|
||||
align MULTIBOOT_TAG_ALIGNMENT
|
||||
align MULTIBOOT_INFO_ALIGN
|
||||
dw 0x6; type=6
|
||||
dw 0x0; flag=0
|
||||
dd 0x8
|
||||
;====================
|
||||
align MULTIBOOT_TAG_ALIGNMENT
|
||||
align MULTIBOOT_INFO_ALIGN
|
||||
;End_tag
|
||||
dw 0x0
|
||||
dw 0x0
|
||||
@ -55,11 +52,11 @@ MULTIBOOT_HEADER_SIZE equ ($ - multiboot_header_tag)
|
||||
|
||||
section .text
|
||||
bits 32
|
||||
align 4096
|
||||
align KERNEL_PAGE_SIZE
|
||||
hal_entry_32:
|
||||
cli
|
||||
cld
|
||||
cmp eax,MULTIBOOT_LOADED_MAGIC
|
||||
cmp eax,MULTIBOOT2_BOOTLOADER_MAGIC
|
||||
je .loaded_by_grub
|
||||
hlt
|
||||
|
||||
@ -74,7 +71,7 @@ hal_entry_32:
|
||||
.init_long_mode:
|
||||
; disable paging first
|
||||
mov eax, cr0 ; Set the A-register to control register 0.
|
||||
and eax, ~(1 << 31) ; Clear the PG-bit, which is bit 31.
|
||||
and eax, 0x7FFFFFFF ; Clear the PG-bit, which is bit 31.
|
||||
mov cr0, eax ; Set control register 0 to the A-register.
|
||||
|
||||
; identity map the first 4GB
|
||||
@ -181,15 +178,15 @@ halp_entry_64:
|
||||
|
||||
section .data
|
||||
bits 64
|
||||
align 4096
|
||||
align KERNEL_PAGE_SIZE
|
||||
times 4096 db 0
|
||||
_stack:
|
||||
|
||||
_pml4:
|
||||
align 4096
|
||||
align KERNEL_PAGE_SIZE
|
||||
times 4096 db 0
|
||||
_pdpt:
|
||||
align 4096
|
||||
align KERNEL_PAGE_SIZE
|
||||
times 4096 db 0
|
||||
_gdt: ; Global Descriptor Table (long mode).
|
||||
.null: equ $ - _gdt ; The null descriptor.
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#define HAL_CORE_COUNT 1
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16_t limit;
|
||||
|
@ -28,12 +28,6 @@
|
||||
#define SEG_AVAILABLE (1ull << 52)
|
||||
#define SEG_32_BITS (1ull << 54)
|
||||
|
||||
static inline uint32_t KABI seg_selector(uint32_t index, uint32_t rpl)
|
||||
{
|
||||
return (index << 3) + rpl;
|
||||
}
|
||||
|
||||
void KABI hal_write_segment_descriptor(void *const gdt, uint32_t const base, uint32_t const limit, uint64_t const attr);
|
||||
|
||||
/**
|
||||
Page Table Definitions
|
||||
@ -79,6 +73,13 @@ void KABI hal_write_segment_descriptor(void *const gdt, uint32_t const base, uin
|
||||
#define PD_ENTRY_NUM(vaddr) (((vaddr) >> 21) & 0x1FF)
|
||||
#define PT_ENTRY_NUM(vaddr) (((vaddr) >> 12) & 0x1FF)
|
||||
|
||||
static inline uint32_t KABI seg_selector(uint32_t index, uint32_t rpl)
|
||||
{
|
||||
return (index << 3) + rpl;
|
||||
}
|
||||
|
||||
void KABI hal_write_segment_descriptor(void *const gdt, uint32_t const base, uint32_t const limit, uint64_t const attr);
|
||||
|
||||
void KABI hal_write_pml4(void *const base, uintptr_t const pdpt_addr, uint64_t const attr);
|
||||
|
||||
void KABI hal_write_pdpt(void *const base, uintptr_t const pd_addr, uint64_t const attr);
|
||||
|
@ -1,9 +1,40 @@
|
||||
#ifndef _KERNEL_HAL_MEM_H_
|
||||
#define _KERNEL_HAL_MEM_H_
|
||||
|
||||
/**
|
||||
* Kernel Memory Layout
|
||||
* ----------------------- 0x0000,0000,0000,0000 - User Space
|
||||
* Application SIZE: 0x0000,8000,0000,0000 (256x PML4)
|
||||
* ----------------------- 0x0000,8000,0000,0000
|
||||
* Non-canonical
|
||||
* ----------------------- 0xFFFF,8000,0000,0000 - Kernel Space
|
||||
* Reserved SIZE: 0x0000,7F00,0000,0000 (254x PML4)
|
||||
* ----------------------- 0xFFFF,FF00,0000,0000
|
||||
* Page Table SIZE: 0x0000,0080,0000,0000 (1x PML4)
|
||||
* ----------------------- 0xFFFF,FF80,0000,0000
|
||||
* Kernel Dynamic SIZE: 0x0000,007F,8000,0000 (Kernel Dynamic + Kernel Image = 1x PML4)
|
||||
* ----------------------- 0xFFFF,FFFF,8000,0000
|
||||
* Kernel Image SIZE: 0x0000,0000,8000,0000
|
||||
* ----------------------- 0xFFFF,FFFF,FFFF,FFFF
|
||||
**/
|
||||
|
||||
#define KERNEL_IMAGE_PADDR (0x1000000)
|
||||
#define KERNEL_PAGE_SIZE (0x1000)
|
||||
|
||||
#define KERNEL_SPACE_VADDR (0xFFFF800000000000)
|
||||
#define KERNEL_RESERVED_VADDR KERNEL_SPACE_VADDR
|
||||
#define KERNEL_RESERVED_SIZE (0x00007F0000000000)
|
||||
#define KERNEL_PAGE_TABLE_VADDR (0xFFFFFF0000000000)
|
||||
#define KERNEL_PAGE_TABLE_SIZE (0x0000008000000000)
|
||||
#define KERNEL_DYNAMIC_VADDR (0xFFFFFF8000000000)
|
||||
#define KERNEL_DYNAMIC_SIZE (0x0000007F80000000)
|
||||
#define KERNEL_IMAGE_VADDR (0xFFFFFFFF80000000)
|
||||
#define KERNEL_IMAGE_SIZE (0x0000000080000000)
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
#include "type.h"
|
||||
#include "lib/linked_list.h"
|
||||
#include "kernel/hal/memdef.h"
|
||||
|
||||
/**
|
||||
* From linker.inc
|
||||
@ -27,3 +58,5 @@ typedef struct
|
||||
} pmm_info_t;
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -1,32 +0,0 @@
|
||||
#ifndef _KERNEL_HAL_MEMDEF_H_
|
||||
#define _KERNEL_HAL_MEMDEF_H_
|
||||
/**
|
||||
* Kernel Memory Layout
|
||||
* ----------------------- 0x0000,0000,0000,0000 - User Space
|
||||
* Application SIZE: 0x0000,8000,0000,0000 (256x PML4)
|
||||
* ----------------------- 0x0000,8000,0000,0000
|
||||
* Non-canonical
|
||||
* ----------------------- 0xFFFF,8000,0000,0000 - Kernel Space
|
||||
* Reserved SIZE: 0x0000,7F00,0000,0000 (254x PML4)
|
||||
* ----------------------- 0xFFFF,FF00,0000,0000
|
||||
* Page Table SIZE: 0x0000,0080,0000,0000 (1x PML4)
|
||||
* ----------------------- 0xFFFF,FF80,0000,0000
|
||||
* Kernel Dynamic SIZE: 0x0000,007F,8000,0000 (Kernel Dynamic + Kernel Image = 1x PML4)
|
||||
* ----------------------- 0xFFFF,FFFF,8000,0000
|
||||
* Kernel Image SIZE: 0x0000,0000,8000,0000
|
||||
* ----------------------- 0xFFFF,FFFF,FFFF,FFFF
|
||||
**/
|
||||
|
||||
#define KERNEL_IMAGE_PADDR (0x1000000)
|
||||
#define KERNEL_PAGE_SIZE (0x1000)
|
||||
|
||||
#define KERNEL_SPACE_VADDR (0xFFFF800000000000)
|
||||
#define KERNEL_RESERVED_VADDR KERNEL_SPACE_VADDR
|
||||
#define KERNEL_RESERVED_SIZE (0x00007F0000000000)
|
||||
#define KERNEL_PAGE_TABLE_VADDR (0xFFFFFF0000000000)
|
||||
#define KERNEL_PAGE_TABLE_SIZE (0x0000008000000000)
|
||||
#define KERNEL_DYNAMIC_VADDR (0xFFFFFF8000000000)
|
||||
#define KERNEL_DYNAMIC_SIZE (0x0000007F80000000)
|
||||
#define KERNEL_IMAGE_VADDR (0xFFFFFFFF80000000)
|
||||
#define KERNEL_IMAGE_SIZE (0x0000000080000000)
|
||||
#endif
|
@ -33,21 +33,18 @@ static inline bool sx_success(status_t status)
|
||||
return (severity == SEVERITY_INFO) || (severity == SEVERITY_SUCCESS);
|
||||
}
|
||||
|
||||
enum _status_t
|
||||
{
|
||||
STATUS_SUCCESS = SX_MAKE_STATUS(SEVERITY_SUCCESS, FACILITY_GENERIC, 0),
|
||||
STATUS_FAIL = SX_MAKE_STATUS(SEVERITY_ERROR, FACILITY_GENERIC, 0),
|
||||
#define STATUS_SUCCESS (SX_MAKE_STATUS(SEVERITY_SUCCESS, FACILITY_GENERIC, 0))
|
||||
#define STATUS_FAIL (SX_MAKE_STATUS(SEVERITY_ERROR, FACILITY_GENERIC, 0))
|
||||
|
||||
RF_UNINITIALIZED = SX_MAKE_STATUS(SEVERITY_ERROR, FACILITY_RF, 1),
|
||||
RF_ALLOCATION_FAILED = SX_MAKE_STATUS(SEVERITY_ERROR, FACILITY_RF, 2),
|
||||
RF_INVALID_ARGUMENTS = SX_MAKE_STATUS(SEVERITY_ERROR, FACILITY_RF, 3),
|
||||
RF_INVALID_HANDLE = SX_MAKE_STATUS(SEVERITY_ERROR, FACILITY_RF, 4),
|
||||
RF_DUPLICATED_HANDLE = SX_MAKE_STATUS(SEVERITY_ERROR, FACILITY_RF, 5),
|
||||
#define RF_UNINITIALIZED (SX_MAKE_STATUS(SEVERITY_ERROR, FACILITY_RF, 1))
|
||||
#define RF_ALLOCATION_FAILED (SX_MAKE_STATUS(SEVERITY_ERROR, FACILITY_RF, 2))
|
||||
#define RF_INVALID_ARGUMENTS (SX_MAKE_STATUS(SEVERITY_ERROR, FACILITY_RF, 3))
|
||||
#define RF_INVALID_HANDLE (SX_MAKE_STATUS(SEVERITY_ERROR, FACILITY_RF, 4))
|
||||
#define RF_DUPLICATED_HANDLE (SX_MAKE_STATUS(SEVERITY_ERROR, FACILITY_RF, 5))
|
||||
|
||||
MM_INVALID_ARGUMENTS = SX_MAKE_STATUS(SEVERITY_ERROR, FACILITY_MM, 1),
|
||||
MM_ALLOCATION_FAILED = SX_MAKE_STATUS(SEVERITY_ERROR, FACILITY_MM, 2),
|
||||
MM_UNINITIALIZED = SX_MAKE_STATUS(SEVERITY_ERROR, FACILITY_MM, 3),
|
||||
MM_NOT_ENOUGH_PAGE = SX_MAKE_STATUS(SEVERITY_ERROR, FACILITY_MM, 4),
|
||||
};
|
||||
#define MM_INVALID_ARGUMENTS (SX_MAKE_STATUS(SEVERITY_ERROR, FACILITY_MM, 1))
|
||||
#define MM_ALLOCATION_FAILED (SX_MAKE_STATUS(SEVERITY_ERROR, FACILITY_MM, 2))
|
||||
#define MM_UNINITIALIZED (SX_MAKE_STATUS(SEVERITY_ERROR, FACILITY_MM, 3))
|
||||
#define MM_NOT_ENOUGH_PAGE (SX_MAKE_STATUS(SEVERITY_ERROR, FACILITY_MM, 4))
|
||||
|
||||
#endif
|
@ -1,6 +1,7 @@
|
||||
include $(MK)/prologue.mk
|
||||
|
||||
SRCIN_$(d) := $(d)/linker.ld.in
|
||||
SRCIN_$(d) := $(d)/linker.ld.in \
|
||||
$(d)/grub.cfg.in
|
||||
|
||||
include $(MK)/stdrules.mk
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "kernel/hal/memdef.h"
|
||||
#define ASM_FILE
|
||||
#include "kernel/hal/mem.h"
|
||||
|
||||
OUTPUT_FORMAT(elf64-x86-64)
|
||||
OUTPUT_ARCH(i386:x86-64)
|
||||
@ -8,23 +9,23 @@ SECTIONS
|
||||
{
|
||||
. = KERNEL_IMAGE_VADDR;
|
||||
|
||||
.multiboot_header : AT(ADDR(.multiboot_header) + KERNEL_IMAGE_PADDR - KERNEL_IMAGE_VADDR)
|
||||
.multiboot_header ALIGN(KERNEL_PAGE_SIZE) : AT(ADDR(.multiboot_header) + KERNEL_IMAGE_PADDR - KERNEL_IMAGE_VADDR)
|
||||
{
|
||||
*(.multiboot_header)
|
||||
}
|
||||
|
||||
.text ALIGN(0x1000) : AT(ADDR(.text) + KERNEL_IMAGE_PADDR - KERNEL_IMAGE_VADDR)
|
||||
.text ALIGN(KERNEL_PAGE_SIZE) : AT(ADDR(.text) + KERNEL_IMAGE_PADDR - KERNEL_IMAGE_VADDR)
|
||||
{
|
||||
*(.text)
|
||||
}
|
||||
|
||||
.data ALIGN(0x1000) : AT(ADDR(.data) + KERNEL_IMAGE_PADDR - KERNEL_IMAGE_VADDR)
|
||||
.data ALIGN(KERNEL_PAGE_SIZE) : AT(ADDR(.data) + KERNEL_IMAGE_PADDR - KERNEL_IMAGE_VADDR)
|
||||
{
|
||||
*(.data)
|
||||
*(.rodata*)
|
||||
}
|
||||
|
||||
.bss ALIGN(0x1000) : AT(ADDR(.bss) + KERNEL_IMAGE_PADDR - KERNEL_IMAGE_VADDR)
|
||||
.bss ALIGN(KERNEL_PAGE_SIZE) : AT(ADDR(.bss) + KERNEL_IMAGE_PADDR - KERNEL_IMAGE_VADDR)
|
||||
{
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
|
@ -6,19 +6,22 @@
|
||||
# Adds c and asm object files to $OBJ variable
|
||||
# Adds all generated files to $CLEAN variable
|
||||
|
||||
OBJ_$(d) := $(SRC_$(d):.c=.o)
|
||||
OBJAS_$(d) := $(SRCAS_$(d):.asm=.a)
|
||||
OBJIN_$(d) := $(SRCIN_$(d):.in=)
|
||||
DEP_$(d) := $(SRC_$(d):.c=.d) $(SRCIN_$(d):.in=.d)
|
||||
OBJ_$(d) := $(OBJ_$(d)) $(addprefix $(OUT)/, $(SRC_$(d):.c=.o))
|
||||
OBJAS_$(d) := $(OBJAS_$(d)) $(addprefix $(OUT)/, $(SRCAS_$(d):.asm=.a))
|
||||
OBJIN_$(d) := $(OBJIN_$(d)) $(addprefix $(OUT)/, $(SRCIN_$(d):.in=))
|
||||
DEP_$(d) := $(DEP_$(d)) $(addsuffix .d, $(OBJ_$(d)) $(OBJIN_$(d)))
|
||||
|
||||
$(OBJ_$(d)): %.o: %.c
|
||||
$(OBJ_$(d)): $(OUT)/%.o: %.c
|
||||
$(MKDIR)
|
||||
$(COMP)
|
||||
$(GDEP)
|
||||
|
||||
$(OBJAS_$(d)): %.a: %.asm
|
||||
$(OBJAS_$(d)): $(OUT)/%.a: %.asm
|
||||
$(MKDIR)
|
||||
$(COMPAS)
|
||||
|
||||
$(OBJIN_$(d)): %: %.in
|
||||
$(OBJIN_$(d)): $(OUT)/%: %.in
|
||||
$(MKDIR)
|
||||
$(PREP)
|
||||
$(GDEP)
|
||||
|
||||
@ -26,4 +29,4 @@ $(OBJIN_$(d)): %: %.in
|
||||
OBJ := $(OBJ) $(OBJ_$(d)) $(OBJAS_$(d))
|
||||
CLEAN := $(CLEAN) $(OBJ_$(d)) $(OBJAS_$(d)) $(OBJIN_$(d)) $(DEP_$(d))
|
||||
|
||||
include $(DEP_$(d))
|
||||
-include $(DEP_$(d))
|
1
qemu.bat
1
qemu.bat
@ -1 +0,0 @@
|
||||
qemu-system-x86_64 -bios OVMF_x86-64_bios.bin -cdrom secxkrnl.iso -s -S
|
1226
sim/bochs/bochs.bxrc
Normal file
1226
sim/bochs/bochs.bxrc
Normal file
File diff suppressed because it is too large
Load Diff
49
sim/bochs/bochs_win.bxrc
Normal file
49
sim/bochs/bochs_win.bxrc
Normal file
@ -0,0 +1,49 @@
|
||||
# configuration file generated by Bochs
|
||||
plugin_ctrl: unmapped=1, biosdev=1, speaker=1, extfpuirq=1, parallel=1, serial=1, gameport=1
|
||||
config_interface: win32config
|
||||
display_library: win32, options="gui_debug"
|
||||
memory: host=256, guest=256
|
||||
romimage: file="$BXSHARE/BIOS-bochs-latest"
|
||||
vgaromimage: file="$BXSHARE/VGABIOS-lgpl-latest"
|
||||
boot: cdrom
|
||||
magic_break: enabled=1
|
||||
floppy_bootsig_check: disabled=0
|
||||
# no floppya
|
||||
# no floppyb
|
||||
ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
|
||||
ata0-master: type=cdrom, path="out/secxkrnl.iso", status=inserted, model="Generic 1234", biosdetect=auto
|
||||
ata0-slave: type=none
|
||||
ata1: enabled=1, ioaddr1=0x170, ioaddr2=0x370, irq=15
|
||||
ata1-master: type=none
|
||||
ata1-slave: type=none
|
||||
ata2: enabled=0
|
||||
ata3: enabled=0
|
||||
pci: enabled=1, chipset=i440fx
|
||||
vga: extension=vbe, update_freq=5
|
||||
cpu: count=1, ips=4000000, model=bx_generic, reset_on_triple_fault=1, cpuid_limit_winnt=0, ignore_bad_msrs=1, mwait_is_nop=0
|
||||
cpuid: level=6, stepping=3, model=3, family=6, vendor_string="GenuineIntel", brand_string=" Intel(R) Pentium(R) 4 CPU "
|
||||
cpuid: mmx=1, apic=xapic, simd=sse2, sse4a=0, misaligned_sse=0, sep=1, movbe=0, adx=0
|
||||
cpuid: aes=0, sha=0, xsave=0, xsaveopt=0, x86_64=1, 1g_pages=1, pcid=0, fsgsbase=1
|
||||
cpuid: smep=0, smap=0, mwait=1, vmx=1
|
||||
print_timestamps: enabled=0
|
||||
port_e9_hack: enabled=0
|
||||
private_colormap: enabled=0
|
||||
clock: sync=none, time0=local, rtc_sync=0
|
||||
# no cmosimage
|
||||
# no loader
|
||||
log: -
|
||||
logprefix: %t%e%d
|
||||
debug: action=ignore
|
||||
info: action=report
|
||||
error: action=report
|
||||
panic: action=ask
|
||||
keyboard: type=mf, serial_delay=250, paste_delay=100000, user_shortcut=none
|
||||
mouse: type=ps2, enabled=0, toggle=ctrl+mbutton
|
||||
sound: driver="default", waveout=none, wavein=none
|
||||
speaker: enabled=1, mode=sound
|
||||
parport1: enabled=1, file=none
|
||||
parport2: enabled=0
|
||||
com1: enabled=1, mode=null
|
||||
com2: enabled=0
|
||||
com3: enabled=0
|
||||
com4: enabled=0
|
2
sim/qemu/qemu.bat
Normal file
2
sim/qemu/qemu.bat
Normal file
@ -0,0 +1,2 @@
|
||||
@echo off
|
||||
qemu-system-x86_64 -bios sim/qemu/qemu_bios.bin -cdrom out/secxkrnl.iso -s -S
|
2
sim/qemu/qemu.sh
Normal file
2
sim/qemu/qemu.sh
Normal file
@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
qemu-system-x86_64 -bios sim/qemu/qemu_bios.bin -cdrom out/secxkrnl.iso -s -S
|
Loading…
Reference in New Issue
Block a user