From b8f7ef086d1d1b1cd686fff04d0a587f8fd39d81 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Thu, 27 Mar 2025 17:24:21 +0100 Subject: add: new driver device kit API. (DDK) refactor: rename SCIKit -> user (then libuser.dylib) boot/modules/netboot: fixed compilation for amd64. Signed-off-by: Amlal El Mahrouss --- dev/kernel/SwapKit/DiskSwap.h | 70 +++++++++++++++++++++++++++++++++++++++++++ dev/kernel/SwapKit/SwapDisk.h | 70 ------------------------------------------- 2 files changed, 70 insertions(+), 70 deletions(-) create mode 100644 dev/kernel/SwapKit/DiskSwap.h delete mode 100644 dev/kernel/SwapKit/SwapDisk.h (limited to 'dev/kernel/SwapKit') diff --git a/dev/kernel/SwapKit/DiskSwap.h b/dev/kernel/SwapKit/DiskSwap.h new file mode 100644 index 00000000..b9c31a65 --- /dev/null +++ b/dev/kernel/SwapKit/DiskSwap.h @@ -0,0 +1,70 @@ + +/* ------------------------------------------- + + Copyright (C) 2024-2025 Amlal EL Mahrouss Labs, all rights reserved. + +------------------------------------------- */ + +#pragma once + +#include +#include + +#define kSwapBlockMaxSize (mib_cast(16)) +#define kSwapPageFile "/boot/pagefile.sys" + +/// @file SwapDisk.h +/// @brief Virtual memory swap disk. + +namespace NeOS +{ + struct SWAP_DISK_HEADER; + + /// @brief Virtual memory interface to swap memory chunks onto disk. + class SwapDiskInterface final + { + public: + explicit SwapDiskInterface() = default; + ~SwapDiskInterface() = default; + + NE_COPY_DEFAULT(SwapDiskInterface); + + public: + /***********************************************************************************/ + /// @brief Write memory chunk onto disk. + /// @param fork_name The swap name to recognize this memory region. + /// @param fork_name_len length of fork name. + /// @param data the data packet. + /// @return Whether the swap was written to disk, or not. + /***********************************************************************************/ + BOOL Write(const Char* fork_name, const SizeT fork_name_len, SWAP_DISK_HEADER* data); + + /***********************************************************************************/ + /// @brief Read memory chunk from disk. + /// @param fork_name The swap name to recognize this memory region. + /// @param fork_name_len length of fork name. + /// @param data the data packet length. + /// @return Whether the swap was fetched to disk, or not. + /***********************************************************************************/ + SWAP_DISK_HEADER* Read(const Char* fork_name, const SizeT fork_name_len, const SizeT data_len); + }; + + /// @brief Swap disk header, containing information about the held virtual memory. + /// @param fMagic Ident number. + /// @param fHeaderSz This header size. + /// @param fTeamID Process Team ID. + /// @param fProcessID Process ID. + /// @param fVirtualAddress Virtual address pointed by data. + /// @param fBlobSz Blob's size. + /// @param fBlob Data blob. + typedef struct SWAP_DISK_HEADER + { + UInt32 fMagic; + SizeT fHeaderSz; + UInt64 fTeamID; + UInt64 fProcessID; + UInt64 fVirtualAddress; + SizeT fBlobSz; + UInt8 fBlob[]; + } PACKED SWAP_DISK_HEADER; +} // namespace NeOS diff --git a/dev/kernel/SwapKit/SwapDisk.h b/dev/kernel/SwapKit/SwapDisk.h deleted file mode 100644 index b9c31a65..00000000 --- a/dev/kernel/SwapKit/SwapDisk.h +++ /dev/null @@ -1,70 +0,0 @@ - -/* ------------------------------------------- - - Copyright (C) 2024-2025 Amlal EL Mahrouss Labs, all rights reserved. - -------------------------------------------- */ - -#pragma once - -#include -#include - -#define kSwapBlockMaxSize (mib_cast(16)) -#define kSwapPageFile "/boot/pagefile.sys" - -/// @file SwapDisk.h -/// @brief Virtual memory swap disk. - -namespace NeOS -{ - struct SWAP_DISK_HEADER; - - /// @brief Virtual memory interface to swap memory chunks onto disk. - class SwapDiskInterface final - { - public: - explicit SwapDiskInterface() = default; - ~SwapDiskInterface() = default; - - NE_COPY_DEFAULT(SwapDiskInterface); - - public: - /***********************************************************************************/ - /// @brief Write memory chunk onto disk. - /// @param fork_name The swap name to recognize this memory region. - /// @param fork_name_len length of fork name. - /// @param data the data packet. - /// @return Whether the swap was written to disk, or not. - /***********************************************************************************/ - BOOL Write(const Char* fork_name, const SizeT fork_name_len, SWAP_DISK_HEADER* data); - - /***********************************************************************************/ - /// @brief Read memory chunk from disk. - /// @param fork_name The swap name to recognize this memory region. - /// @param fork_name_len length of fork name. - /// @param data the data packet length. - /// @return Whether the swap was fetched to disk, or not. - /***********************************************************************************/ - SWAP_DISK_HEADER* Read(const Char* fork_name, const SizeT fork_name_len, const SizeT data_len); - }; - - /// @brief Swap disk header, containing information about the held virtual memory. - /// @param fMagic Ident number. - /// @param fHeaderSz This header size. - /// @param fTeamID Process Team ID. - /// @param fProcessID Process ID. - /// @param fVirtualAddress Virtual address pointed by data. - /// @param fBlobSz Blob's size. - /// @param fBlob Data blob. - typedef struct SWAP_DISK_HEADER - { - UInt32 fMagic; - SizeT fHeaderSz; - UInt64 fTeamID; - UInt64 fProcessID; - UInt64 fVirtualAddress; - SizeT fBlobSz; - UInt8 fBlob[]; - } PACKED SWAP_DISK_HEADER; -} // namespace NeOS -- cgit v1.2.3