blob: 952458554a179de6969de94ffafc73ed5f419ee9 (
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
41
42
43
44
45
46
47
48
49
|
import sys
from miasm.core.locationdb import LocationDB
from miasm.analysis.machine import Machine
machine = Machine("x86_64")
loc_db = LocationDB()
jitter = machine.jitter(loc_db, sys.argv[1])
jitter.cpu.RAX = 16565615892967251934
assert jitter.cpu.RAX == 16565615892967251934
jitter.cpu.RAX = -1 & 0xffffffffffffffff
assert jitter.cpu.RAX == 0xffffffffffffffff
jitter.cpu.RAX = -2 & 0xffffffffffffffff
assert jitter.cpu.RAX == 0xfffffffffffffffe
jitter.cpu.EAX = -2 & 0xffffffff
assert jitter.cpu.EAX == 0xfffffffe
jitter.cpu.RAX = -0xffffffffffffffff & 0xffffffffffffffff
assert jitter.cpu.RAX == 1
try:
jitter.cpu.RAX = 0x1ffffffffffffffff
except TypeError:
pass
else:
raise Exception("Should see that 0x1ffffffffffffffff is too big for RAX")
try:
jitter.cpu.RAX = 0x10000000000000000
except TypeError:
pass
else:
raise Exception("Should see that 0x10000000000000000 is too big for RAX")
jitter.cpu.EAX = -0xefffffff & 0xffffffff
assert jitter.cpu.EAX == 0x10000001
jitter.cpu.EAX = -0xFFFFFFFF & 0xffffffff
assert jitter.cpu.EAX == 1
try:
jitter.cpu.EAX = -0x1ffffffff
except TypeError:
pass
else:
raise Exception("Should see that -0x1ffffffff is too big for EAX")
|