master
py 58 lines 1.75 KB
Raw
1 #
2 # Test the SVE ZReg reports the right amount of data. It uses the
3 # sve-ioctl test and examines the register data each time the
4 # __sve_ld_done breakpoint is hit.
5 #
6 # This is launched via tests/guest-debug/run-test.py
7 #
8
9 import gdb
10 from test_gdbstub import main, report
11
12 initial_vlen = 0
13
14
15 class TestBreakpoint(gdb.Breakpoint):
16 def __init__(self, sym_name="__sve_ld_done"):
17 super(TestBreakpoint, self).__init__(sym_name)
18 # self.sym, ok = gdb.lookup_symbol(sym_name)
19
20 def stop(self):
21 val_i = gdb.parse_and_eval('i')
22 global initial_vlen
23 try:
24 for i in range(0, int(val_i)):
25 val_z = gdb.parse_and_eval("$z0.b.u[%d]" % i)
26 report(int(val_z) == i, "z0.b.u[%d] == %d" % (i, i))
27 for i in range(i + 1, initial_vlen):
28 val_z = gdb.parse_and_eval("$z0.b.u[%d]" % i)
29 report(int(val_z) == 0, "z0.b.u[%d] == 0" % (i))
30 except gdb.error:
31 report(False, "checking zregs (out of range)")
32
33 # Check the aliased V registers are set and GDB has correctly
34 # created them for us having recognised and handled SVE.
35 try:
36 for i in range(0, 16):
37 val_z = gdb.parse_and_eval("$z0.b.u[%d]" % i)
38 val_v = gdb.parse_and_eval("$v0.b.u[%d]" % i)
39 report(int(val_z) == int(val_v),
40 "v0.b.u[%d] == z0.b.u[%d]" % (i, i))
41 except gdb.error:
42 report(False, "checking vregs (out of range)")
43
44
45 def run_test():
46 "Run through the tests one by one"
47
48 print ("Setup breakpoint")
49 bp = TestBreakpoint()
50
51 global initial_vlen
52 vg = gdb.parse_and_eval("$vg")
53 initial_vlen = int(vg) * 8
54
55 gdb.execute("c")
56
57
58 main(run_test, expected_arch="aarch64")