Kernel: Add macros for current archutecture

This commit is contained in:
Bananymous 2023-02-01 01:52:05 +02:00
parent 337569b0ca
commit 7d8aafa0b5
2 changed files with 8 additions and 1 deletions

View File

@ -13,7 +13,7 @@ EXEC_PREFIX?=$(PREFIX)
BOOTDIR?=$(EXEC_PREFIX)/boot BOOTDIR?=$(EXEC_PREFIX)/boot
INCLUDEDIR?=$(PREFIX)/include INCLUDEDIR?=$(PREFIX)/include
CFLAGS:=$(CFLAGS) -D__is_kernel -Iinclude -fstack-protector -ffreestanding -Wall -Wextra -Werror=return-type -fno-omit-frame-pointer -mno-sse -mno-sse2 CFLAGS:=$(CFLAGS) -D__is_kernel -D__arch=$(HOSTARCH) -Iinclude -fstack-protector -ffreestanding -Wall -Wextra -Werror=return-type -fno-omit-frame-pointer -mno-sse -mno-sse2
CPPFLAGS:=$(CPPFLAGS) -fno-rtti -fno-exceptions CPPFLAGS:=$(CPPFLAGS) -fno-rtti -fno-exceptions
LDFLAGS:=$(LDFLAGS) LDFLAGS:=$(LDFLAGS)
LIBS:=$(LIBS) -nostdlib -lk -lbank -lgcc LIBS:=$(LIBS) -nostdlib -lk -lbank -lgcc

View File

@ -0,0 +1,7 @@
#pragma once
#define ARCH(arch) (__arch == arch)
#if !defined(__arch) || (__arch != x86_64 && __arch != i386)
#error "Unsupported architecture"
#endif