File tree 1 file changed +13
-3
lines changed 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -590,27 +590,37 @@ <h3 id="x86">32-bit Intel 386</h3>
590
590
< p >
591
591
The runtime pointer to the < code > g</ code > structure is maintained
592
592
through the value of an otherwise unused (as far as Go is concerned) register in the MMU.
593
- A OS-dependent macro < code > get_tls</ code > is defined for the assembler if the source includes
594
- a special header, < code > go_asm .h</ code > :
593
+ An OS-dependent macro < code > get_tls</ code > is defined for the assembler if the source is
594
+ in the < code > runtime </ code > package and includes a special header, < code > go_tls .h</ code > :
595
595
</ p >
596
596
597
597
< pre >
598
- #include "go_asm .h"
598
+ #include "go_tls .h"
599
599
</ pre >
600
600
601
601
< p >
602
602
Within the runtime, the < code > get_tls</ code > macro loads its argument register
603
603
with a pointer to the < code > g</ code > pointer, and the < code > g</ code > struct
604
604
contains the < code > m</ code > pointer.
605
+ There's another special header containing the offsets for each
606
+ element of < code > g</ code > , called < code > go_asm.h</ code > .
605
607
The sequence to load < code > g</ code > and < code > m</ code > using < code > CX</ code > looks like this:
606
608
</ p >
607
609
608
610
< pre >
611
+ #include "go_tls.h"
612
+ #include "go_asm.h"
613
+ ...
609
614
get_tls(CX)
610
615
MOVL g(CX), AX // Move g into AX.
611
616
MOVL g_m(AX), BX // Move g.m into BX.
612
617
</ pre >
613
618
619
+ < p >
620
+ Note: The code above works only in the < code > runtime</ code > package, while < code > go_tls.h</ code > also
621
+ applies to < a href ="#arm "> arm</ a > , < a href ="#amd64 "> amd64</ a > and amd64p32, and < code > go_asm.h</ code > applies to all architectures.
622
+ </ p >
623
+
614
624
< p >
615
625
Addressing modes:
616
626
</ p >
You can’t perform that action at this time.
0 commit comments