Update files

This commit is contained in:
Alex 2022-11-04 04:38:22 +02:00
parent 39d2845e02
commit ff61b602a5
Signed by untrusted user who does not match committer: enderice2
GPG Key ID: EACC3AD603BAB4DD
10 changed files with 65 additions and 48 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
*.o
*.map
*.fex
out/

View File

@ -1,8 +1,13 @@
build:
mkdir -p out
mkdir -p out/system
make --quiet -C libc build
make --quiet -C apps build
prepare:
$(info Nothing to prepare)
clean:
rm -rf out
make --quiet -C libc clean
make --quiet -C apps clean

7
apps/Makefile Normal file
View File

@ -0,0 +1,7 @@
build:
make --quiet -C system build
make --quiet -C user build
clean:
make --quiet -C system clean
make --quiet -C user clean

5
apps/system/Makefile Normal file
View File

@ -0,0 +1,5 @@
build:
make --quiet -C init build
clean:
make --quiet -C init clean

View File

@ -1,13 +1,13 @@
# Config file
include ../../../Makefile.conf
include ../../../../Makefile.conf
FILENAME = init.fex
CC = ../../../$(COMPILER_PATH)/$(COMPILER_ARCH)gcc
CPP = ../../../$(COMPILER_PATH)/$(COMPILER_ARCH)g++
LD = ../../../$(COMPILER_PATH)/$(COMPILER_ARCH)ld
AS = ../../../$(COMPILER_PATH)/$(COMPILER_ARCH)as
OBJDUMP = ../../../$(COMPILER_PATH)/$(COMPILER_ARCH)objdump
CC = ../../../../$(COMPILER_PATH)/$(COMPILER_ARCH)gcc
CPP = ../../../../$(COMPILER_PATH)/$(COMPILER_ARCH)g++
LD = ../../../../$(COMPILER_PATH)/$(COMPILER_ARCH)ld
AS = ../../../../$(COMPILER_PATH)/$(COMPILER_ARCH)as
OBJDUMP = ../../../../$(COMPILER_PATH)/$(COMPILER_ARCH)objdump
GIT_COMMIT = $(shell git rev-parse HEAD)
GIT_COMMIT_SHORT = $(shell git rev-parse --short HEAD)
@ -47,14 +47,14 @@ ifeq ($(OSARCH), amd64)
CFLAGS += -fPIC -fno-pie -mno-80387 -mno-mmx -mno-3dnow \
-mno-red-zone -mno-sse -mno-sse2 \
-march=x86-64 -pipe \
-march=x86-64 -pipe -ffunction-sections \
-mcmodel=kernel -msoft-float -fno-builtin
LDFLAGS += -Tarch/amd64/linker.ld
else ifeq ($(OSARCH), i686)
CFLAGS += -fPIC -fno-pie -mno-80387 -mno-mmx -mno-3dnow \
-mno-red-zone -mno-sse -mno-sse2 \
-mno-red-zone -mno-sse -mno-sse2 -ffunction-sections \
-march=i686 -pipe -msoft-float -fno-builtin
LDFLAGS += -Tarch/i686/linker.ld
@ -73,7 +73,7 @@ else ifeq ($(OSARCH), i686)
else ifeq ($(OSARCH), aarch64)
endif
mv $(FILENAME) ../../out/$(FILENAME)
mv $(FILENAME) ../../../out/system/$(FILENAME)
$(FILENAME): $(OBJ)
$(CC) $(LDFLAGS) $(OBJ) -o $@

View File

@ -1,5 +1,3 @@
/* EXPERIMENTAL */
OUTPUT_FORMAT(binary)
OUTPUT_ARCH(i386:x86-64)

View File

@ -1,39 +1,29 @@
// EXPERIMENTAL
#include "../../../../Kernel/Fex.hpp"
enum FexFormatType
{
FexFormatType_Unknown,
FexFormatType_Executable,
FexFormatType_Driver
/* ... */
};
enum FexOSType
{
FexOSType_Unknown,
FexOSType_Fennix,
FexOSType_Linux
/* ... */
};
struct Fex
{
char Magic[4];
int Type;
int OS;
unsigned long Pointer;
};
extern "C" int _start();
__attribute__((section(".header")))
Fex header = {
.Magic = {'F', 'E', 'X', '\0'},
.Type = FexFormatType_Executable,
.OS = FexOSType_Fennix,
.Pointer = (unsigned long)_start};
extern "C" int _start()
extern "C" int _start(void *Data);
HEAD(FexFormatType_Executable, FexOSType_Fennix, _start);
#define DEFINE_SYSCALL0(function, n) \
static inline long syscall_##function() \
{ \
long a = n; \
__asm__ __volatile__("pushq %%r11\n" \
"pushq %%rcx\n" \
"syscall\n" \
"popq %%rcx\n" \
"popq %%r11\n" \
: "=a"(a) \
: "a"((long)a)); \
return a; \
}
DEFINE_SYSCALL0(exit, 1);
#define UNUSED(x) (void)(x)
extern "C" int _start(void *Data)
{
UNUSED(Data);
syscall_exit();
return 0;
}

4
apps/user/Makefile Normal file
View File

@ -0,0 +1,4 @@
build:
clean:

View File

4
libc/Makefile Normal file
View File

@ -0,0 +1,4 @@
build:
clean: