diff --git a/doc/asm.html b/doc/asm.html index 77defdbd28f..11033fe3c5f 100644 --- a/doc/asm.html +++ b/doc/asm.html @@ -590,27 +590,37 @@ Here follow some descriptions of key Go-specific details for the supported archi

The runtime pointer to the g structure is maintained through the value of an otherwise unused (as far as Go is concerned) register in the MMU. -A OS-dependent macro get_tls is defined for the assembler if the source includes -a special header, go_asm.h: +An OS-dependent macro get_tls is defined for the assembler if the source is +in the runtime package and includes a special header, go_tls.h:

-#include "go_asm.h"
+#include "go_tls.h"
 

Within the runtime, the get_tls macro loads its argument register with a pointer to the g pointer, and the g struct contains the m pointer. +There's another special header containing the offsets for each +element of g, called go_asm.h. The sequence to load g and m using CX looks like this:

+#include "go_tls.h"
+#include "go_asm.h"
+...
 get_tls(CX)
 MOVL	g(CX), AX     // Move g into AX.
 MOVL	g_m(AX), BX   // Move g.m into BX.
 
+

+Note: The code above works only in the runtime package, while go_tls.h also +applies to arm, amd64 and amd64p32, and go_asm.h applies to all architectures. +

+

Addressing modes: