Skip to content
This repository has been archived by the owner on May 12, 2024. It is now read-only.

Commit

Permalink
Removed src/nighterm directory
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinAlavik committed Mar 24, 2024
1 parent 66f4fa0 commit 0cad8fa
Show file tree
Hide file tree
Showing 143 changed files with 632 additions and 95 deletions.
49 changes: 35 additions & 14 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ override LD := ld
override MAKEFLAGS += -rR

override KERNEL := Paradox
KERNEL_DIR := kernel
ARCH_DIR := arch/x86_64

UNAME_S := $(shell uname -s)

Expand Down Expand Up @@ -41,8 +43,9 @@ $(eval $(call DEFAULT_VAR,LDFLAGS,$(DEFAULT_LDFLAGS)))
override CFLAGS += \
-O0 \
-Ilimine \
-Isrc \
-Isrc/corelib \
-Ikernel \
-Iarch \
-Ikernel/corelib \
-Wall \
-Wextra \
-std=gnu11 \
Expand All @@ -67,46 +70,64 @@ override CFLAGS += \
-Wdiv-by-zero \
-Wunused-variable



override LDFLAGS += -nostdlib -static -m elf_x86_64 -z max-page-size=0x1000 -T linker.ld

override CPPFLAGS := -I. $(CPPFLAGS) -MMD -MP

override NASMFLAGS += -Wall -f elf64

override CFILES := $(shell cd src && find -L * -type f -name '*.c')
override ASFILES := $(shell cd src && find -L * -type f -name '*.S')
override NASMFILES := $(shell cd src && find -L * -type f -name '*.asm')
override CFILES := $(shell cd $(KERNEL_DIR) && find -L * -type f -name '*.c')
override ASFILES := $(shell cd $(KERNEL_DIR) && find -L * -type f -name '*.S')
override NASMFILES := $(shell cd $(KERNEL_DIR) && find -L * -type f -name '*.asm')
override OBJ := $(addprefix obj/,$(CFILES:.c=.c.o) $(ASFILES:.S=.S.o) $(NASMFILES:.asm=.asm.o))
override HEADER_DEPS := $(addprefix obj/,$(CFILES:.c=.c.d) $(ASFILES:.S=.S.d))

override ARCH_CFILES := $(shell cd $(ARCH_DIR) && find -L * -type f -name '*.c')
override ARCH_ASFILES := $(shell cd $(ARCH_DIR) && find -L * -type f -name '*.S')
override ARCH_ASMFILES := $(shell cd $(ARCH_DIR) && find -L * -type f -name '*.asm')
override ARCH_OBJ := $(addprefix obj/,$(ARCH_CFILES:.c=.c.o) $(ARCH_ASFILES:.S=.S.o) $(ARCH_ASMFILES:.asm=.asm.o))
override ARCH_HEADER_DEPS := $(addprefix obj/,$(ARCH_CFILES:.c=.c.d) $(ARCH_ASFILES:.S=.S.d) $(ARCH_ASMFILES:.asm=.asm.d))

.PHONY: all
all: bin/$(KERNEL)

bin/$(KERNEL): GNUmakefile linker.ld $(OBJ)
bin/$(KERNEL): GNUmakefile linker.ld $(OBJ) $(ARCH_OBJ)
@printf " LD\t$@\n"
@mkdir -p "$$(dirname $@)"
@$(LD) $(OBJ) $(LDFLAGS) -o $@
@$(LD) $(OBJ) $(ARCH_OBJ) $(LDFLAGS) -o $@

-include $(HEADER_DEPS)
-include $(HEADER_DEPS) $(ARCH_HEADER_DEPS)

obj/%.c.o: src/%.c GNUmakefile
obj/%.c.o: $(KERNEL_DIR)/%.c GNUmakefile
@printf " CC\t$<\n"
@mkdir -p "$$(dirname $@)"
@$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@

obj/%.S.o: src/%.S GNUmakefile
obj/%.S.o: $(KERNEL_DIR)/%.S GNUmakefile
@printf " AS\t$<\n"
@mkdir -p "$$(dirname $@)"
@$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@

obj/%.asm.o: $(KERNEL_DIR)/%.asm GNUmakefile
@printf " AS\t$<\n"
@mkdir -p "$$(dirname $@)"
@nasm $(NASMFLAGS) $< -o $@

obj/%.c.o: $(ARCH_DIR)/%.c GNUmakefile
@printf " CC\t$<\n"
@mkdir -p "$$(dirname $@)"
@$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@

obj/%.asm.o: src/%.asm GNUmakefile
obj/%.S.o: $(ARCH_DIR)/%.S GNUmakefile
@printf " AS\t$<\n"
@mkdir -p "$$(dirname $@)"
@$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@

obj/%.asm.o: $(ARCH_DIR)/%.asm GNUmakefile
@printf " AS\t$<\n"
@mkdir -p "$$(dirname $@)"
@nasm $(NASMFLAGS) $< -o $@

.PHONY: clean
clean:
rm -rf bin obj Paradox.raw.bin image.iso modules/ramdisk.tar

2 changes: 1 addition & 1 deletion src/system/cpu/cpu.c → arch/x86_64/cpu/cpu.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <system/cpu/cpu.h>
#include <x86_64/cpu/cpu.h>
#include <serial/serial.h>

void hcf()
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/system/cpu/panic.c → arch/x86_64/cpu/panic.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#include <nighterm/nighterm.h> // Dont make this need nighterm.h to draw things on the screen. Use vga.h
#include <printf.h>
#include <stdint.h>
#include <system/cpu/panic.h>
#include <system/drivers/speaker.h>
#include <x86_64/cpu/cpu.h>
#include <system/devices/speaker.h>
#include <system/memory/pmm.h>
#include <vga.h>

Expand Down
2 changes: 1 addition & 1 deletion src/system/cpu/panic.h → arch/x86_64/cpu/panic.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#include <system/idt/idt.h>
#include <x86_64/idt/idt.h>

void panic(const char *reason, int_frame_t frame);
File renamed without changes.
4 changes: 2 additions & 2 deletions src/system/idt/idt.c → arch/x86_64/idt/idt.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#include <printf.h>
#include <stddef.h>
#include <stdint.h>
#include <system/cpu/cpu.h>
#include <system/cpu/panic.h>
#include <x86_64/cpu/cpu.h>
#include <x86_64/cpu/panic.h>
#include <system/pic/pic.h>

#define IDT_ENTRIES 256
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/corelib/strings.c → kernel/corelib/string.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "strings.h"
#include "string.h"
#include <stddef.h>

size_t strlen(const char *str)
Expand Down
6 changes: 3 additions & 3 deletions src/corelib/strings.h → kernel/corelib/string.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef STRINGS_H
#define STRINGS_H
#ifndef __STRING_H__
#define __STRING_H__

#include <stddef.h>
#include <stdint.h>
Expand Down Expand Up @@ -34,4 +34,4 @@ int islower(int c);
char tolower(int c);
char *strrchr(const char *s, int c);

#endif // STRINGS_H
#endif // __STRING_H__
2 changes: 1 addition & 1 deletion src/corelib/tga.c → kernel/corelib/tga.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "tga.h"
#include <printf.h>
#include <strings.h>
#include <string.h>
#include <system/memory/heap.h>

tga_info *tga_parse(uint8_t *ptr, uint32_t size)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 3 additions & 2 deletions src/filesystem/ramdisk.h → kernel/filesystem/ramdisk.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@

#include <stdint.h>
#include <stdlib.h>
#include <strings.h>
#include <string.h>

typedef struct {
typedef struct
{
struct Tar *content;
uint64_t location;
uint32_t size;
Expand Down
File renamed without changes.
13 changes: 8 additions & 5 deletions src/filesystem/tar.h → kernel/filesystem/tar.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#ifndef __TAR_H__
#define __TAR_H__

#include <strings.h>
#include <string.h>
#include <system/memory/heap.h>
#include <system/memory/pmm.h>

#define RAMDISK_PATH_PREFIX "ramdisk"
#define RAMDISK_PATH_PREFIX "initrd"

#define FILENAME_SIZE 100
#define MODE_SIZE 8
Expand All @@ -16,7 +16,8 @@
#define CHKSUM_SIZE 8
#define TYPEFLAG_SIZE 1

struct TarHeader {
struct TarHeader
{
char filename[FILENAME_SIZE];
char mode[MODE_SIZE];
char uid[UID_SIZE];
Expand All @@ -27,14 +28,16 @@ struct TarHeader {
char typeflag[TYPEFLAG_SIZE];
};

struct File {
struct File
{
char *name;
char *content;
unsigned int size;
int isDirectory;
};

struct Tar {
struct Tar
{
struct File *files;
unsigned int fileCount;
};
Expand Down
Loading

0 comments on commit 0cad8fa

Please sign in to comment.