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

Side by Side Diff: tests/stack_alignment/stack_alignment_asm_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 cleanup. 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 unified diff | Download patch
« no previous file with comments | « tests/exception_test/nacl.scons ('k') | tests/stubout_mode/nacl.scons » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 #include <assert.h> 7 #include <assert.h>
8 #include <sched.h> 8 #include <sched.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 ".pushsection .text, \"ax\", %progbits\n" 53 ".pushsection .text, \"ax\", %progbits\n"
54 "ThreadStartWrapper:\n" 54 "ThreadStartWrapper:\n"
55 "mov r0, sp\n" /* Set argument */ 55 "mov r0, sp\n" /* Set argument */
56 "nop; nop\n" /* Padding to put the "bl" at the end of the bundle */ 56 "nop; nop\n" /* Padding to put the "bl" at the end of the bundle */
57 "bl ThreadStart\n" 57 "bl ThreadStart\n"
58 ".popsection\n"); 58 ".popsection\n");
59 59
60 static const int kStackAlignment = 8; 60 static const int kStackAlignment = 8;
61 static const int kStackPadBelowAlign = 0; 61 static const int kStackPadBelowAlign = 0;
62 62
63 #elif defined(__mips__)
64
65 __asm__(
66 ".pushsection .text, \"ax\", %progbits\n"
67 ".global ThreadStartWrapper\n"
68 "ThreadStartWrapper:\n"
69 "move $a0, $sp\n" /* Set argument. */
70 "nop\n"
71 "bal ThreadStart\n"
72 "nop\n"
73 ".popsection\n");
74
75 static const int kStackAlignment = 8;
76 static const int kStackPadBelowAlign = 0;
77
63 #else 78 #else
64 # error Unsupported architecture 79 # error Unsupported architecture
65 #endif 80 #endif
66 81
67 void ThreadStartWrapper(void); 82 void ThreadStartWrapper(void);
68 83
69 void ThreadStart(char *stack_ptr) { 84 void ThreadStart(char *stack_ptr) {
70 /* 85 /*
71 * We do not have TLS set up in this thread, so we don't use libc 86 * We do not have TLS set up in this thread, so we don't use libc
72 * functions like assert() here. Instead, we save stack_ptr and let 87 * functions like assert() here. Instead, we save stack_ptr and let
(...skipping 21 matching lines...) Expand all
94 sched_yield(); 109 sched_yield();
95 } 110 }
96 printf("got g_stack_ptr=%p\n", g_stack_ptr); 111 printf("got g_stack_ptr=%p\n", g_stack_ptr);
97 assert(g_stack_ptr <= stack_top); 112 assert(g_stack_ptr <= stack_top);
98 assert(((uintptr_t) g_stack_ptr + kStackPadBelowAlign) % kStackAlignment 113 assert(((uintptr_t) g_stack_ptr + kStackPadBelowAlign) % kStackAlignment
99 == 0); 114 == 0);
100 } 115 }
101 116
102 return 0; 117 return 0;
103 } 118 }
OLDNEW
« no previous file with comments | « tests/exception_test/nacl.scons ('k') | tests/stubout_mode/nacl.scons » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698