kvisc/vm/in/trap.c

34 lines
628 B
C
Raw Normal View History

2019-06-18 22:56:41 +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.
#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;
2019-07-09 19:51:03 +02:00
IMPL_START_0(into)
{
2019-07-11 18:34:21 +02:00
if (R(RFX) & OF)
2019-07-09 19:51:03 +02:00
_except(ctx, E_OVF, "INTO instruction with FLG.OF=1");
}
IMPL_END;
2019-06-18 22:56:41 +02:00
// XXX more checks
IMPL_START_0(iret)
{
2019-07-09 19:51:03 +02:00
trace("\nReturning from exception #%ld\n\n", R(R11));
2019-07-11 18:34:21 +02:00
R(RIP) = R(R13);
2019-07-09 19:51:03 +02:00
rfs_current_idx = R(R12);
ctx->rf = rfs[R(R12)];
2019-06-18 22:56:41 +02:00
}
IMPL_END;