mirror of
https://github.com/ksherlock/mpw.git
synced 2024-11-24 13:32:39 +00:00
Fix StripAddress when > 16 megs of ram in use.
This commit is contained in:
parent
245fabe648
commit
b146399a7e
@ -391,10 +391,6 @@ void GlobalInit()
|
||||
memoryWriteLong(0xffffffff, MacOS::MinusOne);
|
||||
|
||||
|
||||
// todo -- expects high stack, low heap.
|
||||
// the allocator currently works from the top down,
|
||||
// so put stack at top of memory?
|
||||
|
||||
// 0x0130 -- ApplLimit
|
||||
memoryWriteLong(Flags.memorySize - Flags.stackSize - 1, MacOS::ApplLimit);
|
||||
}
|
||||
@ -405,7 +401,7 @@ void CreateStack()
|
||||
// allocate stack, set A7...
|
||||
|
||||
uint32_t address;
|
||||
uint16_t error;
|
||||
//uint16_t error;
|
||||
|
||||
#if 0
|
||||
Flags.stackSize = (Flags.stackSize + 3) & ~0x03;
|
||||
@ -892,10 +888,8 @@ int main(int argc, char **argv)
|
||||
// for pre-fetch.
|
||||
memorySetMemory(Memory, MemorySize);
|
||||
|
||||
// should we subtract memory from the top
|
||||
// for the stack vs allocating it?
|
||||
|
||||
MM::Init(Memory, MemorySize - Flags.stackSize, kGlobalSize);
|
||||
MM::Init(Memory, MemorySize, kGlobalSize, Flags.stackSize);
|
||||
OS::Init();
|
||||
MPW::Init(argc, argv, defines);
|
||||
|
||||
|
@ -50,6 +50,7 @@ namespace
|
||||
|
||||
uint8_t *Memory;
|
||||
uint32_t MemorySize;
|
||||
uint32_t HeapSize;
|
||||
|
||||
// queue of free Handles
|
||||
std::deque<uint32_t> HandleQueue;
|
||||
@ -104,16 +105,17 @@ namespace
|
||||
namespace MM
|
||||
{
|
||||
|
||||
bool Init(uint8_t *memory, uint32_t memorySize, uint32_t reserved)
|
||||
bool Init(uint8_t *memory, uint32_t memorySize, uint32_t globals, uint32_t stack)
|
||||
{
|
||||
int ok;
|
||||
|
||||
Memory = memory;
|
||||
MemorySize = memorySize;
|
||||
HeapSize = memorySize - stack;
|
||||
|
||||
ok = mplite_init(&pool,
|
||||
memory + reserved,
|
||||
memorySize - reserved,
|
||||
memory + globals,
|
||||
memorySize - globals - stack,
|
||||
32,
|
||||
NULL);
|
||||
|
||||
@ -123,6 +125,9 @@ namespace MM
|
||||
|
||||
if (!alloc_handle_block()) return false;
|
||||
|
||||
|
||||
// create system handles for the stack and global space?
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -761,7 +766,7 @@ namespace MM
|
||||
|
||||
// MemorySize is the top of the heap. stack is after it.
|
||||
|
||||
return sp - MemorySize;
|
||||
return sp - HeapSize;
|
||||
}
|
||||
|
||||
|
||||
@ -1446,7 +1451,9 @@ namespace MM
|
||||
|
||||
Log("%04x StripAddress(%08x)\n", trap, address);
|
||||
|
||||
if (MemorySize <= 0x00ffffff)
|
||||
address &= 0x00ffffff;
|
||||
|
||||
return address;
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ namespace MM
|
||||
uint16_t HUnlock(uint32_t handle);
|
||||
}
|
||||
|
||||
bool Init(uint8_t *memory, uint32_t memorySize, uint32_t reserved);
|
||||
bool Init(uint8_t *memory, uint32_t memorySize, uint32_t globals, uint32_t stack);
|
||||
|
||||
|
||||
uint16_t BlockMove(uint16_t trap);
|
||||
|
Loading…
Reference in New Issue
Block a user