OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2010 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2010 The Native Client Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * be found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 /* | 7 /* |
8 * these were lifted from src/trusted/service_runtime/nacl_config.h | 8 * these were lifted from src/trusted/service_runtime/nacl_config.h |
9 * NOTE: we cannot include this file here | 9 * NOTE: we cannot include this file here |
10 * TODO(robertm): make this file available in the sdk | 10 * TODO(robertm): make this file available in the sdk |
11 * http://code.google.com/p/nativeclient/issues/detail?id=386 | 11 * http://code.google.com/p/nativeclient/issues/detail?id=386 |
12 */ | 12 */ |
13 | 13 |
14 #ifndef BAREBONES_H_ | 14 #ifndef BAREBONES_H_ |
(...skipping 12 matching lines...) Expand all Loading... | |
27 typedef void (*TYPE_nacl_exit) (int status); | 27 typedef void (*TYPE_nacl_exit) (int status); |
28 | 28 |
29 #include <bits/nacl_syscalls.h> | 29 #include <bits/nacl_syscalls.h> |
30 | 30 |
31 | 31 |
32 #define myprint(s) NACL_SYSCALL(write)(1, s, mystrlen(s)) | 32 #define myprint(s) NACL_SYSCALL(write)(1, s, mystrlen(s)) |
33 | 33 |
34 #define THIS_IS_ALWAYS_FALSE_FOR_SMALL_NUMBERS(n) \ | 34 #define THIS_IS_ALWAYS_FALSE_FOR_SMALL_NUMBERS(n) \ |
35 (n * n - 1 != (n + 1) * (n - 1)) | 35 (n * n - 1 != (n + 1) * (n - 1)) |
36 | 36 |
37 | |
38 #if defined(__mips__) | |
39 # define NACL_STACK_ALIGN_MASK (0x7) | |
Roland McGrath
2013/02/13 19:28:39
We want this to be consistent across machines at 1
Mark Seaborn
2013/02/13 22:14:09
Right. While we don't need MIPS to over-align in
petarj
2013/02/14 18:04:14
The return value specified in barebones_stack_alig
petarj
2013/03/05 17:50:04
I will revert this part of the change and remove
b
| |
40 #else | |
41 # define NACL_STACK_ALIGN_MASK (0xf) | |
42 #endif | |
43 | |
37 int mystrlen(const char* s) { | 44 int mystrlen(const char* s) { |
38 int count = 0; | 45 int count = 0; |
39 while (*s++) ++count; | 46 while (*s++) ++count; |
40 return count; | 47 return count; |
41 } | 48 } |
42 | 49 |
43 | 50 |
44 void myhextochar(int n, char buffer[9]) { | 51 void myhextochar(int n, char buffer[9]) { |
45 int i; | 52 int i; |
46 buffer[8] = 0; | 53 buffer[8] = 0; |
47 | 54 |
48 for (i = 0; i < 8; ++i) { | 55 for (i = 0; i < 8; ++i) { |
49 int nibble = 0xf & (n >> (4 * (7 - i))); | 56 int nibble = 0xf & (n >> (4 * (7 - i))); |
50 if (nibble <= 9) { | 57 if (nibble <= 9) { |
51 buffer[i] = nibble + '0'; | 58 buffer[i] = nibble + '0'; |
52 } else { | 59 } else { |
53 buffer[i] = nibble - 10 + 'A'; | 60 buffer[i] = nibble - 10 + 'A'; |
54 } | 61 } |
55 } | 62 } |
56 } | 63 } |
57 | 64 |
58 #endif /* BAREBONES_H_ */ | 65 #endif /* BAREBONES_H_ */ |
OLD | NEW |