summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAmlal El Mahrouss <zka-holder@mahrouss-logic.com>2024-09-30 10:33:13 +0000
committerAmlal El Mahrouss <zka-holder@mahrouss-logic.com>2024-09-30 10:33:13 +0000
commit2d80769d8adb670acf766e5004c44a57b2d6de6a (patch)
tree67187473c17e0818432ddfa20ca27b01ff18ac01
parent2b53f63158b244d0a31af638f384d4af0878938d (diff)
IMP: CRT and DDK improvements. Add SMS struct.
-rw-r--r--dev/crt/alloca.hxx5
-rw-r--r--dev/crt/defines.hxx13
-rw-r--r--dev/ddk/ddk.h20
-rw-r--r--dev/ddk/dev.h11
-rw-r--r--dev/ddk/source_deploy.xml7
5 files changed, 32 insertions, 24 deletions
diff --git a/dev/crt/alloca.hxx b/dev/crt/alloca.hxx
index fedcb25d..038432be 100644
--- a/dev/crt/alloca.hxx
+++ b/dev/crt/alloca.hxx
@@ -9,10 +9,11 @@
#pragma once
-typedef void* ptr_type;
-typedef __SIZE_TYPE__ size_type;
+#include <crt/defines.hxx>
inline ptr_type __ndk_alloca(size_type sz)
{
return __builtin_alloca(sz);
}
+
+#define alloca __ndk_alloca \ No newline at end of file
diff --git a/dev/crt/defines.hxx b/dev/crt/defines.hxx
index 11a76ded..d9670ac1 100644
--- a/dev/crt/defines.hxx
+++ b/dev/crt/defines.hxx
@@ -20,6 +20,9 @@ typedef long int ssize_t;
typedef int ssize_t;
#endif // __LP64__
+typedef void* ptr_type;
+typedef __SIZE_TYPE__ size_type;
+
typedef size_t ptrdiff_t;
typedef size_t uintptr_t;
typedef void* voidptr_t;
@@ -31,10 +34,8 @@ typedef char* caddr_t;
#endif // !null
#ifdef __GNUC__
-#include <crt/__ndk_alloca.hxx>
-#define __ndk_alloca(sz) __ndk_alloca(sz)
+#include <crt/alloca.hxx>
#elif defined(__NDK__)
-
#define __alloca(sz) __ndk_alloca(sz)
#endif
@@ -59,7 +60,7 @@ typedef char* caddr_t;
#endif
#define __alloca alloca
#else
-#warning alloca not detected
+#warning ! alloca not detected !
#endif
typedef long long off_t;
@@ -93,8 +94,8 @@ typedef union double_cast {
#ifdef __STD_CXX__
-#include <crt/__ndk_exception.hxx>
-#include <crt/__ndk_malloc.hxx>
+#include <crt/base_exception.hxx>
+#include <crt/base_alloc.hxx>
#endif // ifdef __STD_CXX__
diff --git a/dev/ddk/ddk.h b/dev/ddk/ddk.h
index 89fe786d..249ada72 100644
--- a/dev/ddk/ddk.h
+++ b/dev/ddk/ddk.h
@@ -2,7 +2,7 @@
Copyright ZKA Technologies.
- FILE: KernelStd.h
+ FILE: ddk.h
PURPOSE: DDK Driver model base header.
------------------------------------------- */
@@ -37,6 +37,8 @@
#define ATTRIBUTE(X) __attribute__((X))
+#define DDK_SMS_MAX_SZ 128
+
#ifndef __NEWOSKRNL__
#error !!! including header in low exception/ring-3 mode !!!
#endif // __NEWOSKRNL__
@@ -44,6 +46,7 @@
struct DDK_STATUS_STRUCT;
struct DDK_OBJECT_MANIFEST;
+/// \brief Object handle manifest.
struct DDK_OBJECT_MANIFEST DK_FINAL
{
char* p_name;
@@ -51,7 +54,7 @@ struct DDK_OBJECT_MANIFEST DK_FINAL
void* p_object;
};
-/// \brief DDK status structure (__at_enable, __at_disable...)
+/// \brief DDK status ping structure.
struct DDK_STATUS_STRUCT DK_FINAL
{
int32_t s_action_id;
@@ -60,6 +63,15 @@ struct DDK_STATUS_STRUCT DK_FINAL
void* s_object;
};
+/// \brief Simple Message Struct
+struct DDK_SMS_STRUCT DK_FINAL
+{
+ char s_msg[DDK_SMS_MAX_SZ];
+ int32_t s_type;
+ int64_t s_sender;
+ int64_t s_receiver;
+};
+
/// @brief Call Kernel (interrupt 0x33)
/// @param KernelRpcName
/// @param cnt number of elements in **dat**
@@ -79,8 +91,8 @@ DK_EXTERN void KernelAddSyscall(const int32_t slot, void (*slotFn)(void* a0));
DK_EXTERN void* KernelAlloc(size_t sz);
/// @brief free heap ptr.
-/// @param pointer to free
-DK_EXTERN void KernelFree(void*);
+/// @param pointer kernel pointer to free.
+DK_EXTERN void KernelFree(void* the_ptr);
/// @brief Get a Kernel property.
/// @param slot property id (always 0)
diff --git a/dev/ddk/dev.h b/dev/ddk/dev.h
index 2a3aeb18..8dad5736 100644
--- a/dev/ddk/dev.h
+++ b/dev/ddk/dev.h
@@ -2,7 +2,8 @@
Copyright ZKA Technologies.
- Purpose: DDK Devices.
+ File: dev.h
+ Purpose: DDK device support.
------------------------------------------- */
@@ -10,17 +11,17 @@
#include <ddk/ddk.h>
-struct _KERNEL_DEVICE;
+struct _DDK_DEVICE;
/// @brief Kernel Device driver.
-typedef struct _KERNEL_DEVICE DK_FINAL
+typedef struct _DDK_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.
+ struct _DDK_DEVICE* (*d_open)(const char* path); // open device.
+ void (*d_close)(struct _DDK_DEVICE* dev); // close device.
} KERNEL_DEVICE, *KERNEL_DEVICE_PTR;
/// @brief Open a new device from path.
diff --git a/dev/ddk/source_deploy.xml b/dev/ddk/source_deploy.xml
deleted file mode 100644
index 3d2325a8..00000000
--- a/dev/ddk/source_deploy.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<SourceDeploy>
-<HiddenFiles>
- <SourceFile>*.cxx</SourceFile>
- <SourceFile>*.c</SourceFile>
- <SourceFile>*.S</SourceFile>
-</HiddenFiles>
-</SourceDeploy>