Hi all, sorry to bother🙏🏻, I have questions as below:
I use `drrun -debug -loglevel 3 -- <avx512/avx2 binary>` as workload to run the dynamorio. Some basic blocks in this workload contain instructions that manipulate both ymm and zmm registers. I want to save only the `ymm` register value in `mcontext` before building the `instr` one by one in a basic block in the /core/arch/interp.c: build_bb_ilist() and restore all 15 `ymm` register back to `mcontext` when all `instr`s in this basic block have been build.
Q1: I wonder if there exists any mechanisms or routines in DR internal to do this store and restore ymm register? Or any examples I can learn from?
Q2: When I debugging, I'm confusing about how DynamoRIO handles a basic block that includes both zmm and ymm register instructions utilizing the `dr_zmm_t simd[MCXT_NUM_SIMD_SLOTS]` array in `mcontext` struct definition. Since the `mcontext` struct has only this array to store the values of vector registers, how does the `simd[MCXT_NUM_SIMD_SLOTS]` array in `mcontext` can be capable of simultaneously storing the values of both zmm and ymm registers when a basic block contains instructions operating on both types of registers?
I'm currently doing this store and restore in an ugly way, and I'm not sure if it's right (intuitively this has a high probability of being wrong.), by saving the `ymm` registers in the `mcontext` directly into a global array: `dr_zmm_t rewrite_reserved_ymm[MCXT_NUM_SIMD_SLOTS];` I added myself.
![Screenshot 2024-02-01 at 00.39.51.png](https://groups.google.com/group/dynamorio-users/attach/12a54c802c1b5/Screenshot%202024-02-01%20at%2000.39.51.png?part=0.1&view=1)