• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* This test used to cause an assertion in the address space manager */
2 
3 __attribute__((noinline))
inner(void)4 static void inner(void)
5 {
6    /* Set registers to apriori known values. */
7    __asm__ __volatile__(
8       "movq $0x101, %%rax\n"
9       "movq $0x102, %%rbx\n"
10       "movq $0x103, %%rcx\n"
11       "movq $0x104, %%rdx\n"
12       "movq $0x105, %%rsi\n"
13       "movq $0x106, %%rdi\n"
14       "movq $0x107, %%r8\n"
15       "movq $0x108, %%r9\n"
16       "movq $0x109, %%r10\n"
17       "movq $0x10a, %%r11\n"
18       "movq $0x10b, %%r12\n"
19       "movq $0x10c, %%r13\n"
20       "movq $0x10d, %%r14\n"
21       "movq $0x10e, %%r15\n"
22       // not %rbp as mdb is then not able to reconstruct stack trace
23       "movq $0x10f, %%rsp\n"
24       "movq $0x1234, (%%rax)\n"  // should cause SEGV here
25       "ud2"                      // should never get here
26       : // no output registers
27       : // no input registers
28       : "memory", "%rax", "%rbx", "%rcx", "%rdx", "%rsi", "%rdi",
29         "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15", "%rsp");
30 }
31 
32 __attribute__((noinline))
outer(void)33 static void outer(void)
34 {
35    inner();
36 }
37 
main(int argc,const char * argv[])38 int main(int argc, const char *argv[])
39 {
40    outer();
41    return 0;
42 }
43