On 08/02/07 14:18, Aubrey Li wrote:
Hi all,I can access a Global structure by mdb-> Global_struct=X, it prints the address of that structure. Now I want to access it from user space, so I wrote a driver and put it in the read op. cmn_err(CE_NOTE, "Global structure = 0x%x\n", (unsigned int)&Global_struct); The driver build successful but report error( undefined symbol) when issue "add_drv mydriver". It's wired for me. Can't the driver access the global variable of the kernel?
Yes there are restrictions. The 'mem' driver already exists for this purpose - it supplies /dev/zero, /dev/mem, /dev/physmem, /dev/kmem, /dev/allkmem etc. Together with /dev/ksyms (see manpage) they provide the infrastructure on top of which libkvm builds, and mdb just uses those interfaces. So you can lookup a symbol or symbols using kvm_nlist and then read out the structure with kvm_read. Those are supplied by libkvm and you can use that to build standalone applications. Alternatively, work within the friendlier mdb api but accept living in a dcmd or walker. Cheers Gavin
smime.p7s
Description: S/MIME Cryptographic Signature
_______________________________________________ opensolaris-code mailing list opensolaris-code@opensolaris.org http://mail.opensolaris.org/mailman/listinfo/opensolaris-code