Closed rdbo closed 6 months ago
Another point in favor of this is that some architectures don't have multiple bit size support. For example, the ARM architecture can only be 32 bits. It is never 64 bits. 64 bit ARM is a completely different arch, ARM64/AARCH64
One difficulty found because of this transition (branch: arch-breaking) is that you can no longer assemble/disassemble for remote processes using LM_GetArchitecture()
as the architecture, and process.bits
as the bits.
To counter that, I added a field arch
to lm_process_t
which contains the detailed architecture of that process.
Another problem that arrived from that is: how should libmem guess its architecture? But now I realize, libmem has always assumed the architectures. For example, if you are running a x86/x64 machine, and the process is 32 bits, libmem has always been assuming that the process is x86_32. Which means this behavior has always been there, just not explicitly. Now it has become explicit:
static inline lm_arch_t
get_architecture_from_bits(lm_size_t bits)
{
// ...
}
This function has been added to guess the architecture of a process based on its bits.
Now you can use process.arch
to assemble/disassemble for remote processes without doing the guessing yourself and leaving that up to libmem.
arch-breaking
branch was merged, let's hope this doesn't come back to haunt me in the future.
Some architectures have lots of modes, e.g ARM. ARM has thumb mode, v8 mode, etc What I'm thinking is to interpret those as different architectures:
In addition to this, I could also deprecate the
bits
parameter from theLM_AssembleEx
andLM_DisassembleEx
functions