Go Assembler

164 views
Skip to first unread message

yao shucai

unread,
Aug 31, 2015, 10:59:03 AM8/31/15
to golang-nuts
Hi there,

I am wondering whether there are any good documents on Go assembler. I only found this: http://golang.org/doc/asm.  

Is Go assembler the same as Plan 9 assembler, or not? Should I study Plan 9 assembly before Go Assembly?

How could I use Go assembly to "malloc" (or syscall "sys_brk") a piece of memory?

Any help is appreciate!
Thanks!
Shucai

Ian Lance Taylor

unread,
Aug 31, 2015, 11:25:19 AM8/31/15
to yao shucai, golang-nuts
On Mon, Aug 31, 2015 at 7:39 AM, yao shucai <yao20...@gmail.com> wrote:
>
> I am wondering whether there are any good documents on Go assembler. I only
> found this: http://golang.org/doc/asm.

That is what there is.

> Is Go assembler the same as Plan 9 assembler, or not? Should I study Plan 9
> assembly before Go Assembly?

The Go assembler is not the same as the Plan 9 assembler. For one
thing, the Go assembler is written in Go. However, as the doc says,
the syntax is closely based on the Plan 9 assembler.

> How could I use Go assembly to "malloc" (or syscall "sys_brk") a piece of
> memory?

You basically can't literally call malloc or sys_brk in a Go program.
Go memory allocation doesn't work that way. You can allocate memory
using mmap, but you don't need to use assembler code to do that; you
can just call syscall.Mmap.

Ian
Reply all
Reply to author
Forward
0 new messages