Indentation fix, cleanup.
[AROS.git] / arch / all-pc / boot / grub2-aros / grub-core / gdb / i386 / signal.c
blob1ac3bbd183d86cd84430223818a2910b45377645
1 /* idt.c - routines for constructing IDT fot the GDB stub */
2 /*
3 * Copyright (C) 2006 Lubomir Kundrak
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #include <grub/machine/memory.h>
21 #include <grub/misc.h>
22 #include <grub/cpu/gdb.h>
23 #include <grub/gdb.h>
25 /* Converting CPU trap number to UNIX signal number as
26 described in System V ABI i386 Processor Supplement, 3-25. */
27 unsigned int
28 grub_gdb_trap2sig (int trap_no)
30 const int signals[] = {
31 SIGFPE, /* 0: Divide error fault */
32 SIGTRAP, /* 1: Single step trap fault */
33 SIGABRT, /* 2: # Nonmaskable interrupt */
34 SIGTRAP, /* 3: Breakpoint trap */
35 SIGSEGV, /* 4: Overflow trap */
36 SIGSEGV, /* 5: Bounds check fault */
37 SIGILL, /* 6: Invalid opcode fault */
38 SIGFPE, /* 7: No coprocessor fault */
39 SIGABRT, /* 8: # Double fault abort */
40 SIGSEGV, /* 9: Coprocessor overrun abort */
41 SIGSEGV, /* 10: Invalid TSS fault */
42 SIGSEGV, /* 11: Segment not present fault */
43 SIGSEGV, /* 12: Stack exception fault */
44 SIGSEGV, /* 13: General protection fault abort */
45 SIGSEGV, /* 14: Page fault */
46 SIGABRT, /* 15: (reserved) */
47 SIGFPE, /* 16: Coprocessor error fault */
48 SIGUSR1 /* other */
51 return signals[trap_no < 17 ? trap_no : 17];