Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 } |
| OLD | NEW |