| 178 | } |
| 179 | |
| 180 | auto InterruptInit(int, const char**) -> void { |
| 181 | InterruptSingleton::create(); |
| 182 | |
| 183 | cpu_io::VBAR_EL1::Write(reinterpret_cast<uint64_t>(vector_table)); |
| 184 | |
| 185 | auto uart_intid = |
| 186 | KernelFdtSingleton::instance().GetAarch64Intid("arm,pl011").value() + |
| 187 | Gic::kSpiBase; |
| 188 | |
| 189 | klog::Info("uart_intid: {}", uart_intid); |
| 190 | |
| 191 | // 通过统一接口注册 UART 外部中断(先注册 handler,再启用 GIC SPI) |
| 192 | InterruptSingleton::instance() |
| 193 | .RegisterExternalInterrupt(uart_intid, cpu_io::GetCurrentCoreId(), 0, |
| 194 | InterruptDelegate::create<uart_handler>()) |
| 195 | .or_else([](Error err) -> Expected<void> { |
| 196 | klog::Err("Failed to register UART IRQ: {}", err.message()); |
| 197 | return std::unexpected(err); |
| 198 | }); |
| 199 | |
| 200 | cpu_io::EnableInterrupt(); |
| 201 | |
| 202 | klog::Info("Hello InterruptInit"); |
| 203 | } |
| 204 | |
| 205 | auto InterruptInitSMP(int, const char**) -> void { |
| 206 | cpu_io::VBAR_EL1::Write(reinterpret_cast<uint64_t>(vector_table)); |
nothing calls this directly
no test coverage detected