using %smid? (compiling a ptx?)

As of PTX 1.3, the %smid special register is suppoted but this feature is inaccessible from C kernels in any normal means.

How can I get this value from my kernel?
I thought it would be possible to add an additional PTX to my build but this doesn’t seem possible because there external functions are not supported.
Another option is to compile my code to PTX, change it (say replace the value 0xBAADF00D with %smid and then compile the PTX.
This option sounds like it should work but I wasn’t able to find a way to do it with nvcc
What is the right way to do this?
Or is there another way to extract %smid?

My platform is WinXP, Visual Studio 2008 if that matters.
Thanks!

I use this:

[codebox]noinline device uint get_smid(void)

{

uint ret;

asm(“mov.u32 %0, %smid;” : “=r”(ret) );

return ret;

}[/codebox]

Thanks!!!