고언어 에서 디스어셈블 가능하대서 해보는데
먼가.. 많이 보던(?) objdump와는 출력 포맷이 달라서 찾아보게 됨.
$ GOARCH=arm64 go build -gcflags -S . # tt main.main STEXT size=240 args=0x0 locals=0x818 funcid=0x0 align=0x0 0x0000 00000 (/home/user/work/src/goneon/neon.go:3) TEXT main.main(SB), ABIInternal, $2080-0 0x0000 00000 (/home/user/work/src/goneon/neon.go:3) MOVD 16(g), R16 0x0004 00004 (/home/user/work/src/goneon/neon.go:3) PCDATA $0, $-2 0x0004 00004 (/home/user/work/src/goneon/neon.go:3) SUB $1952, RSP, R17 0x0008 00008 (/home/user/work/src/goneon/neon.go:3) CMP R16, R17 0x000c 00012 (/home/user/work/src/goneon/neon.go:3) BLS 220 0x0010 00016 (/home/user/work/src/goneon/neon.go:3) PCDATA $0, $-1 0x0010 00016 (/home/user/work/src/goneon/neon.go:3) SUB $2080, RSP, R20 0x0014 00020 (/home/user/work/src/goneon/neon.go:3) STP (R29, R30), -8(R20) 0x0018 00024 (/home/user/work/src/goneon/neon.go:3) PCDATA $0, $-2 0x0018 00024 (/home/user/work/src/goneon/neon.go:3) MOVD R20, RSP 0x001c 00028 (/home/user/work/src/goneon/neon.go:3) PCDATA $0, $-1 0x001c 00028 (/home/user/work/src/goneon/neon.go:3) SUB $8, RSP, R29 0x0020 00032 (/home/user/work/src/goneon/neon.go:3) FUNCDATA $0, gclocals·g2BeySu+wFnoycgXfElmcg==(SB) 0x0020 00032 (/home/user/work/src/goneon/neon.go:3) FUNCDATA $1, gclocals·g2BeySu+wFnoycgXfElmcg==(SB) 0x0020 00032 (<unknown line number>) NOP 0x0020 00032 (/home/user/work/src/goneon/neon.go:4) MOVD $main..autotmp_5-1024(SP), R20 0x0024 00036 (/home/user/work/src/goneon/neon.go:9) PCDATA $0, $-2 0x0024 00036 (/home/user/work/src/goneon/neon.go:9) ADR 52, runtime.duffzero(R27)(R27)(REG) 0x0028 00040 (/home/user/work/src/goneon/neon.go:9) STP (R29, R27), -24(RSP) 0x002c 00044 (/home/user/work/src/goneon/neon.go:9) SUB $24, RSP, R29 0x0030 00048 (/home/user/work/src/goneon/neon.go:9) DUFFZERO runtime.duffzero(SB) 0x0034 00052 (/home/user/work/src/goneon/neon.go:9) SUB $8, RSP, R29 0x0038 00056 (/home/user/work/src/goneon/neon.go:10) PCDATA $0, $-1 0x0038 00056 (/home/user/work/src/goneon/neon.go:10) MOVD $main..autotmp_6-2048(SP), R20 0x003c 00060 (/home/user/work/src/goneon/neon.go:10) PCDATA $0, $-2 0x003c 00060 (/home/user/work/src/goneon/neon.go:10) ADR 76, runtime.duffzero(R27)(R27)(REG) 0x0040 00064 (/home/user/work/src/goneon/neon.go:10) STP (R29, R27), -24(RSP) 0x0044 00068 (/home/user/work/src/goneon/neon.go:10) SUB $24, RSP, R29 0x0048 00072 (/home/user/work/src/goneon/neon.go:10) DUFFZERO runtime.duffzero(SB) 0x004c 00076 (/home/user/work/src/goneon/neon.go:10) SUB $8, RSP, R29 0x0050 00080 (/home/user/work/src/goneon/neon.go:10) PCDATA $0, $-1 0x0050 00080 (/home/user/work/src/goneon/neon.go:10) MOVD ZR, R0 0x0054 00084 (/home/user/work/src/goneon/neon.go:13) JMP 120 0x0058 00088 (/home/user/work/src/goneon/neon.go:14) SBFIZ $2, R0, $32, R2 0x005c 00092 (/home/user/work/src/goneon/neon.go:14) MOVD $main..autotmp_5-1024(SP), R3 0x0060 00096 (/home/user/work/src/goneon/neon.go:14) MOVW R0, (R3)(R2) 0x0064 00100 (/home/user/work/src/goneon/neon.go:15) MOVD $256, R4 0x0068 00104 (/home/user/work/src/goneon/neon.go:15) SUB R0, R4, R5 0x006c 00108 (/home/user/work/src/goneon/neon.go:15) MOVD $main..autotmp_6-2048(SP), R6 0x0070 00112 (/home/user/work/src/goneon/neon.go:15) MOVW R5, (R6)(R2) 0x0074 00116 (/home/user/work/src/goneon/neon.go:13) ADD $1, R0, R0 0x0078 00120 (/home/user/work/src/goneon/neon.go:13) CMPW $256, R0 0x007c 00124 (/home/user/work/src/goneon/neon.go:13) BGE 144 0x0080 00128 (/home/user/work/src/goneon/neon.go:14) MOVW R0, R2 0x0084 00132 (/home/user/work/src/goneon/neon.go:14) CMP $256, R2 0x0088 00136 (/home/user/work/src/goneon/neon.go:14) BLO 88 0x008c 00140 (/home/user/work/src/goneon/neon.go:14) JMP 204 0x0090 00144 (/home/user/work/src/goneon/neon.go:14) MOVD ZR, R0 0x0094 00148 (/home/user/work/src/goneon/neon.go:13) JMP 156 0x0098 00152 (/home/user/work/src/goneon/neon.go:18) ADD $1, R0, R0 0x009c 00156 (/home/user/work/src/goneon/neon.go:18) CMPW $256, R0 0x00a0 00160 (/home/user/work/src/goneon/neon.go:18) BGE 180 0x00a4 00164 (/home/user/work/src/goneon/neon.go:19) MOVW R0, R2 0x00a8 00168 (/home/user/work/src/goneon/neon.go:19) CMP $256, R2 0x00ac 00172 (/home/user/work/src/goneon/neon.go:19) BLO 152 0x00b0 00176 (/home/user/work/src/goneon/neon.go:19) JMP 192 0x00b4 00180 (/home/user/work/src/goneon/neon.go:5) LDP -8(RSP), (R29, R30) 0x00b8 00184 (/home/user/work/src/goneon/neon.go:5) ADD $2080, RSP 0x00bc 00188 (/home/user/work/src/goneon/neon.go:5) RET (R30) 0x00c0 00192 (/home/user/work/src/goneon/neon.go:19) MOVD R2, R0 0x00c4 00196 (/home/user/work/src/goneon/neon.go:19) MOVD $256, R1 0x00c8 00200 (/home/user/work/src/goneon/neon.go:19) PCDATA $1, $0 0x00c8 00200 (/home/user/work/src/goneon/neon.go:19) CALL runtime.panicIndex(SB) 0x00cc 00204 (/home/user/work/src/goneon/neon.go:14) MOVD R2, R0 0x00d0 00208 (/home/user/work/src/goneon/neon.go:14) MOVD $256, R1 0x00d4 00212 (/home/user/work/src/goneon/neon.go:14) CALL runtime.panicIndex(SB) 0x00d8 00216 (/home/user/work/src/goneon/neon.go:14) HINT $0 0x00dc 00220 (/home/user/work/src/goneon/neon.go:14) NOP 0x00dc 00220 (/home/user/work/src/goneon/neon.go:3) PCDATA $1, $-1 0x00dc 00220 (/home/user/work/src/goneon/neon.go:3) PCDATA $0, $-2 0x00dc 00220 (/home/user/work/src/goneon/neon.go:3) MOVD R30, R3 0x00e0 00224 (/home/user/work/src/goneon/neon.go:3) CALL runtime.morestack_noctxt(SB) 0x00e4 00228 (/home/user/work/src/goneon/neon.go:3) PCDATA $0, $-1 0x00e4 00228 (/home/user/work/src/goneon/neon.go:3) JMP 0 0x0000 90 0b 40 f9 f1 83 1e d1 3f 02 10 eb 89 06 00 54 ..@.....?......T 0x0010 f4 83 20 d1 9d fa 3f a9 9f 02 00 91 fd 23 00 d1 .. ...?......#.. 0x0020 f4 63 10 91 9b 00 00 10 fd ef 3e a9 fd 63 00 d1 .c........>..c.. 0x0030 00 00 00 94 fd 23 00 d1 f4 63 00 91 9b 00 00 10 .....#...c...... 0x0040 fd ef 3e a9 fd 63 00 d1 00 00 00 94 fd 23 00 d1 ..>..c.......#.. 0x0050 e0 03 1f aa 09 00 00 14 02 7c 7e 93 e3 63 10 91 .........|~..c.. 0x0060 60 68 22 b8 e4 03 78 b2 85 00 00 cb e6 63 00 91 `h"...x......c.. 0x0070 c5 68 22 b8 00 04 00 91 1f 00 04 71 aa 00 00 54 .h"........q...T 0x0080 02 7c 40 93 5f 00 04 f1 83 fe ff 54 10 00 00 14 .|@._......T.... 0x0090 e0 03 1f aa 02 00 00 14 00 04 00 91 1f 00 04 71 ...............q 0x00a0 aa 00 00 54 02 7c 40 93 5f 00 04 f1 63 ff ff 54 ...T.|@._...c..T 0x00b0 04 00 00 14 fd fb 7f a9 ff 83 20 91 c0 03 5f d6 .......... ..._. 0x00c0 e0 03 02 aa e1 03 78 b2 00 00 00 94 e0 03 02 aa ......x......... 0x00d0 e1 03 78 b2 00 00 00 94 1f 20 03 d5 e3 03 1e aa ..x...... ...... 0x00e0 00 00 00 94 c7 ff ff 17 00 00 00 00 00 00 00 00 ................ rel 48+4 t=9 runtime.duffzero+0 rel 72+4 t=9 runtime.duffzero+0 rel 200+4 t=9 runtime.panicIndex+0 rel 212+4 t=9 runtime.panicIndex+0 rel 224+4 t=9 runtime.morestack_noctxt+0 main.add STEXT size=240 args=0x0 locals=0x818 funcid=0x0 align=0x0 0x0000 00000 (/home/user/work/src/goneon/neon.go:7) TEXT main.add(SB), ABIInternal, $2080-0 0x0000 00000 (/home/user/work/src/goneon/neon.go:7) MOVD 16(g), R16 0x0004 00004 (/home/user/work/src/goneon/neon.go:7) PCDATA $0, $-2 0x0004 00004 (/home/user/work/src/goneon/neon.go:7) SUB $1952, RSP, R17 var symregexp = flag.String("s", "", "only dump symbols matching this regexp") var gnuAsm = flag.Bool("gnu", false, "print GNU assembly next to Go assembly (where supported)") var symRE *regexp.Regexp 0x0008 00008 (/home/user/work/src/goneon/neon.go:7) CMP R16, R17 0x000c 00012 (/home/user/work/src/goneon/neon.go:7) BLS 220 0x0010 00016 (/home/user/work/src/goneon/neon.go:7) PCDATA $0, $-1 0x0010 00016 (/home/user/work/src/goneon/neon.go:7) SUB $2080, RSP, R20 0x0014 00020 (/home/user/work/src/goneon/neon.go:7) STP (R29, R30), -8(R20) 0x0018 00024 (/home/user/work/src/goneon/neon.go:7) PCDATA $0, $-2 0x0018 00024 (/home/user/work/src/goneon/neon.go:7) MOVD R20, RSP 0x001c 00028 (/home/user/work/src/goneon/neon.go:7) PCDATA $0, $-1 0x001c 00028 (/home/user/work/src/goneon/neon.go:7) SUB $8, RSP, R29 0x0020 00032 (/home/user/work/src/goneon/neon.go:7) FUNCDATA $0, gclocals·g2BeySu+wFnoycgXfElmcg==(SB) 0x0020 00032 (/home/user/work/src/goneon/neon.go:7) FUNCDATA $1, gclocals·g2BeySu+wFnoycgXfElmcg==(SB) 0x0020 00032 (/home/user/work/src/goneon/neon.go:9) MOVD $main..autotmp_5-1024(SP), R20 0x0024 00036 (/home/user/work/src/goneon/neon.go:9) PCDATA $0, $-2 0x0024 00036 (/home/user/work/src/goneon/neon.go:9) ADR 52, runtime.duffzero(R27)(R27)(REG) 0x0028 00040 (/home/user/work/src/goneon/neon.go:9) STP (R29, R27), -24(RSP) 0x002c 00044 (/home/user/work/src/goneon/neon.go:9) SUB $24, RSP, R29 0x0030 00048 (/home/user/work/src/goneon/neon.go:9) DUFFZERO runtime.duffzero(SB) 0x0034 00052 (/home/user/work/src/goneon/neon.go:9) SUB $8, RSP, R29 0x0038 00056 (/home/user/work/src/goneon/neon.go:10) PCDATA $0, $-1 0x0038 00056 (/home/user/work/src/goneon/neon.go:10) MOVD $main..autotmp_6-2048(SP), R20 0x003c 00060 (/home/user/work/src/goneon/neon.go:10) PCDATA $0, $-2 0x003c 00060 (/home/user/work/src/goneon/neon.go:10) ADR 76, runtime.duffzero(R27)(R27)(REG) 0x0040 00064 (/home/user/work/src/goneon/neon.go:10) STP (R29, R27), -24(RSP) 0x0044 00068 (/home/user/work/src/goneon/neon.go:10) SUB $24, RSP, R29 0x0048 00072 (/home/user/work/src/goneon/neon.go:10) DUFFZERO runtime.duffzero(SB) 0x004c 00076 (/home/user/work/src/goneon/neon.go:10) SUB $8, RSP, R29 0x0050 00080 (/home/user/work/src/goneon/neon.go:10) PCDATA $0, $-1 0x0050 00080 (/home/user/work/src/goneon/neon.go:10) MOVD ZR, R0 0x0054 00084 (/home/user/work/src/goneon/neon.go:13) JMP 120 0x0058 00088 (/home/user/work/src/goneon/neon.go:14) SBFIZ $2, R0, $32, R2 0x005c 00092 (/home/user/work/src/goneon/neon.go:14) MOVD $main..autotmp_5-1024(SP), R3 0x0060 00096 (/home/user/work/src/goneon/neon.go:14) MOVW R0, (R3)(R2) 0x0064 00100 (/home/user/work/src/goneon/neon.go:15) MOVD $256, R4 0x0068 00104 (/home/user/work/src/goneon/neon.go:15) SUB R0, R4, R5 0x006c 00108 (/home/user/work/src/goneon/neon.go:15) MOVD $main..autotmp_6-2048(SP), R6 0x0070 00112 (/home/user/work/src/goneon/neon.go:15) MOVW R5, (R6)(R2) 0x0074 00116 (/home/user/work/src/goneon/neon.go:13) ADD $1, R0, R0 0x0078 00120 (/home/user/work/src/goneon/neon.go:13) CMPW $256, R0 0x007c 00124 (/home/user/work/src/goneon/neon.go:13) BGE 144 0x0080 00128 (/home/user/work/src/goneon/neon.go:14) MOVW R0, R2 0x0084 00132 (/home/user/work/src/goneon/neon.go:14) CMP $256, R2 0x0088 00136 (/home/user/work/src/goneon/neon.go:14) BLO 88 0x008c 00140 (/home/user/work/src/goneon/neon.go:14) JMP 204 0x0090 00144 (/home/user/work/src/goneon/neon.go:14) MOVD ZR, R0 0x0094 00148 (/home/user/work/src/goneon/neon.go:13) JMP 156 0x0098 00152 (/home/user/work/src/goneon/neon.go:18) ADD $1, R0, R0 0x009c 00156 (/home/user/work/src/goneon/neon.go:18) CMPW $256, R0 0x00a0 00160 (/home/user/work/src/goneon/neon.go:18) BGE 180 0x00a4 00164 (/home/user/work/src/goneon/neon.go:19) MOVW R0, R2 0x00a8 00168 (/home/user/work/src/goneon/neon.go:19) CMP $256, R2 0x00ac 00172 (/home/user/work/src/goneon/neon.go:19) BLO 152 0x00b0 00176 (/home/user/work/src/goneon/neon.go:19) JMP 192 0x00b4 00180 (/home/user/work/src/goneon/neon.go:21) LDP -8(RSP), (R29, R30) 0x00b8 00184 (/home/user/work/src/goneon/neon.go:21) ADD $2080, RSP 0x00bc 00188 (/home/user/work/src/goneon/neon.go:21) RET (R30) 0x00c0 00192 (/home/user/work/src/goneon/neon.go:19) MOVD R2, R0 0x00c4 00196 (/home/user/work/src/goneon/neon.go:19) MOVD $256, R1 0x00c8 00200 (/home/user/work/src/goneon/neon.go:19) PCDATA $1, $0 0x00c8 00200 (/home/user/work/src/goneon/neon.go:19) CALL runtime.panicIndex(SB) 0x00cc 00204 (/home/user/work/src/goneon/neon.go:14) MOVD R2, R0 0x00d0 00208 (/home/user/work/src/goneon/neon.go:14) MOVD $256, R1 0x00d4 00212 (/home/user/work/src/goneon/neon.go:14) CALL runtime.panicIndex(SB) 0x00d8 00216 (/home/user/work/src/goneon/neon.go:14) HINT $0 0x00dc 00220 (/home/user/work/src/goneon/neon.go:14) NOP 0x00dc 00220 (/home/user/work/src/goneon/neon.go:7) PCDATA $1, $-1 0x00dc 00220 (/home/user/work/src/goneon/neon.go:7) PCDATA $0, $-2 0x00dc 00220 (/home/user/work/src/goneon/neon.go:7) MOVD R30, R3 0x00e0 00224 (/home/user/work/src/goneon/neon.go:7) CALL runtime.morestack_noctxt(SB) 0x00e4 00228 (/home/user/work/src/goneon/neon.go:7) PCDATA $0, $-1 0x00e4 00228 (/home/user/work/src/goneon/neon.go:7) JMP 0 0x0000 90 0b 40 f9 f1 83 1e d1 3f 02 10 eb 89 06 00 54 ..@.....?......T 0x0010 f4 83 20 d1 9d fa 3f a9 9f 02 00 91 fd 23 00 d1 .. ...?......#.. 0x0020 f4 63 10 91 9b 00 00 10 fd ef 3e a9 fd 63 00 d1 .c........>..c.. 0x0030 00 00 00 94 fd 23 00 d1 f4 63 00 91 9b 00 00 10 .....#...c...... 0x0040 fd ef 3e a9 fd 63 00 d1 00 00 00 94 fd 23 00 d1 ..>..c.......#.. 0x0050 e0 03 1f aa 09 00 00 14 02 7c 7e 93 e3 63 10 91 .........|~..c.. 0x0060 60 68 22 b8 e4 03 78 b2 85 00 00 cb e6 63 00 91 `h"...x......c.. 0x0070 c5 68 22 b8 00 04 00 91 1f 00 04 71 aa 00 00 54 .h"........q...T 0x0080 02 7c 40 93 5f 00 04 f1 83 fe ff 54 10 00 00 14 .|@._......T.... 0x0090 e0 03 1f aa 02 00 00 14 00 04 00 91 1f 00 04 71 ...............q 0x00a0 aa 00 00 54 02 7c 40 93 5f 00 04 f1 63 ff ff 54 ...T.|@._...c..T 0x00b0 04 00 00 14 fd fb 7f a9 ff 83 20 91 c0 03 5f d6 .......... ..._. 0x00c0 e0 03 02 aa e1 03 78 b2 00 00 00 94 e0 03 02 aa ......x......... 0x00d0 e1 03 78 b2 00 00 00 94 1f 20 03 d5 e3 03 1e aa ..x...... ...... 0x00e0 00 00 00 94 c7 ff ff 17 00 00 00 00 00 00 00 00 ................ rel 48+4 t=9 runtime.duffzero+0 rel 72+4 t=9 runtime.duffzero+0 rel 200+4 t=9 runtime.panicIndex+0 rel 212+4 t=9 runtime.panicIndex+0 rel 224+4 t=9 runtime.morestack_noctxt+0 go:cuinfo.producer.main SDWARFCUINFO dupok size=0 0x0000 72 65 67 61 62 69 regabi go:cuinfo.packagename.main SDWARFCUINFO dupok size=0 0x0000 6d 61 69 6e main go:info.main.add$abstract SDWARFABSFCN dupok size=45 0x0000 05 6d 61 69 6e 2e 61 64 64 00 01 01 0e 61 00 08 .main.add....a.. 0x0010 00 00 00 00 0e 62 00 09 00 00 00 00 0e 63 00 0a .....b.......c.. 0x0020 00 00 00 00 0e 69 00 0c 00 00 00 00 00 .....i....... rel 16+4 t=31 go:info.[]int32+0 rel 24+4 t=31 go:info.[]int32+0 rel 32+4 t=31 go:info.[]int32+0 rel 40+4 t=31 go:info.int32+0 main..inittask SNOPTRDATA size=24 0x0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0x0010 00 00 00 00 00 00 00 00 ........ type:.eqfunc1024 SRODATA dupok size=16 0x0000 00 00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 ................ rel 0+8 t=1 runtime.memequal_varlen+0 runtime.memequal64·f SRODATA dupok size=8 0x0000 00 00 00 00 00 00 00 00 ........ rel 0+8 t=1 runtime.memequal64+0 runtime.gcbits.0100000000000000 SRODATA dupok size=8 0x0000 01 00 00 00 00 00 00 00 ........ type:.namedata.*[256]int32- SRODATA dupok size=13 0x0000 00 0b 2a 5b 32 35 36 5d 69 6e 74 33 32 ..*[256]int32 type:*[256]int32 SRODATA dupok size=56 0x0000 08 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00 ................ 0x0010 5c eb 0a 2f 08 08 08 36 00 00 00 00 00 00 00 00 \../...6........ 0x0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0x0030 00 00 00 00 00 00 00 00 ........ rel 24+8 t=1 runtime.memequal64·f+0 rel 32+8 t=1 runtime.gcbits.0100000000000000+0 rel 40+4 t=5 type:.namedata.*[256]int32-+0 rel 48+8 t=1 type:[256]int32+0 runtime.gcbits. SRODATA dupok size=0 type:[256]int32 SRODATA dupok size=72 0x0000 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0x0010 1e 16 ae f5 0a 04 04 11 00 00 00 00 00 00 00 00 ................ 0x0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0x0030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0x0040 00 01 00 00 00 00 00 00 ........ rel 24+8 t=1 type:.eqfunc1024+0 rel 32+8 t=1 runtime.gcbits.+0 rel 40+4 t=5 type:.namedata.*[256]int32-+0 rel 44+4 t=-32763 type:*[256]int32+0 rel 48+8 t=1 type:int32+0 rel 56+8 t=1 type:[]int32+0 gclocals·g2BeySu+wFnoycgXfElmcg== SRODATA dupok size=8 0x0000 01 00 00 00 00 00 00 00 ........ |
PCDATA 라는 녀석은 Program Counter는 절~대 아니고
걍 gabage collector 관련한 지시어라고.. 그런데 왜 컴파일러에게 알려주지?
The FUNCDATA and PCDATA directives contain information for use by the garbage collector; they are introduced by the compiler. |
[링크 : https://doc.codingdict.com/golang/doc/golang.org/doc/asm.html]
[링크 : https://stackoverflow.com/questions/53436811/what-is-the-meaning-of-pcdata-in-go-assembly]
Plan 9 어셈블러라는게 있는 듯.
The assembler is based on the input style of the Plan 9 assemblers, which is documented in detail elsewhere. |
[링크 : https://go.dev/doc/asm]
어쩌구 저쩌구.. MOVF와 MOVD를 이용해서 단배정도/복수배정도 실수에 대해서 읽거나 저장하는데
MOVWD, MOVWF, MOVDW, MOVWD, MOVFD, MOVFD 등으로 변환된다
라는데.. 레지스터도 그냥 R0~R12로만 되어있고 aarch64등과 같은 세부 아키텍쳐는 생략된 일종의 중간언어로 어셈을 쓰는 느낌?
ARM The assembler provides access to R0 through R14 and the PC. The stack pointer is R13, the link register is R14, and the static base register is R12. R0 is the return register and also the register holding the first argument to a subroutine. The external registers in Plan 9’s C are allocated from R10 down. R11 is used by the loader as a temporary register. The assembler supports the CPSR and SPSR registers. It also knows about coprocessor registers C0 through C15. Floating registers are F0 through F7, FPSR and FPCR. As with the other architectures, loads and stores are called MOV, e.g. MOVW for load word or store word, and MOVM for load or store multiple, depending on the operands. Addressing modes are supported by suffixes to the instructions: .IA (increment after), .IB (increment before), .DA (decrement after), and .DB (decrement before). These can only be used with the MOV instructions. The move multiple instruction, MOVM, defines a range of registers using brackets, e.g. [R0-R12]. The special MOVM addressing mode bits W, U, and P are written in the same manner, for example, MOVM.DB.W. A .S suffix allows a MOVM instruction to access user R13 and R14 when in another processor mode. Shifts and rotates in addressing modes are supported by binary operators << (logical left shift), >> (logical right shift), -> (arithmetic right shift), and @> (rotate right); for example R7>>R2or R2@>2. The assembler does not support indexing by a shifted expression; only names can be doubly indexed. Any instruction can be followed by a suffix that makes the instruction conditional: .EQ, .NE, and so on, as in the ARM manual, with synonyms .HS (for .CS) and .LO (for .CC), for example ADD.NE. Arithmetic and logical instructions can have a .S suffix, as ARM allows, to set condition codes. The syntax of the MCR and MRC coprocessor instructions is largely as in the manual, with the usual adjustments. The assembler directly supports only the ARM floating-point coprocessor operations used by the compiler: CMP, ADD, SUB, MUL, and DIV, all with F or D suffix selecting single or double precision. Floating-point load or store become MOVF and MOVD. Conversion instructions are also specified by moves: MOVWD, MOVWF, MOVDW, MOVWD, MOVFD, and MOVDF. |
[링크 : https://9p.io/sys/doc/asm.html]
'Programming > golang' 카테고리의 다른 글
golang echo 패키지 소스 (0) | 2023.09.13 |
---|---|
go packed struct (0) | 2023.09.01 |
golang goarch=arm64 와 디스어셈블러 (0) | 2023.08.23 |
golang echo 서버 이상한 버그 발견? (0) | 2023.06.27 |
go ws server client example (0) | 2023.06.08 |