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

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: Update per codereview. 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 __asm__(
Mark Seaborn 2013/03/11 15:54:38 Add empty line before this for spacing consistency
petarj 2013/03/14 01:13:03 Done.
65 ".pushsection .text, \"ax\", %progbits\n"
66 "ThreadStartWrapper:\n"
67 "move $a0, $sp\n" /* Set argument. */
68 "nop\n"
69 "bal ThreadStart\n"
70 "nop\n"
71 ".popsection\n");
72
73 static const int kStackAlignment = 8;
74 static const int kStackPadBelowAlign = 0;
75
63 #else 76 #else
64 # error Unsupported architecture 77 # error Unsupported architecture
65 #endif 78 #endif
66 79
67 void ThreadStartWrapper(void); 80 void ThreadStartWrapper(void);
68 81
69 void ThreadStart(char *stack_ptr) { 82 void ThreadStart(char *stack_ptr) {
70 /* 83 /*
71 * We do not have TLS set up in this thread, so we don't use libc 84 * 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 85 * functions like assert() here. Instead, we save stack_ptr and let
(...skipping 21 matching lines...) Expand all
94 sched_yield(); 107 sched_yield();
95 } 108 }
96 printf("got g_stack_ptr=%p\n", g_stack_ptr); 109 printf("got g_stack_ptr=%p\n", g_stack_ptr);
97 assert(g_stack_ptr <= stack_top); 110 assert(g_stack_ptr <= stack_top);
98 assert(((uintptr_t) g_stack_ptr + kStackPadBelowAlign) % kStackAlignment 111 assert(((uintptr_t) g_stack_ptr + kStackPadBelowAlign) % kStackAlignment
99 == 0); 112 == 0);
100 } 113 }
101 114
102 return 0; 115 return 0;
103 } 116 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698