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 <errno.h> | 7 #include <errno.h> |
8 #include <signal.h> | 8 #include <signal.h> |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 #include <string.h> | 10 #include <string.h> |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
264 frame->context.frame_ptr = regs->r11; | 264 frame->context.frame_ptr = regs->r11; |
265 regs->lr = kReturnAddr; | 265 regs->lr = kReturnAddr; |
266 regs->r0 = context_user_addr; /* Argument 1 */ | 266 regs->r0 = context_user_addr; /* Argument 1 */ |
267 regs->prog_ctr = NaClUserToSys(nap, nap->exception_handler); | 267 regs->prog_ctr = NaClUserToSys(nap, nap->exception_handler); |
268 regs->stack_ptr = NaClUserToSys(nap, new_stack_ptr); | 268 regs->stack_ptr = NaClUserToSys(nap, new_stack_ptr); |
269 #elif NACL_ARCH(NACL_BUILD_ARCH) == NACL_mips | 269 #elif NACL_ARCH(NACL_BUILD_ARCH) == NACL_mips |
270 frame->context.frame_ptr = regs->frame_ptr; | 270 frame->context.frame_ptr = regs->frame_ptr; |
271 regs->return_addr = kReturnAddr; | 271 regs->return_addr = kReturnAddr; |
272 regs->a0 = context_user_addr; | 272 regs->a0 = context_user_addr; |
273 regs->prog_ctr = NaClUserToSys(nap, nap->exception_handler); | 273 regs->prog_ctr = NaClUserToSys(nap, nap->exception_handler); |
274 regs->stack_ptr = NaClUserToSys(nap, new_stack_ptr); | 274 regs->stack_ptr = NaClUserToSys(nap, new_stack_ptr) - NACL_STACK_ARG_SIZE; |
Mark Seaborn
2013/03/06 00:26:58
The adjustment should be applied before NaClUserTo
petarj
2013/03/07 14:52:48
Done, I added the adjustment just after the alignm
| |
275 regs->t9 = regs->prog_ctr; | |
Mark Seaborn
2013/03/06 00:26:58
Can you add a comment? e.g. "PIC functions assume
petarj
2013/03/07 14:52:48
Done.
| |
275 #else | 276 #else |
276 # error Unsupported architecture | 277 # error Unsupported architecture |
277 #endif | 278 #endif |
278 | 279 |
279 #if NACL_ARCH(NACL_BUILD_ARCH) == NACL_x86 | 280 #if NACL_ARCH(NACL_BUILD_ARCH) == NACL_x86 |
280 frame->return_addr = kReturnAddr; | 281 frame->return_addr = kReturnAddr; |
281 regs->flags &= ~NACL_X86_DIRECTION_FLAG; | 282 regs->flags &= ~NACL_X86_DIRECTION_FLAG; |
282 #endif | 283 #endif |
283 | 284 |
284 return 1; | 285 return 1; |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
460 unsigned int a; | 461 unsigned int a; |
461 | 462 |
462 /* Remove all handlers */ | 463 /* Remove all handlers */ |
463 for (a = 0; a < NACL_ARRAY_SIZE(s_Signals); a++) { | 464 for (a = 0; a < NACL_ARRAY_SIZE(s_Signals); a++) { |
464 if (sigaction(s_Signals[a], &s_OldActions[a], NULL) != 0) { | 465 if (sigaction(s_Signals[a], &s_OldActions[a], NULL) != 0) { |
465 NaClLog(LOG_FATAL, "Failed to unregister handler for %d.\n\tERR:%s\n", | 466 NaClLog(LOG_FATAL, "Failed to unregister handler for %d.\n\tERR:%s\n", |
466 s_Signals[a], strerror(errno)); | 467 s_Signals[a], strerror(errno)); |
467 } | 468 } |
468 } | 469 } |
469 } | 470 } |
OLD | NEW |