[英]At&T Assembly indexing arrays and declaring arrays
我该如何在AT&T程序集中索引和声明数组?
声明是否这样做:
array:
.zero 256
创建一个256数组,值为零。
索引它我这样做吗:
movq $array, %r14 //Set array to a register name
//Say that r11 has the number 5 stored
movq (%r14, %r11, 8), %r15 //This will make r15 at index 5 of array
movq %rbx ,%r15 //This will store value of rbx into r15
这是我的方法吗? 如果没有,我该如何在AT&T程序集中创建和索引数组?
您的程序集将数组的起始地址存储在r14
,将数组的第r11
个元素的值移动到r15
,然后将rbx
的值移动到r15
。 它不会将任何值移入数组。 如果要将第r11
个元素的地址移动到r15
然后将rbx
的值移动到数组的第r11
个元素,则需要使用leaq (%r14, %r11, 8), %r15
来移动将数组第r11
个元素的地址放入r15
,然后使用movq %rbx, (%r15)
将rbx
的值移动到数组第r11
个元素。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.