我正在寻找一种方法将一些代码转换为相当于y86的代码.问题是我无法找到一个好的y86函数列表.我可以找到一些功能,但不是一个很好的主要功能列表.有谁知道我在哪里可以找到这样的清单?
除非我复制错误,否则上面的代码是由学生在课堂上写在老师的帮助/更正中的:
int array[100], sum, i;
void ini() {
for(i = 0; i < 100; i++)
array[i] = i;
}
int main() {
ini();
sum = 0;
for(i = 0; i < 100; i++)
sum += array[i];
}
.pos 0
irmovl Stack, %esp
rrmovl Stack, %ebp
jmp main
array:
.pos 430
sum: .long 0
i: .long 0
main:
call ini //
irmovl $0, %eax // %eax = 0
irmovl sum, %esi // %esi = 0xsum
rmmovl %eax, 0(%esi) // 0(%esi) = …
Run Code Online (Sandbox Code Playgroud) 我正在用 Y86 编写一个程序,但我在设置堆栈和基指针的代码行中不断收到错误“找不到标签”。我的代码是:
.pos 0
init:
irmovl Stack, %esp //Set up stack pointer
irmovl Stack, %ebp //Set up base pointer
call main //call main program
halt //Terminate program
Run Code Online (Sandbox Code Playgroud)
这就是我的笔记中的显示方式,但是当我尝试编译时,我得到了
Error on line 8: Can't find label
Line 8, Byte 0x0006: irmovl stack, %esp //Set up stack pointer
Error on line 9: Can't find label
Line 9, Byte 0x000c: irmovl stack, %ebp //Set up base pointer
Run Code Online (Sandbox Code Playgroud)
我尝试将 .pos 0 行放入 init 函数中(我认为这可能会有所帮助),并简单地取消 init: 行,但我仍然遇到同样的问题。
IA32至Y86
ATT大会
我有以下IA32汇编代码:
Bubble:
.LFB0:
pushl %esi
pushl %ebx
movl 16(%esp), %esi
movl 12(%esp), %edx
subl $1, %esi
andl %esi, %esi
jle .L1
.L7:
xorl %eax, %eax
.L5:
movl 4(%edx,%eax,4), %ecx
movl (%edx,%eax,4), %ebx
cmpl %ebx, %ecx
jge .L4
movl %ebx, 4(%edx,%eax,4)
movl %ecx, (%edx,%eax,4)
.L4:
addl $1, %eax
cmpl %eax, %esi
jg .L5
subl $1, %esi
jne .L7
.L1:
popl %ebx
popl %esi
ret
Run Code Online (Sandbox Code Playgroud)
我正在尝试将其转换为Y86汇编代码.我在翻译比较指令时遇到问题:
cmpl %ebx, %ecx
Run Code Online (Sandbox Code Playgroud)
谢谢.
我正在尝试在 Linux 上编译 Y86-64 代码的模拟器。我已经重写了 makefile,但结果如下所示。它说“未定义引用 \'matherr\'”。(看起来它在链接时与 gcc 连接)
\n\n(cd pipe; make all GUIMODE=-DHAS_GUI TKLIBS="-L/usr/lib/ -ltk8.5 -ltcl8.5" TKINC="-I/usr/include/tcl8.5 ")\n make[1]: \xe8\xbf\x9b\xe5\x85\xa5\xe7\x9b\xae\xe5\xbd\x95\xe2\x80\x9c/home/gongchen/\xe6\xa1\x8c\xe9\x9d\xa2/ICS/archlab-handout/sim/pipe\xe2\x80\x9d\n # Building the pipe-std.hcl version of PIPE\n ../misc/hcl2c -n pipe-std.hcl < pipe-std.hcl > pipe-std.c\n gcc -Wall -O2 -I/usr/include/tcl8.5 -I../misc -DHAS_GUI -o psim psim.c pipe-std.c \\\n ../misc/isa.c -L/usr/lib/ -ltk8.5 -ltcl8.5 -lm\n /tmp/cchKTZy7.o:(.data.rel+0x0)\xef\xbc\x9a\xe5\xaf\xb9\xe2\x80\x98matherr\xe2\x80\x99\xe6\x9c\xaa\xe5\xae\x9a\xe4\xb9\x89\xe7\x9a\x84\xe5\xbc\x95\xe7\x94\xa8\n collect2: error: ld returned 1 exit status\n Makefile:42: recipe for target \'psim\' failed\n make[1]: *** [psim] Error 1\n make[1]: \xe7\xa6\xbb\xe5\xbc\x80\xe7\x9b\xae\xe5\xbd\x95\xe2\x80\x9c/home/gongchen/\xe6\xa1\x8c\xe9\x9d\xa2/ICS/archlab-handout/sim/pipe\xe2\x80\x9d\n Makefile:28: recipe for target \'all\' failed\n make: …
Run Code Online (Sandbox Code Playgroud) 嗨,我正在阅读一本教科书,它说程序不允许访问大于的地址0xc0000000
(如32位版本的Linux的情况),因此汇编代码无效:
1. irmovl $1,%eax
2. xorl %esp,%esp // Set stack pointer to 0 and CC to 100
3. pushl %eax // Attempt to write to 0xfffffffc, will fail
Run Code Online (Sandbox Code Playgroud)
我糊涂了.我有两个问题:
为什么程序不允许访问大于的地址0xc0000000
,是不是像0xc0000008
有效地址那样的地址?
如果真的不允许程序访问大于0xc0000000
,0xfffffffc
低于(小于)的地址0xc0000000
,那么它为什么会失败?