aboutsummaryrefslogtreecommitdiff
path: root/riscv/insns/cm_push.h
blob: 64accd4b5f16d05fb26c2801d67a7a886a4644e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
require_zcmp_pushpop;

const auto new_sp = SP - insn.zcmp_stack_adjustment(xlen);
auto addr = SP;

for (int i = Sn(11); i >= 0; i--) {
  if (insn.zcmp_regmask() & (1 << i)) {
    addr -= xlen / 8;

    if (xlen == 32)
      MMU.store<uint32_t>(addr, READ_REG(i));
    else
      MMU.store<uint64_t>(addr, READ_REG(i));
  }
}

WRITE_REG(X_SP, new_sp);