Chromium Code Reviews| Index: tests/debug_stub/debugger_test.c |
| diff --git a/tests/debug_stub/debugger_test.c b/tests/debug_stub/debugger_test.c |
| index 251491a5e2f6133ab2ed09eb7f7dfa7f1bb48c16..dfcf3289bfe48316bb372f7a5c3ffef068473533 100644 |
| --- a/tests/debug_stub/debugger_test.c |
| +++ b/tests/debug_stub/debugger_test.c |
| @@ -37,6 +37,11 @@ __asm__(".pushsection .text, \"ax\", %progbits\n" |
| "fault_addr:\n" |
| ".word " NACL_TO_STRING(NACL_INSTR_ARM_BREAKPOINT) "\n" |
| ".popsection\n"); |
| +#elif defined(__mips__) |
| +__asm__(".pushsection .text, \"ax\", %progbits\n" |
| + "fault_addr:\n" |
| + ".word 0x0000000d\n" |
|
Mark Seaborn
2013/12/26 17:01:13
Can you comment the instruction that this encodes?
petarj
2013/12/26 18:36:24
Done.
|
| + ".popsection\n"); |
| #else |
| # error Update fault_addr for other architectures |
| #endif |
| @@ -100,6 +105,36 @@ void set_registers_and_stop(void) { |
| regs.stack_ptr = 0x12345678; |
| regs.lr = 0xe000000f; |
| regs.cpsr = (1 << 29) | (1 << 27); /* C and Q flags */ |
| +#elif defined(__mips__) |
| + /* Skip zero register because it can not be set. */ |
| + regs.at = 0x11000220; |
| + regs.v0 = 0x22000330; |
| + regs.v1 = 0x33000440; |
| + regs.a0 = 0x44000550; |
| + regs.a1 = 0x55000660; |
| + regs.a2 = 0x66000770; |
| + regs.a3 = 0x77000880; |
| + regs.t0 = 0x88000990; |
| + regs.t1 = 0x99000AA0; |
| + regs.t2 = 0xAA000BB0; |
| + regs.t3 = 0xBB000CC0; |
| + regs.t4 = 0xCC000DD0; |
| + regs.t5 = 0xDD000EE0; |
| + /* Skip t6, t7 and t8, because they can not be set by untrusted code. */ |
| + regs.s0 = 0x11100222; |
| + regs.s1 = 0x22200333; |
| + regs.s2 = 0x33300444; |
| + regs.s3 = 0x44400555; |
| + regs.s4 = 0x55500666; |
| + regs.s5 = 0x66600777; |
| + regs.s6 = 0x77700888; |
| + regs.s7 = 0x88800999; |
| + regs.t9 = 0xAAA00BBB; |
| + /* Skip k0 and k1 registers, since they can be changed by kernel. */ |
|
Mark Seaborn
2013/12/26 17:01:13
"can only"?
petarj
2013/12/26 18:36:24
See the comment elsewhere.
|
| + regs.global_ptr = 0xDDD00EEE; |
| + regs.stack_ptr = 0x2EE00FFF; |
| + regs.frame_ptr = 0xFFF00000; |
| + regs.return_addr = 0x0A0A0A0A; |
| #else |
| # error Update set_registers_and_stop for other architectures |
| #endif |
| @@ -159,6 +194,9 @@ void test_single_step(void) { |
| #elif defined(__arm__) |
|
Mark Seaborn
2013/12/26 17:01:13
"|| defined(__mips__)" for brevity?
petarj
2013/12/26 18:36:24
Done.
|
| printf("Single-stepping is not supported on ARM\n"); |
| exit(1); |
| +#elif defined(__mips__) |
| + printf("Single-stepping is not supported on MIPS\n"); |
| + exit(1); |
| #else |
| # error Update test_single_step for other architectures |
| #endif |
| @@ -189,6 +227,10 @@ void breakpoint(void) { |
| __asm__(".p2align 4\n" |
| ".word " NACL_TO_STRING(NACL_INSTR_ARM_BREAKPOINT) "\n" |
| ".p2align 4\n"); |
| +#elif defined(__mips__) |
| + __asm__(".p2align 4\n" |
| + ".word 0x0000000d\n" |
|
Mark Seaborn
2013/12/26 17:01:13
ditto
petarj
2013/12/26 18:36:24
Done.
|
| + ".p2align 4\n"); |
| #else |
| # error Unsupported architecture |
| #endif |