Hi -

On 2016-08-03 at 11:39 Gan Shun <[email protected]> wrote:
> diff --git a/user/vmm/decode.c b/user/vmm/decode.c
> index a38438c..5df5095 100644
> --- a/user/vmm/decode.c
> +++ b/user/vmm/decode.c
> @@ -36,6 +36,7 @@
>  #include <vmm/virtio_mmio.h>
>  #include <vmm/virtio_ids.h>
>  #include <vmm/virtio_config.h>
> +#include <ros/arch/mmu.h>
>  #include <ros/arch/trapframe.h>
>  
>  int debug_decode = 0;
> @@ -197,6 +198,7 @@ int decode(struct guest_thread *vm_thread, uint64_t *gpa, 
> uint8_t *destreg,
>             uint64_t **regp, int *store, int *size, int *advance)
>  {
>       struct vm_trapframe *vm_tf = &(vm_thread->uthread.u_ctx.tf.vm_tf);
> +     uint8_t *kva = NULL;

Minor thing.  Can you rename kva to something else?  It's not a kernel
virtual address, which threw me off for a bit.

>       DPRINTF("v is %p\n", vm_tf);
>  
> @@ -210,17 +212,15 @@ int decode(struct guest_thread *vm_thread, uint64_t 
> *gpa, uint8_t *destreg,
>       *gpa = vm_tf->tf_guest_pa;
>       DPRINTF("gpa is %p\n", *gpa);
>  
> -     // To find out what to do, we have to look at
> -     // RIP. Technically, we should read RIP, walk the page tables
> -     // to find the PA, and read that. But we're in the kernel, so
> -     // we take a shortcut for now: read the low 30 bits and use
> -     // that as the kernel PA, or our VA, and see what's
> -     // there. Hokey. Works.
> -     uint8_t *kva = (void *)(vm_tf->tf_rip & 0x3fffffff);
> +     DPRINTF("rip is %p\n", vm_tf->tf_rip);
> +
> +     if (rippa(vm_thread, (uint64_t *)&kva))
> +             return VM_PAGE_FAULT;
>       DPRINTF("kva is %p\n", kva);

For instance, down here kva is the physical address of the %rip.

Thanks,
Barret

-- 
You received this message because you are subscribed to the Google Groups 
"Akaros" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to