On Sun, Apr 09, 2006 at 12:49:15AM -0700, Xie Gang
wrote:> Hi,all
> I don''t quite understand the the issue "Pointers and Address
Spaces" mentioned in dtrace guide.
> It says that Applying the * or [] operators to the address of user space
in D would result in a kernel address space access, which would result in an
> invalid address error .
> The intel x86 address space share the same address space for user and
kernel. And why is there an error?
On Intel, we use the same address space for user and kernel, but only as
an implementation detail -- certainly nothing we''d want to expose to
users.
Further, writing a script that depended on that knowledge would allow for
scripts that worked on architectures with shared user/kernel AS (e.g. x86)
and failed on other architectures (e.g. SPARC). (In fact, we used to have
exactly this problem before we added the correct checks for memory accesses.)
I think the useability point that you''re actually making is that
it''s a
pain to have to manually copyin() from an address that DTrace could figure
out was an user-land address. We have planned some ways of doing copyout
"automagic", but I''m not sure when that will happen.
Adam
--
Adam Leventhal, Solaris Kernel Development http://blogs.sun.com/ahl