blob: af697e495b059f02bc6ac1be5c803de49d6246f5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
import sys
from miasm.analysis.machine import Machine
machine = Machine("x86_64")
jitter = machine.jitter(sys.argv[1])
jitter.cpu.RAX = 16565615892967251934
assert jitter.cpu.RAX == 16565615892967251934
jitter.cpu.RAX = -1
assert jitter.cpu.RAX == 0xffffffffffffffff
jitter.cpu.RAX = -2
assert jitter.cpu.RAX == 0xfffffffffffffffe
jitter.cpu.EAX = -2
assert jitter.cpu.EAX == 0xfffffffe
jitter.cpu.RAX = -0xffffffffffffffff
assert jitter.cpu.RAX == 1
try:
jitter.cpu.RAX = 0x1ffffffffffffffff
except TypeError as te:
pass
else:
raise Exception("Should see that 0x1ffffffffffffffff is to big for RAX")
jitter.cpu.EAX = -0xefffffff
assert jitter.cpu.EAX == 0x10000001
jitter.cpu.EAX = -0xFFFFFFFF
assert jitter.cpu.EAX == 1
try:
jitter.cpu.EAX = -0x1ffffffff
except TypeError as te:
pass
else:
raise Exception("Should see that -0x1ffffffff is to big for EAX")
|