RiscVSbiEcall.S 1021 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //------------------------------------------------------------------------------
  2. //
  3. // Make ECALL to SBI
  4. //
  5. // Copyright (c) 2023, Ventana Micro Systems Inc. All rights reserved.<BR>
  6. //
  7. // SPDX-License-Identifier: BSD-2-Clause-Patent
  8. //
  9. //------------------------------------------------------------------------------
  10. #include <Register/RiscV64/RiscVImpl.h>
  11. .data
  12. .align 3
  13. .section .text
  14. //
  15. // Make ECALL to SBI
  16. // ecall updates the same a0 and a1 registers with
  17. // return values. Hence, the C function which calls
  18. // this should pass the address of Arg0 and Arg1.
  19. // This routine saves the address and updates it
  20. // with a0 and a1 once ecall returns.
  21. //
  22. // @param a0 : Pointer to Arg0
  23. // @param a1 : Pointer to Arg1
  24. // @param a2 : Arg2
  25. // @param a3 : Arg3
  26. // @param a4 : Arg4
  27. // @param a5 : Arg5
  28. // @param a6 : FunctionID
  29. // @param a7 : ExtensionId
  30. //
  31. ASM_FUNC (RiscVSbiEcall)
  32. mv t0, a0
  33. mv t1, a1
  34. ld a0, 0(a0)
  35. ld a1, 0(a1)
  36. ecall
  37. sd a0, 0(t0)
  38. sd a1, 0(t1)
  39. ret