forked from Simple-XX/SimpleKernel
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Zone.N <[email protected]>
- Loading branch information
Showing
3 changed files
with
64 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
|
||
/** | ||
* @file interrupt.h | ||
* @brief 中断处理 | ||
* @author Zone.N ([email protected]) | ||
* @version 1.0 | ||
* @date 2023-07-15 | ||
* @copyright MIT LICENSE | ||
* https://github.com/Simple-XX/SimpleKernel | ||
* @par change log: | ||
* <table> | ||
* <tr><th>Date<th>Author<th>Description | ||
* <tr><td>2023-07-15<td>Zone.N ([email protected])<td>创建文件 | ||
* </table> | ||
*/ | ||
|
||
#ifndef SIMPLEKERNEL_SRC_KERNEL_INCLUDE_INTERRUPT_H_ | ||
#define SIMPLEKERNEL_SRC_KERNEL_INCLUDE_INTERRUPT_H_ | ||
|
||
#include <cstdint> | ||
|
||
#include "cpu.hpp" | ||
#include "interrupt_base.h" | ||
#include "stdio.h" | ||
|
||
/** | ||
* @brief core-local interrupt controller | ||
* 本地核心中断控制器 | ||
* 用于控制 excp 与 intr | ||
*/ | ||
class Clint { | ||
public: | ||
Clint() { | ||
// 开启内部中断 | ||
Cpu::WriteSie(Cpu::ReadSie() | Cpu::kSieSsie); | ||
printf("Clint init.\n"); | ||
} | ||
|
||
/// @name 构造/析构函数 | ||
/// @{ | ||
Clint(const Clint &) = default; | ||
Clint(Clint &&) = default; | ||
auto operator=(const Clint &) -> Clint & = default; | ||
auto operator=(Clint &&) -> Clint & = default; | ||
~Clint() = default; | ||
/// @} | ||
}; | ||
|
||
class Interrupt : public InterruptBase { | ||
public: | ||
Interrupt() { Clint(); } | ||
|
||
/// @name 构造/析构函数 | ||
/// @{ | ||
Interrupt(const Interrupt &) = default; | ||
Interrupt(Interrupt &&) = default; | ||
auto operator=(const Interrupt &) -> Interrupt & = default; | ||
auto operator=(Interrupt &&) -> Interrupt & = default; | ||
~Interrupt() = default; | ||
/// @} | ||
}; | ||
|
||
#endif /* SIMPLEKERNEL_SRC_KERNEL_INCLUDE_INTERRUPT_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters