kvisc/vm/in/instrs.h

32 lines
1.6 KiB
C
Raw Normal View History

2019-05-30 12:44:56 +02:00
// The OS/K Team licenses this file to you under the MIT license.
2019-05-15 21:56:42 +02:00
// See the LICENSE file in the project root for more information.
2019-05-15 21:47:08 +02:00
2019-06-05 12:53:09 +02:00
#include <pc/arch.h>
2019-05-15 21:47:08 +02:00
2019-06-13 15:00:48 +02:00
//----------------------------------------------------------------------------//
2019-08-08 18:39:12 +02:00
#define IMPL_START(name, n) \
uint i_##name##_##n(acc_t *p1, acc_t *p2, acc_t *p3, \
2019-08-14 20:23:05 +02:00
ulong *r1, ulong *r2) \
2019-07-01 21:46:36 +02:00
2019-08-03 17:41:44 +02:00
#define XSRCP(v, p, x) \
if (ACC_FMT_IS_MEM(p->type)) \
2019-08-03 19:01:12 +02:00
v = readmem##x(p->addr, p->mlen); \
2019-08-03 17:41:44 +02:00
else v = p->val; \
#define SRCP(p) \
if (__builtin_expect(ACC_FMT_IS_MEM(p->type), 0)) \
2019-08-03 19:01:12 +02:00
p->val = readmemsx(p->addr, p->mlen); \
2019-08-03 17:41:44 +02:00
2019-07-04 20:33:49 +02:00
//----------------------------------------------------------------------------//
2019-05-16 16:48:45 +02:00
#define CHK_SUPERV() \
do { \
2019-07-11 18:34:21 +02:00
if ((R(CR0) & UF) > 0) { \
2019-08-03 19:01:12 +02:00
_except(E_SYS, "Supervisor-only INSTR"); \
2019-05-16 16:48:45 +02:00
} \
} while (0)
2019-05-15 21:47:08 +02:00
2019-06-13 15:00:48 +02:00
//----------------------------------------------------------------------------//