1
0
mirror of https://github.com/golang/go synced 2024-11-20 00:44:45 -07:00

commentary about extern register

R=rsc
DELTA=16  (12 added, 0 deleted, 4 changed)
OCL=33030
CL=33035
This commit is contained in:
Rob Pike 2009-08-11 13:30:35 -07:00
parent fed0435257
commit d08f0067b5

View File

@ -64,10 +64,22 @@ typedef struct hash Hmap;
typedef struct Hchan Hchan;
/*
* per cpu declaration
* per-cpu declaration.
* "extern register" is a special storage class implemented by 6c, 8c, etc.
* on machines with lots of registers, it allocates a register that will not be
* used in generated code. on the x86, it allocates a slot indexed by a
* segment register.
*
* amd64: allocated downwards from R15
* x86: allocated upwards from 0(FS)
* arm: allocated upwards from R9
*
* every C file linked into a Go program must include runtime.h
* so that the C compiler knows to avoid other uses of these registers.
* the Go compilers know to avoid them.
*/
extern register G* g; // R15
extern register M* m; // R14
extern register G* g;
extern register M* m;
/*
* defined constants