tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: kernel panic with new pseudo device
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello,
On May 21, 2009, at 9:24 AM, matthew sporleder wrote:
Hi, I'm trying to write a pseudo device with an envsys component. I
mostly followed http://www.netbsd.org/docs/kernel/pseudo/ and got a
working device, but now I get a panic when I attempt to do:
sc->sc_sme = sysmon_envsys_create();
My best guess is that I didn't get any memory allocated for my _softc
structure, but I'm not really sure how to validate that.
A rough cut of my code is here:
http://mspo.com/code/screenblankenv.c.txt
Can anyone offer some hints? I'm a little stuck.
You use CFATTACH_DECL_NEW yet all your device methods use struct
device * and there's a struct device in your softc. CFATTACH_DECL_NEW
is for devices that split device and softc and use device_t instead.
So, you panic because your code assumes that device and softc are the
same thing but in reality you have only a device_t, try to access the
softc fields behind it and segfault. To get your softc you need to
call device_private() and store it in your softc for future reference.
have fun
Michael
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
iQEVAwUBShWE/cpnzkX8Yg2nAQJN2ggAu9wf3B180bM4o8rsxb+Wa2Zz+JMb7oq2
r5NfJTOKQZYe4wJ2y5/ILAz2cjP7OjQ3mgnyvhq4qCcP3OOvrvvrNqRflXX5SZk+
ijXDKy8O1Tilw2+VBVnfoUGAq29TQ/MY9eK84BvIAzinPjsFu7T3a+9obtWjdye3
eCAbQcVp3bPRAc9lm9CJsNtH3X+/UfTg+STTFGn64iVZhZGE0oz7Z7Le8xVTq0lP
7+63wyL9WejqN/dLieOEr9KQPFk7ee2FVtT1h7ZTe8x2wy0kczmpE8ug7peef744
O6YgtslMJf/uWejN/Coqu4K1OhRH4mmcreyoa5LuQZUtPlGPV1kLyA==
=PrYm
-----END PGP SIGNATURE-----
Home |
Main Index |
Thread Index |
Old Index