1
0
mirror of https://gitlab.os-k.eu/os-k-team/kvisc.git synced 2023-08-25 14:05:46 +02:00
kvisc/vm/pc/mem.h

28 lines
821 B
C
Raw Normal View History

2019-06-14 16:47:01 +02:00
// The OS/K Team licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
2019-06-15 13:42:30 +02:00
static inline ushort bswap16(ushort u)
{ return ((u<<8) | (u>>8)); }
static inline char getmempref(ushort len)
2019-07-24 16:52:26 +02:00
{ return (len==1?'b':(len==2?'w':(len==4?'d':(len==8?'q':'x')))); }
2019-06-15 13:42:30 +02:00
2019-06-14 16:47:01 +02:00
#define MEMOFF (1 * 1024 * 1024)
#define MEMSIZE (16 * 1024 * 1024) // 16MB
2019-07-10 17:17:45 +02:00
#define MAXADDR 0x8000000000000 // 2^48 - 1
2019-07-24 16:52:26 +02:00
#define addr2real(p) ((p) - MEMOFF)
#define real2addr(p) ((p) + MEMOFF)
2019-06-14 16:47:01 +02:00
// Address of boot firmware stack
#define FWSTACK (MEMOFF * 2) // 2MB
2019-08-03 19:01:12 +02:00
ulong readstr(ulong addr, ulong maxn, char *buf);
ulong writestr(ulong addr, ulong maxn, char *str);
2019-06-26 21:25:59 +02:00
2019-08-03 19:01:12 +02:00
ulong readmemzx(ulong addr, uint len);
ulong readmemsx(ulong addr, uint len);
void writemem(ulong val, ulong addr, uint len);
2019-06-23 20:56:04 +02:00