zhihui Chen wrote:
> Thanks.  Does this mean that all data used in Kernel can be accessed 
> directly without using copyin and copyinstr function?
>  
Mostly. There are a number of places where addresses are passed
around in the kernel that have a flag in another register or structure
that indicates this address actually refers to user data and must be
copied in before accessing (e.g., the early stages of processing a
write system call). Some cases refer to addresses where date will
be placed when done (e.g., read system call).

It really is important to spend some time following the code through
various calls of interest and looking to see how variables are used.
> I tried to trace its value with following:
> printf("mp=0x%x\n",*(int *)(self->arg1));
>  
> but each time the output value is 0x0, is it right?
>  
Haven't any idea without spending more time looking at things.

Jim
----
> Thanks
> Zhihui
>  
> 2008/7/20, James Litchfield <[EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]>>:
>
>     Isn't the second argument to kstrgetmsg a **mblk_t (i.e., a
>     pointer already in the kernel address space)?
>
>         *int*
>           7191 kstrgetmsg
>         <http://src.opensolaris.org/source/s?refs=kstrgetmsg>(
>           7192         *struct* vnode
>         <http://src.opensolaris.org/source/s?defs=vnode> *vp
>         
> <http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/os/streamio.c#vp>,
>           7193         mblk_t
>         <http://src.opensolaris.org/source/s?defs=mblk_t> **mctlp
>         <http://src.opensolaris.org/source/s?defs=mctlp>,
>           7194         *struct* uio
>         
> <http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/os/streamio.c#uio>
>         *uiop,
>           7195         *unsigned* *char* *prip
>         <http://src.opensolaris.org/source/s?defs=prip>,
>           7196         *int* *flagsp
>         <http://src.opensolaris.org/source/s?defs=flagsp>,
>           7197         clock_t
>         <http://src.opensolaris.org/source/s?defs=clock_t> timout
>         <http://src.opensolaris.org/source/s?defs=timout>,
>           7198         rval_t
>         <http://src.opensolaris.org/source/s?defs=rval_t> *rvp
>         <http://src.opensolaris.org/source/s?defs=rvp>)
>
>     You should be just able to do
>
>       printf("mp=0x%p\n", self->arg1);
>
>     Jim Litchfield
>
>     zhihui Chen wrote:
>
>         I want to check value of the in-out parameter of one function
>         when it returns, but each time dtrace will report error.
>         Following is the script, anyone can help me correct the error
>         with it?
>         #!/usr/sbin/dtrace -s
>         #pragma D option quiet
>         #pragma D option bufsize=4m
>
>         fbt::kstrgetmsg:entry
>         /pid==$target/
>         {
>                self->arg1=arg1;
>         }
>
>         fbt::kstrgetmsg:return
>         /pid==$target&&self->arg1/
>         {
>                printf("mp=%x\n",*(uint64_t *)copyin(self->arg1,8));
>                self->arg1=0;
>         }
>          intel6# ./kstrgetmsg.d -c "rcp intel2-1:/test1000k ."
>         rcp: dropped connection
>         dtrace: error on enabled probe ID 2 (ID 17047:
>         fbt:genunix:kstrgetmsg:return): invalid address
>         (0xffffff001edd9b90) in action #1 at DIF offset 52
>         dtrace: error on enabled probe ID 2 (ID 17047:
>         fbt:genunix:kstrgetmsg:return): invalid address
>         (0xffffff001edd9b90) in action #1 at DIF offset 52
>         dtrace: error on enabled probe ID 2 (ID 17047:
>         fbt:genunix:kstrgetmsg:return): invalid address
>         (0xffffff001edd9b90) in action #1 at DIF offset 52
>         .......
>
>          Thanks
>         Zhihui
>         
> ------------------------------------------------------------------------
>
>         _______________________________________________
>         dtrace-discuss mailing list
>         [email protected]
>         <mailto:[email protected]>
>          
>
>

_______________________________________________
dtrace-discuss mailing list
[email protected]

Reply via email to