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

Last change on this file since 396 was 380, checked in by alain, 7 years ago

Remove the generic kernel/kern/do_exception files to handle exceptions in HAL.
The HAL call only the vmm_handle_page_fault() function if required.

File size: 3.0 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//
[380]34// - NON_FATAL : exceptions such as "page unmapped" or "FPU unusable" can be non fatal.
35//   => The hal_do_exception() function call the generic vmm_handle_page_fault(),
36//      or the fpu_handle_exception() function, and the calling thread resumes execution
37//      when the exception has been handled.
[16]38//
[380]39// - USER_ERROR : exceptions such a "illegal vaddr" or "illegal write access" are fatal.
40//   => The hal_do_exception() function send a kill signal to the calling thread process,
41//      and displays an error message on TXT0.
[16]42//
[380]43// - KERNEL_PANIC : "kernel mistakes" are abnormal events.
44//   => The hal_do_exception() function calls the generic panic() function, to display
45//      a message on TXT0, disable IRQs and call the hal_core_sleep() function.
[16]46//
[380]47// For all exceptions, the faulty core context has been saved in a registers array
48// stored in the user thread descriptor (for a core in user mode), and in the
49// kernel stack (for a core in kernel mode).
[16]50//
51// Any architecture specific implementation must implement this API.
52//////////////////////////////////////////////////////////////////////////////////////////
53
54/**** forward declaration  ****/
55
56struct thread_s;
57
58/*****************************************************************************************
[380]59 * This function is called by the hal_kentry() function when an exception is detected by
60 * the hardware for a given thread running on a given core.
[16]61 *****************************************************************************************
62 * @ this      : pointer on the faulty thread descriptor.
[380]63 * @ regs_tbl  : array containing the core registers values saved by hal_kentry().
[16]64 ****************************************************************************************/
65void hal_do_exception( struct thread_s * this, 
66                       reg_t           * regs_tbl );
67
68#endif  // _HAL_EXCEPTION_H_
Note: See TracBrowser for help on using the repository browser.