Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible bug with test instruction #59

Open
VickyMerzOwn opened this issue Aug 19, 2023 · 0 comments
Open

Possible bug with test instruction #59

VickyMerzOwn opened this issue Aug 19, 2023 · 0 comments

Comments

@VickyMerzOwn
Copy link

Was going through threads-intro/loop.s.
This is what it looks like:

.main
.top
sub  $1,%dx
test $0,%dx     
jgte .top         
halt

If I run: ./x86.py -p loop.s -t 1 -i 100 -R dx -c, I get the following output:

dx          Thread 0         
    0   
   -1   1000 sub  $1,%dx
   -1   1001 test $0,%dx
   -1   1002 jgte .top
   -1   1003 halt

My doubt is the following:
If dx is initialised to 0.
By 1001 test $0, %dx, it becomes -1, and here the constant 0 is greater than -1.
So in 1002 jgte .top should send the process in a loop, shouldn't it?
Or am I missing something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant