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>
24 void v3_init_exception_state(struct guest_info * info) {
25 info->excp_state.excp_pending = 0;
26 info->excp_state.excp_num = 0;
27 info->excp_state.excp_error_code = 0;
33 int v3_raise_exception_with_error(struct guest_info * info, uint_t excp, uint_t error_code) {
34 struct v3_excp_state * excp_state = &(info->excp_state);
36 if (excp_state->excp_pending == 0) {
37 excp_state->excp_pending = 1;
38 excp_state->excp_num = excp;
39 excp_state->excp_error_code = error_code;
40 excp_state->excp_error_code_valid = 1;
41 // PrintDebug("[v3_raise_exception_with_error] error code: %x\n", error_code);
43 PrintError("Error injecting exception_w_error (excp=%d) (error=%d) -- Exception (%d) (error=%d) already pending\n",
44 excp, error_code, excp_state->excp_num, excp_state->excp_error_code);
51 int v3_raise_exception(struct guest_info * info, uint_t excp) {
52 struct v3_excp_state * excp_state = &(info->excp_state);
53 //PrintDebug("[v3_raise_exception]\n");
54 if (excp_state->excp_pending == 0) {
55 excp_state->excp_pending = 1;
56 excp_state->excp_num = excp;
57 excp_state->excp_error_code = 0;
58 excp_state->excp_error_code_valid = 0;
60 PrintError("Error injecting exception (excp=%d) -- Exception (%d) (error=%d) already pending\n",
61 excp, excp_state->excp_num, excp_state->excp_error_code);
69 int v3_excp_pending(struct guest_info * info) {
70 struct v3_excp_state * excp_state = &(info->excp_state);
72 if (excp_state->excp_pending == 1) {
80 int v3_get_excp_number(struct guest_info * info) {
81 struct v3_excp_state * excp_state = &(info->excp_state);
83 if (excp_state->excp_pending == 1) {
84 return excp_state->excp_num;
91 int v3_injecting_excp(struct guest_info * info, uint_t excp) {
92 struct v3_excp_state * excp_state = &(info->excp_state);
94 excp_state->excp_pending = 0;
95 excp_state->excp_num = 0;
96 excp_state->excp_error_code = 0;
97 excp_state->excp_error_code_valid = 0;