summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Private/CFKit/IPCEndpoint.hxx27
-rw-r--r--Private/HALKit/AMD64/Storage/ATA-DMA.cxx0
-rw-r--r--Private/HALKit/AMD64/Storage/ATA-PIO.cxx (renamed from Private/HALKit/AMD64/Storage/ATA.cxx)6
-rw-r--r--Private/KernelKit/HError.hpp1
-rw-r--r--Private/KernelKit/UserHeap.hpp6
-rw-r--r--Private/NetworkKit/IPCEP.hxx45
-rw-r--r--Private/NewBoot/Source/HEL/AMD64/BootATA.cxx2
-rw-r--r--Private/Source/ProcessScheduler.cxx33
-rw-r--r--Private/Source/URL.cxx8
-rw-r--r--Private/StorageKit/PRDT.hpp6
10 files changed, 83 insertions, 51 deletions
diff --git a/Private/CFKit/IPCEndpoint.hxx b/Private/CFKit/IPCEndpoint.hxx
deleted file mode 100644
index bc697dc7..00000000
--- a/Private/CFKit/IPCEndpoint.hxx
+++ /dev/null
@@ -1,27 +0,0 @@
-/* -------------------------------------------
-
- Copyright Mahrouss Logic
-
-------------------------------------------- */
-
-#ifndef _INC_IPC_ENDPOINT_HXX_
-#define _INC_IPC_ENDPOINT_HXX_
-
-#include <NewKit/Defines.hpp>
-#include <NewKit/String.hpp>
-
-/// @brief Includes macros and utilities to make an IPC connection.
-
-/// IA separator.
-#define kRemoteSeparator "."
-
-/// Interchange address, consists of domain+namespace.
-#define kRemoteInvalid "00.00.00.00:00000000"
-#define kRemoteMaxLen 21
-
-namespace NewOS {
-typedef UIntPtr ipc_method_type;
-typedef Char ipc_remote_type[kRemoteMaxLen];
-} // namespace NewOS
-
-#endif // _INC_IPC_ENDPOINT_HXX_ \ No newline at end of file
diff --git a/Private/HALKit/AMD64/Storage/ATA-DMA.cxx b/Private/HALKit/AMD64/Storage/ATA-DMA.cxx
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/Private/HALKit/AMD64/Storage/ATA-DMA.cxx
diff --git a/Private/HALKit/AMD64/Storage/ATA.cxx b/Private/HALKit/AMD64/Storage/ATA-PIO.cxx
index b2191250..0f8a0d75 100644
--- a/Private/HALKit/AMD64/Storage/ATA.cxx
+++ b/Private/HALKit/AMD64/Storage/ATA-PIO.cxx
@@ -5,9 +5,9 @@
------------------------------------------- */
/**
- * @file ATA.cxx
+ * @file ATA-PIO.cxx
* @author Amlal El Mahrouss (amlalelmahrouss@icloud.com)
- * @brief ATA driver.
+ * @brief ATA driver (PIO mode).
* @version 0.1
* @date 2024-02-02
*
@@ -138,6 +138,7 @@ Void drv_ata_read(UInt64 Lba, UInt16 IO, UInt8 Master, Char* Buf,
Out8(IO + ATA_REG_LBA0, (Lba));
Out8(IO + ATA_REG_LBA1, (Lba) >> 8);
Out8(IO + ATA_REG_LBA2, (Lba) >> 16);
+ Out8(IO + ATA_REG_LBA3, (Lba) >> 24);
Out8(IO + ATA_REG_COMMAND, ATA_CMD_READ_PIO);
@@ -160,6 +161,7 @@ Void drv_ata_write(UInt64 Lba, UInt16 IO, UInt8 Master, Char* Buf,
Out8(IO + ATA_REG_LBA0, (Lba));
Out8(IO + ATA_REG_LBA1, (Lba) >> 8);
Out8(IO + ATA_REG_LBA2, (Lba) >> 16);
+ Out8(IO + ATA_REG_LBA3, (Lba) >> 24);
Out8(IO + ATA_REG_COMMAND, ATA_CMD_WRITE_PIO);
diff --git a/Private/KernelKit/HError.hpp b/Private/KernelKit/HError.hpp
index d5a16fd6..a0105d64 100644
--- a/Private/KernelKit/HError.hpp
+++ b/Private/KernelKit/HError.hpp
@@ -33,6 +33,7 @@ inline constexpr HError kErrorInternal = 49;
inline constexpr HError kErrorForkAlreadyExists = 50;
inline constexpr HError kErrorOutOfTeamSlot = 51;
inline constexpr HError kErrorHeapNotPresent = 52;
+inline constexpr HError kErrorNoEntrypoint = 53;
inline constexpr HError kErrorUnimplemented = 0;
Boolean ke_bug_check(void) noexcept;
diff --git a/Private/KernelKit/UserHeap.hpp b/Private/KernelKit/UserHeap.hpp
index c919db53..e1455b49 100644
--- a/Private/KernelKit/UserHeap.hpp
+++ b/Private/KernelKit/UserHeap.hpp
@@ -22,9 +22,13 @@
namespace NewOS {
typedef enum {
- kUserHeapHypervisor = 0x2,
+ /// @brief Driver only heap.
+ kUserHeapDriver = 0x2,
+ /// @brief Shared heap.
kUserHeapShared = 0x4,
+ /// @brief User and private heap.
kUserHeapUser = 0x6,
+ /// @brief Read and Write heap.
kUserHeapRw = 0x8,
} kUserHeapFlags;
diff --git a/Private/NetworkKit/IPCEP.hxx b/Private/NetworkKit/IPCEP.hxx
new file mode 100644
index 00000000..b3b8a759
--- /dev/null
+++ b/Private/NetworkKit/IPCEP.hxx
@@ -0,0 +1,45 @@
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+------------------------------------------- */
+
+#ifndef _INC_IPC_ENDPOINT_HXX_
+#define _INC_IPC_ENDPOINT_HXX_
+
+#include <NewKit/Defines.hpp>
+#include <NewKit/String.hpp>
+
+/// @brief IPC Endpoint Protocol (IPCEP) definition.
+
+/// IA separator.
+#define kRemoteSeparator "."
+
+/// Interchange address, consists of domain+namespace.
+#define kRemoteInvalid "00.00.00.00:0"
+#define kRemoteMaxLen 21
+
+#define kRemoteHeaderMagic 0xFFEEAACCEE
+
+namespace NewOS {
+/// @brief 96-bit number to represent the domain and namespace
+struct PACKED IPCEPNumber final {
+ UInt32 RemoteAddress;
+ UInt64 RemoteNamespace;
+};
+
+typedef struct IPCEPNumber IPCEPNumberType;
+
+/// @brief IPCEP connection header
+typedef struct IPCEPConnectionHeader final {
+ UInt64 IpcHeader; // 0xFFEEAACCEE
+ UInt8 IpcEndianess; // 0 : LE, 1 : BE
+ SizeT IpcPacketSize;
+ IPCEPNumberType IpcFrom;
+ IPCEPNumberType IpcTo;
+ UInt32 IpcCRC32;
+ Char IpcPad[8];
+} PACKED IPCEPConnectionHeader;
+} // namespace NewOS
+
+#endif // _INC_IPC_ENDPOINT_HXX_ \ No newline at end of file
diff --git a/Private/NewBoot/Source/HEL/AMD64/BootATA.cxx b/Private/NewBoot/Source/HEL/AMD64/BootATA.cxx
index ed591412..3f309f31 100644
--- a/Private/NewBoot/Source/HEL/AMD64/BootATA.cxx
+++ b/Private/NewBoot/Source/HEL/AMD64/BootATA.cxx
@@ -143,6 +143,7 @@ Void boot_ata_read(UInt64 Lba, UInt16 IO, UInt8 Master, CharacterTypeUTF8* Buf,
Out8(IO + ATA_REG_LBA0, (Lba));
Out8(IO + ATA_REG_LBA1, (Lba) >> 8);
Out8(IO + ATA_REG_LBA2, (Lba) >> 16);
+ Out8(IO + ATA_REG_LBA3, (Lba) >> 24);
Out8(IO + ATA_REG_COMMAND, ATA_CMD_READ_PIO);
@@ -176,6 +177,7 @@ Void boot_ata_write(UInt64 Lba, UInt16 IO, UInt8 Master, CharacterTypeUTF8* Buf,
Out8(IO + ATA_REG_LBA0, (Lba));
Out8(IO + ATA_REG_LBA1, (Lba) >> 8);
Out8(IO + ATA_REG_LBA2, (Lba) >> 16);
+ Out8(IO + ATA_REG_LBA3, (Lba) >> 24);
Out8(IO + ATA_REG_COMMAND, ATA_CMD_WRITE_PIO);
diff --git a/Private/Source/ProcessScheduler.cxx b/Private/Source/ProcessScheduler.cxx
index 5d8a7f56..59b9bcea 100644
--- a/Private/Source/ProcessScheduler.cxx
+++ b/Private/Source/ProcessScheduler.cxx
@@ -146,37 +146,36 @@ void ProcessHeader::Exit(Int32 exit_code) {
SizeT ProcessScheduler::Add(Ref<ProcessHeader> &process) {
if (!process) return -1;
+
+ if (!process.Leak().Image) {
+ if (process.Leak().Kind != ProcessHeader::kLibKind) {
+ return -kErrorNoEntrypoint;
+ }
+ }
+
if (!mTeam.AsArray().Count() > kSchedProcessLimitPerTeam) return -kErrorOutOfTeamSlot;
if (process.Leak().Ring != (Int32)ProcessSelector::kRingKernel) return -1;
kcout << "ProcessScheduler::Add(Ref<ProcessHeader>& process)\r\n";
- process.Leak().HeapPtr = rt_new_heap(kUserHeapUser | kUserHeapRw);
- process.Leak().ProcessId = mTeam.AsArray().Count();
- process.Leak().HeapCursor = process.Leak().HeapPtr;
+ /// Create heap according to type of process.
+ if (process.Leak().Kind == ProcessHeader::kUserKind)
+ process.Leak().HeapPtr = rt_new_heap(kUserHeapUser | kUserHeapRw);
+ else if (process.Leak().Kind == ProcessHeader::kLibKind)
+ process.Leak().HeapPtr = rt_new_heap(kUserHeapUser | kUserHeapRw || kUserHeapShared);
+ else
+ process.Leak().HeapPtr = rt_new_heap(kUserHeapDriver | kUserHeapRw);
process.Leak().StackFrame = reinterpret_cast<HAL::StackFrame *>(
ke_new_ke_heap(sizeof(HAL::StackFrame), true, false));
MUST_PASS(process.Leak().StackFrame);
- UIntPtr imageStart = reinterpret_cast<UIntPtr>(process.Leak().Image);
-
- process.Leak().SetEntrypoint(imageStart);
-
mTeam.AsArray().Add(process);
- if (!imageStart && process.Leak().Kind == ProcessHeader::kUserKind) {
- process.Leak().Crash();
- }
-
- if (!imageStart && process.Leak().Kind == ProcessHeader::kDriverKind) {
- if (process.Leak().Ring == 3)
- process.Leak().Crash();
- else
- ke_stop(RUNTIME_CHECK_PROCESS);
- }
+ process.Leak().ProcessId = mTeam.AsArray().Count() - 1;
+ process.Leak().HeapCursor = process.Leak().HeapPtr;
return mTeam.AsArray().Count() - 1;
}
diff --git a/Private/Source/URL.cxx b/Private/Source/URL.cxx
index fba6bca9..c384c378 100644
--- a/Private/Source/URL.cxx
+++ b/Private/Source/URL.cxx
@@ -16,10 +16,10 @@ Url::Url(StringView &strUrl) : m_urlView(strUrl, false) {}
Url::~Url() = default;
constexpr const char *kURLProtocols[] = {
- "https", // http with tls.
- "http", // http
- "file", // filesystem protocol
- "ftp", // file transfer protocol
+ "file", // Filesystem protocol
+ "ping", // Ping protocol.
+ "telnet", // Telnet protocol
+ "ssh", // SSH protocol
};
constexpr const int kUrlOutSz = 3; //! such as: ://
diff --git a/Private/StorageKit/PRDT.hpp b/Private/StorageKit/PRDT.hpp
index f3f4aa67..48886db6 100644
--- a/Private/StorageKit/PRDT.hpp
+++ b/Private/StorageKit/PRDT.hpp
@@ -12,6 +12,12 @@
#define kPrdtTransferSize (sizeof(NewOS::UShort))
namespace NewOS {
+enum {
+ kPRDTTransferInProgress,
+ kPRDTTransferIsDone,
+ kPRDTTransferCount,
+};
+
class PRDT final {
public:
explicit PRDT() = delete;