| Index: tests/common/register_set.h
|
| diff --git a/tests/common/register_set.h b/tests/common/register_set.h
|
| index 5bb747d174b1c8fa1d02e322504c2c2d95fbf7ee..78876765423ffe5e109143beaf98113a332c66c4 100644
|
| --- a/tests/common/register_set.h
|
| +++ b/tests/common/register_set.h
|
| @@ -231,6 +231,21 @@ extern const uint8_t kX86FlagBits[5];
|
|
|
| #if NACL_ARCH(NACL_BUILD_ARCH) == NACL_x86 && NACL_BUILD_SUBARCH == 32
|
|
|
| +#if defined(NONSFI_MODE) && NONSFI_MODE
|
| +/*
|
| + * Look up GOT for PIC.
|
| + */
|
| +#define STORE_PROG_CTR(def_func) \
|
| + "call 0f\n" \
|
| + "0: popl %eax\n" \
|
| + "1: addl $_GLOBAL_OFFSET_TABLE_ + (1b - 0b), %eax\n" \
|
| + "movl " #def_func "@GOT(%eax), %eax\n" \
|
| + "movl %eax, 0x20(%esp)\n"
|
| +
|
| +#else
|
| +#define STORE_PROG_CTR(def_func) "movl $" #def_func ", 0x20(%esp)\n"
|
| +#endif
|
| +
|
| # define REGS_SAVER_FUNC_NOPROTO(def_func, callee_func) \
|
| void callee_func(struct NaClSignalContext *regs); \
|
| __asm__( \
|
| @@ -240,7 +255,8 @@ extern const uint8_t kX86FlagBits[5];
|
| #def_func ":\n" \
|
| /* Push most of "struct NaClSignalContext" in reverse order. */ \
|
| "push $0\n" /* Leave space for flags */ \
|
| - "push $" #def_func "\n" /* Fill out prog_ctr with known value */ \
|
| + /* TODO(uekawa): allow use of @got or use something else. */ \
|
| + "push $0 \n" /* Leave space for prog_ctr */ \
|
| "push %edi\n" \
|
| "push %esi\n" \
|
| "push %ebp\n" \
|
| @@ -252,6 +268,7 @@ extern const uint8_t kX86FlagBits[5];
|
| /* Save flags. */ \
|
| SAVE_X86_FLAGS_INTO_REG("%eax") \
|
| "movl %eax, 0x24(%esp)\n" \
|
| + STORE_PROG_CTR(def_func) /* Fill out prog_ctr with known value */ \
|
| /* Adjust saved %esp value to account for preceding pushes. */ \
|
| "addl $5 * 4, 0x10(%esp)\n" \
|
| /* Save argument to callee_func() temporarily. */ \
|
|
|