mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-01-04 23:24:56 +00:00
hv: get correct fault address for copy_to/from_gva
When doing copy_to/from_gva, it's possible the guest no page happens on none-first page. In this case, we need get correct fault address from gva2gpa. Signed-off-by: Yin Fengwei <fengwei.yin@intel.com> Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com> Acked-by: Anthony Xu <anthony.xu@intel.com> Acked-by: Eddie Dong <Eddie.dong@intel.com>
This commit is contained in:
@@ -97,11 +97,11 @@ static void dump_guest_reg(struct vcpu *vcpu)
|
||||
static void dump_guest_stack(struct vcpu *vcpu)
|
||||
{
|
||||
uint32_t i;
|
||||
uint64_t tmp[DUMP_STACK_SIZE];
|
||||
uint64_t tmp[DUMP_STACK_SIZE], fault_addr;
|
||||
uint32_t err_code = 0;
|
||||
|
||||
if (copy_from_gva(vcpu, tmp, vcpu_get_gpreg(vcpu, CPU_REG_RSP),
|
||||
DUMP_STACK_SIZE, &err_code) < 0) {
|
||||
DUMP_STACK_SIZE, &err_code, &fault_addr) < 0) {
|
||||
printf("\r\nUnabled to Copy Guest Stack:\r\n");
|
||||
return;
|
||||
}
|
||||
@@ -143,11 +143,11 @@ static void show_guest_call_trace(struct vcpu *vcpu)
|
||||
* if the address is invalid, it will cause hv page fault
|
||||
* then halt system */
|
||||
while ((count < CALL_TRACE_HIERARCHY_MAX) && (bp != 0)) {
|
||||
uint64_t parent_bp = 0UL;
|
||||
uint64_t parent_bp = 0UL, fault_addr;
|
||||
|
||||
err_code = 0U;
|
||||
err = copy_from_gva(vcpu, &parent_bp, bp, sizeof(parent_bp),
|
||||
&err_code);
|
||||
&err_code, &fault_addr);
|
||||
if (err < 0) {
|
||||
printf("\r\nUnabled to get Guest parent BP\r\n");
|
||||
return;
|
||||
|
||||
@@ -592,7 +592,7 @@ int shell_vcpu_dumpreg(int argc, char **argv)
|
||||
char temp_str[MAX_STR_SIZE];
|
||||
struct vm *vm;
|
||||
struct vcpu *vcpu;
|
||||
uint64_t i;
|
||||
uint64_t i, fault_addr;
|
||||
uint64_t tmp[DUMPREG_SP_SIZE];
|
||||
uint32_t err_code = 0;
|
||||
|
||||
@@ -676,7 +676,8 @@ int shell_vcpu_dumpreg(int argc, char **argv)
|
||||
|
||||
/* dump sp */
|
||||
status = copy_from_gva(vcpu, tmp, vcpu_get_gpreg(vcpu, CPU_REG_RSP),
|
||||
DUMPREG_SP_SIZE*sizeof(uint64_t), &err_code);
|
||||
DUMPREG_SP_SIZE*sizeof(uint64_t), &err_code,
|
||||
&fault_addr);
|
||||
if (status < 0) {
|
||||
/* copy_from_gva fail */
|
||||
shell_puts("Cannot handle user gva yet!\r\n");
|
||||
|
||||
Reference in New Issue
Block a user