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

Last change on this file since 626 was 619, checked in by alain, 5 years ago

1) Fix a bug in KSH : after the "load" command,

the [ksh] prompt is now printed after completion
of the loaded application.

2) Fix a bug in vmm_handle_cow() : the copy-on-write

use now a hal_remote_memcpy() to replicate the page content.


File size: 2.9 KB
Line 
1/*
2 * hal_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_kernel_types.h>
28#include <thread.h>
29
30//////////////////////////////////////////////////////////////////////////////////////////
31//     Architecture specific exception handler API
32//
33// ALMOS-MKH defines three classes of exceptions:
34//
35// - NON_FATAL : exceptions such as "page unmapped" or "FPU unusable" can be non fatal.
36//   => The hal_do_exception() function call the generic vmm_handle_page_fault(),
37//      or the fpu_handle_exception() function, and the calling thread resumes execution
38//      when the exception can be  sucessfully handled.
39//
40// - USER_ERROR : exceptions such a "illegal vaddr" or "illegal write access" are fatal.
41//   => The hal_do_exception() function send a kill signal to the calling thread process,
42//      and displays an error message on TXT0.
43//
44// - KERNEL_PANIC : "kernel mistakes" are abnormal events.
45//   => The hal_do_exception() function calls the generic panic() function, to display
46//      a message on TXT0, disable IRQs and call the hal_core_sleep() function.
47//
48// For all exceptions, the faulty core registers have been saved in the "uzone"
49// that can be accessed through the "uzone" pointer stored in thread descriptor.
50//////////////////////////////////////////////////////////////////////////////////////////
51
52
53/*****************************************************************************************
54 * This enum defines the global exception types after analysis by the exception handler.
55 ****************************************************************************************/
56
57typedef enum
58{
59    EXCP_NON_FATAL,
60    EXCP_USER_ERROR,
61    EXCP_KERNEL_PANIC,
62
63}
64exception_handling_type_t;
65
66
67/*****************************************************************************************
68 * This function is called by the hal_kentry() function when an exception is detected by
69 * the hardware for a given thread running on a given core.
70 ****************************************************************************************/
71void hal_do_exception( void );
72
73
74#endif  // _HAL_EXCEPTION_H_
Note: See TracBrowser for help on using the repository browser.