1/*	$OpenBSD: debug_md.h,v 1.8 2022/12/08 01:25:45 guenther Exp $	*/
2
3/*
4 * Copyright (c) 1997 Michael Shalayeff
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 *    notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 *    notice, this list of conditions and the following disclaimer in the
14 *    documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 */
29
30#define	REG_NAMES	\
31	"eax", "ecx", "edx", "ebx", "esp", \
32	"ebp", "esi", "edi", "eip", "eflags", \
33	"cs",  "ss",  "ds",  "es",  "fs", \
34	"gs"
35#define REG_VALUES(r)	\
36	&(r).r_eax, &(r).r_ecx, &(r).r_edx, &(r).r_ebx, &(r).r_esp, \
37	&(r).r_ebp, &(r).r_esi, &(r).r_edi, &(r).r_eip, &(r).r_eflags, \
38	&(r).r_cs , &(r).r_ss,  &(r).r_ds,  &(r).r_es,  &(r).r_fs, \
39	&(r).r_gs
40#define TRAP_NAMES	\
41	"invalid opcode fault", "breakpoint trap", "arithmetic trap", \
42	"asynchronous system trap", "protection fault", "trace trap", \
43	"page fault", "alignment fault", "integer divide fault", \
44	"non-maskable interrupt", "overflow trap", "bounds check fault", \
45	"device not available fault", "double fault", \
46	"fp coprocessor operand fetch fault (![P]Pro)", "invalid tss fault", \
47	"segment not present fault", "stack fault", "machine check ([P]Pro)", \
48	"reserved fault base"
49
50#ifdef	_LOCORE
51	.globl	reg
52#define DUMP_REGS	int $2
53#else
54#define DUMP_REGS	__asm("int $2")
55extern struct reg reg;
56#endif
57