| 1 |
# Copyright (c) Meta Platforms, Inc. and affiliates. |
| 2 |
# SPDX-License-Identifier: LGPL-2.1-or-later |
| 3 |
|
| 4 |
REGISTERS = [ |
| 5 |
*[DrgnRegister(f"r{i}") for i in range(32)], |
| 6 |
DrgnRegister("lr"), |
| 7 |
*[DrgnRegister(f"cr{i}") for i in range(8)], |
| 8 |
] |
| 9 |
|
| 10 |
# There are two conflicting definitions of DWARF register numbers after 63. The |
| 11 |
# original definition appears to be "64-bit PowerPC ELF Application Binary |
| 12 |
# Interface Supplement" [1]. The GNU toolchain instead uses its own that was |
| 13 |
# later codified in "Power Architecture 64-Bit ELF V2 ABI Specification" [2]. |
| 14 |
# We use the latter. |
| 15 |
# |
| 16 |
# 1: https://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi.html |
| 17 |
# 2: https://openpowerfoundation.org/specifications/64bitelfabi/ |
| 18 |
REGISTER_LAYOUT = [ |
| 19 |
DrgnRegisterLayout("lr", size=8, dwarf_number=65), |
| 20 |
*[DrgnRegisterLayout(f"r{i}", size=8, dwarf_number=i) for i in range(32)], |
| 21 |
*[DrgnRegisterLayout(f"cr{i}", size=8, dwarf_number=68 + i) for i in range(8)], |
| 22 |
] |
| 23 |
|
| 24 |
STACK_POINTER_REGISTER = "r1" |