2 Test Intel(R) MPX registers do not get overwritten by AVX data.
8 from lldbsuite.test.decorators import *
9 from lldbsuite.test.lldbtest import *
10 from lldbsuite.test import lldbutil
13 class MPXOffsetIntersectionTestCase(TestBase):
15 mydir = TestBase.compute_mydir(__file__)
17 AVX_REGS = ('ymm' + str(i) for i in range(16))
18 YMM_VALUE = '{' + ' '.join(('0x00' for _ in range(32))) + '}'
20 MPX_REGULAR_REGS = ('bnd0', 'bnd1', 'bnd2', 'bnd3')
21 MPX_CONFIG_REGS = ('bndcfgu', 'bndstatus')
22 BND_VALUE = '{' + ' '.join(('0xff' for _ in range(16))) + '}'
24 @skipIf(oslist=no_match(['linux']))
25 @skipIf(archs=no_match(['x86_64']))
26 def test_mpx_registers_offset_intersection(self):
27 """Test if AVX data does not overwrite MPX values."""
29 self.mpx_registers_offset_intersection()
31 def mpx_registers_offset_intersection(self):
32 exe = self.getBuildArtifact('a.out')
33 self.runCmd('file ' + exe, CURRENT_EXECUTABLE_SET)
34 self.runCmd('run', RUN_SUCCEEDED)
35 target = self.dbg.GetSelectedTarget()
36 process = target.GetProcess()
37 thread = process.GetThreadAtIndex(0)
38 currentFrame = thread.GetFrameAtIndex(0)
42 for registerSet in currentFrame.GetRegisters():
43 if 'advanced vector extensions' in registerSet.GetName().lower():
45 if 'memory protection extension' in registerSet.GetName().lower():
47 if not (has_avx and has_mpx):
48 self.skipTest('Both AVX and MPX registers must be supported.')
50 for reg in self.AVX_REGS:
51 self.runCmd('register write ' + reg + " '" + self.YMM_VALUE + " '")
52 for reg in self.MPX_REGULAR_REGS + self.MPX_CONFIG_REGS:
53 self.runCmd('register write ' + reg + " '" + self.BND_VALUE + " '")
60 for reg in self.MPX_REGULAR_REGS:
61 self.expect('register read ' + reg,
62 substrs = [reg + ' = {0xffffffffffffffff 0xffffffffffffffff}'])
63 for reg in self.MPX_CONFIG_REGS:
64 self.expect('register read ' + reg,
65 substrs = [reg + ' = {0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff}'])
68 for reg in self.AVX_REGS:
69 self.expect('register read ' + reg, substrs = [reg + ' = ' + self.YMM_VALUE])