1. Is there a good place to look for translation between Plan9 asm
and Intel/GNU asm? I don't have enough asm in my head to be able
to imagine what many of the ops are doing.
Sadly not, and you need to be bilingual when working with plan9 asm,
(go build -gcflags -S) and gas asm which is the default for objdump
and gdb. The most obvious example gas reads right to left, and plan9
is left to right. The other major change is the MOV instruction, which
is a generic reg -> mem, mem -> reg, and reg -> reg instruction which
is replaced the correct instruction at link(?) time. Sometimes this
can include use of a scratch register to construct one of the operands
if it is not possible to directly encode this. For 6a that shouldn't
be a problem, but is a gotcha in 5a.
2. Related to the first question, the N in REPN is nz or ne? (I'm
starting on snippets that are simple).
Unknown, grep src/cmd/6a/lex.c shows
odessa:6a dfc$ grep AREPN *
lex.c: "REPN", LTYPE0, AREPN,
odessa:6l dfc$ grep AREPN *
6.out.h: AREPN,
optab.c: { AREPN, ynone, Px, 0xf2 },
Then you need to get the intel instruction manual out. Sometimes the
asm in the same file gives a hint, sometimes you have to dig. Luckily
arm only has a few bits for instruction encoding, so I've managed to
avoid learning this skill.
3. When an asm_arch.s defined function does not exist for a
specific function in a go function declaration the build falls
back to a pure go function. In bytes for IndexByte, this is
indexBytePortable. How is this specified?
There is no fallback, for example in older version of bytes/arm_arm.s,
the IndexByte function is forward to IndexBytePortable like so.
https://code.google.com/p/go/source/browse/src/pkg/bytes/asm_arm.s?name=release-branch.r60Cheers
Dave
thanks
Dan
On Thu, 2013-01-24 at 11:13 +1100, Dave Cheney wrote:
I can't speak for others but IMO the source is your best starting
place. I would read the .s files in the following order, bytes/,
syscall/, crypto/, math/, runtime/
The least obvious things are the calling convention and the magic
suffixes on the end of TEXT declarations.
Robert Sandra frequently posts about specific questions he has while
reading the source. I think this is useful as it creates a public
record of answers which are current to that point.
--