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

Side by Side Diff: tests/toolchain/stack_frame.cc

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 /* 7 /*
8 * This tests execises __builtin_dwarf_cfa() 8 * This tests execises __builtin_dwarf_cfa()
9 * 9 *
10 * NOTE: because of fun pointer casting we need to disable -pedantic. 10 * NOTE: because of fun pointer casting we need to disable -pedantic.
(...skipping 23 matching lines...) Expand all
34 if (i % 8 == 7) printf("\n"); 34 if (i % 8 == 7) printf("\n");
35 } 35 }
36 } 36 }
37 37
38 38
39 void* GetReturnAddress(void* frame_end) { 39 void* GetReturnAddress(void* frame_end) {
40 #if defined(__native_client__) 40 #if defined(__native_client__)
41 41
42 #if defined(__arm__) 42 #if defined(__arm__)
43 return ((void**)frame_end)[-1]; 43 return ((void**)frame_end)[-1];
44 #elif defined(__mips__)
45 return ((void**)frame_end)[-1];
44 #elif defined(__i386__) 46 #elif defined(__i386__)
45 return ((void**)frame_end)[-1]; 47 return ((void**)frame_end)[-1];
46 #elif defined(__x86_64__) 48 #elif defined(__x86_64__)
47 /* NOTE: a call pushes 64 bits but we only care about the first 32 */ 49 /* NOTE: a call pushes 64 bits but we only care about the first 32 */
48 return ((void**)frame_end)[-2]; 50 return ((void**)frame_end)[-2];
49 #else 51 #else
50 #error "unknown arch" 52 #error "unknown arch"
51 #endif 53 #endif
52 54
53 #else /* !defined(__native_client__) */ 55 #else /* !defined(__native_client__) */
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 int main(int argc, char* argv[]) { 129 int main(int argc, char* argv[]) {
128 printf("&main: %p\n", FUNPTR2PTR(main)); 130 printf("&main: %p\n", FUNPTR2PTR(main));
129 printf("&recurse: %p\n", FUNPTR2PTR(recurse)); 131 printf("&recurse: %p\n", FUNPTR2PTR(recurse));
130 ASSERT(FUNPTR2PTR(recurse) < FUNPTR2PTR(main), 132 ASSERT(FUNPTR2PTR(recurse) < FUNPTR2PTR(main),
131 "ERROR: this test assumes that main() follows recurse()\n"); 133 "ERROR: this test assumes that main() follows recurse()\n");
132 134
133 unsigned char* cfa = (unsigned char*) __builtin_dwarf_cfa(); 135 unsigned char* cfa = (unsigned char*) __builtin_dwarf_cfa();
134 recurse(NUM_ITERS, cfa); 136 recurse(NUM_ITERS, cfa);
135 return 55; 137 return 55;
136 } 138 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698