For an example of a user-level provider, see the pkcs11_softtoken example in OpenSolaris. This is a working provider that you can use as a foundation for your own provider.
To access the code for this provider, go to the OpenSolaris source web site at http://src.opensolaris.org/source/. In the File Path field, enter pkcs11_softtoken/common, make sure the onnv Project is selected, and click the Search button.