Thank you Ian, I forgot the objdump tool. Maybe the output of it is more authority than `disass` in delve, maybe is arch-dependent. :)
在 2019年8月11日星期日 UTC+8下午11:41:58,Ian Lance Taylor写道: > > On Sat, Aug 10, 2019 at 11:25 PM Yang Wu <wuya...@gmail.com <javascript:>> > wrote: > > > > $ go version > > go version go1.12.7 darwin/amd64 > > $ uname -a > > Darwin WudeMacBook-Pro.local 18.6.0 Darwin Kernel Version 18.6.0: Thu > Apr 25 23:16:27 PDT 2019;RELEASE_X86_64 x86_64 > > > > I read a asm code segment recently, it look like this: > > > > mov %fs:-8, %RCX // load G descriptor from TLS > > cmp 16(%RCX), %RSP > > jbe morestack > > > > How do I know mov %fs:-8, %RCX is load G descriptor from TLS ? > > > > When I learn about the runtime package, I find that MOVQ $0x123, g(BX) > in asm_amd64.s. It is disass like this, mov qword ptr gs:[0x30], 0x123 when > I using delve. I figure that they may be the same question. But I am not > sure about this > > That disassembly from delve doesn't look right to me. When I > disassemble that instruction in asm_amd64.s using objdump, using AT&T > syntax, I see > > 451270: 64 48 c7 04 25 f8 ff movq > $0x123,%fs:0xfffffffffffffff8 > > So that corresponds to the instructions you mention before, which are > used in function prologues. > > Ian > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/22115c84-27ba-45f9-bfe7-a3be07babbae%40googlegroups.com.