Skip to content

Commit d391d54

Browse files
committed
make gregset2user work for aarc64 as well.
1 parent 0bc9026 commit d391d54

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

process.cc

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ namespace Procman {
109109
/*
110110
* convert a gregset_t to an Elf::CoreRegs
111111
*/
112-
#ifndef __aarch64__
113112
void
114113
gregset2user(user_regs_struct &core, const gregset_t greg) {
115114
#if defined(__i386__)
@@ -140,14 +139,16 @@ gregset2user(user_regs_struct &core, const gregset_t greg) {
140139
core.rcx = greg[REG_RCX];
141140
core.rsp = greg[REG_RSP];
142141
core.rip = greg[REG_RIP];
143-
#elif defined(__arm__)
144-
// ARM has unfied types for NT_PRSTATUS and ucontext, and the offsets are
145-
// actually the DWARF register numbers, too.
146-
for (int i = 0; i < ELF_NGREG)
142+
#elif defined(__aarch64__)
143+
// For ARM64, copy the general purpose registers
144+
for (int i = 0; i < 31; i++)
147145
core.regs[i] = greg[i];
146+
core.sp = greg[31];
147+
core.pc = greg[32];
148+
#else
149+
#error "Unsupported architecture for register conversion"
148150
#endif
149151
}
150-
#endif
151152

152153

153154
Process::Process(pstack::Context &context_, Elf::Object::sptr exec, Reader::sptr memory)

0 commit comments

Comments
 (0)