'Simple y86 do-nothing program halt
[terminal]$ ./yis a.yo
Stopped in 11 steps at PC = 0x2c. Status 'HLT', CC Z=1 S=0 O=0
Changes to registers:
%eax: 0x00000000 0x00000004
%ebx: 0x00000000 0x00000005
%esp: 0x00000000 0x00000023
%ebp: 0x00000000 0x0000002f
Changes to memory:
0x0020: 0x2c803fa0 0x27803fa0
0x0024: 0x20000000 0x05000000
0x0028: 0x905fb054 0x04000000
0x002c: 0x45205fa0 0x37000000
0x0030: 0x32200120 0x0d000000
0x0034: 0x00905fb0 0x00000000
[terminal]$ cat a.yo
0x000: | .pos 0
0x000: | init:
0x000: 30f437000000 | irmovl Stack, %esp
0x006: 2045 | rrmovl %esp, %ebp
0x008: 800e000000 | call Main
0x00d: 00 | halt
|
0x00e: | Main:
0x00e: a05f | pushl %ebp
0x010: 2045 | rrmovl %esp,%ebp
|
0x012: 30f004000000 | irmovl $4,%eax
0x018: a00f | pushl %eax
0x01a: 30f305000000 | irmovl $5,%ebx
0x020: a03f | pushl %ebx
0x022: 802c000000 | call Sum
|
0x027: 2054 | rrmovl %ebp,%esp
0x029: b05f | popl %ebp
0x02b: 90 | ret
|
0x02c: | Sum:
0x02c: a05f | pushl %ebp #right here
0x02e: 2045 | rrmovl %esp,%ebp
|
0x030: 2001 | rrmovl %eax,%ecx
0x032: 2032 | rrmovl %ebx,%edx
|
0x034: b05f | popl %ebp
0x036: 90 | ret
0x037: | Stack:
I'm using the yas simulator to compile and run my y86 assembly. I'm trying to understand why the program would halt at 0x2c, It does nothing except send 2 constants into a function (which aren't even used) that just moves the values that would be parameter into other registers.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
