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

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 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 unified diff | Download patch
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 "ThreadStartWrapper:\n"
68 "move $a0, $sp\n" /* Set argument. */
69 "nop\n"
70 "bal ThreadStart\n"
71 "nop\n"
72 ".popsection\n");
73
74 static const int kStackAlignment = 8;
75 static const int kStackPadBelowAlign = 0;
76
63 #else 77 #else
64 # error Unsupported architecture 78 # error Unsupported architecture
65 #endif 79 #endif
66 80
67 void ThreadStartWrapper(void); 81 void ThreadStartWrapper(void);
68 82
69 void ThreadStart(char *stack_ptr) { 83 void ThreadStart(char *stack_ptr) {
70 /* 84 /*
71 * We do not have TLS set up in this thread, so we don't use libc 85 * 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 86 * functions like assert() here. Instead, we save stack_ptr and let
(...skipping 21 matching lines...) Expand all
94 sched_yield(); 108 sched_yield();
95 } 109 }
96 printf("got g_stack_ptr=%p\n", g_stack_ptr); 110 printf("got g_stack_ptr=%p\n", g_stack_ptr);
97 assert(g_stack_ptr <= stack_top); 111 assert(g_stack_ptr <= stack_top);
98 assert(((uintptr_t) g_stack_ptr + kStackPadBelowAlign) % kStackAlignment 112 assert(((uintptr_t) g_stack_ptr + kStackPadBelowAlign) % kStackAlignment
99 == 0); 113 == 0);
100 } 114 }
101 115
102 return 0; 116 return 0;
103 } 117 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698