Y86 Stopped in 1 Steps Exception HLT

299 views Asked by At

I translated a simple c program into IA32 and then transliterated it into Y86 but I am getting an error I don't understand or know how to debug since I am just learning Y86. The error is:

Stopped in 1 steps at PC = 0x1.  Exception 'HLT', CC Z=1 S=0 O=0
Changes to registers:

Changes to memory:

The program is supposed to initialize i to 0 and then proceed through a for loop until i is greater than or equal to 5 and increment i each time. Inside the for loop I set j equal to i*2 and k is equal to j+1. My Y86 code is as follows:

main:
    irmovl  $0, %ebx
    jmp L2
    halt
L3:
    rrmovl  %ebx, %eax
    addl    %eax, %eax
    rrmovl  %eax, %ecx
    rrmovl  %ecx, %eax
    irmovl  $1, %esi
    addl    %esi, %eax
    rrmovl  %eax, %edx
    addl    %esi, %ebx
L2:
    irmovl $4, %edi
    subl  %edi, %ebx
    jle L3

I can provide the C code and IA32 code I transliterated from if it would help you answer my problem I really need some help thanks.

1

There are 1 answers

0
Y86 Tutoring On

You forgot to add the extra NL (CR) in the source file. YAS is flawed. When it assembles it wraps the assembly around if there is no NL (CR) at the end of the source (ys) file, overwriting the beginning of the created object code (yo) file.

The result... well it is bad. In your case, YAS probably inserted a HLT instruction in the first character of the object file.