Code: Select all
extern struct cpu *cpu asm("%gs:0");
This is a hack using the assembly label attribute available in some compilers which works by accident rather than by design - if at all.
However, having a simple way of automatically referencing an offset from fs/gs is damn convenient, and having it be a variable rather than a function carries a measure of elegance.
Can the same thing somehow be be done The Right Way™?