mirror of
https://github.com/vivier/EMILE.git
synced 2024-12-21 18:30:20 +00:00
Add GetPhysical() trap
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
parent
80b3fbbec7
commit
2b6bc8a596
@ -7,6 +7,7 @@
|
||||
#ifndef __MACOS_MEMORY_H__
|
||||
#define __MACOS_MEMORY_H__
|
||||
|
||||
#include <macos/types.h>
|
||||
#include <macos/traps.h>
|
||||
|
||||
#ifdef __mc68000__
|
||||
@ -28,5 +29,30 @@ static inline void* NewPtr(unsigned long byteCount)
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
typedef struct MemoryBlock {
|
||||
void *address;
|
||||
unsigned long count;
|
||||
} MemoryBlock;
|
||||
|
||||
typedef struct LogicalToPhysicalTable {
|
||||
MemoryBlock logical;
|
||||
MemoryBlock physical[8];
|
||||
} LogicalToPhysicalTable;
|
||||
|
||||
static inline OSErr GetPhysical(LogicalToPhysicalTable *addresses,
|
||||
unsigned long *physicalEntryCount)
|
||||
{
|
||||
register OSErr ret asm("%%d0");
|
||||
|
||||
asm("move.l %1, %%a0\n"
|
||||
"move.l %2, %%a1\n"
|
||||
MemoryDispatch(_GetPhysical)
|
||||
: "=d" (ret) : "a" (addresses), "a" (physicalEntryCount)
|
||||
: UNPRESERVED_REGS );
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* __mc68000__ */
|
||||
#endif /* __MACOS_MEMORY_H__ */
|
||||
|
@ -25,6 +25,7 @@
|
||||
#define _PBStatusSync 0xA005
|
||||
#define _DvrRemove 0xA03E
|
||||
#define _ReadXPRam 0xA051
|
||||
#define _MemoryDispatch 0xA05C
|
||||
#define _SlotManager 0xA06E
|
||||
#define _HWPriv 0xA098
|
||||
#define _SCSIDispatch 0xA815
|
||||
@ -106,4 +107,28 @@
|
||||
HWPrivSelector(selector)" /* "#selector" */\n" \
|
||||
Trap(_HWPriv)
|
||||
|
||||
/*
|
||||
* Memory Dispatch selectors
|
||||
*
|
||||
*/
|
||||
|
||||
#define _HoldMemory 0x0000
|
||||
#define _UnholdMemory 0x0001
|
||||
#define _LockMemory 0x0002
|
||||
#define _UnlockMemory 0x0003
|
||||
#define _LockMemoryContiguous 0x0004
|
||||
#define _GetPhysical 0x0005
|
||||
#define _LockMemoryForOutput 0x000A
|
||||
#define _MakeMemoryResident 0x000B
|
||||
#define _ReleaseMemoryData 0x000C
|
||||
#define _MakeMemoryNonResident 0x000D
|
||||
#define _FlushMemory 0x000E
|
||||
#define _GetVolumeVirtualMemoryInfo 0x000F
|
||||
|
||||
#define MemoryDispatchSelector(a) " move.l #"#a", %%d0"
|
||||
|
||||
#define MemoryDispatch(selector) \
|
||||
MemoryDispatchSelector(selector)" /* "#selector" */\n" \
|
||||
Trap(_MemoryDispatch)
|
||||
|
||||
#endif /* __MACOS_TRAPS_H__ */
|
||||
|
Loading…
Reference in New Issue
Block a user