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: build:
mkdir -p out
mkdir -p out/system
make --quiet -C libc build
make --quiet -C apps build
prepare: prepare:
$(info Nothing to prepare) $(info Nothing to prepare)
clean: 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 # Config file
include ../../../Makefile.conf include ../../../../Makefile.conf
FILENAME = init.fex FILENAME = init.fex
CC = ../../../$(COMPILER_PATH)/$(COMPILER_ARCH)gcc CC = ../../../../$(COMPILER_PATH)/$(COMPILER_ARCH)gcc
CPP = ../../../$(COMPILER_PATH)/$(COMPILER_ARCH)g++ CPP = ../../../../$(COMPILER_PATH)/$(COMPILER_ARCH)g++
LD = ../../../$(COMPILER_PATH)/$(COMPILER_ARCH)ld LD = ../../../../$(COMPILER_PATH)/$(COMPILER_ARCH)ld
AS = ../../../$(COMPILER_PATH)/$(COMPILER_ARCH)as AS = ../../../../$(COMPILER_PATH)/$(COMPILER_ARCH)as
OBJDUMP = ../../../$(COMPILER_PATH)/$(COMPILER_ARCH)objdump OBJDUMP = ../../../../$(COMPILER_PATH)/$(COMPILER_ARCH)objdump
GIT_COMMIT = $(shell git rev-parse HEAD) GIT_COMMIT = $(shell git rev-parse HEAD)
GIT_COMMIT_SHORT = $(shell git rev-parse --short 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 \ CFLAGS += -fPIC -fno-pie -mno-80387 -mno-mmx -mno-3dnow \
-mno-red-zone -mno-sse -mno-sse2 \ -mno-red-zone -mno-sse -mno-sse2 \
-march=x86-64 -pipe \ -march=x86-64 -pipe -ffunction-sections \
-mcmodel=kernel -msoft-float -fno-builtin -mcmodel=kernel -msoft-float -fno-builtin
LDFLAGS += -Tarch/amd64/linker.ld LDFLAGS += -Tarch/amd64/linker.ld
else ifeq ($(OSARCH), i686) else ifeq ($(OSARCH), i686)
CFLAGS += -fPIC -fno-pie -mno-80387 -mno-mmx -mno-3dnow \ 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 -march=i686 -pipe -msoft-float -fno-builtin
LDFLAGS += -Tarch/i686/linker.ld LDFLAGS += -Tarch/i686/linker.ld
@ -73,7 +73,7 @@ else ifeq ($(OSARCH), i686)
else ifeq ($(OSARCH), aarch64) else ifeq ($(OSARCH), aarch64)
endif endif
mv $(FILENAME) ../../out/$(FILENAME) mv $(FILENAME) ../../../out/system/$(FILENAME)
$(FILENAME): $(OBJ) $(FILENAME): $(OBJ)
$(CC) $(LDFLAGS) $(OBJ) -o $@ $(CC) $(LDFLAGS) $(OBJ) -o $@

View File

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

View File

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