diff options
| author | Amlal EL Mahrouss <amlalelmahrouss@icloud.com> | 2024-07-30 10:01:42 +0200 |
|---|---|---|
| committer | Amlal EL Mahrouss <amlalelmahrouss@icloud.com> | 2024-07-30 10:01:42 +0200 |
| commit | 6ea68d219dc3a1bcc0deef1683e8442082025940 (patch) | |
| tree | 5a6879105a374bb4353959790d85c5de88de6be8 /SCIKit | |
| parent | bf642edd6c77d405637f0695452460640b8e540d (diff) | |
[IMP] SCIKit: SharedInterface1 and UnknownInterface, both are defined in foreign SOs.
[REFACTOR] IPCEP is just now IPC.
Signed-off-by: Amlal EL Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'SCIKit')
| -rw-r--r-- | SCIKit/ErrorTypes.cxx | 9 | ||||
| -rw-r--r-- | SCIKit/ErrorTypes.hxx | 8 | ||||
| -rw-r--r-- | SCIKit/SharedInterface1.hxx (renamed from SCIKit/StandardInterface.hxx) | 58 | ||||
| -rw-r--r-- | SCIKit/Types.hxx | 69 | ||||
| -rw-r--r-- | SCIKit/makefile | 7 |
5 files changed, 98 insertions, 53 deletions
diff --git a/SCIKit/ErrorTypes.cxx b/SCIKit/ErrorTypes.cxx new file mode 100644 index 00000000..7bd4146a --- /dev/null +++ b/SCIKit/ErrorTypes.cxx @@ -0,0 +1,9 @@ +/* -------------------------------------------
+
+ Copyright ZKA Technologies
+
+------------------------------------------- */
+
+#include <SCIKit/ErrorTypes.hxx>
+
+HError kLastError = 0;
\ No newline at end of file diff --git a/SCIKit/ErrorTypes.hxx b/SCIKit/ErrorTypes.hxx index 041786ba..4473722a 100644 --- a/SCIKit/ErrorTypes.hxx +++ b/SCIKit/ErrorTypes.hxx @@ -6,11 +6,7 @@ #pragma once -#include <SCI/StandardInterface.hxx> - -#ifdef __KERNEL__ -#error !!! including header in kernel mode !!! -#endif // __KERNEL__ +#include <SCIKit/Types.hxx> #define ErrLocalIsOk() (kLastError == kErrorSuccess) #define ErrLocalFailed() (kLastError != kErrorSuccess) @@ -50,4 +46,4 @@ inline constexpr HError kErrorSign = 60; inline constexpr HError kErrorInvalidCreds = 61; inline constexpr HError kErrorUnimplemented = 0; -inline HError kLastError = 0; +IMPORT_C HError kLastError; diff --git a/SCIKit/StandardInterface.hxx b/SCIKit/SharedInterface1.hxx index 9e792546..b1f7ce9d 100644 --- a/SCIKit/StandardInterface.hxx +++ b/SCIKit/SharedInterface1.hxx @@ -2,59 +2,27 @@ Copyright ZKA Technologies.
-File: newstd.hxx.
-Purpose: System Call Interface.
+File: StandardInterface1.hxx.
+Purpose: System Call Interface Version 1.
------------------------------------------- */
#ifndef __SCI_STD_HXX__
#define __SCI_STD_HXX__
-#ifdef __KERNEL__
-#error !!! including header in kernel mode !!!
-#endif // __KERNEL__
-
-#define IMPORT_CXX extern "C++"
-#define IMPORT_C extern "C"
-
-#define cRestrictR "r"
-#define cRestrictRB "rb"
-#define cRestrictW "w"
-#define cRestrictRW "rw"
-
-class SCISharedInterface; /// @brief System call class.
-
-typedef long long int FD;
-typedef bool Bool;
-typedef void UInt0;
-
-typedef __UINT64_TYPE__ UInt64;
-typedef __UINT32_TYPE__ UInt32;
-typedef __UINT16_TYPE__ UInt16;
-typedef __UINT8_TYPE__ UInt8;
-
-typedef __SIZE_TYPE__ SizeT;
-
-typedef __INT64_TYPE__ SInt64;
-typedef __INT32_TYPE__ SInt32;
-typedef __INT16_TYPE__ SInt16;
-typedef __INT8_TYPE__ SInt8;
-
-typedef char UTFChar;
-
-typedef UInt32 PowerID;
+#include <SCIKit/Types.hxx>
/**
@brief System call class.
*/
-class SCISharedInterface
+class __attribute__((uuid_of(SharedInterface1))) SharedInterface1 : public UnknownInterface
{
public:
- explicit SCISharedInterface() = default;
- virtual ~SCISharedInterface() = default;
+ explicit SharedInterface1() = default;
+ virtual ~SharedInterface1() = default;
- SCISharedInterface& operator=(const SCISharedInterface&) = default;
- SCISharedInterface(const SCISharedInterface&) = default;
+ SharedInterface1& operator=(const SharedInterface1&) = default;
+ SharedInterface1(const SharedInterface1&) = default;
public:
/// @brief disable device.
@@ -69,8 +37,8 @@ public: /// @brief check if MBCI device is wokeup.
virtual Bool PowerIsWokeup(PowerID) = 0;
- /// @brief probe MBCI/ACPI device from phone.
- virtual PowerID PowerProbeDevice(const char* namepace, const int index) = 0;
+ /// @brief probe MBCI/ACPI device from device.
+ virtual PowerID PowerProbeDevice(const char* namezpace, const int index) = 0;
// THOSE DOESNT REQUIRE PERMISSIONS FROM THE USER. //
@@ -89,7 +57,7 @@ public: // THOSE MAY REQUIRE PERMISSIONS FROM THE USER. //
/// @brief Open descriptor.
- virtual FD OpenStorage(const char* path, const char* restr) = 0;
+ virtual FD OpenStorage(const char* path, const UInt32 restr) = 0;
/// @brief Close descriptor.
virtual UInt0 CloseStorage(FD descriptorType) = 0;
@@ -116,8 +84,4 @@ public: virtual UInt0* WriteStorage(const UTFChar* cmdNameOrData, SizeT cmdSize, FD descriptorType) = 0;
};
-/// @brief Get shared syscall object.
-/// @return Syscall implementation.
-IMPORT_C SCISharedInterface* SCIGetSharedInterface(UInt0);
-
#endif // ifndef __SCI_STD_HXX__
diff --git a/SCIKit/Types.hxx b/SCIKit/Types.hxx new file mode 100644 index 00000000..c6c93fdc --- /dev/null +++ b/SCIKit/Types.hxx @@ -0,0 +1,69 @@ +/* -------------------------------------------
+
+Copyright ZKA Technologies.
+
+File: Types.hxx.
+Purpose: System Call types.
+
+------------------------------------------- */
+
+
+#pragma once
+
+#define IMPORT_CXX extern "C++"
+#define IMPORT_C extern "C"
+
+#define cRestrictR 1
+#define cRestrictRB 2
+#define cRestrictW 4
+#define cRestrictRW 6
+
+typedef long long int FD;
+typedef bool Bool;
+typedef void UInt0;
+
+typedef __UINT64_TYPE__ UInt64;
+typedef __UINT32_TYPE__ UInt32;
+typedef __UINT16_TYPE__ UInt16;
+typedef __UINT8_TYPE__ UInt8;
+
+typedef __SIZE_TYPE__ SizeT;
+
+typedef __INT64_TYPE__ SInt64;
+typedef __INT32_TYPE__ SInt32;
+typedef __INT16_TYPE__ SInt16;
+typedef __INT8_TYPE__ SInt8;
+
+typedef char UTFChar;
+
+typedef UInt32 PowerID;
+
+// Interfaces are divided between classes.
+// So that they aren't too big.
+
+class SharedInterface1;
+class SharedInterface2;
+class SharedInterface3;
+class UnknownInterface;
+class EncodingInterface;
+
+class __attribute__((uuid_of(UnknownInterface))) UnknownInterface
+{
+public:
+ explicit UnknownInterface() = default;
+ virtual ~UnknownInterface() = default;
+
+ UnknownInterface& operator=(const UnknownInterface&) = default;
+ UnknownInterface(const UnknownInterface&) = default;
+
+ SInt32 Release() { return -1; }
+
+ template <typename TCLS>
+ SInt32 Release(TCLS* cls) { return -1; }
+
+ template <typename TCLS, typename UCLSID>
+ TCLS* QueryInterface(UCLSID uclsidOfCls) { return nullptr; }
+};
+
+template <typename TCLS, typename UCLSID>
+TCLS* SciGetClassFromCLSID(UCLSID uclsidOfCls);
\ No newline at end of file diff --git a/SCIKit/makefile b/SCIKit/makefile new file mode 100644 index 00000000..2989d18c --- /dev/null +++ b/SCIKit/makefile @@ -0,0 +1,7 @@ +######################
+# (C) ZKA
+######################
+
+.PHONY: build-sci
+build-sci:
+ g++ *.cxx -I../ -shared -fPIC -o libSCI.so
\ No newline at end of file |
