push_gpr_to_kernel_stack
push_gpr_to_kernel_stack() is a code artifact referenced in the RISC-V assembly program generation flow described for riscv_asm_program_gen.[C1]
Purpose
The documented purpose of push_gpr_to_kernel_stack() is to push general-purpose registers to the stack for trap handling.[C1]
Generation-flow context
In the described flow, main-program and sub-program generation occur first. After that, host-interface-related instructions are added using gen_section(), including a write_tohost section and an _exit label.[C2]
push_gpr_to_kernel_stack() is then invoked or generated as part of the trap-handling setup. The same evidence states that riscv_asm_program uses gen_section() to select the mtvec_handler instruction section, which has exception_handler and interrupt_handler defined.[C3]
Role in generated RISC-V programs
The surrounding riscv_asm_program_gen machinery, together with instruction-sequence, base-test, and helper classes, generates complete RISC-V assembly programs with randomized instructions and randomized general-purpose register selections.[C4] Within that generated program context, push_gpr_to_kernel_stack() belongs to the trap-handling support path rather than the randomized instruction body itself.[C1]