Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(640)

Unified Diff: tests/exception_test/exception_test.c

Issue 12256018: [MIPS] Add remaining parts for building tests for MIPS (Closed) Base URL: http://src.chromium.org/native_client/trunk/src/native_client/
Patch Set: Minor change. Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tests/exception_test/exception_test.c
diff --git a/tests/exception_test/exception_test.c b/tests/exception_test/exception_test.c
index 76724a9245c2401bf4aa330ce1f6e4923a28d0f4..a44e2db25c223fe3ccf0e763f76037bb1ea495e6 100644
--- a/tests/exception_test/exception_test.c
+++ b/tests/exception_test/exception_test.c
@@ -31,7 +31,11 @@ char *g_registered_stack;
size_t g_registered_stack_size;
+#if defined(__mips__)
+#define STACK_ALIGNMENT 8
+#else
#define STACK_ALIGNMENT 16
+#endif
#if defined(__i386__)
const int kReturnAddrSize = 4;
@@ -45,6 +49,10 @@ const int kRedZoneSize = 128;
const int kReturnAddrSize = 0;
const int kArgSizeOnStack = 0;
const int kRedZoneSize = 0;
+#elif defined(__mips__)
+const int kReturnAddrSize = 0;
+const int kArgSizeOnStack = 16;
+const int kRedZoneSize = 0;
#else
# error Unsupported architecture
#endif
@@ -63,7 +71,11 @@ struct AlignedType {
*/
__attribute__((noinline))
void check_pointer_is_aligned(void *pointer) {
+#if defined(__mips__)
+ assert((uintptr_t) pointer % 8 == 0);
+#else
assert((uintptr_t) pointer % 16 == 0);
+#endif
}
void check_stack_is_aligned(void) {
@@ -97,6 +109,15 @@ __asm__(".pushsection .text, \"ax\", %progbits\n"
"prog_ctr_at_crash:\n"
"str r0, [r0]\n"
".popsection\n");
+#elif defined(__mips__)
+__asm__(".pushsection .text, \"ax\", %progbits\n"
+ ".p2align 4\n"
+ "crash_at_known_address:\n"
+ "ori $t0, $zero, 0\n"
+ "and $t0, $t0, $t7\n"
+ "prog_ctr_at_crash:\n"
+ "sw $t0, 0($t0)\n"
+ ".popsection\n");
#else
# error Unsupported architecture
#endif
@@ -121,6 +142,8 @@ void exception_handler_wrapped(struct NaClSignalContext *entry_regs) {
assert(context->frame_ptr == (uint32_t) g_regs_at_crash.rbp);
#elif defined(__arm__)
assert(context->frame_ptr == g_regs_at_crash.r11);
+#elif defined(__mips__)
+ assert(context->frame_ptr == g_regs_at_crash.frame_ptr);
#else
# error Unsupported architecture
#endif
@@ -194,6 +217,9 @@ void test_exception_stack_with_size(char *stack, size_t stack_size) {
#if defined(__arm__)
/* crash_at_known_address clobbers r0. */
g_regs_at_crash.r0 = 0;
+#elif defined(__mips__)
+ /* crash_at_known_address clobbers t0. */
+ g_regs_at_crash.t0 = 0;
#endif
if (!setjmp(g_jmp_buf)) {

Powered by Google App Engine
This is Rietveld 408576698