-
Notifications
You must be signed in to change notification settings - Fork 0
/
exception.c
55 lines (44 loc) · 883 Bytes
/
exception.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
An interface for handling exceptions.
*/
#include "exception.h"
#include <stdio.h>
static xsm_exception _exception;
/* Set the exception variables */
int exception_set(char *message, int type, int mode)
{
_exception.message = message;
_exception.type = type;
_exception.mode = mode;
return XSM_SUCCESS;
}
/* Retrieve the exception message */
char *exception_message()
{
return _exception.message;
}
/* Retrieve the exception type */
int exception_code()
{
return _exception.type;
}
/* Set memory address */
void exception_set_ma(int address)
{
_exception.ma = address;
}
/* Set exception page number */
void exception_set_epn(int page)
{
_exception.epn = page;
}
/* Retrieve memory address */
int exception_get_ma()
{
return _exception.ma;
}
/* Retrieve exception page number */
int exception_get_epn()
{
return _exception.epn;
}