Port-amd64 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: EINVAL from copyin/out - how?



Robert Elz wrote:
>Since copyout itself cannot return EINVAL (that is the .S code that implements
>it), it must be happening (so it seems) via some trap, that returns with EINVAL
>in ra - causing copyout to return EINVAL.  The question is whether it is
>some kind of trap related to reading the kernel address data (the address
>itself looks OK, the printf prints the args to copyout), or a trap related
>the write into user space I have no idea at the minute (it could even be some
>unrelated interrupt not restoring registers properly - but given the way the
>error occurs, when it occurs, that's incredibly unlikely.)

My understanding of the way the VM system works is that a pmap is in two
parts, a machine independent part and a part that contains whatever data
structures are required by the MMU.

The MI part is filled in when you make a call to map an area of memory,
the MD part is left unchanged at this time.

When you call copy{in,out}(), for the first time on a particular page
the MMU will cause the CPU to trap as that page will be missing from
the MD table, the trap handler will fix up the MD table for this page
using the info in the MI part then return back to the copy function
which will then retry what it was trying to do.




Home | Main Index | Thread Index | Old Index