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/in/instrs.h
julianb0 cbd079d2a0
vm
2019-08-14 20:23:05 +02:00

32 lines
1.6 KiB
C

// The OS/K Team licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#include <pc/arch.h>
//----------------------------------------------------------------------------//
#define IMPL_START(name, n) \
uint i_##name##_##n(acc_t *p1, acc_t *p2, acc_t *p3, \
ulong *r1, ulong *r2) \
#define XSRCP(v, p, x) \
if (ACC_FMT_IS_MEM(p->type)) \
v = readmem##x(p->addr, p->mlen); \
else v = p->val; \
#define SRCP(p) \
if (__builtin_expect(ACC_FMT_IS_MEM(p->type), 0)) \
p->val = readmemsx(p->addr, p->mlen); \
//----------------------------------------------------------------------------//
#define CHK_SUPERV() \
do { \
if ((R(CR0) & UF) > 0) { \
_except(E_SYS, "Supervisor-only INSTR"); \
} \
} while (0)
//----------------------------------------------------------------------------//