diff --git a/y86-app-bin/abs-asum-cmov.bin b/y86-app-bin/abs-asum-cmov.bin new file mode 100755 index 0000000..b704f43 Binary files /dev/null and b/y86-app-bin/abs-asum-cmov.bin differ diff --git a/y86-app-bin/abs-asum-jmp.bin b/y86-app-bin/abs-asum-jmp.bin new file mode 100755 index 0000000..69460f4 Binary files /dev/null and b/y86-app-bin/abs-asum-jmp.bin differ diff --git a/y86-app-bin/asum.bin b/y86-app-bin/asum.bin new file mode 100755 index 0000000..acba84e Binary files /dev/null and b/y86-app-bin/asum.bin differ diff --git a/y86-app-bin/asumr.bin b/y86-app-bin/asumr.bin new file mode 100755 index 0000000..416bbc7 Binary files /dev/null and b/y86-app-bin/asumr.bin differ diff --git a/y86-app-bin/cjr.bin b/y86-app-bin/cjr.bin new file mode 100755 index 0000000..98fca47 Binary files /dev/null and b/y86-app-bin/cjr.bin differ diff --git a/y86-app-bin/j-cc.bin b/y86-app-bin/j-cc.bin new file mode 100755 index 0000000..fde221d Binary files /dev/null and b/y86-app-bin/j-cc.bin differ diff --git a/y86-app-bin/poptest.bin b/y86-app-bin/poptest.bin new file mode 100755 index 0000000..1db4e9b Binary files /dev/null and b/y86-app-bin/poptest.bin differ diff --git a/y86-app-bin/prog1.bin b/y86-app-bin/prog1.bin new file mode 100755 index 0000000..55c1faf Binary files /dev/null and b/y86-app-bin/prog1.bin differ diff --git a/y86-app-bin/prog10.bin b/y86-app-bin/prog10.bin new file mode 100755 index 0000000..d57b9bf Binary files /dev/null and b/y86-app-bin/prog10.bin differ diff --git a/y86-app-bin/prog2.bin b/y86-app-bin/prog2.bin new file mode 100755 index 0000000..5368672 Binary files /dev/null and b/y86-app-bin/prog2.bin differ diff --git a/y86-app-bin/prog3.bin b/y86-app-bin/prog3.bin new file mode 100755 index 0000000..accce54 Binary files /dev/null and b/y86-app-bin/prog3.bin differ diff --git a/y86-app-bin/prog4.bin b/y86-app-bin/prog4.bin new file mode 100755 index 0000000..950b2db Binary files /dev/null and b/y86-app-bin/prog4.bin differ diff --git a/y86-app-bin/prog5.bin b/y86-app-bin/prog5.bin new file mode 100755 index 0000000..dec5eca Binary files /dev/null and b/y86-app-bin/prog5.bin differ diff --git a/y86-app-bin/prog6.bin b/y86-app-bin/prog6.bin new file mode 100755 index 0000000..f456698 Binary files /dev/null and b/y86-app-bin/prog6.bin differ diff --git a/y86-app-bin/prog7.bin b/y86-app-bin/prog7.bin new file mode 100755 index 0000000..76cbc84 Binary files /dev/null and b/y86-app-bin/prog7.bin differ diff --git a/y86-app-bin/prog8.bin b/y86-app-bin/prog8.bin new file mode 100755 index 0000000..f7572c0 Binary files /dev/null and b/y86-app-bin/prog8.bin differ diff --git a/y86-app-bin/prog9.bin b/y86-app-bin/prog9.bin new file mode 100755 index 0000000..43b07c3 Binary files /dev/null and b/y86-app-bin/prog9.bin differ diff --git a/y86-app-bin/pushquestion.bin b/y86-app-bin/pushquestion.bin new file mode 100755 index 0000000..20080c1 Binary files /dev/null and b/y86-app-bin/pushquestion.bin differ diff --git a/y86-app-bin/pushtest.bin b/y86-app-bin/pushtest.bin new file mode 100755 index 0000000..585a3ff Binary files /dev/null and b/y86-app-bin/pushtest.bin differ diff --git a/y86-app-bin/ret-hazard.bin b/y86-app-bin/ret-hazard.bin new file mode 100755 index 0000000..6dc5148 Binary files /dev/null and b/y86-app-bin/ret-hazard.bin differ diff --git a/y86-base/abs-asum-cmov.ys b/y86-base/abs-asum-cmov.ys new file mode 100644 index 0000000..97dffa4 --- /dev/null +++ b/y86-base/abs-asum-cmov.ys @@ -0,0 +1,52 @@ +# Modification of asum code to compute absolute values of entries. +# This version uses a conditional jump +# Execution begins at address 0 + .pos 0 +init: irmovl Stack, %esp # Set up Stack pointer + irmovl Stack, %ebp # Set up base pointer + jmp Main # Execute main program + +# Array of 4 elements + .align 4 +array: .long 0x0000000d + .long 0xffffff40 # -0xc0 + .long 0x00000b00 + .long 0xffff6000 # -0xa0000 + +Main: irmovl $4,%eax + pushl %eax # Push 4 + irmovl array,%edx + pushl %edx # Push array + call AbsSum # Sum(array, 4) + halt + + # int AbsSum(int *Start, int Count) +AbsSum: + pushl %ebp + rrmovl %esp,%ebp + mrmovl 8(%ebp),%ecx # ecx = Start + mrmovl 12(%ebp),%edx # edx = Count + irmovl $0, %eax # sum = 0 + andl %edx,%edx + je End +#/* $begin abs-sum-cmov-ys 0 */ +Loop: + mrmovl (%ecx),%esi # get x = *Start + irmovl $0,%edi # 0 + subl %esi,%edi # -x + cmovg %edi,%esi # if -x > 0 then x = -x + addl %esi,%eax # add x to sum + irmovl $4,%ebx # + addl %ebx,%ecx # Start++ + irmovl $-1,%ebx # + addl %ebx,%edx # Count-- + jne Loop # Stop when 0 +#/* $end abs-sum-cmov-ys 0 */ +End: + popl %ebp + ret + + .pos 0x100 +Stack: # The stack goes here +#/* $end code-ysa */ +#/* $end code-yso */ diff --git a/y86-base/abs-asum-jmp.ys b/y86-base/abs-asum-jmp.ys new file mode 100644 index 0000000..d5d34eb --- /dev/null +++ b/y86-base/abs-asum-jmp.ys @@ -0,0 +1,53 @@ +# Modification of asum code to compute absolute values of entries. +# This version uses a conditional jump +# Execution begins at address 0 + .pos 0 +init: irmovl Stack, %esp # Set up Stack pointer + irmovl Stack, %ebp # Set up base pointer + jmp Main # Execute main program + +# Array of 4 elements + .align 4 +array: .long 0x0000000d + .long 0xffffff40 # -0xc0 + .long 0x00000b00 + .long 0xffff6000 # -0xa0000 + +Main: irmovl $4,%eax + pushl %eax # Push 4 + irmovl array,%edx + pushl %edx # Push array + call AbsSum # Sum(array, 4) + halt + +#/* $begin abs-sum-jmp-ys 0 */ + # int AbsSum(int *Start, int Count) +AbsSum: + pushl %ebp + rrmovl %esp,%ebp + mrmovl 8(%ebp),%ecx # ecx = Start + mrmovl 12(%ebp),%edx # edx = Count + irmovl $0, %eax # sum = 0 + andl %edx,%edx + je End +Loop: + mrmovl (%ecx),%esi # get x = *Start + irmovl $0,%edi # 0 + subl %esi,%edi # -x + jle Pos # Skip if -x <= 0 + rrmovl %edi,%esi # x = -x +Pos: + addl %esi,%eax # add x to sum + irmovl $4,%ebx # + addl %ebx,%ecx # Start++ + irmovl $-1,%ebx # + addl %ebx,%edx # Count-- + jne Loop # Stop when 0 +End: + popl %ebp + ret +#/* $end abs-sum-jmp-ys 0 */ + .pos 0x100 +Stack: # The stack goes here +#/* $end code-ysa */ +#/* $end code-yso */ diff --git a/y86-base/addl.ys b/y86-base/addl.ys new file mode 100644 index 0000000..4d31aad --- /dev/null +++ b/y86-base/addl.ys @@ -0,0 +1,4 @@ +# test addl + addl %esi, %edi + halt +# end diff --git a/y86-base/align.ys b/y86-base/align.ys new file mode 100644 index 0000000..5550455 --- /dev/null +++ b/y86-base/align.ys @@ -0,0 +1,5 @@ +# test .align +.align 4 + halt +.align 8 +# end diff --git a/y86-base/andl.ys b/y86-base/andl.ys new file mode 100644 index 0000000..a4403cc --- /dev/null +++ b/y86-base/andl.ys @@ -0,0 +1,4 @@ +# test andl + andl %esi, %edi + halt +# end diff --git a/y86-base/asum.ys b/y86-base/asum.ys new file mode 100644 index 0000000..cf6da29 --- /dev/null +++ b/y86-base/asum.ys @@ -0,0 +1,53 @@ +#/* $begin code-yso */ +#/* $begin code-ysa */ +# Execution begins at address 0 + .pos 0 +init: irmovl Stack, %esp # Set up stack pointer + irmovl Stack, %ebp # Set up base pointer + call Main # Execute main program + halt # Terminate program + +# Array of 4 elements + .align 4 +array: .long 0xd + .long 0xc0 + .long 0xb00 + .long 0xa000 + +Main: pushl %ebp + rrmovl %esp,%ebp + irmovl $4,%eax + pushl %eax # Push 4 + irmovl array,%edx + pushl %edx # Push array + call Sum # Sum(array, 4) + rrmovl %ebp,%esp + popl %ebp + ret + +#/* $begin sum-ys 0 */ + # int Sum(int *Start, int Count) +Sum: pushl %ebp + rrmovl %esp,%ebp + mrmovl 8(%ebp),%ecx # ecx = Start + mrmovl 12(%ebp),%edx # edx = Count + xorl %eax,%eax # sum = 0 + andl %edx,%edx # Set condition codes + je End +Loop: mrmovl (%ecx),%esi # get *Start + addl %esi,%eax # add to sum + irmovl $4,%ebx # + addl %ebx,%ecx # Start++ + irmovl $-1,%ebx # + addl %ebx,%edx # Count-- + jne Loop # Stop when 0 +End: rrmovl %ebp,%esp + popl %ebp + ret +#/* $end sum-ys 0 */ + +# The stack starts here and grows to lower addresses + .pos 0x100 +Stack: +#/* $end code-ysa */ +#/* $end code-yso */ diff --git a/y86-base/asumr.ys b/y86-base/asumr.ys new file mode 100644 index 0000000..5842994 --- /dev/null +++ b/y86-base/asumr.ys @@ -0,0 +1,48 @@ +# Execution begins at address 0 + .pos 0 +init: irmovl Stack, %esp # Set up Stack pointer + irmovl Stack, %ebp # Set up base pointer + jmp Main # Execute main program + +# Array of 4 elements + .align 4 +array: .long 0xd + .long 0xc0 + .long 0xb00 + .long 0xa000 + +Main: irmovl $4,%eax + pushl %eax # Push 4 + irmovl array,%edx + pushl %edx # Push array + call rSum # Sum(array, 4) + halt + +#/* $begin rsum-ys */ + # int Sum(int *Start, int Count) +rSum: pushl %ebp + rrmovl %esp,%ebp + pushl %ebx # Save value of %ebx + mrmovl 8(%ebp),%ebx # Get Start + mrmovl 12(%ebp),%eax # Get Count + andl %eax,%eax # Test value of Count + jle L38 # If <= 0, goto zreturn + irmovl $-1,%edx + addl %edx,%eax # Count-- + pushl %eax # Push Count + irmovl $4,%edx + rrmovl %ebx,%eax + addl %edx,%eax + pushl %eax # Push Start+1 + call rSum # Sum(Start+1, Count-1) + mrmovl (%ebx),%edx + addl %edx,%eax # Add *Start + jmp L39 # goto done +L38: xorl %eax,%eax # zreturn: +L39: mrmovl -4(%ebp),%ebx # done: Restore %ebx + rrmovl %ebp,%esp # Deallocate stack frame + popl %ebp # Restore %ebp + ret +#/* $end rsum-ys */ + .pos 0x400 +Stack: # The stack goes here diff --git a/y86-base/byte.ys b/y86-base/byte.ys new file mode 100644 index 0000000..80d66f0 --- /dev/null +++ b/y86-base/byte.ys @@ -0,0 +1,7 @@ +# test .byte + halt +Data: + .byte 0x0A + .byte 0x1B + .byte 0x2C +# end diff --git a/y86-base/call.ys b/y86-base/call.ys new file mode 100644 index 0000000..0249d57 --- /dev/null +++ b/y86-base/call.ys @@ -0,0 +1,5 @@ +# test call +Func1: + call Func1 + halt +# end diff --git a/y86-base/cjr.ys b/y86-base/cjr.ys new file mode 100644 index 0000000..6225c89 --- /dev/null +++ b/y86-base/cjr.ys @@ -0,0 +1,17 @@ +# /* $begin cjr-ys */ +# Code to generate a combination of not-taken branch and ret + irmovl Stack, %esp + irmovl rtnp,%eax + pushl %eax # Set up return pointer + xorl %eax,%eax # Set Z condition code + jne target # Not taken (First part of combination) + irmovl $1,%eax # Should execute this + halt +target: ret # Second part of combination + irmovl $2,%ebx # Should not execute this + halt +rtnp: irmovl $3,%edx # Should not execute this + halt +.pos 0x40 +Stack: +# /* $end cjr-ys */ diff --git a/y86-base/cmove.ys b/y86-base/cmove.ys new file mode 100644 index 0000000..f08d497 --- /dev/null +++ b/y86-base/cmove.ys @@ -0,0 +1,4 @@ +# test cmove + cmove %esi, %edi + halt +# end diff --git a/y86-base/cmovg.ys b/y86-base/cmovg.ys new file mode 100644 index 0000000..9f63b87 --- /dev/null +++ b/y86-base/cmovg.ys @@ -0,0 +1,4 @@ +# test cmovg + cmovg %eax, %ebx + halt +# end diff --git a/y86-base/cmovge.ys b/y86-base/cmovge.ys new file mode 100644 index 0000000..9a7e2d3 --- /dev/null +++ b/y86-base/cmovge.ys @@ -0,0 +1,4 @@ +# test cmovge + cmovge %eax, %ebx + halt +# end diff --git a/y86-base/cmovl.ys b/y86-base/cmovl.ys new file mode 100644 index 0000000..ec3998a --- /dev/null +++ b/y86-base/cmovl.ys @@ -0,0 +1,4 @@ +# test cmovl + cmovl %esi, %edi + halt +# end diff --git a/y86-base/cmovle.ys b/y86-base/cmovle.ys new file mode 100644 index 0000000..2eace0e --- /dev/null +++ b/y86-base/cmovle.ys @@ -0,0 +1,4 @@ +# test cmovle + cmovle %esi, %edi + halt +# end diff --git a/y86-base/cmovne.ys b/y86-base/cmovne.ys new file mode 100644 index 0000000..3732dc6 --- /dev/null +++ b/y86-base/cmovne.ys @@ -0,0 +1,4 @@ +# test cmovne + cmovne %esi, %edi + halt +# end diff --git a/y86-base/halt.ys b/y86-base/halt.ys new file mode 100644 index 0000000..39417cb --- /dev/null +++ b/y86-base/halt.ys @@ -0,0 +1,3 @@ +# halt immediately + halt # Terminate program +# end diff --git a/y86-base/irmovl.ys b/y86-base/irmovl.ys new file mode 100644 index 0000000..04edb78 --- /dev/null +++ b/y86-base/irmovl.ys @@ -0,0 +1,5 @@ +# test irmovl + irmovl $123, %eax + irmovl $-123, %ebx + halt +# end diff --git a/y86-base/j-cc.ys b/y86-base/j-cc.ys new file mode 100644 index 0000000..b8c95d5 --- /dev/null +++ b/y86-base/j-cc.ys @@ -0,0 +1,15 @@ + irmovl $1, %esi + irmovl $2, %edi + irmovl $4, %ebp + irmovl $-32, %eax + irmovl $64, %edx + subl %edx,%eax + je target + nop + halt +target: + addl %esi,%edx + nop + nop + nop + halt diff --git a/y86-base/je.ys b/y86-base/je.ys new file mode 100644 index 0000000..44e9fb0 --- /dev/null +++ b/y86-base/je.ys @@ -0,0 +1,5 @@ +# test je +Loop: + je Loop + halt +# end diff --git a/y86-base/jg.ys b/y86-base/jg.ys new file mode 100644 index 0000000..e2bc979 --- /dev/null +++ b/y86-base/jg.ys @@ -0,0 +1,5 @@ +# test jg +Loop: + jg Loop + halt +# end diff --git a/y86-base/jge.ys b/y86-base/jge.ys new file mode 100644 index 0000000..9c53713 --- /dev/null +++ b/y86-base/jge.ys @@ -0,0 +1,5 @@ +# test jge +Loop: + jge Loop + halt +# end diff --git a/y86-base/jl.ys b/y86-base/jl.ys new file mode 100644 index 0000000..49041b3 --- /dev/null +++ b/y86-base/jl.ys @@ -0,0 +1,5 @@ +# test jl +Loop: + jl Loop + halt +# end diff --git a/y86-base/jle.ys b/y86-base/jle.ys new file mode 100644 index 0000000..9f96fbf --- /dev/null +++ b/y86-base/jle.ys @@ -0,0 +1,5 @@ +# test jle +Loop: + jle Loop + halt +# end diff --git a/y86-base/jmp.ys b/y86-base/jmp.ys new file mode 100644 index 0000000..7598090 --- /dev/null +++ b/y86-base/jmp.ys @@ -0,0 +1,5 @@ +# test jmp +Loop: + jmp Loop + halt +# end diff --git a/y86-base/jne.ys b/y86-base/jne.ys new file mode 100644 index 0000000..cef6987 --- /dev/null +++ b/y86-base/jne.ys @@ -0,0 +1,5 @@ +# test jne +Loop: + jne Loop + halt +# end diff --git a/y86-base/long.ys b/y86-base/long.ys new file mode 100644 index 0000000..1ce16de --- /dev/null +++ b/y86-base/long.ys @@ -0,0 +1,7 @@ +# test .long + halt +Data: + .long 0xfffff70A + .long 0x0000001B + .long 0xfff9062C +# end diff --git a/y86-base/mrmovl.ys b/y86-base/mrmovl.ys new file mode 100644 index 0000000..95c8546 --- /dev/null +++ b/y86-base/mrmovl.ys @@ -0,0 +1,6 @@ +# test mrmovl + mrmovl -2(%esp), %eax + mrmovl (%ebx), %esi + mrmovl 8(%ebp), %ecx + halt +# end diff --git a/y86-base/nop.ys b/y86-base/nop.ys new file mode 100644 index 0000000..6cf296c --- /dev/null +++ b/y86-base/nop.ys @@ -0,0 +1,5 @@ +# nop, nop and halt + nop + nop + halt # Terminate program +# end diff --git a/y86-base/popl.ys b/y86-base/popl.ys new file mode 100644 index 0000000..d38d2c9 --- /dev/null +++ b/y86-base/popl.ys @@ -0,0 +1,4 @@ +# test popl + popl %ebp + halt +# end diff --git a/y86-base/poptest.ys b/y86-base/poptest.ys new file mode 100644 index 0000000..94ec064 --- /dev/null +++ b/y86-base/poptest.ys @@ -0,0 +1,6 @@ +# Test of Pop semantics for Y86 + irmovl $0x100,%esp # Initialize stack pointer + irmovl $0xABCD,%eax + pushl %eax # Put known value on stack + popl %esp # Either get 0xABCD, or 0xfc + halt diff --git a/y86-base/pos.ys b/y86-base/pos.ys new file mode 100644 index 0000000..9fcf3b1 --- /dev/null +++ b/y86-base/pos.ys @@ -0,0 +1,7 @@ +# test .pos +.pos 0 +Begin: + halt +.pos 0x100 +Stack: +# end diff --git a/y86-base/prog1.ys b/y86-base/prog1.ys new file mode 100644 index 0000000..a982759 --- /dev/null +++ b/y86-base/prog1.ys @@ -0,0 +1,8 @@ +# prog1: Pad with 3 nop's + irmovl $10,%edx + irmovl $3,%eax + nop + nop + nop + addl %edx,%eax + halt diff --git a/y86-base/prog10.ys b/y86-base/prog10.ys new file mode 100644 index 0000000..c908e0c --- /dev/null +++ b/y86-base/prog10.ys @@ -0,0 +1,7 @@ +# prog10 + irmovl $1,%eax + xorl %esp,%esp # Set stack pointer to 0 and CC to 100 + pushl %eax # Attempt to write to 0xfffffffc + addl %eax,%eax # (Should not be executed) Would set CC to 000 + irmovl $2, %eax # Not executed + irmovl $3, %eax # Not executed diff --git a/y86-base/prog2.ys b/y86-base/prog2.ys new file mode 100644 index 0000000..65e0d60 --- /dev/null +++ b/y86-base/prog2.ys @@ -0,0 +1,7 @@ +# prog2: Pad with 2 nop's + irmovl $10,%edx + irmovl $3,%eax + nop + nop + addl %edx,%eax + halt diff --git a/y86-base/prog3.ys b/y86-base/prog3.ys new file mode 100644 index 0000000..b6344cc --- /dev/null +++ b/y86-base/prog3.ys @@ -0,0 +1,6 @@ +# prog3: Pad with 1 nop + irmovl $10,%edx + irmovl $3,%eax + nop + addl %edx,%eax + halt diff --git a/y86-base/prog4.ys b/y86-base/prog4.ys new file mode 100644 index 0000000..99cf21a --- /dev/null +++ b/y86-base/prog4.ys @@ -0,0 +1,5 @@ +# prog4: No padding + irmovl $10,%edx + irmovl $3,%eax + addl %edx,%eax + halt diff --git a/y86-base/prog5.ys b/y86-base/prog5.ys new file mode 100644 index 0000000..5d08045 --- /dev/null +++ b/y86-base/prog5.ys @@ -0,0 +1,8 @@ +# prog5: Load/use hazard + irmovl $128,%edx + irmovl $3,%ecx + rmmovl %ecx, 0(%edx) + irmovl $10,%ebx + mrmovl 0(%edx), %eax # Load %eax + addl %ebx,%eax # Use %eax + halt diff --git a/y86-base/prog6.ys b/y86-base/prog6.ys new file mode 100644 index 0000000..f5b2abe --- /dev/null +++ b/y86-base/prog6.ys @@ -0,0 +1,5 @@ +# prog6: Forwarding Priority + irmovl $10,%edx + irmovl $3,%edx + rrmovl %edx,%eax + halt diff --git a/y86-base/prog7.ys b/y86-base/prog7.ys new file mode 100644 index 0000000..f852389 --- /dev/null +++ b/y86-base/prog7.ys @@ -0,0 +1,14 @@ +# Demonstration of return +# /* $begin prog7-ys */ +# prog7 + irmovl Stack,%esp # Initialize stack pointer + call Proc # procedure call + irmovl $10,%edx # return point + halt +.pos 0x20 +Proc: # Proc: + ret # return immediately + rrmovl %edx,%ebx # not executed +.pos 0x30 +Stack: # Stack: Stack pointer +# /* $end prog7-ys */ diff --git a/y86-base/prog8.ys b/y86-base/prog8.ys new file mode 100644 index 0000000..6021281 --- /dev/null +++ b/y86-base/prog8.ys @@ -0,0 +1,13 @@ +# Demonstrate branch cancellation +# /* $begin prog8-ys */ +# prog8 + xorl %eax,%eax + jne target # Not taken + irmovl $1, %eax # Fall through + halt +target: + irmovl $2, %edx # Target + irmovl $3, %ebx # Target+1 +# /* $end prog8-ys */ + halt + diff --git a/y86-base/prog9.ys b/y86-base/prog9.ys new file mode 100644 index 0000000..5725a10 --- /dev/null +++ b/y86-base/prog9.ys @@ -0,0 +1,9 @@ +# Exception handling +# /* $begin prog9-yo */ + xorl %eax,%eax + jne Target # Not taken + irmovl $1, %eax # Fall through + halt +Target: + .byte 0xFF # Invalid instruction code +# /* $end prog9-yo */ diff --git a/y86-base/pushl.ys b/y86-base/pushl.ys new file mode 100644 index 0000000..1092bf4 --- /dev/null +++ b/y86-base/pushl.ys @@ -0,0 +1,4 @@ +# test addl + pushl %ebp + halt +# end diff --git a/y86-base/pushquestion.ys b/y86-base/pushquestion.ys new file mode 100644 index 0000000..ffeafe0 --- /dev/null +++ b/y86-base/pushquestion.ys @@ -0,0 +1,5 @@ + # Assembly Code to test semantics of pushl + irmovl $0x100, %esp + pushl %esp # Ambiguous + popl %eax + halt diff --git a/y86-base/pushtest.ys b/y86-base/pushtest.ys new file mode 100644 index 0000000..ab8859d --- /dev/null +++ b/y86-base/pushtest.ys @@ -0,0 +1,7 @@ +# Test of Push semantics for Y86 + irmovl $0x100,%esp # Initialize stack pointer + rrmovl %esp,%eax # Save stack pointer + pushl %esp # Push the stack pointer (old or new?) + popl %edx # Get it back + subl %edx,%eax # Compute difference. Either 0 (old) or 4 (new). + halt diff --git a/y86-base/ret-hazard.ys b/y86-base/ret-hazard.ys new file mode 100644 index 0000000..f6135f5 --- /dev/null +++ b/y86-base/ret-hazard.ys @@ -0,0 +1,13 @@ +#/* $begin ret-hazard-ys */ +# Test instruction that modifies %esp followed by ret + irmovl mem,%ebx + mrmovl 0(%ebx),%esp # Sets %esp to point to return point + ret # Returns to return point + halt # +rtnpt: irmovl $5,%esi # Return point + halt +.pos 0x40 +mem: .long stack # Holds desired stack pointer +.pos 0x50 +stack: .long rtnpt # Top of stack: Holds return point +#/* $end ret-hazard-ys */ diff --git a/y86-base/ret.ys b/y86-base/ret.ys new file mode 100644 index 0000000..eefe044 --- /dev/null +++ b/y86-base/ret.ys @@ -0,0 +1,4 @@ +# test ret + ret + halt +# end diff --git a/y86-base/rmmovl.ys b/y86-base/rmmovl.ys new file mode 100644 index 0000000..2583700 --- /dev/null +++ b/y86-base/rmmovl.ys @@ -0,0 +1,6 @@ +# test rmmovl + rmmovl %ecx, 4(%ecx) + rmmovl %ecx, (%ebx) + rmmovl %eax, 12(%ebp) + halt +# end diff --git a/y86-base/rrmovl.ys b/y86-base/rrmovl.ys new file mode 100644 index 0000000..fb964be --- /dev/null +++ b/y86-base/rrmovl.ys @@ -0,0 +1,5 @@ +# test rrmovl + rrmovl %eax, %ebx + rrmovl %ecx, %esi + halt +# end diff --git a/y86-base/subl.ys b/y86-base/subl.ys new file mode 100644 index 0000000..b56e742 --- /dev/null +++ b/y86-base/subl.ys @@ -0,0 +1,4 @@ +# test subl + subl %esi, %edi + halt +# end diff --git a/y86-base/word.ys b/y86-base/word.ys new file mode 100644 index 0000000..6a25b01 --- /dev/null +++ b/y86-base/word.ys @@ -0,0 +1,7 @@ +# test .word + halt +Data: + .word 0x130A + .word 0xFF1B + .word 0x172C +# end diff --git a/y86-base/xorl.ys b/y86-base/xorl.ys new file mode 100644 index 0000000..9167067 --- /dev/null +++ b/y86-base/xorl.ys @@ -0,0 +1,4 @@ +# test xorl + xorl %esi, %edi + halt +# end diff --git a/y86-ins-bin/addl.bin b/y86-ins-bin/addl.bin new file mode 100755 index 0000000..4230e81 Binary files /dev/null and b/y86-ins-bin/addl.bin differ diff --git a/y86-ins-bin/align.bin b/y86-ins-bin/align.bin new file mode 100755 index 0000000..f76dd23 Binary files /dev/null and b/y86-ins-bin/align.bin differ diff --git a/y86-ins-bin/andl.bin b/y86-ins-bin/andl.bin new file mode 100755 index 0000000..4b63a2b Binary files /dev/null and b/y86-ins-bin/andl.bin differ diff --git a/y86-ins-bin/byte.bin b/y86-ins-bin/byte.bin new file mode 100755 index 0000000..b304302 Binary files /dev/null and b/y86-ins-bin/byte.bin differ diff --git a/y86-ins-bin/call.bin b/y86-ins-bin/call.bin new file mode 100755 index 0000000..ed3414e Binary files /dev/null and b/y86-ins-bin/call.bin differ diff --git a/y86-ins-bin/cmove.bin b/y86-ins-bin/cmove.bin new file mode 100755 index 0000000..c26ff62 Binary files /dev/null and b/y86-ins-bin/cmove.bin differ diff --git a/y86-ins-bin/cmovg.bin b/y86-ins-bin/cmovg.bin new file mode 100755 index 0000000..6f1e9a9 Binary files /dev/null and b/y86-ins-bin/cmovg.bin differ diff --git a/y86-ins-bin/cmovge.bin b/y86-ins-bin/cmovge.bin new file mode 100755 index 0000000..8de2dd0 Binary files /dev/null and b/y86-ins-bin/cmovge.bin differ diff --git a/y86-ins-bin/cmovl.bin b/y86-ins-bin/cmovl.bin new file mode 100755 index 0000000..20a0008 Binary files /dev/null and b/y86-ins-bin/cmovl.bin differ diff --git a/y86-ins-bin/cmovle.bin b/y86-ins-bin/cmovle.bin new file mode 100755 index 0000000..3d76a14 Binary files /dev/null and b/y86-ins-bin/cmovle.bin differ diff --git a/y86-ins-bin/cmovne.bin b/y86-ins-bin/cmovne.bin new file mode 100755 index 0000000..ff2a1df Binary files /dev/null and b/y86-ins-bin/cmovne.bin differ diff --git a/y86-ins-bin/halt.bin b/y86-ins-bin/halt.bin new file mode 100755 index 0000000..f76dd23 Binary files /dev/null and b/y86-ins-bin/halt.bin differ diff --git a/y86-ins-bin/irmovl.bin b/y86-ins-bin/irmovl.bin new file mode 100755 index 0000000..bf2ff19 Binary files /dev/null and b/y86-ins-bin/irmovl.bin differ diff --git a/y86-ins-bin/je.bin b/y86-ins-bin/je.bin new file mode 100755 index 0000000..62378b1 Binary files /dev/null and b/y86-ins-bin/je.bin differ diff --git a/y86-ins-bin/jg.bin b/y86-ins-bin/jg.bin new file mode 100755 index 0000000..c8ec03b Binary files /dev/null and b/y86-ins-bin/jg.bin differ diff --git a/y86-ins-bin/jge.bin b/y86-ins-bin/jge.bin new file mode 100755 index 0000000..b02c101 Binary files /dev/null and b/y86-ins-bin/jge.bin differ diff --git a/y86-ins-bin/jl.bin b/y86-ins-bin/jl.bin new file mode 100755 index 0000000..6a952eb Binary files /dev/null and b/y86-ins-bin/jl.bin differ diff --git a/y86-ins-bin/jle.bin b/y86-ins-bin/jle.bin new file mode 100755 index 0000000..bedc478 Binary files /dev/null and b/y86-ins-bin/jle.bin differ diff --git a/y86-ins-bin/jmp.bin b/y86-ins-bin/jmp.bin new file mode 100755 index 0000000..43bce27 Binary files /dev/null and b/y86-ins-bin/jmp.bin differ diff --git a/y86-ins-bin/jne.bin b/y86-ins-bin/jne.bin new file mode 100755 index 0000000..ad40cba Binary files /dev/null and b/y86-ins-bin/jne.bin differ diff --git a/y86-ins-bin/long.bin b/y86-ins-bin/long.bin new file mode 100755 index 0000000..5923219 Binary files /dev/null and b/y86-ins-bin/long.bin differ diff --git a/y86-ins-bin/mrmovl.bin b/y86-ins-bin/mrmovl.bin new file mode 100755 index 0000000..6e69119 Binary files /dev/null and b/y86-ins-bin/mrmovl.bin differ diff --git a/y86-ins-bin/nop.bin b/y86-ins-bin/nop.bin new file mode 100755 index 0000000..092999d Binary files /dev/null and b/y86-ins-bin/nop.bin differ diff --git a/y86-ins-bin/popl.bin b/y86-ins-bin/popl.bin new file mode 100755 index 0000000..be292bb Binary files /dev/null and b/y86-ins-bin/popl.bin differ diff --git a/y86-ins-bin/pos.bin b/y86-ins-bin/pos.bin new file mode 100755 index 0000000..f76dd23 Binary files /dev/null and b/y86-ins-bin/pos.bin differ diff --git a/y86-ins-bin/pushl.bin b/y86-ins-bin/pushl.bin new file mode 100755 index 0000000..e362489 Binary files /dev/null and b/y86-ins-bin/pushl.bin differ diff --git a/y86-ins-bin/ret.bin b/y86-ins-bin/ret.bin new file mode 100755 index 0000000..e040d82 Binary files /dev/null and b/y86-ins-bin/ret.bin differ diff --git a/y86-ins-bin/rmmovl.bin b/y86-ins-bin/rmmovl.bin new file mode 100755 index 0000000..2864255 Binary files /dev/null and b/y86-ins-bin/rmmovl.bin differ diff --git a/y86-ins-bin/rrmovl.bin b/y86-ins-bin/rrmovl.bin new file mode 100755 index 0000000..8b4a3b6 Binary files /dev/null and b/y86-ins-bin/rrmovl.bin differ diff --git a/y86-ins-bin/subl.bin b/y86-ins-bin/subl.bin new file mode 100755 index 0000000..0cab44b Binary files /dev/null and b/y86-ins-bin/subl.bin differ diff --git a/y86-ins-bin/word.bin b/y86-ins-bin/word.bin new file mode 100755 index 0000000..9b59a00 Binary files /dev/null and b/y86-ins-bin/word.bin differ diff --git a/y86-ins-bin/xorl.bin b/y86-ins-bin/xorl.bin new file mode 100755 index 0000000..70d6570 Binary files /dev/null and b/y86-ins-bin/xorl.bin differ