source: trunk/hal/generic/hal_exception.h @ 165

Last change on this file since 165 was 17, checked in by max@…, 8 years ago

Typos, and cosmetic.

File size: 3.4 KB
RevLine 
[16]1/*
2 * hal_do_exception.c - Architecture specific exception handler API definition
3 *
4 * Authors    Alain Greiner (2016,2017)
5 *
6 * Copyright (c) UPMC Sorbonne Universites
7 *
8 * This file is part of ALMOS-MKH.
9 *
10 * ALMOS-MKH is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; version 2.0 of the License.
13 *
14 * ALMOS-MKH is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with ALMOS-MKH; if not, write to the Free Software Foundation,
21 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24#ifndef _HAL_EXCEPTION_H_
25#define _HAL_EXCEPTION_H_
26
27#include <hal_types.h>
28
29//////////////////////////////////////////////////////////////////////////////////////////
30//     Architecture specific exception handler API
31//
32// ALMOS-MKH defines three classes of exceptions:
33//
[17]34// - NON_FATAL : exceptions such as "page fault" or "FPU unusable" are non fatal.
35//   The calling thread resumes execution when the exception has been handled.
[16]36//
37// - USER_ERROR : these exceptions such a "illegal vaddr" or "illegal write access"
38//   are fatal. The calling thread process is killed, after an "error" message on the
39//   kernel terminal.
40//
41// - KERNEL_PANIC : events such as "no memory" or "kernel mistakes" are considered
[17]42//   abnormal events. The calling core goes to sleep, after a "panic" message
[16]43//   on the kernel terminal.
44//
45// For all exceptions, the faulty core context has been saved in a registers
46// array stored in the user thread descriptor (core in user mode), and in the
47// kernel stack (core in kernel mode).
48//
49// Any architecture specific implementation must implement this API.
50//////////////////////////////////////////////////////////////////////////////////////////
51
52/**** forward declaration  ****/
53
54struct thread_s;
55
56/*****************************************************************************************
57 * This function implements the ALMOS-MKH exception handler.
58 * It is called by the hal_kentry function when an exception is detected
59 * by the hardware for an user thread running on a given core.
60 *****************************************************************************************
61 * @ this      : pointer on the faulty thread descriptor.
62 * @ regs_tbl  : array containing the core registers values saved by hal_kentry.
63 ****************************************************************************************/
64void hal_do_exception( struct thread_s * this, 
65                       reg_t           * regs_tbl );
66
67/*****************************************************************************************
[17]68 * This function prints on the kernel terminal the saved context (core registers)
[16]69 * and the thread state of a faulty thread.
70 *****************************************************************************************
71 * @ this      : pointer on the faulty thread descriptor.
72 * @ regs_tbl  : pointer on the array containing the core registers values.
73 ****************************************************************************************/
74void hal_exception_dump( struct thread_s * this,
75                         reg_t           * regs_tbl );
76
77#endif  // _HAL_EXCEPTION_H_
Note: See TracBrowser for help on using the repository browser.