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

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay