SimpleKernel 1.17.0
Loading...
Searching...
No Matches
interrupt_base.h
Go to the documentation of this file.
1
5#pragma once
6
7#include <cpu_io.h>
8#include <etl/delegate.h>
9
10#include <cstdint>
11
12#include "expected.hpp"
13
24 public:
32 etl::delegate<uint64_t(uint64_t, cpu_io::TrapContext*)>;
33
36 InterruptBase() = default;
37 InterruptBase(const InterruptBase&) = delete;
39 auto operator=(const InterruptBase&) -> InterruptBase& = delete;
41 virtual ~InterruptBase() = default;
43
48 virtual auto Do(uint64_t, cpu_io::TrapContext*) -> void = 0;
49
55 virtual auto RegisterInterruptFunc(uint64_t cause, InterruptDelegate func)
56 -> void = 0;
57
63 [[nodiscard]] virtual auto SendIpi(uint64_t target_cpu_mask)
64 -> Expected<void> = 0;
65
70 [[nodiscard]] virtual auto BroadcastIpi() -> Expected<void> = 0;
71
80 [[nodiscard]] virtual auto RegisterExternalInterrupt(
81 uint32_t irq, uint32_t cpu_id, uint32_t priority,
82 InterruptDelegate handler) -> Expected<void> = 0;
83};
中断子系统抽象基类
virtual auto BroadcastIpi() -> Expected< void >=0
广播 IPI 到所有其他核心
virtual auto RegisterInterruptFunc(uint64_t cause, InterruptDelegate func) -> void=0
注册中断处理函数
auto operator=(InterruptBase &&) -> InterruptBase &=delete
InterruptBase(const InterruptBase &)=delete
auto operator=(const InterruptBase &) -> InterruptBase &=delete
InterruptBase(InterruptBase &&)=delete
virtual ~InterruptBase()=default
virtual auto Do(uint64_t, cpu_io::TrapContext *) -> void=0
执行中断处理
etl::delegate< uint64_t(uint64_t, cpu_io::TrapContext *)> InterruptDelegate
类型安全的中断处理委托
virtual auto SendIpi(uint64_t target_cpu_mask) -> Expected< void >=0
发送 IPI 到指定核心
virtual auto RegisterExternalInterrupt(uint32_t irq, uint32_t cpu_id, uint32_t priority, InterruptDelegate handler) -> Expected< void >=0
注册外部中断处理函数
InterruptBase()=default
std::expected< T, Error > Expected
std::expected 别名模板
Definition expected.hpp:365