| // Copyright lowRISC contributors. |
| // Licensed under the Apache License, Version 2.0, see LICENSE for details. |
| // SPDX-License-Identifier: Apache-2.0 |
| // Allocate space in .bss for saving architectural state before jumping |
| .zero 4 * 17 // ra, sp, gp, tp, s0-s11, mtvec |
| .size arch_state_store, .-arch_state_store |
| // Save the architectural state. There is no need to save caller preserved |
| // registers as C calling run_rvc_test will expect them to be clobbered anyway |
| // and act appropriately. RA is the exception as we need to know where to jump |
| // back to after the test is complete. mtvec is saved as the compliance test |
| // environment alters it, other CSRs may also be changed but no adverse |
| // effects have yet been observed from this. |
| // Tail-call to compliance test. |
| // The test will jump to `end_rvc_test` at the end rather than |
| // return, so we don't want to do a `call`. |
| // Restore architectural state. |
| // riscv-compliance loads its own mtvec that will jump to mtvec_handler if the |
| // symbol exists. This will only be jumped to in situations where we are not |
| // Restore gp/sp so handler from the OTTF will work correctly. |
| // Virtual-tail-call into the OTTF's handler. |