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-06-18 12:58:26 +02:00
|
|
|
{ "inv", RES },
|
|
|
|
{ "rip", RES },
|
|
|
|
{ "flg", RES },
|
|
|
|
|
|
|
|
{ "rbp", GPR },
|
|
|
|
{ "rsp", GPR },
|
|
|
|
|
|
|
|
{ "rx0", RES },
|
|
|
|
{ "rx1", RES },
|
|
|
|
{ "rx2", RES },
|
|
|
|
|
|
|
|
{ "rax", GPR },
|
|
|
|
{ "rbx", GPR },
|
|
|
|
{ "rcx", GPR },
|
|
|
|
{ "rdx", GPR },
|
|
|
|
{ "rsx", GPR },
|
|
|
|
{ "rbi", GPR },
|
|
|
|
{ "rsi", GPR },
|
|
|
|
{ "rdi", GPR },
|
|
|
|
|
|
|
|
{ "nx0", GPR },
|
|
|
|
{ "nx1", GPR },
|
|
|
|
{ "nx2", GPR },
|
|
|
|
{ "nx3", GPR },
|
|
|
|
{ "nx4", GPR },
|
|
|
|
{ "nx5", GPR },
|
|
|
|
{ "nx6", GPR },
|
|
|
|
{ "nx7", GPR },
|
|
|
|
|
|
|
|
{ "ax0", GPR },
|
|
|
|
{ "ax1", GPR },
|
|
|
|
{ "ax2", GPR },
|
|
|
|
{ "ax3", GPR },
|
|
|
|
{ "ax4", GPR },
|
|
|
|
{ "ax5", GPR },
|
|
|
|
{ "ax6", GPR },
|
|
|
|
{ "ax7", GPR },
|
|
|
|
|
|
|
|
{ "lx0", GPR },
|
|
|
|
{ "lx1", GPR },
|
|
|
|
{ "lx2", GPR },
|
|
|
|
{ "lx3", GPR },
|
|
|
|
{ "lx4", GPR },
|
|
|
|
{ "lx5", GPR },
|
|
|
|
{ "lx6", GPR },
|
|
|
|
{ "lx7", GPR },
|
|
|
|
|
|
|
|
{ "cr0", CTL },
|
|
|
|
{ "cr1", CTL },
|
|
|
|
{ "cr2", CTL },
|
|
|
|
{ "cr3", CTL },
|
|
|
|
{ "cr4", CTL },
|
|
|
|
{ "cr5", CTL },
|
|
|
|
{ "cr6", CTL },
|
|
|
|
{ "cr7", CTL },
|
|
|
|
|
|
|
|
{ "sa0", SYS },
|
|
|
|
{ "sa1", SYS },
|
|
|
|
{ "sa2", SYS },
|
|
|
|
{ "sa3", SYS },
|
|
|
|
{ "sa4", SYS },
|
|
|
|
{ "sa5", SYS },
|
|
|
|
{ "sa6", SYS },
|
|
|
|
{ "sa7", SYS },
|
2019-05-15 19:26:40 +02:00
|
|
|
};
|
|
|
|
|
2019-06-14 13:34:24 +02:00
|
|
|
#define DUMPREGS(down, up) \
|
|
|
|
for (i = down; i <= up; i++) { \
|
|
|
|
if (i % 4 == 0) \
|
2019-06-19 21:41:22 +02:00
|
|
|
trace("\n"); \
|
2019-06-14 13:34:24 +02:00
|
|
|
r = &ctx->r[i]; \
|
2019-06-19 21:41:22 +02:00
|
|
|
trace("%s=0x%-16lX ", r->name, R(i)); \
|
2019-06-14 13:34:24 +02:00
|
|
|
} \
|
|
|
|
|
2019-05-29 16:57:22 +02:00
|
|
|
void dumpregs(ctx_t *ctx)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
reg_t *r;
|
2019-05-30 12:44:56 +02:00
|
|
|
|
2019-06-21 22:19:55 +02:00
|
|
|
trace("Current RFRAME index: #%lu\n", rfs_current_idx);
|
2019-06-14 13:34:24 +02:00
|
|
|
|
2019-06-16 12:17:31 +02:00
|
|
|
DUMPREGS(RAX, RDI);
|
2019-06-14 13:34:24 +02:00
|
|
|
DUMPREGS(AX0, AX3);
|
|
|
|
DUMPREGS(LX0, LX3);
|
|
|
|
|
2019-06-19 21:41:22 +02:00
|
|
|
trace("\n");
|
2019-06-14 13:34:24 +02:00
|
|
|
DUMPREGS(NX0, NX3);
|
|
|
|
DUMPREGS(SA0, SA3);
|
|
|
|
DUMPREGS(CR0, CR3);
|
2019-06-18 22:56:41 +02:00
|
|
|
DUMPREGS(CR4, CR7);
|
2019-06-14 13:34:24 +02:00
|
|
|
|
2019-06-14 16:47:01 +02:00
|
|
|
|
2019-06-19 21:41:22 +02:00
|
|
|
trace("\n\nrip=0x%-16lX rsp=0x%-16lX rbp=0x%-16lX rx0=%-16lu\n\n",
|
|
|
|
rip, rsp, rbp, ctx->ninstrs);
|
2019-06-14 13:34:24 +02:00
|
|
|
|
2019-06-19 21:41:22 +02:00
|
|
|
trace("CF=%x OF=%x\n"
|
|
|
|
"ZF=%x SF=%x\n"
|
|
|
|
"PF=%x DF=%x\n"
|
|
|
|
"IF=%x UF=%x\n",
|
|
|
|
!!(flg&CF), !!(flg&OF),
|
|
|
|
!!(flg&ZF), !!(flg&SF),
|
|
|
|
!!(flg&PF), !!(flg&DF),
|
|
|
|
!!(cr0&IF), !!(cr0&UF));
|
2019-06-18 22:56:41 +02:00
|
|
|
|
|
|
|
assert(inv == 0);
|
2019-05-29 16:57:22 +02:00
|
|
|
}
|
|
|
|
|