You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.2 KiB
C
38 lines
1.2 KiB
C
/* See the end of this file for copyright and license terms. */
|
|
|
|
#include <arch/segment.h>
|
|
#include <arch/trap.h>
|
|
|
|
#include <gay/kprintf.h>
|
|
#include <gay/systm.h>
|
|
|
|
void print_regs(const struct i386_trap_frame *ctx)
|
|
{
|
|
u32 esp;
|
|
if (ctx->hw_frame->cs == X86_32_USER_CS)
|
|
esp = ctx->hw_frame->user_esp;
|
|
else
|
|
esp = ctx->esp - 3 * 4; /* eip, cs, eflags */
|
|
|
|
kprintf("EIP = %#x:%#08x\n", ctx->hw_frame->cs, ctx->hw_frame->eip);
|
|
kprintf("EFLAGS = %#08x\n", ctx->hw_frame->eflags);
|
|
kprintf("EAX = %#08x EDI = %#08x\n", ctx->eax, ctx->edi);
|
|
kprintf("EBX = %#08x ESI = %#08x\n", ctx->ebx, ctx->esi);
|
|
kprintf("ECX = %#08x ESP = %#08x\n", ctx->ecx, esp);
|
|
kprintf("EDX = %#08x EBP = %#08x\n", ctx->edx, ctx->ebp);
|
|
}
|
|
|
|
/*
|
|
* This file is part of GayBSD.
|
|
* Copyright (c) 2021 fef <owo@fef.moe>.
|
|
*
|
|
* GayBSD is nonviolent software: you may only use, redistribute, and/or
|
|
* modify it under the terms of the Cooperative Nonviolent Public License
|
|
* (CNPL) as found in the LICENSE file in the source code root directory
|
|
* or at <https://git.pixie.town/thufie/npl-builder>; either version 7
|
|
* of the license, or (at your option) any later version.
|
|
*
|
|
* GayBSD comes with ABSOLUTELY NO WARRANTY, to the extent
|
|
* permitted by applicable law. See the CNPL for details.
|
|
*/
|