Reorganized source tree

This commit is contained in:
2020-08-01 16:37:44 -05:00
parent f5dd5bb135
commit 44e712d214
29 changed files with 35 additions and 53 deletions

View File

@@ -1,7 +1,19 @@
SUBDIRS = interrupts mmgr
noinst_PROGRAMS = quark-kernel noinst_PROGRAMS = quark-kernel
quark_kernel_SOURCES = quarkkernel.cpp elf.cpp tty.cpp systeminfo.cpp util.cpp entry.S pio.S multiboot2header.S quark_kernel_SOURCES = quarkkernel.cpp elf.cpp tty.cpp systeminfo.cpp util.cpp memorymap.cpp buddyallocator.cpp
quark_kernel_LDADD = -lgcc mmgr/libmmgr.a interrupts/libinterrupts.a quark_kernel_LDADD = -lgcc
quark_kernel_CPPFLAGS = -ffreestanding -O0 -Wall -fno-exceptions -fno-rtti -ggdb quark_kernel_CPPFLAGS = -ffreestanding -mgeneral-regs-only -O0 -Wall -fno-exceptions -fno-rtti -ggdb
quark_kernel_LDFLAGS = -T linker.ld -nostdlib quark_kernel_LDFLAGS = -nostdlib
quark_kernel_DEPENDENCIES = linker.ld
if x86
quark_kernel_SOURCES += x86/pagetableentry.cpp \
x86/mmap.cpp \
x86/interrupts.cpp \
x86/inthandlers.cpp \
x86/interruptdescriptor.cpp \
x86/idt.S \
x86/entry.S \
x86/pio.S \
x86/multiboot2header.S
quark_kernel_LDFLAGS += -T x86/linker.ld
quark_kernel_DEPENDENCIES = x86/linker.ld
endif

View File

@@ -1,5 +1,5 @@
#include "buddyallocator.hpp" #include "buddyallocator.hpp"
#include "types.hpp" #include "systypes.hpp"
#include "memorymap.hpp" #include "memorymap.hpp"
#define roundUp(n, m) ((n % m == 0) ? n : (n + m - (n % m))) #define roundUp(n, m) ((n % m == 0) ? n : (n + m - (n % m)))

View File

@@ -1,6 +0,0 @@
noinst_LIBRARIES = libinterrupts.a
libinterrupts_a_CPPFLAGS = -ffreestanding -mgeneral-regs-only -O0 -Wall -fno-exceptions -fno-rtti -ggdb
if x86
libinterrupts_a_SOURCES = x86/interrupts.cpp x86/inthandlers.cpp x86/interruptdescriptor.cpp x86/idt.S
endif

View File

@@ -4,7 +4,7 @@
#include <stdint.h> #include <stdint.h>
#include <stddef.h> #include <stddef.h>
#include "types.hpp" #include "systypes.hpp"
namespace kernel namespace kernel
{ {

View File

@@ -1,7 +0,0 @@
noinst_LIBRARIES = libmmgr.a
libmmgr_a_SOURCES = memorymap.cpp buddyallocator.cpp
libmmgr_a_CPPFLAGS = -ffreestanding -O0 -Wall -fno-exceptions -fno-rtti -ggdb
if x86
libmmgr_a_SOURCES += x86/pagetableentry.cpp x86/mmap.cpp
endif

View File

@@ -1,15 +0,0 @@
#ifndef MEM_TYPES_H
#define MEM_TYPES_H
#include <stdint.h>
#include <stddef.h>
#if defined __i386__ || __arm__
typedef uint32_t physaddr_t;
#elif defined __x86_64__ || __aarch64__
typedef uint64_t physaddr_t;
#else
typedef uint64_t physaddr_t;
#endif
#endif

View File

@@ -2,7 +2,7 @@
#define __MEMORYALLOCATOR_H_ #define __MEMORYALLOCATOR_H_
#include <stddef.h> #include <stddef.h>
#include "types.hpp" #include "systypes.hpp"
namespace kernel namespace kernel
{ {

View File

@@ -3,8 +3,8 @@
#include "systypes.hpp" #include "systypes.hpp"
#include "systeminfo.hpp" #include "systeminfo.hpp"
#include "mmgr/mmgr.hpp" #include "mmgr.hpp"
#include "pio.hpp" #include "x86/pio.hpp"
#include "tty.hpp" #include "tty.hpp"
#include "util.hpp" #include "util.hpp"
#include "config.h" #include "config.h"

View File

@@ -1,6 +1,15 @@
#ifndef SYSTYPES_H #ifndef SYSTYPES_H
#define SYSTYPES_H #define SYSTYPES_H
#include "mmgr/types.hpp" #include <stdint.h>
#include <stddef.h>
#if defined __i386__ || __arm__
typedef uint32_t physaddr_t;
#elif defined __x86_64__ || __aarch64__
typedef uint64_t physaddr_t;
#else
typedef uint64_t physaddr_t;
#endif
#endif #endif

View File

@@ -1,5 +1,5 @@
.section .multiboot .section .multiboot
.include "multiboot2header.S" .include "x86/multiboot2header.S"
.section .rodata .section .rodata
@@ -17,11 +17,6 @@ gdt:
gdt_info: gdt_info:
.short 23 .short 23
.long gdt .long gdt
.align 16
idt_info:
.short idt_end - idt - 1
.long idt
.section .bss .section .bss
@@ -50,11 +45,6 @@ system_info:
.global memory_map .global memory_map
memory_map: memory_map:
.skip 16 * 16 .skip 16 * 16
.global idt
idt:
.skip 8 * 256
idt_end:
.section .text .section .text
.global _start .global _start
@@ -234,7 +224,6 @@ s_end:
# Initialize stack # Initialize stack
mov $stackTop, %esp mov $stackTop, %esp
lgdt gdt_info lgdt gdt_info
lidt idt_info
jmp $8, $.ldcs jmp $8, $.ldcs
.ldcs: .ldcs:

View File

@@ -2,7 +2,7 @@
#define SRC_PAGETABLEENTRY_H_ #define SRC_PAGETABLEENTRY_H_
#include <stdint.h> #include <stdint.h>
#include "../types.hpp" #include "../systypes.hpp"
namespace kernel { namespace kernel {