@JudyYe
2016-04-26T11:45:05.000000Z
字数 4941
阅读 444
os
dx Thread 0
0
-1 1000 sub $1,%dx
-1 1001 test $0,%dx
-1 1002 jgte .top
-1 1003 halt
dx Thread 0 Thread 1
3
2 1000 sub $1,%dx
2 1001 test $0,%dx
2 1002 jgte .top
1 1000 sub $1,%dx
1 1001 test $0,%dx
1 1002 jgte .top
0 1000 sub $1,%dx
0 1001 test $0,%dx
0 1002 jgte .top
-1 1000 sub $1,%dx
-1 1001 test $0,%dx
-1 1002 jgte .top
-1 1003 halt
3 ----- Halt;Switch ----- ----- Halt;Switch -----
2 1000 sub $1,%dx
2 1001 test $0,%dx
2 1002 jgte .top
1 1000 sub $1,%dx
1 1001 test $0,%dx
1 1002 jgte .top
0 1000 sub $1,%dx
0 1001 test $0,%dx
0 1002 jgte .top
-1 1000 sub $1,%dx
-1 1001 test $0,%dx
-1 1002 jgte .top
-1 1003 halt
dx Thread 0 Thread 1
3
2 1000 sub $1,%dx
3 ------ Interrupt ------ ------ Interrupt ------
2 1000 sub $1,%dx
2 1001 test $0,%dx
2 ------ Interrupt ------ ------ Interrupt ------
2 1001 test $0,%dx
2 1002 jgte .top
1 1000 sub $1,%dx
2 ------ Interrupt ------ ------ Interrupt ------
2 1002 jgte .top
1 ------ Interrupt ------ ------ Interrupt ------
1 1001 test $0,%dx
1 1002 jgte .top
0 1000 sub $1,%dx
2 ------ Interrupt ------ ------ Interrupt ------
1 1000 sub $1,%dx
1 1001 test $0,%dx
1 1002 jgte .top
0 ------ Interrupt ------ ------ Interrupt ------
0 1001 test $0,%dx
0 1002 jgte .top
-1 1000 sub $1,%dx
1 ------ Interrupt ------ ------ Interrupt ------
0 1000 sub $1,%dx
0 1001 test $0,%dx
-1 ------ Interrupt ------ ------ Interrupt ------
-1 1001 test $0,%dx
-1 1002 jgte .top
-1 1003 halt
0 ----- Halt;Switch ----- ----- Halt;Switch -----
0 ------ Interrupt ------ ------ Interrupt ------
0 1002 jgte .top
-1 1000 sub $1,%dx
-1 ------ Interrupt ------ ------ Interrupt ------
-1 1001 test $0,%dx
-1 1002 jgte .top
-1 ------ Interrupt ------ ------ Interrupt ------
-1 1003 halt
2000 bx Thread 0
0 0
0 0 1000 mov 2000, %ax
0 0 1001 add $1, %ax
1 0 1002 mov %ax, 2000
1 -1 1003 sub $1, %bx
1 -1 1004 test $0, %bx
1 -1 1005 jgt .top
1 -1 1006 halt
变量x的内存地址为2000, ./x86.py -p looping-race-nolock.s -t 2 -a bx=3 -M 2000, 请问变量x的值是什么?为何每个线程要循环3次?
变量x的内存地址为2000, ./x86.py -p looping-race-nolock.s -t 2 -M 2000 -i 4 -r -s 0, 请问变量x的值是什么?
dx Thread 0 Thread 1
3
2 1000 sub $1,%dx
3 ------ Interrupt ------ ------ Interrupt ------
2 1000 sub $1,%dx
2 1001 test $0,%dx
2 ------ Interrupt ------ ------ Interrupt ------
2 1001 test $0,%dx
2 1002 jgte .top
1 1000 sub $1,%dx
2 ------ Interrupt ------ ------ Interrupt ------
2 1002 jgte .top
1 ------ Interrupt ------ ------ Interrupt ------
1 1001 test $0,%dx
1 1002 jgte .top
2 ------ Interrupt ------ ------ Interrupt ------
1 1000 sub $1,%dx
1 1001 test $0,%dx
1 ------ Interrupt ------ ------ Interrupt ------
0 1000 sub $1,%dx
1 ------ Interrupt ------ ------ Interrupt ------
1 1002 jgte .top
0 ------ Interrupt ------ ------ Interrupt ------
0 1001 test $0,%dx
0 1002 jgte .top
-1 1000 sub $1,%dx
1 ------ Interrupt ------ ------ Interrupt ------
0 1000 sub $1,%dx
0 1001 test $0,%dx
-1 ------ Interrupt ------ ------ Interrupt ------
-1 1001 test $0,%dx
-1 1002 jgte .top
0 ------ Interrupt ------ ------ Interrupt ------
0 1002 jgte .top
-1 ------ Interrupt ------ ------ Interrupt ------
-1 1003 halt
0 ----- Halt;Switch ----- ----- Halt;Switch -----
-1 1000 sub $1,%dx
-1 1001 test $0,%dx
-1 ------ Interrupt ------ ------ Interrupt ------
-1 1002 jgte .top
-1 1003 halt
2000 bx Thread 0 Thread 1
0 0
0 0 1000 mov 2000, %ax
0 0 1001 add $1, %ax
0 0 ------ Interrupt ------ ------ Interrupt ------
0 0 1000 mov 2000, %ax
0 0 1001 add $1, %ax
0 0 ------ Interrupt ------ ------ Interrupt ------
1 0 1002 mov %ax, 2000
1 -1 1003 sub $1, %bx
1 -1 1004 test $0, %bx
1 0 ------ Interrupt ------ ------ Interrupt ------
1 0 1002 mov %ax, 2000
1 -1 ------ Interrupt ------ ------ Interrupt ------
1 -1 1005 jgt .top
1 -1 1006 halt
1 0 ----- Halt;Switch ----- ----- Halt;Switch -----
1 0 ------ Interrupt ------ ------ Interrupt ------
1 -1 1003 sub $1, %bx
1 -1 1004 test $0, %bx
1 -1 ------ Interrupt ------ ------ Interrupt ------
1 -1 1005 jgt .top
1 -1 1006 halt
2000 bx Thread 0 Thread 1
0 0
0 0 1000 mov 2000, %ax
0 0 1001 add $1, %ax
1 0 1002 mov %ax, 2000
1 -1 1003 sub $1, %bx
1 0 ------ Interrupt ------ ------ Interrupt ------
1 0 1000 mov 2000, %ax
1 0 1001 add $1, %ax
1 -1 ------ Interrupt ------ ------ Interrupt ------
1 -1 1004 test $0, %bx
1 -1 1005 jgt .top
1 0 ------ Interrupt ------ ------ Interrupt ------
2 0 1002 mov %ax, 2000
2 -1 1003 sub $1, %bx
2 -1 1004 test $0, %bx
2 -1 ------ Interrupt ------ ------ Interrupt ------
2 -1 1006 halt
2 -1 ----- Halt;Switch ----- ----- Halt;Switch -----
2 -1 1005 jgt .top
2 -1 1006 halt
2000 bx Thread 0 Thread 1
0 1
0 1 1000 mov 2000, %ax
0 1 ------ Interrupt ------ ------ Interrupt ------
0 1 1000 mov 2000, %ax
0 1 ------ Interrupt ------ ------ Interrupt ------
0 1 1001 add $1, %ax
0 1 ------ Interrupt ------ ------ Interrupt ------
0 1 1001 add $1, %ax
0 1 ------ Interrupt ------ ------ Interrupt ------
1 1 1002 mov %ax, 2000
1 1 ------ Interrupt ------ ------ Interrupt ------
1 1 1002 mov %ax, 2000
1 1 ------ Interrupt ------ ------ Interrupt ------
1 0 1003 sub $1, %bx
1 1 ------ Interrupt ------ ------ Interrupt ------
1 0 1003 sub $1, %bx
1 0 ------ Interrupt ------ ------ Interrupt ------
1 0 1004 test $0, %bx
1 0 ------ Interrupt ------ ------ Interrupt ------
1 0 1004 test $0, %bx
1 0 ------ Interrupt ------ ------ Interrupt ------
1 0 1005 jgt .top
1 0 ------ Interrupt ------ ------ Interrupt ------
1 0 1005 jgt .top
1 0 ------ Interrupt ------ ------ Interrupt ------
1 0 1006 halt
1 0 ----- Halt;Switch ----- ----- Halt;Switch -----
1 0 ------ Interrupt ------ ------ Interrupt ------
1 0 1006 halt