From 421db65331663304466577b7187780d9eba18077 Mon Sep 17 00:00:00 2001 From: Amlal Date: Sat, 28 Sep 2024 19:13:46 +0200 Subject: feat: Add common XPCOM controls directory, restructure project, and introduce API breaking changes - Added a new directory for common XPCOM controls to organize reusable components. - Restructured project layout for better modularity and maintainability. - Introduced API breaking changes in the process, requiring adjustments for backward compatibility. Signed-off-by: Amlal --- dev/comm/xpcom_sms.idl | 31 +++++++++ dev/crt/ReadMe.md | 2 +- dev/crt/__ndk_alloca.hxx | 18 ----- dev/crt/__ndk_defines.hxx | 121 -------------------------------- dev/crt/__ndk_exception.hxx | 35 ---------- dev/crt/__ndk_new_delete.hxx | 28 -------- dev/crt/alloca.hxx | 18 +++++ dev/crt/base_alloc.hxx | 49 +++++++++++++ dev/crt/base_exception.hxx | 35 ++++++++++ dev/crt/crt.json | 4 +- dev/crt/defines.hxx | 124 +++++++++++++++++++++++++++++++++ dev/crt/math.hxx | 34 +++++---- dev/crt/src/__ndk_runtime.cxx | 12 ---- dev/crt/src/crt_lib.cxx | 13 ++++ dev/ddk/KernelDev.h | 32 --------- dev/ddk/KernelPrint.h | 18 ----- dev/ddk/KernelStd.h | 105 ---------------------------- dev/ddk/KernelString.h | 17 ----- dev/ddk/ddk.h | 105 ++++++++++++++++++++++++++++ dev/ddk/dev.h | 32 +++++++++ dev/ddk/io.h | 18 +++++ dev/ddk/src/KernelAlloc.c | 36 ---------- dev/ddk/src/KernelCall.c | 60 ---------------- dev/ddk/src/KernelCallDispatch.S | 36 ---------- dev/ddk/src/KernelCxxRt.cxx | 29 -------- dev/ddk/src/KernelDev.c | 29 -------- dev/ddk/src/KernelPrint.c | 37 ---------- dev/ddk/src/KernelString.c | 39 ----------- dev/ddk/src/KernelVersion.c | 25 ------- dev/ddk/src/ddk_alloc.c | 36 ++++++++++ dev/ddk/src/ddk_dev.c | 29 ++++++++ dev/ddk/src/ddk_io.c | 37 ++++++++++ dev/ddk/src/ddk_kernel_call.c | 60 ++++++++++++++++ dev/ddk/src/ddk_kernel_call_dispatch.S | 36 ++++++++++ dev/ddk/src/ddk_rt_cxx.cxx | 29 ++++++++ dev/ddk/src/ddk_str.c | 39 +++++++++++ dev/ddk/src/ddk_ver.c | 25 +++++++ dev/ddk/str.h | 17 +++++ dev/sci/makefile | 2 +- dev/sci/sci.json | 2 +- dev/sci/source_deploy.xml | 3 - dev/sci/xpcom_sms.idl | 34 --------- dev/zba/amd64-efi.make | 4 +- 43 files changed, 756 insertions(+), 739 deletions(-) create mode 100644 dev/comm/xpcom_sms.idl delete mode 100644 dev/crt/__ndk_alloca.hxx delete mode 100644 dev/crt/__ndk_defines.hxx delete mode 100644 dev/crt/__ndk_exception.hxx delete mode 100644 dev/crt/__ndk_new_delete.hxx create mode 100644 dev/crt/alloca.hxx create mode 100644 dev/crt/base_alloc.hxx create mode 100644 dev/crt/base_exception.hxx create mode 100644 dev/crt/defines.hxx delete mode 100644 dev/crt/src/__ndk_runtime.cxx create mode 100644 dev/crt/src/crt_lib.cxx delete mode 100644 dev/ddk/KernelDev.h delete mode 100644 dev/ddk/KernelPrint.h delete mode 100644 dev/ddk/KernelStd.h delete mode 100644 dev/ddk/KernelString.h create mode 100644 dev/ddk/ddk.h create mode 100644 dev/ddk/dev.h create mode 100644 dev/ddk/io.h delete mode 100644 dev/ddk/src/KernelAlloc.c delete mode 100644 dev/ddk/src/KernelCall.c delete mode 100644 dev/ddk/src/KernelCallDispatch.S delete mode 100644 dev/ddk/src/KernelCxxRt.cxx delete mode 100644 dev/ddk/src/KernelDev.c delete mode 100644 dev/ddk/src/KernelPrint.c delete mode 100644 dev/ddk/src/KernelString.c delete mode 100644 dev/ddk/src/KernelVersion.c create mode 100644 dev/ddk/src/ddk_alloc.c create mode 100644 dev/ddk/src/ddk_dev.c create mode 100644 dev/ddk/src/ddk_io.c create mode 100644 dev/ddk/src/ddk_kernel_call.c create mode 100644 dev/ddk/src/ddk_kernel_call_dispatch.S create mode 100644 dev/ddk/src/ddk_rt_cxx.cxx create mode 100644 dev/ddk/src/ddk_str.c create mode 100644 dev/ddk/src/ddk_ver.c create mode 100644 dev/ddk/str.h delete mode 100644 dev/sci/xpcom_sms.idl (limited to 'dev') diff --git a/dev/comm/xpcom_sms.idl b/dev/comm/xpcom_sms.idl new file mode 100644 index 00000000..27736153 --- /dev/null +++ b/dev/comm/xpcom_sms.idl @@ -0,0 +1,31 @@ +/* ------------------------------------------- + +Copyright ZKA Technologies. + +Purpose: SMS XPCOM interface + +------------------------------------------- */ + +#ifndef __NDK__ +#define object class +#define protocol class +#define interface private +#define interface_method +#define CONST const +#define CHAR char +#define INT32 __INT32_TYPE__ +#define SIZE_T __SIZE_TYPE__ +#define _Output +#define _Input +#define clsid(X) + +#warning ! You may be using the clang version of the ZKAKit, please be cautious that some features mayn't be present. ! +#endif // !__NDK__ + +clsid("0943A614-0201-4107-8F8D-E909DF7F53C9") +protocol ISMS +{ +interface: + interface_method INT32 SendMessage(_Input CONST CHAR* bytes, _Input SIZE_T bytes_size); + interface_method INT32 RecvMessage(_Output CONST CHAR** bytes_in, _Input SIZE_T bytes_size); +}; diff --git a/dev/crt/ReadMe.md b/dev/crt/ReadMe.md index c90f5b5f..4f8ad4f5 100644 --- a/dev/crt/ReadMe.md +++ b/dev/crt/ReadMe.md @@ -1,4 +1,4 @@ -# ZKA C++ RunTime. +# ZKA C++ RunTime Kit. This is the public interface of ZKA' C++ RunTime. diff --git a/dev/crt/__ndk_alloca.hxx b/dev/crt/__ndk_alloca.hxx deleted file mode 100644 index 3c796bf2..00000000 --- a/dev/crt/__ndk_alloca.hxx +++ /dev/null @@ -1,18 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies. - - File: __ndk_alloca.hxx - Purpose: Stack allocation functions. - -------------------------------------------- */ - -#pragma once - -typedef void* ptr_type; -typedef __SIZE_TYPE__ size_type; - -inline ptr_type __ndk_alloca(size_type sz) -{ - return __builtin_alloca(sz); -} diff --git a/dev/crt/__ndk_defines.hxx b/dev/crt/__ndk_defines.hxx deleted file mode 100644 index bea3f67c..00000000 --- a/dev/crt/__ndk_defines.hxx +++ /dev/null @@ -1,121 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies. - -------------------------------------------- */ - -#ifndef __NDK_DEFINES_HXX__ -#define __NDK_DEFINES_HXX__ - -#ifndef __GNUC__ - -typedef __SIZE_TYPE__ size_t; - -#ifdef __LP64__ -typedef long int ssize_t; -#else -typedef int ssize_t; -#endif // __LP64__ - -typedef size_t ptrdiff_t; -typedef size_t uintptr_t; -typedef void* voidptr_t; -typedef void* any_t; -typedef char* caddr_t; - -#ifndef NULL -#define NULL ((voidptr_t)0) -#endif // !null - -#ifdef __GNUC__ -#include -#define __ndk_alloca(sz) __ndk_alloca(sz) -#elif defined(__NDK__) - -#define __alloca(sz) __ndk_alloca(sz) -#endif - -#define __deref(ptr) (*(ptr)) - -#ifdef __cplusplus -#define __init_decl() \ - extern "C" \ - { -#define __fini_decl() \ - } \ - ; -#else -#define __init_decl() -#define __fini_decl() -#endif - -#if __has_builtin(__builtin_alloca) -#define alloca(sz) __builtin_alloca(sz) -#ifdef __alloca -#undef __alloca -#endif -#define __alloca alloca -#else -#warning alloca not detected -#endif - -typedef long long off_t; -typedef unsigned long long uoff_t; - -typedef union float_cast { - struct - { - unsigned int mantissa : 23; - unsigned int exponent : 8; - unsigned int sign : 1; - }; - - float f; -} __attribute__((packed)) float_cast_t; - -typedef union double_cast { - struct - { - unsigned long long int mantissa : 52; - unsigned int exponent : 11; - unsigned int sign : 1; - }; - - double f; -} __attribute__((packed)) double_cast_t; - -#endif // ifndef __GNUC__ - -/// Include these helpers as well. - -#ifdef __STD_CXX__ - -#include -#include - -#endif // ifdef __STD_CXX__ - -namespace std -{ - /// @brief Forward object. - /// @tparam Args the object type. - /// @param arg the object. - /// @return object's rvalue - template - inline Args&& forward(Args& arg) - { - return static_cast(arg); - } - - /// @brief Move object. - /// @tparam Args the object type. - /// @param arg the object. - /// @return object's rvalue - template - inline Args&& move(Args&& arg) - { - return static_cast(arg); - } -} // namespace std - -#endif /* __NDK_DEFINES_HXX__ */ diff --git a/dev/crt/__ndk_exception.hxx b/dev/crt/__ndk_exception.hxx deleted file mode 100644 index 67735a9d..00000000 --- a/dev/crt/__ndk_exception.hxx +++ /dev/null @@ -1,35 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies. - -------------------------------------------- */ - -#pragma once - -#include - -/// @brief CRT exit, with exit code (!!! exits all threads. !!!) -/// @param code -/// @return -extern "C" int __exit(int code); - -/// @brief Standard C++ namespace -namespace std -{ - inline void __throw_general(void) - { - __exit(33); - } - - inline void __throw_domain_error(const char* error) - { - __throw_general(); - __builtin_unreachable(); // prevent from continuing. - } - - inline void __throw_bad_array_new_length(void) - { - __throw_general(); - __builtin_unreachable(); // prevent from continuing. - } -} // namespace std diff --git a/dev/crt/__ndk_new_delete.hxx b/dev/crt/__ndk_new_delete.hxx deleted file mode 100644 index fad61aa9..00000000 --- a/dev/crt/__ndk_new_delete.hxx +++ /dev/null @@ -1,28 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies. - -------------------------------------------- */ - -#pragma once - -#include - -namespace stdx -{ - /// @brief allocate a new class. - /// @tparam KindClass the class type to allocate. - template - inline void* allocate(Args&&... args) - { - return new KindClass(forward(args)...); - } - - /// @brief free a class. - /// @tparam KindClass the class type to allocate. - template - inline void release(KindClass ptr) - { - delete ptr; - } -} // namespace stdx diff --git a/dev/crt/alloca.hxx b/dev/crt/alloca.hxx new file mode 100644 index 00000000..fedcb25d --- /dev/null +++ b/dev/crt/alloca.hxx @@ -0,0 +1,18 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies. + + File: alloca.hxx + Purpose: Stack allocation functions. + +------------------------------------------- */ + +#pragma once + +typedef void* ptr_type; +typedef __SIZE_TYPE__ size_type; + +inline ptr_type __ndk_alloca(size_type sz) +{ + return __builtin_alloca(sz); +} diff --git a/dev/crt/base_alloc.hxx b/dev/crt/base_alloc.hxx new file mode 100644 index 00000000..de157866 --- /dev/null +++ b/dev/crt/base_alloc.hxx @@ -0,0 +1,49 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies. + +------------------------------------------- */ + +#pragma once + +#include + +namespace std::base_alloc +{ + /// @brief allocate a new class. + /// @tparam KindClass the class type to allocate. + template + inline KindClass* allocate(Args&&... args) + { + return new KindClass(forward(args)...); + } + + /// @brief allocate a new class. + /// @note aborts on error. + /// @tparam KindClass the class type to allocate. + template + inline KindClass* allocate_nothrow(Args&&... args) noexcept + { + return allocate(forward(args)...); + } + + /// @brief free a class. + /// @tparam KindClass the class type to allocate. + template + inline void release(KindClass ptr) + { + if (!ptr) + return; + + delete ptr; + } + + /// @brief destroy and free a class. + /// @note aborts on error. + /// @tparam KindClass the class type to allocate. + template + inline void release_nothrow(KindClass ptr) noexcept + { + release(ptr); + } +} // namespace std::base_alloc diff --git a/dev/crt/base_exception.hxx b/dev/crt/base_exception.hxx new file mode 100644 index 00000000..9d3fd208 --- /dev/null +++ b/dev/crt/base_exception.hxx @@ -0,0 +1,35 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies. + +------------------------------------------- */ + +#pragma once + +#include + +/// @brief CRT exit, with exit code (!!! exits all threads. !!!) +/// @param code +/// @return +extern "C" int __exit(int code); + +/// @brief Standard C++ namespace +namespace std +{ + inline void __throw_general(void) + { + __exit(33); + } + + inline void __throw_domain_error(const char* error) + { + __throw_general(); + __builtin_unreachable(); // prevent from continuing. + } + + inline void __throw_bad_array_new_length(void) + { + __throw_general(); + __builtin_unreachable(); // prevent from continuing. + } +} // namespace std diff --git a/dev/crt/crt.json b/dev/crt/crt.json index dbca05fa..07368550 100644 --- a/dev/crt/crt.json +++ b/dev/crt/crt.json @@ -3,13 +3,13 @@ "compiler_std": "c++20", "headers_path": ["../", "./"], "sources_path": ["src/*.cxx"], - "output_name": "ndkcrt.dll", + "output_name": "zka-crt-cxx.dll", "compiler_flags": [ "-ffreestanding", "-shared", "-fno-rtti", "-fno-exceptions", - " -Wl,--subsystem=17" + "-Wl,--subsystem=17" ], "cpp_macros": [ "__CRT_AMD64__", diff --git a/dev/crt/defines.hxx b/dev/crt/defines.hxx new file mode 100644 index 00000000..11a76ded --- /dev/null +++ b/dev/crt/defines.hxx @@ -0,0 +1,124 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies. + +------------------------------------------- */ + +#ifndef __NDK_DEFINES_HXX__ +#define __NDK_DEFINES_HXX__ + +#include +#include + +#ifndef __GNUC__ + +typedef __SIZE_TYPE__ size_t; + +#ifdef __LP64__ +typedef long int ssize_t; +#else +typedef int ssize_t; +#endif // __LP64__ + +typedef size_t ptrdiff_t; +typedef size_t uintptr_t; +typedef void* voidptr_t; +typedef void* any_t; +typedef char* caddr_t; + +#ifndef NULL +#define NULL ((voidptr_t)0) +#endif // !null + +#ifdef __GNUC__ +#include +#define __ndk_alloca(sz) __ndk_alloca(sz) +#elif defined(__NDK__) + +#define __alloca(sz) __ndk_alloca(sz) +#endif + +#define __deref(ptr) (*(ptr)) + +#ifdef __cplusplus +#define __init_decl() \ + extern "C" \ + { +#define __fini_decl() \ + } \ + ; +#else +#define __init_decl() +#define __fini_decl() +#endif + +#if __has_builtin(__builtin_alloca) +#define alloca(sz) __builtin_alloca(sz) +#ifdef __alloca +#undef __alloca +#endif +#define __alloca alloca +#else +#warning alloca not detected +#endif + +typedef long long off_t; +typedef unsigned long long uoff_t; + +typedef union float_cast { + struct + { + unsigned int mantissa : 23; + unsigned int exponent : 8; + unsigned int sign : 1; + }; + + float f; +} __attribute__((packed)) float_cast_t; + +typedef union double_cast { + struct + { + unsigned long long int mantissa : 52; + unsigned int exponent : 11; + unsigned int sign : 1; + }; + + double f; +} __attribute__((packed)) double_cast_t; + +#endif // ifndef __GNUC__ + +/// Include these helpers as well. + +#ifdef __STD_CXX__ + +#include +#include + +#endif // ifdef __STD_CXX__ + +namespace std +{ + /// @brief Forward object. + /// @tparam Args the object type. + /// @param arg the object. + /// @return object's rvalue + template + inline Args&& forward(Args& arg) + { + return static_cast(arg); + } + + /// @brief Move object. + /// @tparam Args the object type. + /// @param arg the object. + /// @return object's rvalue + template + inline Args&& move(Args&& arg) + { + return static_cast(arg); + } +} // namespace std + +#endif /* __NDK_DEFINES_HXX__ */ diff --git a/dev/crt/math.hxx b/dev/crt/math.hxx index 5f55b430..56bb1236 100644 --- a/dev/crt/math.hxx +++ b/dev/crt/math.hxx @@ -6,24 +6,22 @@ #pragma once -#include +#include /// @file Math.hxx /// @brief Math functions. -namespace CRT -{ - using namespace Kernel; - #ifdef __ZKA_USE_DOUBLE__ - typedef double Real; +typedef double real_type; #else - typedef float Real; +typedef float real_type; #endif +namespace std::math +{ /// @brief Power function, with Repeat argument. - template - inline Real Pow(Real in) + template + inline real_type pow(real_type in) { if (Exponent == 0) return 1; // Any number to the power of 0 is 1. @@ -31,11 +29,11 @@ namespace CRT if (Exponent == 1) return in; // Any number to the power of 1 is itself. - UInt64 cnt = Exponent; + size_t cnt = Exponent; - Real result = 1; + real_type result = 1; - for (auto i = 0; i < (cnt); ++i) + for (auto i = 0; i < cnt; ++i) result *= in; return result; @@ -43,22 +41,22 @@ namespace CRT /// @brief Square of function, with Base template argument. /// @param of Base argument to find sqquare of - template - inline Real SqrOf(Real in) + template + inline real_type sqr(real_type in) { if (in == 0) return 0; - return Pow<1 / Base>(in); + return pow<1 / Base>(in); } /// @brief Linear interpolation equation solver. /// @param from where? /// @param to to? /// @param Updated diff value according to difference. - inline Real CGLerp(Real to, Real from, Real stat) + inline real_type lerp(real_type to, real_type from, real_type stat) { - Real diff = (to - from); + real_type diff = (to - from); return from + (diff * stat); } -} // namespace CRT +} // namespace std::math diff --git a/dev/crt/src/__ndk_runtime.cxx b/dev/crt/src/__ndk_runtime.cxx deleted file mode 100644 index b81963a8..00000000 --- a/dev/crt/src/__ndk_runtime.cxx +++ /dev/null @@ -1,12 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies. - -------------------------------------------- */ - -#include -#include -#include -#include - -/// @note No sources needed for now. diff --git a/dev/crt/src/crt_lib.cxx b/dev/crt/src/crt_lib.cxx new file mode 100644 index 00000000..530e40db --- /dev/null +++ b/dev/crt/src/crt_lib.cxx @@ -0,0 +1,13 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies. + +------------------------------------------- */ + +#include +#include +#include +#include +#include + +/// @note Just here for building. diff --git a/dev/ddk/KernelDev.h b/dev/ddk/KernelDev.h deleted file mode 100644 index b7dce834..00000000 --- a/dev/ddk/KernelDev.h +++ /dev/null @@ -1,32 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies. - - Purpose: DDK Devices. - -------------------------------------------- */ - -#pragma once - -#include - -struct _KERNEL_DEVICE; - -/// @brief Kernel Device driver. -typedef struct _KERNEL_DEVICE DK_FINAL -{ - char d_name[255]; // the device name. Could be /./DEVICE_NAME/ - void* (*d_read)(void* arg, int len); // read from device. - void (*d_write)(void* arg, int len); - void (*d_wait)(void); // write to device. - struct _KERNEL_DEVICE* (*d_open)(const char* path); // open device. - void (*d_close)(struct _KERNEL_DEVICE* dev); // close device. -} KERNEL_DEVICE, *KERNEL_DEVICE_PTR; - -/// @brief Open a new device from path. -/// @param devicePath the device's path. -DK_EXTERN KERNEL_DEVICE_PTR KernelOpenDevice(const char* devicePath); - -/// @brief Close any device. -/// @param device valid device. -DK_EXTERN void KernelCloseDevice(KERNEL_DEVICE_PTR device); diff --git a/dev/ddk/KernelPrint.h b/dev/ddk/KernelPrint.h deleted file mode 100644 index 6ab6118e..00000000 --- a/dev/ddk/KernelPrint.h +++ /dev/null @@ -1,18 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies. - - Purpose: DDK Text I/O. - -------------------------------------------- */ - -#pragma once - -#include - -/// @brief print character into UART. -DK_EXTERN void KernelPrintChar(const char ch); - -/// @brief print string to UART. -/// @param message string to transmit to UART. -DK_EXTERN void KernelPrintStr(const char* message); diff --git a/dev/ddk/KernelStd.h b/dev/ddk/KernelStd.h deleted file mode 100644 index 89fe786d..00000000 --- a/dev/ddk/KernelStd.h +++ /dev/null @@ -1,105 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies. - - FILE: KernelStd.h - PURPOSE: DDK Driver model base header. - -------------------------------------------- */ - -#pragma once - -#include -#include - -#if defined(__cplusplus) -#define DK_EXTERN extern "C" __declspec(dllexport) -#define nil nullptr -#undef NULL -#define NULL 0 -#define DK_FINAL final -#else -#define DK_EXTERN extern __declspec(dllexport) -#define nil ((void*)0) -#undef NULL -#define NULL ((void*)0) -#define DK_FINAL -#endif // defined(__cplusplus) - -#ifndef __DDK__ -#undef DK_EXTERN -#if defined(__cplusplus) -#define DK_EXTERN extern "C" __declspec(dllimport) -#else -#define DK_EXTERN __declspec(dllimport) -#endif -#endif - -#define ATTRIBUTE(X) __attribute__((X)) - -#ifndef __NEWOSKRNL__ -#error !!! including header in low exception/ring-3 mode !!! -#endif // __NEWOSKRNL__ - -struct DDK_STATUS_STRUCT; -struct DDK_OBJECT_MANIFEST; - -struct DDK_OBJECT_MANIFEST DK_FINAL -{ - char* p_name; - int32_t p_kind; - void* p_object; -}; - -/// \brief DDK status structure (__at_enable, __at_disable...) -struct DDK_STATUS_STRUCT DK_FINAL -{ - int32_t s_action_id; - int32_t s_issuer_id; - int32_t s_group_id; - void* s_object; -}; - -/// @brief Call Kernel (interrupt 0x33) -/// @param KernelRpcName -/// @param cnt number of elements in **dat** -/// @param dat data ptr -/// @param sz sz of whole data ptr. -/// @return result of call -DK_EXTERN void* KernelCall(const char* name, int32_t cnt, void* dat, size_t sz); - -/// @brief add system call. -/// @param slot system call slot -/// @param slotFn, syscall slot. -DK_EXTERN void KernelAddSyscall(const int32_t slot, void (*slotFn)(void* a0)); - -/// @brief allocate heap ptr. -/// @param sz size of ptr. -/// @return the pointer allocated or **nil**. -DK_EXTERN void* KernelAlloc(size_t sz); - -/// @brief free heap ptr. -/// @param pointer to free -DK_EXTERN void KernelFree(void*); - -/// @brief Get a Kernel property. -/// @param slot property id (always 0) -/// @param name the property's name. -/// @return property's object. -DK_EXTERN struct DDK_OBJECT_MANIFEST* KernelGetObject(const int slot, const char* name); - -/// @brief Set a Kernel property. -/// @param slot property id (always 0) -/// @param name the property's name. -/// @param ddk_pr pointer to a property's DDK_OBJECT_MANIFEST. -/// @return property's object. -DK_EXTERN void* KernelSetObject(const int32_t slot, const struct DDK_OBJECT_MANIFEST* ddk_pr); - -/// @brief The highest API version of the DDK. -DK_EXTERN int32_t c_api_version_highest; - -/// @brief The lowest API version of the DDK. -DK_EXTERN int32_t c_api_version_least; - -/// @brief c_api_version_least+c_api_version_highest combined version. -DK_EXTERN int32_t c_api_version; diff --git a/dev/ddk/KernelString.h b/dev/ddk/KernelString.h deleted file mode 100644 index 01d7d919..00000000 --- a/dev/ddk/KernelString.h +++ /dev/null @@ -1,17 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies. - - Purpose: DDK Strings. - -------------------------------------------- */ - -#pragma once - -#include - -/// @brief DDK equivalent of POSIX's string.h -/// @file KernelString.h - -DK_EXTERN size_t KernelStringLength(const char* in); -DK_EXTERN int KernelStringCopy(char* dst, const char* src, size_t len); diff --git a/dev/ddk/ddk.h b/dev/ddk/ddk.h new file mode 100644 index 00000000..89fe786d --- /dev/null +++ b/dev/ddk/ddk.h @@ -0,0 +1,105 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies. + + FILE: KernelStd.h + PURPOSE: DDK Driver model base header. + +------------------------------------------- */ + +#pragma once + +#include +#include + +#if defined(__cplusplus) +#define DK_EXTERN extern "C" __declspec(dllexport) +#define nil nullptr +#undef NULL +#define NULL 0 +#define DK_FINAL final +#else +#define DK_EXTERN extern __declspec(dllexport) +#define nil ((void*)0) +#undef NULL +#define NULL ((void*)0) +#define DK_FINAL +#endif // defined(__cplusplus) + +#ifndef __DDK__ +#undef DK_EXTERN +#if defined(__cplusplus) +#define DK_EXTERN extern "C" __declspec(dllimport) +#else +#define DK_EXTERN __declspec(dllimport) +#endif +#endif + +#define ATTRIBUTE(X) __attribute__((X)) + +#ifndef __NEWOSKRNL__ +#error !!! including header in low exception/ring-3 mode !!! +#endif // __NEWOSKRNL__ + +struct DDK_STATUS_STRUCT; +struct DDK_OBJECT_MANIFEST; + +struct DDK_OBJECT_MANIFEST DK_FINAL +{ + char* p_name; + int32_t p_kind; + void* p_object; +}; + +/// \brief DDK status structure (__at_enable, __at_disable...) +struct DDK_STATUS_STRUCT DK_FINAL +{ + int32_t s_action_id; + int32_t s_issuer_id; + int32_t s_group_id; + void* s_object; +}; + +/// @brief Call Kernel (interrupt 0x33) +/// @param KernelRpcName +/// @param cnt number of elements in **dat** +/// @param dat data ptr +/// @param sz sz of whole data ptr. +/// @return result of call +DK_EXTERN void* KernelCall(const char* name, int32_t cnt, void* dat, size_t sz); + +/// @brief add system call. +/// @param slot system call slot +/// @param slotFn, syscall slot. +DK_EXTERN void KernelAddSyscall(const int32_t slot, void (*slotFn)(void* a0)); + +/// @brief allocate heap ptr. +/// @param sz size of ptr. +/// @return the pointer allocated or **nil**. +DK_EXTERN void* KernelAlloc(size_t sz); + +/// @brief free heap ptr. +/// @param pointer to free +DK_EXTERN void KernelFree(void*); + +/// @brief Get a Kernel property. +/// @param slot property id (always 0) +/// @param name the property's name. +/// @return property's object. +DK_EXTERN struct DDK_OBJECT_MANIFEST* KernelGetObject(const int slot, const char* name); + +/// @brief Set a Kernel property. +/// @param slot property id (always 0) +/// @param name the property's name. +/// @param ddk_pr pointer to a property's DDK_OBJECT_MANIFEST. +/// @return property's object. +DK_EXTERN void* KernelSetObject(const int32_t slot, const struct DDK_OBJECT_MANIFEST* ddk_pr); + +/// @brief The highest API version of the DDK. +DK_EXTERN int32_t c_api_version_highest; + +/// @brief The lowest API version of the DDK. +DK_EXTERN int32_t c_api_version_least; + +/// @brief c_api_version_least+c_api_version_highest combined version. +DK_EXTERN int32_t c_api_version; diff --git a/dev/ddk/dev.h b/dev/ddk/dev.h new file mode 100644 index 00000000..2a3aeb18 --- /dev/null +++ b/dev/ddk/dev.h @@ -0,0 +1,32 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies. + + Purpose: DDK Devices. + +------------------------------------------- */ + +#pragma once + +#include + +struct _KERNEL_DEVICE; + +/// @brief Kernel Device driver. +typedef struct _KERNEL_DEVICE DK_FINAL +{ + char d_name[255]; // the device name. Could be /./DEVICE_NAME/ + void* (*d_read)(void* arg, int len); // read from device. + void (*d_write)(void* arg, int len); + void (*d_wait)(void); // write to device. + struct _KERNEL_DEVICE* (*d_open)(const char* path); // open device. + void (*d_close)(struct _KERNEL_DEVICE* dev); // close device. +} KERNEL_DEVICE, *KERNEL_DEVICE_PTR; + +/// @brief Open a new device from path. +/// @param devicePath the device's path. +DK_EXTERN KERNEL_DEVICE_PTR KernelOpenDevice(const char* devicePath); + +/// @brief Close any device. +/// @param device valid device. +DK_EXTERN void KernelCloseDevice(KERNEL_DEVICE_PTR device); diff --git a/dev/ddk/io.h b/dev/ddk/io.h new file mode 100644 index 00000000..ece8d059 --- /dev/null +++ b/dev/ddk/io.h @@ -0,0 +1,18 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies. + + Purpose: DDK Text I/O. + +------------------------------------------- */ + +#pragma once + +#include + +/// @brief print character into UART. +DK_EXTERN void KernelPrintChar(const char ch); + +/// @brief print string to UART. +/// @param message string to transmit to UART. +DK_EXTERN void KernelPrintStr(const char* message); diff --git a/dev/ddk/src/KernelAlloc.c b/dev/ddk/src/KernelAlloc.c deleted file mode 100644 index af99f23b..00000000 --- a/dev/ddk/src/KernelAlloc.c +++ /dev/null @@ -1,36 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies. - - Purpose: DDK allocator. - -------------------------------------------- */ - -#include - -/** - \brief Allocates a new heap on the Kernel's side. - \param sz the size of the heap block. - \return the newly allocated pointer. -*/ -DK_EXTERN void* KernelAlloc(size_t sz) -{ - if (!sz) - ++sz; - - void* ptr = KernelCall("MmNewKeHeap", 1, &sz, sizeof(size_t)); - - return ptr; -} - -/** - \brief Frees a pointer from the heap. - \param ptr the pointer to free. -*/ -DK_EXTERN void KernelFree(void* ptr) -{ - if (!ptr) - return; - - KernelCall("MmDeleteKeHeap", 1, ptr, 0); -} diff --git a/dev/ddk/src/KernelCall.c b/dev/ddk/src/KernelCall.c deleted file mode 100644 index ccb401af..00000000 --- a/dev/ddk/src/KernelCall.c +++ /dev/null @@ -1,60 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies. - - Purpose: DDK Kernel call. - -------------------------------------------- */ - -#include -#include - -/// @brief this is an internal call, do not use it. -DK_EXTERN ATTRIBUTE(naked) void* __KernelCallDispatch(const char* name, int32_t cnt, void* data, size_t sz); - -/// @brief Interupt Kernel -/// @param KernelRpcName RPC name -/// @param cnt number of elements in **data** pointer. -/// @param data data pointer. -/// @param sz The size of the whole data pointer. -/// @retval void* Kernel call was successful. -/// @retval nil Kernel call failed, call KernelLastError(void) -DK_EXTERN void* KernelCall(const char* name, int32_t cnt, void* data, size_t sz) -{ - if (!name || *name == 0 || cnt == 0) - return nil; - - return __KernelCallDispatch(name, cnt, data, sz); -} - -/// @brief Add system call. -/// @param slot system call slot -/// @param slotFn, syscall slot. -DK_EXTERN void KernelAddSyscall(const int slot, void (*slotFn)(void* a0)) -{ - KernelCall("IntAddSyscall", slot, slotFn, 1); -} - -/// @brief Get a Kernel property. -/// @param slot property id (always 0) -/// @param name the object's name. -/// @return Object manifest. -DK_EXTERN struct DDK_OBJECT_MANIFEST* KernelGetObject(const int slot, const char* name) -{ - struct DDK_OBJECT_MANIFEST* manifest = (struct DDK_OBJECT_MANIFEST*)KernelCall("RtlGetObject", slot, (void*)name, 1); - - if (!manifest) - return nil; - - return manifest; -} - -/// @brief Set a Kernel property. -/// @param slot property id (always 0) -/// @param name the object's name. -/// @param ddk_pr pointer to a object's DDK_OBJECT_MANIFEST. -/// @return property's object. -DK_EXTERN void* KernelSetObject(const int slot, const struct DDK_OBJECT_MANIFEST* ddk_pr) -{ - return KernelCall("RtlSetObject", slot, (void*)ddk_pr, 1); -} diff --git a/dev/ddk/src/KernelCallDispatch.S b/dev/ddk/src/KernelCallDispatch.S deleted file mode 100644 index 3a9a57b5..00000000 --- a/dev/ddk/src/KernelCallDispatch.S +++ /dev/null @@ -1,36 +0,0 @@ -/** - lang: asm - compiler: gnu - */ - -.globl __KernelCallDispatch - -.text - -/* Really simple function, takes our va-list, - and brings it to the trap handler in the Kernel. */ - -#ifdef __DDK_AMD64__ - -/* args rcx, rdx, r8, r9 */ -__KernelCallDispatch: - int $0x33 - ret - -#elif defined(__DDK_POWER64__) - -/* args r8, r9, r10, r11 */ -__KernelCallDispatch: - /* There is no specific interrupt request id for a system call in POWER. */ - sc - blr - -#elif defined(__DDK_ARM64__) - -/* args x0, x8, x9, x10, x11 is kept to tell that this is a Kernel call */ -__KernelCallDispatch: - /* There is no specific interrupt request id for a system call in ARM64 as well. */ - mov x9, #0x33 - svc #0 - -#endif diff --git a/dev/ddk/src/KernelCxxRt.cxx b/dev/ddk/src/KernelCxxRt.cxx deleted file mode 100644 index 947e2de7..00000000 --- a/dev/ddk/src/KernelCxxRt.cxx +++ /dev/null @@ -1,29 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies. - - Purpose: DDK C++ runtime. - -------------------------------------------- */ - -#include - -void* operator new(size_t sz) -{ - return KernelAlloc(sz); -} - -void operator delete(void* ptr) -{ - KernelFree(ptr); -} - -void* operator new[](size_t sz) -{ - return KernelAlloc(sz); -} - -void operator delete[](void* ptr) -{ - KernelFree(ptr); -} diff --git a/dev/ddk/src/KernelDev.c b/dev/ddk/src/KernelDev.c deleted file mode 100644 index 3cf7ed48..00000000 --- a/dev/ddk/src/KernelDev.c +++ /dev/null @@ -1,29 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies. - - Purpose: DDK Text I/O. - -------------------------------------------- */ - -#include -#include - -/// @brief Open a new binary device from path. -DK_EXTERN KERNEL_DEVICE_PTR KernelOpenDevice(const char* devicePath) -{ - if (!devicePath) - return nil; - - return KernelCall("ZkOpenDevice", 1, (void*)devicePath, KernelStringLength(devicePath)); -} - -/// @brief Close any device. -/// @param device valid device. -DK_EXTERN void KernelCloseDevice(KERNEL_DEVICE_PTR device) -{ - if (!device) - return; - - KernelCall("ZkCloseDevice", 1, device, sizeof(KERNEL_DEVICE)); -} diff --git a/dev/ddk/src/KernelPrint.c b/dev/ddk/src/KernelPrint.c deleted file mode 100644 index 7f8c8604..00000000 --- a/dev/ddk/src/KernelPrint.c +++ /dev/null @@ -1,37 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies. - - Purpose: DDK Text I/O. - -------------------------------------------- */ - -#include - -DK_EXTERN void KernelPrintChar(const char ch) -{ - char assembled[2] = {0}; - assembled[0] = ch; - assembled[1] = 0; - - KernelCall("SrWriteCharacter", 1, assembled, 1); -} - -/// @brief print string to UART. -/// @param message UART to transmit. -DK_EXTERN void KernelPrintStr(const char* message) -{ - if (!message) - return; - if (*message == 0) - return; - - size_t index = 0; - size_t len = KernelStringLength(message); - - while (index < len) - { - KernelPrintChar(message[index]); - ++index; - } -} diff --git a/dev/ddk/src/KernelString.c b/dev/ddk/src/KernelString.c deleted file mode 100644 index 0030aa02..00000000 --- a/dev/ddk/src/KernelString.c +++ /dev/null @@ -1,39 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies. - - Purpose: DDK Strings. - -------------------------------------------- */ - -#include - -DK_EXTERN size_t KernelStringLength(const char* in) -{ - if (in == nil) - return 0; - if (*in == 0) - return 0; - - size_t index = 0; - - while (in[index] != 0) - { - ++index; - } - - return index; -} - -DK_EXTERN int KernelStringCopy(char* dst, const char* src, size_t len) -{ - size_t index = 0; - - while (index != len) - { - dst[index] = src[index]; - ++index; - } - - return index; -} diff --git a/dev/ddk/src/KernelVersion.c b/dev/ddk/src/KernelVersion.c deleted file mode 100644 index c40e8ff9..00000000 --- a/dev/ddk/src/KernelVersion.c +++ /dev/null @@ -1,25 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies. - - Purpose: DDK versioning. - -------------------------------------------- */ - -#include - -#ifndef cDDKVersionHighest -#define cDDKVersionHighest 1 -#endif // !cDDKVersionHighest - -#ifndef cDDKVersionLowest -#define cDDKVersionLowest 1 -#endif // !cDDKVersionLowest - -#ifndef cDDKVersion -#define cDDKVersion 1 -#endif // !cDDKVersion - -int32_t c_api_version_highest = cDDKVersionHighest; -int32_t c_api_version_least = cDDKVersionLowest; -int32_t c_api_version = cDDKVersion; diff --git a/dev/ddk/src/ddk_alloc.c b/dev/ddk/src/ddk_alloc.c new file mode 100644 index 00000000..3c379bf7 --- /dev/null +++ b/dev/ddk/src/ddk_alloc.c @@ -0,0 +1,36 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies. + + Purpose: DDK allocator. + +------------------------------------------- */ + +#include + +/** + \brief Allocates a new heap on the Kernel's side. + \param sz the size of the heap block. + \return the newly allocated pointer. +*/ +DK_EXTERN void* KernelAlloc(size_t sz) +{ + if (!sz) + ++sz; + + void* ptr = KernelCall("MmNewKeHeap", 1, &sz, sizeof(size_t)); + + return ptr; +} + +/** + \brief Frees a pointer from the heap. + \param ptr the pointer to free. +*/ +DK_EXTERN void KernelFree(void* ptr) +{ + if (!ptr) + return; + + KernelCall("MmDeleteKeHeap", 1, ptr, 0); +} diff --git a/dev/ddk/src/ddk_dev.c b/dev/ddk/src/ddk_dev.c new file mode 100644 index 00000000..19dd3f55 --- /dev/null +++ b/dev/ddk/src/ddk_dev.c @@ -0,0 +1,29 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies. + + Purpose: DDK Text I/O. + +------------------------------------------- */ + +#include +#include + +/// @brief Open a new binary device from path. +DK_EXTERN KERNEL_DEVICE_PTR KernelOpenDevice(const char* devicePath) +{ + if (!devicePath) + return nil; + + return KernelCall("ZkOpenDevice", 1, (void*)devicePath, KernelStringLength(devicePath)); +} + +/// @brief Close any device. +/// @param device valid device. +DK_EXTERN void KernelCloseDevice(KERNEL_DEVICE_PTR device) +{ + if (!device) + return; + + KernelCall("ZkCloseDevice", 1, device, sizeof(KERNEL_DEVICE)); +} diff --git a/dev/ddk/src/ddk_io.c b/dev/ddk/src/ddk_io.c new file mode 100644 index 00000000..de39ea48 --- /dev/null +++ b/dev/ddk/src/ddk_io.c @@ -0,0 +1,37 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies. + + Purpose: DDK Text I/O. + +------------------------------------------- */ + +#include + +DK_EXTERN void KernelPrintChar(const char ch) +{ + char assembled[2] = {0}; + assembled[0] = ch; + assembled[1] = 0; + + KernelCall("SrWriteCharacter", 1, assembled, 1); +} + +/// @brief print string to UART. +/// @param message UART to transmit. +DK_EXTERN void KernelPrintStr(const char* message) +{ + if (!message) + return; + if (*message == 0) + return; + + size_t index = 0; + size_t len = KernelStringLength(message); + + while (index < len) + { + KernelPrintChar(message[index]); + ++index; + } +} diff --git a/dev/ddk/src/ddk_kernel_call.c b/dev/ddk/src/ddk_kernel_call.c new file mode 100644 index 00000000..d768cb09 --- /dev/null +++ b/dev/ddk/src/ddk_kernel_call.c @@ -0,0 +1,60 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies. + + Purpose: DDK Kernel call. + +------------------------------------------- */ + +#include +#include + +/// @brief this is an internal call, do not use it. +DK_EXTERN ATTRIBUTE(naked) void* __KernelCallDispatch(const char* name, int32_t cnt, void* data, size_t sz); + +/// @brief Interupt Kernel +/// @param KernelRpcName RPC name +/// @param cnt number of elements in **data** pointer. +/// @param data data pointer. +/// @param sz The size of the whole data pointer. +/// @retval void* Kernel call was successful. +/// @retval nil Kernel call failed, call KernelLastError(void) +DK_EXTERN void* KernelCall(const char* name, int32_t cnt, void* data, size_t sz) +{ + if (!name || *name == 0 || cnt == 0) + return nil; + + return __KernelCallDispatch(name, cnt, data, sz); +} + +/// @brief Add system call. +/// @param slot system call slot +/// @param slotFn, syscall slot. +DK_EXTERN void KernelAddSyscall(const int slot, void (*slotFn)(void* a0)) +{ + KernelCall("IntAddSyscall", slot, slotFn, 1); +} + +/// @brief Get a Kernel property. +/// @param slot property id (always 0) +/// @param name the object's name. +/// @return Object manifest. +DK_EXTERN struct DDK_OBJECT_MANIFEST* KernelGetObject(const int slot, const char* name) +{ + struct DDK_OBJECT_MANIFEST* manifest = (struct DDK_OBJECT_MANIFEST*)KernelCall("RtlGetObject", slot, (void*)name, 1); + + if (!manifest) + return nil; + + return manifest; +} + +/// @brief Set a Kernel property. +/// @param slot property id (always 0) +/// @param name the object's name. +/// @param ddk_pr pointer to a object's DDK_OBJECT_MANIFEST. +/// @return property's object. +DK_EXTERN void* KernelSetObject(const int slot, const struct DDK_OBJECT_MANIFEST* ddk_pr) +{ + return KernelCall("RtlSetObject", slot, (void*)ddk_pr, 1); +} diff --git a/dev/ddk/src/ddk_kernel_call_dispatch.S b/dev/ddk/src/ddk_kernel_call_dispatch.S new file mode 100644 index 00000000..3a9a57b5 --- /dev/null +++ b/dev/ddk/src/ddk_kernel_call_dispatch.S @@ -0,0 +1,36 @@ +/** + lang: asm + compiler: gnu + */ + +.globl __KernelCallDispatch + +.text + +/* Really simple function, takes our va-list, + and brings it to the trap handler in the Kernel. */ + +#ifdef __DDK_AMD64__ + +/* args rcx, rdx, r8, r9 */ +__KernelCallDispatch: + int $0x33 + ret + +#elif defined(__DDK_POWER64__) + +/* args r8, r9, r10, r11 */ +__KernelCallDispatch: + /* There is no specific interrupt request id for a system call in POWER. */ + sc + blr + +#elif defined(__DDK_ARM64__) + +/* args x0, x8, x9, x10, x11 is kept to tell that this is a Kernel call */ +__KernelCallDispatch: + /* There is no specific interrupt request id for a system call in ARM64 as well. */ + mov x9, #0x33 + svc #0 + +#endif diff --git a/dev/ddk/src/ddk_rt_cxx.cxx b/dev/ddk/src/ddk_rt_cxx.cxx new file mode 100644 index 00000000..4d5f2563 --- /dev/null +++ b/dev/ddk/src/ddk_rt_cxx.cxx @@ -0,0 +1,29 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies. + + Purpose: DDK C++ runtime. + +------------------------------------------- */ + +#include + +void* operator new(size_t sz) +{ + return KernelAlloc(sz); +} + +void operator delete(void* ptr) +{ + KernelFree(ptr); +} + +void* operator new[](size_t sz) +{ + return KernelAlloc(sz); +} + +void operator delete[](void* ptr) +{ + KernelFree(ptr); +} diff --git a/dev/ddk/src/ddk_str.c b/dev/ddk/src/ddk_str.c new file mode 100644 index 00000000..2969a9e2 --- /dev/null +++ b/dev/ddk/src/ddk_str.c @@ -0,0 +1,39 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies. + + Purpose: DDK Strings. + +------------------------------------------- */ + +#include + +DK_EXTERN size_t KernelStringLength(const char* in) +{ + if (in == nil) + return 0; + if (*in == 0) + return 0; + + size_t index = 0; + + while (in[index] != 0) + { + ++index; + } + + return index; +} + +DK_EXTERN int KernelStringCopy(char* dst, const char* src, size_t len) +{ + size_t index = 0; + + while (index != len) + { + dst[index] = src[index]; + ++index; + } + + return index; +} diff --git a/dev/ddk/src/ddk_ver.c b/dev/ddk/src/ddk_ver.c new file mode 100644 index 00000000..ff27634d --- /dev/null +++ b/dev/ddk/src/ddk_ver.c @@ -0,0 +1,25 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies. + + Purpose: DDK versioning. + +------------------------------------------- */ + +#include + +#ifndef cDDKVersionHighest +#define cDDKVersionHighest 1 +#endif // !cDDKVersionHighest + +#ifndef cDDKVersionLowest +#define cDDKVersionLowest 1 +#endif // !cDDKVersionLowest + +#ifndef cDDKVersion +#define cDDKVersion 1 +#endif // !cDDKVersion + +int32_t c_api_version_highest = cDDKVersionHighest; +int32_t c_api_version_least = cDDKVersionLowest; +int32_t c_api_version = cDDKVersion; diff --git a/dev/ddk/str.h b/dev/ddk/str.h new file mode 100644 index 00000000..0b9bde21 --- /dev/null +++ b/dev/ddk/str.h @@ -0,0 +1,17 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies. + + Purpose: DDK Strings. + +------------------------------------------- */ + +#pragma once + +#include + +/// @brief DDK equivalent of POSIX's string.h +/// @file KernelString.h + +DK_EXTERN size_t KernelStringLength(const char* in); +DK_EXTERN int KernelStringCopy(char* dst, const char* src, size_t len); diff --git a/dev/sci/makefile b/dev/sci/makefile index 05593216..c66d7a78 100644 --- a/dev/sci/makefile +++ b/dev/sci/makefile @@ -5,7 +5,7 @@ CC=g++ FLAGS=-I../ -shared -fPIC -D__ZKA_SYMS__ -OUTPUT=sci.dll +OUTPUT=zka-sci-cxx.dll .PHONY: build-sci build-sci: diff --git a/dev/sci/sci.json b/dev/sci/sci.json index 32a9238b..0b7c6bb7 100644 --- a/dev/sci/sci.json +++ b/dev/sci/sci.json @@ -3,7 +3,7 @@ "compiler_std": "c++20", "headers_path": ["../"], "sources_path": ["src/*.cxx"], - "output_name": "sci.dll", + "output_name": "zka-sci-cxx.dll", "compiler_flags": [ "-fPIC", "-ffreestanding", diff --git a/dev/sci/source_deploy.xml b/dev/sci/source_deploy.xml index a392015c..fda225db 100644 --- a/dev/sci/source_deploy.xml +++ b/dev/sci/source_deploy.xml @@ -1,9 +1,6 @@ - src/*.cxx - *.drawio *.hxx - *.inl *.idl diff --git a/dev/sci/xpcom_sms.idl b/dev/sci/xpcom_sms.idl deleted file mode 100644 index ae37d285..00000000 --- a/dev/sci/xpcom_sms.idl +++ /dev/null @@ -1,34 +0,0 @@ -/* ------------------------------------------- - -Copyright ZKA Technologies. - -File: rt.internal.inl -Purpose: Base code of XPCOM. - -------------------------------------------- */ - -/// @internal - -#ifndef __NDK__ -#define object class -#define protocol class -#define interface private -#define interface_method -#define CONST const -#define CHAR char -#define INT32 __INT32_TYPE__ -#define SIZE_T __SIZE_TYPE__ -#define _Output -#define _Input -#define clsid(X) - -#warning ! You may be using the clang version of the ZKAKit, please be cautious that some features mayn't be present. ! -#endif // !__NDK__ - -clsid("0943A614-0201-4107-8F8D-E909DF7F53C9") -protocol ISMS -{ -interface: - interface_method INT32 SendMessage(_Input CONST CHAR* bytes, _Input SIZE_T bytes_size); - interface_method INT32 RecvMessage(_Output CONST CHAR** bytes_in, _Input SIZE_T bytes_size); -}; diff --git a/dev/zba/amd64-efi.make b/dev/zba/amd64-efi.make index 1dee6a1d..49008035 100644 --- a/dev/zba/amd64-efi.make +++ b/dev/zba/amd64-efi.make @@ -54,8 +54,8 @@ FLAG_GNU=-fshort-wchar -D__EFI_x86_64__ -mno-red-zone -D__NEWOSKRNL__ -D__NEWOSL BOOT_LOADER=newosldr.exe KERNEL=newoskrnl.exe DDK=ddk.dll -SCI=sci.dll -CRT=ndkcrt.dll +SCI=zka-sci-cxx.dll +CRT=zka-crt-cxx.dll SYS_CHK=syschk.sys STARTUP=startup.sys -- cgit v1.2.3