add place-holder directory for the a3000 wd533c93 scsi controller implementation.
[AROS.git] / arch / i386-all / exec / alert_cpu.c
blobc7fb94aa4ecc27d3d9119ba243469123c1d49ca3
1 /*
2 Copyright © 2010-2012, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: CPU context parsing routines.
6 Lang: english
7 */
9 #include <exec/rawfmt.h>
10 #include <proto/exec.h>
12 #include <string.h>
14 #include "exec_intern.h"
15 #include "exec_util.h"
17 static const char *gpr_fmt = "EAX=0x%08lx EBX=0x%08lx ECX=0x%08lx EDX=0x%08lx\n"
18 "ESI=0x%08lx EDI=0x%08lx ESP=0x%08lx EBP=0x%08lx\n"
19 "EIP=0x%08lx ESP=0x%08lx EFLAGS=0x%08lx";
21 static const char *seg_fmt = "\nCS=%04lx SS=%04lx DS=%04lx\n"
22 "ES=%04lx FS=%04lx GS=%04lx";
24 char *FormatCPUContext(char *buffer, struct ExceptionContext *ctx, struct ExecBase *SysBase)
26 VOID_FUNC dest = buffer ? RAWFMTFUNC_STRING : RAWFMTFUNC_SERIAL;
27 char *buf;
29 buf = NewRawDoFmt(gpr_fmt, dest, buffer,
30 ctx->eax, ctx->ebx, ctx->ecx, ctx->edx,
31 ctx->esi, ctx->edi, ctx->esp, ctx->ebp,
32 ctx->eip, ctx->esp, ctx->eflags);
33 if (ctx->Flags & ECF_SEGMENTS)
35 buf = NewRawDoFmt(seg_fmt, dest, buf - 1,
36 ctx->cs, ctx->ss, ctx->ds,
37 ctx->es, ctx->fs, ctx->gs);
40 return buf - 1;
43 /* Unwind a single stack frame. CPU-dependent. */
44 APTR UnwindFrame(APTR fp, APTR *caller)
46 APTR *ebp = fp;
48 *caller = ebp[1]; /* Fill in caller address */
49 return ebp[0]; /* Return pointer to the previous frame */