forked from AdaDoom3/AdaDoom3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathneo-system-memory.ads
116 lines (116 loc) · 3.37 KB
/
neo-system-memory.ads
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
with
System,
Interfaces,
Neo.Foundation.Text_IO,
Neo.Foundation.Data_Types,
Neo.Foundation.Package_Testing;
use
System,
Interfaces,
Neo.Foundation.Text_IO,
Neo.Foundation.Data_Types,
Neo.Foundation.Package_Testing;
package Neo.System.Memory -- Memory allocation, all in one place
is
-------------
-- Numbers --
-------------
type Integer_Memory_Identifier
is new Integer_1_Unsigned;
-------------
-- Records --
-------------
type Record_Memory
is record
Load : Float_4_Percent;
Physical_Total : Integer_8_Natural;
Physical_Available : Integer_8_Natural;
Page_File_Total : Integer_8_Natural;
Page_File_Available : Integer_8_Natural;
Virtual_Total : Integer_8_Natural;
Virtual_Available : Integer_8_Natural;
Virtual_Available_Extended : Integer_8_Natural;
end record;
---------------
-- Constants --
---------------
CLEARED_MEMORY_VALUE : constant Boolean := False;
UNASSIGNED_IDENTIFIER : constant Integer_Memory_Identifier := 0;
MEMORY_ALIGNMENT : constant Integer_4_Unsigned := 16;
-----------------
-- Subprograms --
-----------------
procedure Test;
procedure Set_Byte_Limits(
Minimum : in Integer_4_Unsigned;
Maximum : in Integer_4_Unsigned);
function Get_Data
return Record_Memory;
function Lock(
Location : in Address;
Number_Of_Bytes : in Integer_4_Unsigned)
return Boolean;
function Unlock(
Location : in Address;
Number_Of_Bytes : in Integer_4_Unsigned)
return Boolean;
function Allocate(
Number_Of_Bits : in Integer_4_Unsigned;
Memory_Identifier : in Integer_Memory_Identifier := UNASSIGNED_IDENTIFIER)
return Address;
function Allocate_Dirty(
Number_Of_Bits : in Integer_4_Unsigned;
Memory_Identifier : in Integer_Memory_Identifier := UNASSIGNED_IDENTIFIER)
return Address;
procedure Free(
Item : in Address);
-------
private
-------
--------------------
-- Implementation --
--------------------
package Implementation
is
function Get
return Record_Memory;
procedure Set_Byte_Limits(
Minimum : in Integer_4_Unsigned;
Maximum : in Integer_4_Unsigned);
function Lock(
Location : in Address;
Number_Of_Bytes : in Integer_4_Unsigned)
return Boolean;
function Unlock(
Location : in Address;
Number_Of_Bytes : in Integer_4_Unsigned)
return Boolean;
function Clear(
Location : in Address;
Size : in Integer_4_Unsigned;
Initial_Value : in Boolean := CLEARED_MEMORY_VALUE)
return Address;
function Allocate(
Size : in Integer_4_Unsigned;
Alignment : in Integer_4_Unsigned)
return Address;
procedure Free(
Data : in Address);
end Implementation;
end Neo.System.Memory;