DEV Community

Van a performance artist
Van a performance artist

Posted on

how to pass pointer from user to kernel in xv6

the addr in usermode and kernel mode it different. so while passing pointer to kernel mode, we should just pass a uint64 var to it.
then we can get it through function as a var.
Image description
it is more like a offset, later we can locate it.

Image description
argaddr works same like argint, it capture the arg of syscall from proc sturcture

Image description
then we can get the real address of the virtual address by its pagetable and offset easily

Image description

Image description
memmove part is pretty simple, kernel mode has the right to access all address
Image description

Top comments (0)