blob: 11cc6332577ca79043d37c1ecfd40e739d72dd84 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
/* -------------------------------------------
Copyright (C) 2024-2025 Amlal EL Mahrouss Labs, all rights reserved.
------------------------------------------- */
#pragma once
#include <NewKit/Defines.h>
#include <CompilerKit/CompilerKit.h>
#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 This class is a disk swap delegate for any data. available as a syscall too.
class SwapDisk final
{
public:
explicit SwapDisk() = default;
~SwapDisk() = default;
NE_COPY_DEFAULT(SwapDisk);
BOOL Write(const Char* fork_name, const SizeT fork_name_len, SWAP_DISK_HEADER* data, const SizeT data_len);
SWAP_DISK_HEADER* Read(const Char* fork_name, const SizeT fork_name_len, const SizeT data_len);
};
typedef struct SWAP_DISK_HEADER
{
UInt32 fMagic;
SizeT fHeaderSz;
UInt64 fTeamID;
UInt64 fProcessID;
UInt64 fVirtualAddress;
SizeT fBlobSz;
Char fBlob[];
} PACKED SWAP_DISK_HEADER;
} // namespace NeOS
|