93 |
|
static uint32 page_size; |
94 |
|
static uintptr zero_page; |
95 |
|
static uintptr base; |
96 |
< |
static uintptr top; |
97 |
< |
static const uint32 size = 0x40000; // 256 KB |
96 |
> |
static uintptr data; |
97 |
> |
static uintptr proc; |
98 |
> |
static const uint32 size = 0x80000; // 512 KB |
99 |
|
public: |
100 |
|
static bool Init(void); |
101 |
|
static void Exit(void); |
103 |
|
static uint32 ZeroPage(); |
104 |
|
static uint32 Reserve(uint32 size); |
105 |
|
static void Release(uint32 size); |
106 |
+ |
static uint32 ReserveProc(uint32 size); |
107 |
|
friend class SheepVar; |
108 |
|
}; |
109 |
|
|
125 |
|
|
126 |
|
inline uint32 SheepMem::Reserve(uint32 size) |
127 |
|
{ |
128 |
< |
top -= align(size); |
129 |
< |
assert(top >= base); |
130 |
< |
return top; |
128 |
> |
data -= align(size); |
129 |
> |
assert(data >= proc); |
130 |
> |
return data; |
131 |
|
} |
132 |
|
|
133 |
|
inline void SheepMem::Release(uint32 size) |
134 |
|
{ |
135 |
< |
top += align(size); |
135 |
> |
data += align(size); |
136 |
> |
} |
137 |
> |
|
138 |
> |
inline uint32 SheepMem::ReserveProc(uint32 size) |
139 |
> |
{ |
140 |
> |
uint32 mproc = proc; |
141 |
> |
proc += align(size); |
142 |
> |
assert(proc < data); |
143 |
> |
return mproc; |
144 |
> |
} |
145 |
> |
|
146 |
> |
static inline uint32 SheepProc(const uint8 *proc, uint32 proc_size) |
147 |
> |
{ |
148 |
> |
uint32 mac_proc = SheepMem::ReserveProc(proc_size); |
149 |
> |
Host2Mac_memcpy(mac_proc, proc, proc_size); |
150 |
> |
return mac_proc; |
151 |
|
} |
152 |
|
|
153 |
|
class SheepVar |