ipi.rs 682 B

123456789101112131415161718192021222324
  1. use super::SbiRet;
  2. use crate::hart_mask::HartMask;
  3. use crate::ipi::{max_hart_id, send_ipi_many};
  4. const FUNCTION_IPI_SEND_IPI: u32 = 0x0;
  5. #[inline]
  6. pub fn handle_ecall_ipi(function: u32, param0: usize, param1: usize) -> SbiRet {
  7. match function {
  8. FUNCTION_IPI_SEND_IPI => send_ipi(param0, param1),
  9. _ => SbiRet::not_supported(),
  10. }
  11. }
  12. #[inline]
  13. fn send_ipi(hart_mask: usize, hart_mask_base: usize) -> SbiRet {
  14. let max_hart_id = if let Some(id) = max_hart_id() {
  15. id
  16. } else {
  17. return SbiRet::not_supported();
  18. };
  19. let hart_mask = unsafe { HartMask::from_addr(hart_mask, hart_mask_base, max_hart_id) };
  20. send_ipi_many(hart_mask)
  21. }