View Full Version : making a passed-in structptr accessible globally in kernel

06-26-2011, 01:41 PM
Hi folks! I've decided to ask for help.

I do a set-kernel-arg, and therefore pass in to my kernel, a pointer to a structure holding many needed params.

I can see the values of those parameters in my __kernel function, i.e. vh->sizex, and inside there it's all fine; I can do printfs when it's running on the cpu, etc.

However, I need to access the paramaters in that structure from helper functions within my source file.

SO, I want to either (1) set a globally-within-the-kernel-accessible structure pointer that allows all helper functions to access the data pointed to by the in-loaded pointer, or (2) copy the data from the structure pointed to by the in-loaded pointer to a within-the-kernel-globally accessible copy of that structure.

If my command of the English language is sufficient (it is after all my native tongue, however I've had 3 drinks), and if I've communicated my needs adequately, then cool! If I am being an idiot, please feel free to say so and, please, explain precisely in what manner I am being such.

p.s. edit: I have been through many iterations of trying to copy the pointer to another that is file-level-defined, or trying to copy the individual elements from the passed-in struct pointer to a within-the-kernel accessible copy of the structure, and have been told in many ways "can't-convert-address-spaces" kind of things until it's coming out of my ears. Have also done many internet searches on error phrases that I had hoped were helpful. SO, now, finally, asking explicitly here. Maybe one of you can at least set me on the right track. TIA.