2 * This file is part of the Palacios Virtual Machine Monitor developed
3 * by the V3VEE Project with funding from the United States National
4 * Science Foundation and the Department of Energy.
6 * The V3VEE Project is a joint project between Northwestern University
7 * and the University of New Mexico. You can find out more at
10 * Copyright (c) 2008, Jack Lange <jarusl@cs.northwestern.edu>
11 * Copyright (c) 2008, The V3VEE Project <http://www.v3vee.org>
12 * All rights reserved.
14 * Author: Jack Lange <jarusl@cs.northwestern.edu>
16 * This is free software. You are permitted to use,
17 * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
20 #include <palacios/vmm_excp.h>
21 #include <palacios/vmm.h>
22 #include <palacios/vmm_types.h>
23 #include <palacios/vm_guest.h>
25 void v3_init_exception_state(struct guest_info * info) {
26 info->excp_state.excp_pending = 0;
27 info->excp_state.excp_num = 0;
28 info->excp_state.excp_error_code = 0;
34 int v3_raise_exception_with_error(struct guest_info * info, uint_t excp, uint_t error_code) {
35 struct v3_excp_state * excp_state = &(info->excp_state);
37 if (excp_state->excp_pending == 0) {
38 excp_state->excp_pending = 1;
39 excp_state->excp_num = excp;
40 excp_state->excp_error_code = error_code;
41 excp_state->excp_error_code_valid = 1;
42 // PrintDebug("[v3_raise_exception_with_error] error code: %x\n", error_code);
44 PrintError("Error injecting exception_w_error (excp=%d) (error=%d) -- Exception (%d) (error=%d) already pending\n",
45 excp, error_code, excp_state->excp_num, excp_state->excp_error_code);
52 int v3_raise_exception(struct guest_info * info, uint_t excp) {
53 struct v3_excp_state * excp_state = &(info->excp_state);
54 //PrintDebug("[v3_raise_exception]\n");
55 if (excp_state->excp_pending == 0) {
56 excp_state->excp_pending = 1;
57 excp_state->excp_num = excp;
58 excp_state->excp_error_code = 0;
59 excp_state->excp_error_code_valid = 0;
61 PrintError("Error injecting exception (excp=%d) -- Exception (%d) (error=%d) already pending\n",
62 excp, excp_state->excp_num, excp_state->excp_error_code);
70 int v3_excp_pending(struct guest_info * info) {
71 struct v3_excp_state * excp_state = &(info->excp_state);
73 if (excp_state->excp_pending == 1) {
81 int v3_get_excp_number(struct guest_info * info) {
82 struct v3_excp_state * excp_state = &(info->excp_state);
84 if (excp_state->excp_pending == 1) {
85 return excp_state->excp_num;
92 int v3_injecting_excp(struct guest_info * info, uint_t excp) {
93 struct v3_excp_state * excp_state = &(info->excp_state);
95 excp_state->excp_pending = 0;
96 excp_state->excp_num = 0;
97 excp_state->excp_error_code = 0;
98 excp_state->excp_error_code_valid = 0;