https://codereview.appspot.com/20930043/diff/120001/doc/asm.html#newcode39
doc/asm.html:39: <a href="/pkg/runtime/"><code>runtime</code></a> and
On 2013/11/02 12:15:57, aram wrote:
> Agreed.
i've linked to /pkg/runtime in all other docs.
https://codereview.appspot.com/20930043/diff/120001/doc/asm.html#newcode105
doc/asm.html:105: Some symbols, such as <code>PC</code>, <code>R0</code>
and <code>SP</code>, are predeclared and refer to registers.
i do not fell confident to document this. if you want to give me text,
we can put it in the ARM section.
https://codereview.appspot.com/20930043/diff/120001/doc/asm.html#newcode126
doc/asm.html:126: that assembly programming is a fraught endeavor.
On 2013/11/02 06:14:19, minux wrote:
> except the m, g registers in ARM though. the convention is lower case.
> (and the assembler will only recognize the lower case one)
> another inconsistency, perhaps we should fix it before release however
> the C runtime code also uses lower cased m and g, so I'm not sure if
> we want to break the consistency here.
Done.
https://codereview.appspot.com/20930043/diff/120001/doc/asm.html#newcode140
doc/asm.html:140: so to convert that output to assembler input they must
be translated back into middle dots.
On 2013/11/02 06:14:19, minux wrote:
> do you also want to mention / (U+2215)?
> it allows you to refer to symbols in other packages that have slashes
in their
> package names.
> for example, see src/pkg/runtime/race.c
maybe in the next round.
https://codereview.appspot.com/20930043/diff/120001/doc/asm.html#newcode150
doc/asm.html:150: The last instruction in a <code>TEXT</code> block must
be some sort of jump, usually a <code>RET</code> (pseudo-)instruction.
On 2013/11/02 06:14:19, minux wrote:
> if it's not, the linker will add a jump to itself catchall instruction
for you,
> so don't expect to achieve fall through TEXT functions.
Done.
On 2013/11/03 08:45:48, minux wrote:
> actually not one constants, but one constant and optionally another
one.
> (framesize - argsize). And it is very important to give the correct
argsize
> here or the backtrace routine will complain.
> we might also want to document what $-4 does for the frame size on ARM
> (omit the LR save).
done
https://codereview.appspot.com/20930043/diff/120001/doc/asm.html#newcode207
doc/asm.html:207: Their values are:
maybe for after go1.2
https://codereview.appspot.com/20930043/diff/120001/doc/asm.html#newcode207
doc/asm.html:207: Their values are:
On 2013/11/02 06:14:19, minux wrote:
> the assembly file must include textflag.h in cmd/ld to use those
symbolic names,
> which makes it very diffcuilt for 3rd-party (out-of-tree) packages to
use them.
> Perhaps we should do something here.
> i suggest we make it one of the standard header and make cmd/dist copy
it
> to pkg/$GOOS_$GOARCH just like runtime.h and cgocall.h.
> (I will make CL for this, if you agree)
Done.
https://codereview.appspot.com/20930043/diff/120001/doc/asm.html#newcode259
doc/asm.html:259: That is, the file
<code>$GOROOT/src/cmd/8l/8.out.h</code> contains a C enumeration, called
<code>as</code>,
On 2013/11/02 06:14:19, minux wrote:
> <a href="/src/cmd/8l/8.out.h"><code>$GOROOT/...</code></a>
why? i state this is for 8.
this is an assembler guide (not manual even). it requires some knowledge
on the part of the reader. i'm not even planning to link it other than
from the assembler doc.go files.
https://codereview.appspot.com/20930043/diff/120001/doc/asm.html#newcode299
doc/asm.html:299: through the value of an otherwise unused register in
the MMU.
On 2013/11/02 12:15:57, aram wrote:
> I know you mean "unused for something else", but it can be interpreted
> as "unused in general". This paragraph, while correct, is misleading
> to someone accustomed to non-Go assembly programming. FS/GS usually
> point to the user-space thread structure, and from there programs
> can use TLS. On most platforms we reset FS/GS to something else
> with a private system call because the default doesn't work correctly
> with statically compiled binaries (the mechanism requires a lot of
> dance between the kernel, libc and ld.so). Even with our resetting,
> we still use them for the same purpose.
> We don't reset FS.base on Windows or on the nascent solaris port
> because these ports always produce dynamically linked binaries.
i think it's fine as is. this isn't a full assembler manual but i put in
a parenthetical
https://codereview.appspot.com/20930043/diff/120001/doc/asm.html#newcode300
doc/asm.html:300: A OS-dependent macro <code>get_tls</code> is
predefined in the assembler; it loads its argument register
On 2013/11/02 06:14:19, minux wrote:
> the file needs to include zasm_GOOS_GOARCH.h to use these macros.
> so 3rd-party (out-of-tree) packages are not able to use them.
done
> (In general, I think we should discourage 3rd-party package to mess
> with m and g, and I suggest we don't mention this)
it needs to be written down.
https://codereview.appspot.com/20930043/diff/120001/doc/asm.html#newcode308
doc/asm.html:308: MOVL m(CX), BX // Move m into BX.
On 2013/11/02 12:15:57, aram wrote:
> Could you reverse this line so that it's obvious that you can store
with these
> macros as well?
you shouldn't be writing the m and g registers and f you need to have it
explained how to implement m->x and this example isn't enough, you
shouldn't be here at all.
https://codereview.appspot.com/20930043/diff/120001/doc/asm.html#newcode315
doc/asm.html:315: in a two-word structure pointed to by the
<code>GS</code> machine register.
On 2013/11/02 12:15:57, aram wrote:
> GS is a pseudo-register now.
i don't know what that means in this context. i got this information
from reading the source code. if someone wants to provide accurate
information for this section, you're welcome to do so.
https://codereview.appspot.com/20930043/diff/120001/doc/asm.html#newcode332
doc/asm.html:332: </p>
On 2013/11/02 12:15:57, aram wrote:
> Agreed.
Done.
https://codereview.appspot.com/20930043/diff/120001/doc/asm.html#newcode332
doc/asm.html:332: </p>
On 2013/11/02 06:14:19, minux wrote:
> Also worth mentioning how to workaround unsupported opcodes with
> BYTE $0x0f; BYTE $0x6f; BYTE $0x00 // on x86 and
> WORD $0x12345678 // on ARM.
> This is very useful and in fact, i believe that most of 3rd-party
assembly
> code needs this (to use newest processor features for example).
Done.
https://codereview.appspot.com/20930043/