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/regs.c

51 lines
1.8 KiB
C
Raw Normal View History

2019-05-15 20:06:45 +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-05-15 19:26:40 +02:00
2019-06-21 22:19:55 +02:00
#include <pc/device.h>
2019-05-15 19:26:40 +02:00
2019-06-16 12:48:30 +02:00
reg_t arch_r[] =
2019-05-15 19:26:40 +02:00
{
2019-07-22 13:18:13 +02:00
{ "zero", GPR }, { "cr0", SYS }, { "cr1", SYS }, { "cr2", SYS },
{ "rfx", GPR }, { "rip", GPR }, { "rbp", GPR }, { "rsp", GPR },
2019-07-04 20:33:49 +02:00
{ "rax", GPR }, { "rbx", GPR }, { "rcx", GPR }, { "rdx", GPR },
2019-07-22 13:18:13 +02:00
{ "rsi", GPR }, { "rdi", GPR }, { "ax0", GPR }, { "ax1", GPR },
{ "ax2", GPR }, { "ax3", GPR }, { "ax4", GPR }, { "ax5", GPR },
2019-07-04 20:33:49 +02:00
2019-07-22 13:18:13 +02:00
{ "r12", GPR }, { "r13", GPR }, { "r14", GPR }, { "r15", GPR },
{ "r16", GPR }, { "r17", GPR }, { "r18", GPR }, { "r19", GPR },
{ "r20", GPR }, { "grp", GPR }, { "trp", GPR }, { "srp", SYS },
2019-05-15 19:26:40 +02:00
};
2019-07-01 00:45:08 +02:00
static_assert(sizeof(arch_r)/sizeof(reg_t) == NREGS, "");
2019-07-17 22:25:50 +02:00
#define TRACE logerr
2019-05-29 16:57:22 +02:00
void dumpregs(ctx_t *ctx)
{
2019-07-17 22:25:50 +02:00
TRACE("Current RFRAME index: #%lu", rfs_current_idx);
2019-05-30 12:44:56 +02:00
2019-07-17 22:25:50 +02:00
TRACE("\n\nEnviron:");
2019-07-24 16:52:26 +02:00
TRACE("\nrpc=0x%-16lX rip=0x%-16lX rfx=0x%-16lX", ctx->cur_pc, R(RIP), R(RFX));
2019-07-17 22:25:50 +02:00
TRACE("\nrsp=0x%-16lX rbp=0x%-16lX trp=0x%-16lX", R(RSP), R(RBP), R(TRP));
2019-07-24 16:52:26 +02:00
TRACE("\nfc0=0x%-16lu cr0=0x%-16lX cr1=0x%-16lX", ctx->ninstrs, R(CR0), R(CR1));
2019-07-01 00:45:08 +02:00
2019-07-17 22:25:50 +02:00
TRACE("\n\nArgument:");
TRACE("\nax0=0x%-16lX ax1=0x%-16lX ax2=0x%-16lX", R(AX0), R(AX1), R(AX2));
TRACE("\nax3=0x%-16lX ax4=0x%-16lX ax5=0x%-16lX", R(AX3), R(AX4), R(AX5));
2019-06-23 21:12:25 +02:00
2019-07-17 22:25:50 +02:00
TRACE("\n\nVolatile:");
2019-07-22 13:18:13 +02:00
TRACE("\nrax=0x%-16lX rbx=0x%-16lX rcx=0x%-16lX", R(RAX), R(RBX), R(RCX));
TRACE("\nrdx=0x%-16lX rsi=0x%-16lX rdi=0x%-16lX", R(RDX), R(RSI), R(RDI));
2019-06-23 21:12:25 +02:00
2019-07-17 22:25:50 +02:00
TRACE("\n\nPersistent:");
2019-07-22 13:18:13 +02:00
TRACE("\nr12=0x%-16lX r13=0x%-16lX r14=0x%-16lX", R(R12), R(R13), R(R14));
TRACE("\nr15=0x%-16lX r16=0x%-16lX r17=0x%-16lX", R(R15), R(R16), R(R17));
TRACE("\nr18=0x%-16lX r19=0x%-16lX r20=0x%-16lX", R(R18), R(R19), R(R20));
2019-06-14 13:34:24 +02:00
2019-07-17 22:25:50 +02:00
TRACE("\n");
2019-06-18 22:56:41 +02:00
2019-07-17 22:25:50 +02:00
assert(R(RZX) == 0);
2019-05-29 16:57:22 +02:00
}