From c3dd65457d7ee15d33422af90592ff14898e7b6d Mon Sep 17 00:00:00 2001 From: "Justin C. Miller" Date: Thu, 28 Jan 2021 18:42:42 -0800 Subject: [PATCH] [kernel] Move 'table' includes to j6/tables Move all table-style include files that are part of the public kernel interface to the j6/tables include path --- src/boot/guids.cpp | 13 ------------- src/boot/guids.h | 8 -------- src/boot/guids.inc | 11 ----------- src/include/{ => j6/tables}/log_areas.inc | 0 src/include/j6/{ => tables}/object_types.inc | 0 src/include/{ => j6/tables}/syscalls.inc | 0 src/include/j6/types.h | 2 +- src/kernel/objects/kobject.h | 2 +- src/kernel/syscall.cpp | 2 +- src/kernel/syscall.h | 4 ++-- src/kernel/syscall.s | 1 - src/libraries/kutil/include/kutil/logger.h | 2 +- src/libraries/kutil/logger.cpp | 4 ++-- src/libraries/libc/arch/x86_64/syscalls.s | 2 +- src/libraries/libc/include/j6libc/syscalls.h | 2 +- 15 files changed, 10 insertions(+), 43 deletions(-) delete mode 100644 src/boot/guids.cpp delete mode 100644 src/boot/guids.h delete mode 100644 src/boot/guids.inc rename src/include/{ => j6/tables}/log_areas.inc (100%) rename src/include/j6/{ => tables}/object_types.inc (100%) rename src/include/{ => j6/tables}/syscalls.inc (100%) diff --git a/src/boot/guids.cpp b/src/boot/guids.cpp deleted file mode 100644 index ec5d8ca..0000000 --- a/src/boot/guids.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "guids.h" - -#define GUID(dw, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8, name) \ - EFI_GUID name __attribute__((section(".rodata"))) = {dw, w1, w2, {b1, b2, b3, b4, b5, b6, b7, b8}} -#include "guids.inc" -#undef GUID - -int is_guid(EFI_GUID *a, EFI_GUID *b) -{ - uint64_t *ai = (uint64_t *)a; - uint64_t *bi = (uint64_t *)b; - return ai[0] == bi[0] && ai[1] == bi[1]; -} diff --git a/src/boot/guids.h b/src/boot/guids.h deleted file mode 100644 index 9deaee8..0000000 --- a/src/boot/guids.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once -#include - -int is_guid(EFI_GUID *a, EFI_GUID *b); - -#define GUID(dw, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8, name) extern EFI_GUID name -#include "guids.inc" -#undef GUID diff --git a/src/boot/guids.inc b/src/boot/guids.inc deleted file mode 100644 index 2a3c4ee..0000000 --- a/src/boot/guids.inc +++ /dev/null @@ -1,11 +0,0 @@ -GUID(0xeb9d2d30,0x2d88,0x11d3,0x9a,0x16,0x00,0x90,0x27,0x3f,0xc1,0x4d, guid_acpi1); -GUID(0x8868e871,0xe4f1,0x11d3,0xbc,0x22,0x00,0x80,0xc7,0x3c,0x88,0x81, guid_acpi2); -GUID(0x09576e92,0x6d3f,0x11d2,0x8e,0x39,0x00,0xa0,0xc9,0x69,0x72,0x3b, guid_file_info); -GUID(0x9042a9de,0x23dc,0x4a38,0x96,0xfb,0x7a,0xde,0xd0,0x80,0x51,0x6a, guid_gfx_out); -GUID(0x964e5b22,0x6459,0x11d2,0x8e,0x39,0x00,0xa0,0xc9,0x69,0x72,0x3b, guid_simple_filesystem); -GUID(0x09576e91,0x6d3f,0x11d2,0x8e,0x39,0x00,0xa0,0xc9,0x69,0x72,0x3b, guid_device_path); -GUID(0x8b843e20,0x8132,0x4852,0x90,0xcc,0x55,0x1a,0x4e,0x4a,0x7f,0x1c, guid_device_path_to_text); - -GUID(0x10d0669c,0x9ec6,0x4268,0xbc,0x48,0xff,0x74,0x75,0x21,0xfe,0x07, guid_jsix_vendor); - -// vim: ft=c diff --git a/src/include/log_areas.inc b/src/include/j6/tables/log_areas.inc similarity index 100% rename from src/include/log_areas.inc rename to src/include/j6/tables/log_areas.inc diff --git a/src/include/j6/object_types.inc b/src/include/j6/tables/object_types.inc similarity index 100% rename from src/include/j6/object_types.inc rename to src/include/j6/tables/object_types.inc diff --git a/src/include/syscalls.inc b/src/include/j6/tables/syscalls.inc similarity index 100% rename from src/include/syscalls.inc rename to src/include/j6/tables/syscalls.inc diff --git a/src/include/j6/types.h b/src/include/j6/types.h index 6223bdb..26e03f1 100644 --- a/src/include/j6/types.h +++ b/src/include/j6/types.h @@ -38,7 +38,7 @@ typedef uint64_t j6_handle_t; enum j6_object_type { #define OBJECT_TYPE( name, val ) j6_object_type_ ## name = val, -#include "j6/object_types.inc" +#include "j6/tables/object_types.inc" #undef OBJECT_TYPE j6_object_type_max diff --git a/src/kernel/objects/kobject.h b/src/kernel/objects/kobject.h index 38e58be..9454fd1 100644 --- a/src/kernel/objects/kobject.h +++ b/src/kernel/objects/kobject.h @@ -17,7 +17,7 @@ public: enum class type : uint16_t { #define OBJECT_TYPE( name, val ) name = val, -#include "j6/object_types.inc" +#include "j6/tables/object_types.inc" #undef OBJECT_TYPE max diff --git a/src/kernel/syscall.cpp b/src/kernel/syscall.cpp index 3eda4a0..5dd0b50 100644 --- a/src/kernel/syscall.cpp +++ b/src/kernel/syscall.cpp @@ -69,7 +69,7 @@ syscall_enable() syscall_names[id] = #name; \ static_assert( id <= num_calls, "Syscall " #name " has id > syscall::MAX" ); \ log::debug(logs::syscall, "Enabling syscall 0x%02x as " #name , id); -#include "syscalls.inc" +#include "j6/tables/syscalls.inc" #undef SYSCALL } diff --git a/src/kernel/syscall.h b/src/kernel/syscall.h index 7b19b92..87a2124 100644 --- a/src/kernel/syscall.h +++ b/src/kernel/syscall.h @@ -8,7 +8,7 @@ struct cpu_state; enum class syscall : uint64_t { #define SYSCALL(id, name, ...) name = id, -#include "syscalls.inc" +#include "j6/tables/syscalls.inc" #undef SYSCALL // Maximum syscall id. If you change this, also change @@ -21,6 +21,6 @@ void syscall_enable(); namespace syscalls { #define SYSCALL(id, name, ...) j6_status_t name (__VA_ARGS__); -#include "syscalls.inc" +#include "j6/tables/syscalls.inc" #undef SYSCALL } diff --git a/src/kernel/syscall.s b/src/kernel/syscall.s index 375713d..fb9e1d6 100644 --- a/src/kernel/syscall.s +++ b/src/kernel/syscall.s @@ -1,4 +1,3 @@ -%include "push_all.inc" %include "tasking.inc" ; Make sure to keep MAX_SYSCALLS in sync with diff --git a/src/libraries/kutil/include/kutil/logger.h b/src/libraries/kutil/include/kutil/logger.h index a4ca516..03e1684 100644 --- a/src/libraries/kutil/include/kutil/logger.h +++ b/src/libraries/kutil/include/kutil/logger.h @@ -126,7 +126,7 @@ void fatal(area_t area, const char *fmt, ...); namespace logs { #define LOG(name, lvl) extern const log::area_t name; -#include "log_areas.inc" +#include "j6/tables/log_areas.inc" #undef LOG } // namespace logs diff --git a/src/libraries/kutil/logger.cpp b/src/libraries/kutil/logger.cpp index 4f7f284..9d313a7 100644 --- a/src/libraries/kutil/logger.cpp +++ b/src/libraries/kutil/logger.cpp @@ -9,7 +9,7 @@ namespace logs { #define LOG(name, lvl) \ const log::area_t name = #name ## _h; \ const char * name ## _name = #name; -#include "log_areas.inc" +#include "j6/tables/log_areas.inc" #undef LOG } @@ -44,7 +44,7 @@ logger::logger(uint8_t *buffer, size_t size, logger::immediate_cb output) : #define LOG(name, lvl) \ register_area(logs::name, logs::name ## _name, log::level::lvl); -#include "log_areas.inc" +#include "j6/tables/log_areas.inc" #undef LOG } diff --git a/src/libraries/libc/arch/x86_64/syscalls.s b/src/libraries/libc/arch/x86_64/syscalls.s index b9b5416..4bae8dd 100644 --- a/src/libraries/libc/arch/x86_64/syscalls.s +++ b/src/libraries/libc/arch/x86_64/syscalls.s @@ -25,4 +25,4 @@ %define SYSCALL(n, name, a, b, c, d) SYSCALL name, n %define SYSCALL(n, name, a, b, c, d, e) SYSCALL name, n -%include "syscalls.inc" +%include "j6/tables/syscalls.inc" diff --git a/src/libraries/libc/include/j6libc/syscalls.h b/src/libraries/libc/include/j6libc/syscalls.h index 9815a03..50856ed 100644 --- a/src/libraries/libc/include/j6libc/syscalls.h +++ b/src/libraries/libc/include/j6libc/syscalls.h @@ -7,7 +7,7 @@ extern "C" { #endif #define SYSCALL(n, name, ...) j6_status_t _syscall_ ## name (__VA_ARGS__); -#include "syscalls.inc" +#include "j6/tables/syscalls.inc" #undef SYSCALL #ifdef __cplusplus