Update drivers

This commit is contained in:
Alex
2022-12-16 01:42:21 +02:00
parent 0091fe5965
commit 4d4c2aeba6
31 changed files with 423 additions and 376 deletions

View File

@ -27,6 +27,9 @@ __attribute__((section(".extended"))) FexExtended ExtendedHeader = {
// Global variable that holds the kernel API
KernelAPI *KAPI;
// Macro that prints a message to UART
#define print(msg) KAPI->Util.DebugPrint((char *)(msg), KAPI->Info.DriverUID)
/* --------------------------------------------------------------------------------------------------------- */
// Driver entry point. This is called at initialization. "Data" argument points to the kernel API structure.
@ -44,7 +47,7 @@ int DriverEntry(void *Data)
return KERNEL_API_VERSION_NOT_SUPPORTED;
// We print "Hello World!" to UART.
KAPI->Util.DebugPrint(((char *)"Hello World!" + KAPI->Info.Offset), KAPI->Info.DriverUID);
print("Hello World!");
return OK;
}
@ -55,17 +58,22 @@ int CallbackHandler(KernelCallback *Data)
{
case AcknowledgeReason:
{
KAPI->Util.DebugPrint(((char *)"Kernel acknowledged the driver." + KAPI->Info.Offset), KAPI->Info.DriverUID);
print("Kernel acknowledged the driver.");
break;
}
case InterruptReason:
{
KAPI->Util.DebugPrint(((char *)"Interrupt received." + KAPI->Info.Offset), KAPI->Info.DriverUID);
print("Interrupt received.");
break;
}
case StopReason:
{
print("Driver stopped.");
break;
}
default:
{
KAPI->Util.DebugPrint(((char *)"Unknown reason." + KAPI->Info.Offset), KAPI->Info.DriverUID);
print("Unknown reason.");
break;
}
}

View File

@ -29,12 +29,12 @@ HEADERS = $(sort $(dir $(wildcard ../../include/*)))
OBJ = $(C_SOURCES:.c=.o) $(CPP_SOURCES:.cpp=.o) $(ASM_SOURCES:.asm=.o) $(S_SOURCES:.S=.o) $(PSF_SOURCES:.psf=.o) $(BMP_SOURCES:.bmp=.o)
INCLUDE_DIR = ../../include
LDFLAGS := \
-fPIC -fno-pie \
-Wl,-static,--no-dynamic-linker,-ztext \
-nostdlib -nodefaultlibs -nolibc \
-zmax-page-size=0x1000 \
-Wl,-Map file.map -shared
LDFLAGS := \
-fPIC -fPIE -pie -Wl,-eDriverEntry \
-Wl,-static,--no-dynamic-linker,-ztext,--no-warn-rwx-segment \
-nostdlib -nodefaultlibs -nolibc \
-zmax-page-size=0x1000 \
-Wl,-Map file.map -static -Tlinker.ld
WARNCFLAG = -Wall -Wextra
@ -45,23 +45,20 @@ CFLAGS := \
ifeq ($(OSARCH), amd64)
CFLAGS += -fPIC -fno-pie -mno-80387 -mno-mmx -mno-3dnow \
-mno-red-zone -mno-sse -mno-sse2 \
-march=x86-64 -pipe -ffunction-sections \
-mcmodel=kernel -msoft-float -fno-builtin
LDFLAGS += -Tarch/amd64/linker.ld
CFLAGS += -fPIC -fPIE -pie -mno-80387 -mno-mmx -mno-3dnow \
-mno-red-zone -mno-sse -mno-sse2 \
-march=x86-64 -pipe -ffunction-sections \
-msoft-float -fno-builtin
else ifeq ($(OSARCH), i686)
CFLAGS += -fPIC -fno-pie -mno-80387 -mno-mmx -mno-3dnow \
CFLAGS += -fPIC -fPIE -pie -mno-80387 -mno-mmx -mno-3dnow \
-mno-red-zone -mno-sse -mno-sse2 -ffunction-sections \
-march=i686 -pipe -msoft-float -fno-builtin
LDFLAGS += -Tarch/i686/linker.ld
else ifeq ($(OSARCH), aarch64)
CFLAGS += -pipe -fno-builtin -fPIC
LDFLAGS += -Tarch/aarch64/linker.ld
endif
@ -88,13 +85,7 @@ $(FILENAME): $(OBJ)
%.o: %.S
$(info Compiling $<)
ifeq ($(OSARCH), amd64)
$(AS) -o $@ $<
else ifeq ($(OSARCH), i686)
$(AS) -o $@ $<
else ifeq ($(OSARCH), aarch64)
$(AS) -o $@ $<
endif
clean:
rm -f *.o file.map file_dump.map $(OBJ)