SH Built-in Functions (Using the GNU Compiler Collection (GCC)) (original) (raw)

Returns the value that is currently set in the ‘GBR’ register. Memory loads and stores that use the thread pointer as a base address are turned into ‘GBR’ based displacement loads and stores, if possible. For example:

struct my_tcb { int a, b, c, d, e; };

int get_tcb_value (void) { // Generate ‘mov.l @(8,gbr),r0’ instruction return ((my_tcb*)__builtin_thread_pointer ())->c; }