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/trap.c
2019-07-11 18:34:21 +02:00

34 lines
628 B
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 <in/instrs.h>
IMPL_START_1(trap)
{
if (v1 > 255)
_except(ctx, E_ILL, "TRAP number greater than 255");
_except(ctx, v1 + 256, "TRAP instruction");
}
IMPL_END;
IMPL_START_0(into)
{
if (R(RFX) & OF)
_except(ctx, E_OVF, "INTO instruction with FLG.OF=1");
}
IMPL_END;
// XXX more checks
IMPL_START_0(iret)
{
trace("\nReturning from exception #%ld\n\n", R(R11));
R(RIP) = R(R13);
rfs_current_idx = R(R12);
ctx->rf = rfs[R(R12)];
}
IMPL_END;