X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm_excp.c;fp=palacios%2Fsrc%2Fpalacios%2Fvmm_excp.c;h=ea6cdc56a260baf47bbddca1fd29fba9c3f66188;hb=4db5b116275d135e67c67b0781fc8c184e884001;hp=0000000000000000000000000000000000000000;hpb=da745a84b3c0ae1127da37991c283b403402a822;p=palacios.git diff --git a/palacios/src/palacios/vmm_excp.c b/palacios/src/palacios/vmm_excp.c new file mode 100644 index 0000000..ea6cdc5 --- /dev/null +++ b/palacios/src/palacios/vmm_excp.c @@ -0,0 +1,98 @@ +/* + * This file is part of the Palacios Virtual Machine Monitor developed + * by the V3VEE Project with funding from the United States National + * Science Foundation and the Department of Energy. + * + * The V3VEE Project is a joint project between Northwestern University + * and the University of New Mexico. You can find out more at + * http://www.v3vee.org + * + * Copyright (c) 2008, Jack Lange + * Copyright (c) 2008, The V3VEE Project + * All rights reserved. + * + * Author: Jack Lange + * + * This is free software. You are permitted to use, + * redistribute, and modify it as specified in the file "V3VEE_LICENSE". + */ + +#include +#include +#include + +void v3_init_exception_state(struct guest_info * info) { + info->excp_state.excp_pending = 0; + info->excp_state.excp_num = 0; + info->excp_state.excp_error_code = 0; + +} + + + +int v3_raise_exception_with_error(struct guest_info * info, uint_t excp, uint_t error_code) { + struct v3_excp_state * excp_state = &(info->excp_state); + + if (excp_state->excp_pending == 0) { + excp_state->excp_pending = 1; + excp_state->excp_num = excp; + excp_state->excp_error_code = error_code; + excp_state->excp_error_code_valid = 1; + // PrintDebug("[v3_raise_exception_with_error] error code: %x\n", error_code); + } else { + PrintError("exception already pending, currently not implemented\n"); + return -1; + } + + return 0; +} + +int v3_raise_exception(struct guest_info * info, uint_t excp) { + struct v3_excp_state * excp_state = &(info->excp_state); + //PrintDebug("[v3_raise_exception]\n"); + if (excp_state->excp_pending == 0) { + excp_state->excp_pending = 1; + excp_state->excp_num = excp; + excp_state->excp_error_code = 0; + excp_state->excp_error_code_valid = 0; + } else { + PrintError("exception already pending, currently not implemented\n"); + return -1; + } + + return 0; +} + + +int v3_excp_pending(struct guest_info * info) { + struct v3_excp_state * excp_state = &(info->excp_state); + + if (excp_state->excp_pending == 1) { + return 1; + } + + return 0; +} + + +int v3_get_excp_number(struct guest_info * info) { + struct v3_excp_state * excp_state = &(info->excp_state); + + if (excp_state->excp_pending == 1) { + return excp_state->excp_num; + } + + return 0; +} + + +int v3_injecting_excp(struct guest_info * info, uint_t excp) { + struct v3_excp_state * excp_state = &(info->excp_state); + + excp_state->excp_pending = 0; + excp_state->excp_num = 0; + excp_state->excp_error_code = 0; + excp_state->excp_error_code_valid = 0; + + return 0; +}