source: grub-pc/trunk/fuentes/grub-core/gdb/i386/signal.c @ 22

Last change on this file since 22 was 22, checked in by mabarracus, 4 years ago

updated version and apply net.ifnames=0 into debian/rules

File size: 2.2 KB
Line 
1/* idt.c - routines for constructing IDT fot the GDB stub */
2/*
3 *  Copyright (C) 2006  Lubomir Kundrak
4 *
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.
9 *
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.
14 *
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.
18 */
19
20#include <grub/machine/memory.h>
21#include <grub/misc.h>
22#include <grub/cpu/gdb.h>
23#include <grub/gdb.h>
24
25/* Converting CPU trap number to UNIX signal number as
26   described in System V ABI i386 Processor Supplement, 3-25.  */
27unsigned int
28grub_gdb_trap2sig (int trap_no)
29{
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                                */
49  };
50
51  return signals[trap_no < 17 ? trap_no : 17];
52}
53
Note: See TracBrowser for help on using the repository browser.