diff options
author | Hanhwi Jang <jang.hanhwi@gmail.com> | 2018-01-10 11:39:38 +0900 |
---|---|---|
committer | Hanhwi Jang <jang.hanhwi@gmail.com> | 2018-01-20 09:07:44 +0000 |
commit | 8cb6bb444a6ee0106807d0a22bbc63323b410bf8 (patch) | |
tree | 2c0ec220b99ce9e764b0e551538f1622369db6c3 /util/m5/m5op_x86.S | |
parent | 2e5da9229547eeb3da02205e7c789c3ae589feff (diff) | |
download | gem5-8cb6bb444a6ee0106807d0a22bbc63323b410bf8.tar.xz |
util: Implement PIC version of m5ops for X86.
Using m5ops for X86 in shared objects requires PIC for the m5ops.
Typically, the PIC version is used to make m5op interfaces to other
languages like python and lua.
Change-Id: I2463904c13ea8b839d0386d3c743d8dad1e1e6bc
Reviewed-on: https://gem5-review.googlesource.com/7261
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>
Diffstat (limited to 'util/m5/m5op_x86.S')
-rw-r--r-- | util/m5/m5op_x86.S | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/util/m5/m5op_x86.S b/util/m5/m5op_x86.S index 957874122..69995e0ab 100644 --- a/util/m5/m5op_x86.S +++ b/util/m5/m5op_x86.S @@ -32,19 +32,32 @@ #include <gem5/asm/generic/m5ops.h> -#ifdef M5OP_ADDR +#if defined(M5OP_ADDR) && defined(M5OP_PIC) /* Use the memory mapped m5op interface */ #define TWO_BYTE_OP(name, number) \ .globl name; \ .func name; \ name: \ - mov m5_mem, %r11; \ + mov m5_mem@gotpcrel(%rip), %r11; \ + mov (%r11), %r11; \ mov $number, %rax; \ shl $8, %rax; \ mov 0(%r11, %rax, 1), %rax; \ ret; \ .endfunc; +#elif defined(M5OP_ADDR) && !defined(M5OP_PIC) +/* Use the memory mapped m5op interface */ +#define TWO_BYTE_OP(name, number) \ + .globl name; \ + .func name; \ +name: \ + mov m5_mem, %r11; \ + mov $number, %rax; \ + shl $8, %rax; \ + mov 0(%r11, %rax, 1), %rax; \ + ret; \ + .endfunc; #else /* Use the magic instruction based m5op interface. This does not work * in virtualized environments. |