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

Side by Side Diff: tests/common/register_set.h

Issue 546043004: NonSFI mode: Make tests/common/register_set.h PIC-friendly. (Closed) Base URL: https://chromium.googlesource.com/native_client/src/native_client.git@master
Patch Set: review Created 6 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef NATIVE_CLIENT_TESTS_COMMON_REGISTER_SET_H_ 7 #ifndef NATIVE_CLIENT_TESTS_COMMON_REGISTER_SET_H_
8 #define NATIVE_CLIENT_TESTS_COMMON_REGISTER_SET_H_ 8 #define NATIVE_CLIENT_TESTS_COMMON_REGISTER_SET_H_
9 9
10 #include "native_client/src/include/nacl/nacl_exception.h" 10 #include "native_client/src/include/nacl/nacl_exception.h"
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 233
234 # define REGS_SAVER_FUNC_NOPROTO(def_func, callee_func) \ 234 # define REGS_SAVER_FUNC_NOPROTO(def_func, callee_func) \
235 void callee_func(struct NaClSignalContext *regs); \ 235 void callee_func(struct NaClSignalContext *regs); \
236 __asm__( \ 236 __asm__( \
237 ".pushsection .text, \"ax\", @progbits\n" \ 237 ".pushsection .text, \"ax\", @progbits\n" \
238 ".p2align 5\n" \ 238 ".p2align 5\n" \
239 ".global " #def_func "\n"\ 239 ".global " #def_func "\n"\
240 #def_func ":\n" \ 240 #def_func ":\n" \
241 /* Push most of "struct NaClSignalContext" in reverse order. */ \ 241 /* Push most of "struct NaClSignalContext" in reverse order. */ \
242 "push $0\n" /* Leave space for flags */ \ 242 "push $0\n" /* Leave space for flags */ \
243 "push $" #def_func "\n" /* Fill out prog_ctr with known value */ \ 243 "push $0\n" /* Leave space for prog_ctr */ \
244 "push %edi\n" \ 244 "push %edi\n" \
245 "push %esi\n" \ 245 "push %esi\n" \
246 "push %ebp\n" \ 246 "push %ebp\n" \
247 "push %esp\n" \ 247 "push %esp\n" \
248 "push %ebx\n" \ 248 "push %ebx\n" \
249 "push %edx\n" \ 249 "push %edx\n" \
250 "push %ecx\n" \ 250 "push %ecx\n" \
251 "push %eax\n" \ 251 "push %eax\n" \
252 /* Save flags. */ \ 252 /* Save flags. */ \
253 SAVE_X86_FLAGS_INTO_REG("%eax") \ 253 SAVE_X86_FLAGS_INTO_REG("%eax") \
254 "movl %eax, 0x24(%esp)\n" \ 254 "movl %eax, 0x24(%esp)\n" \
255 /* Obtain def_func from GOT to fill prog_ctr with known value. */ \
256 "call 0f\n" \
257 "0: popl %eax\n" \
258 "1: addl $_GLOBAL_OFFSET_TABLE_ + (1b - 0b), %eax\n" \
259 "movl " #def_func "@GOT(%eax), %eax\n" \
260 "movl %eax, 0x20(%esp)\n" \
255 /* Adjust saved %esp value to account for preceding pushes. */ \ 261 /* Adjust saved %esp value to account for preceding pushes. */ \
256 "addl $5 * 4, 0x10(%esp)\n" \ 262 "addl $5 * 4, 0x10(%esp)\n" \
257 /* Save argument to callee_func() temporarily. */ \ 263 /* Save argument to callee_func() temporarily. */ \
258 "mov %esp, %eax\n" \ 264 "mov %esp, %eax\n" \
259 /* Align the stack pointer and leave space for an argument. */ \ 265 /* Align the stack pointer and leave space for an argument. */ \
260 "pushl $0\n" \ 266 "pushl $0\n" \
261 "and $~15, %esp\n" \ 267 "and $~15, %esp\n" \
262 /* Set argument to callee_func(). */ \ 268 /* Set argument to callee_func(). */ \
263 "mov %eax, (%esp)\n" \ 269 "mov %eax, (%esp)\n" \
264 "call " #callee_func "\n" \ 270 "call " #callee_func "\n" \
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 void RegsUnsetNonCalleeSavedRegisters(struct NaClSignalContext *regs); 447 void RegsUnsetNonCalleeSavedRegisters(struct NaClSignalContext *regs);
442 448
443 /* 449 /*
444 * For a function called with register state |regs|, extract the first 450 * For a function called with register state |regs|, extract the first
445 * argument. This is useful for a function entry point defined by 451 * argument. This is useful for a function entry point defined by
446 * REGS_SAVER_FUNC. 452 * REGS_SAVER_FUNC.
447 */ 453 */
448 uintptr_t RegsGetArg1(const struct NaClSignalContext *regs); 454 uintptr_t RegsGetArg1(const struct NaClSignalContext *regs);
449 455
450 #endif 456 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698