aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLulu Cai <cailulu@loongson.cn>2023-11-26 14:25:26 +0800
committerliuzhensong <liuzhensong@loongson.cn>2023-12-25 11:46:22 +0800
commit3898e04b8e4be8744f876ba475b5b2a07ca61ee6 (patch)
treea9a27b9285a79b41d748a71a99b9ec90c3639f29 /include
parent4f248d61eb9d319b552e3e0b2db862928c2c1971 (diff)
downloadgdb-3898e04b8e4be8744f876ba475b5b2a07ca61ee6.zip
gdb-3898e04b8e4be8744f876ba475b5b2a07ca61ee6.tar.gz
gdb-3898e04b8e4be8744f876ba475b5b2a07ca61ee6.tar.bz2
LoongArch: Add tls transition support.
Transitions between DESC->IE/LE and IE->LE are supported now. 1. For DESC -> LE: pcalau12i $a0,%desc_pc_hi20(var) => lu12i.w $a0,%le_hi20(var) addi.d $a0,$a0,%desc_pc_lo12(var) => ori $a0,$a0,%le_lo12(var) ld.d $a1,$a0,%desc_ld(var) => NOP jirl $ra,$a1,%desc_call(var) => NOP add.d $a0,$a0,$tp 2. For DESC -> IE: pcalau12i $a0,%desc_pc_hi20(var) => pcalau12i $a0,%ie_pc_hi20(var) addi.d $a0,$a0,%desc_pc_lo12(var) => ld.d $a0,$a0,%ie_pc_lo12(var) ld.d $a1,$a0,%desc_ld(var) => NOP jirl $ra,$a1,%desc_call(var) => NOP add.d $a0,$a0,$tp 3. For IE -> LE: pcalau12i $a0,%ie_pc_hi20(var) => lu12i.w $a0,%le_hi20(var) ld.d $a0,$a0,%ie_pc_lo12(var) => ori $a0,$a0,%le_lo12(var) add.d $a0,$a0,$tp 4. When a tls variable is accessed using both DESC and IE, DESC transitions to IE and uses the same GOT entry as IE.
Diffstat (limited to 'include')
-rw-r--r--include/opcode/loongarch.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/opcode/loongarch.h b/include/opcode/loongarch.h
index da936f7..32ff4d8 100644
--- a/include/opcode/loongarch.h
+++ b/include/opcode/loongarch.h
@@ -42,6 +42,12 @@ extern "C"
((value) < (-(1 << ((bits) - 1) << align)) \
|| (value) > ((((1 << ((bits) - 1)) - 1) << align)))
+ #define LARCH_LU12I_W 0x14000000
+ #define LARCH_ORI 0x03800000
+ #define LARCH_LD_D 0x28c00000
+ #define LARCH_RD_A0 0x04
+ #define LARCH_RD_RJ_A0 0x084
+
typedef uint32_t insn_t;
struct loongarch_opcode