-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added IO protection by setting IOPL to zero.
- Loading branch information
1 parent
294fc78
commit 1efc7eb
Showing
5 changed files
with
32 additions
and
0 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
Binary file not shown.
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,18 @@ | ||
;; 2022 Ian Moffett <ian@kesscoin.com> | ||
|
||
global iopl_zero | ||
|
||
|
||
;; This will make sure IO operations can only operate in | ||
;; ring zero. | ||
iopl_zero: | ||
pushf ;; Push flags onto stack. | ||
pop rax ;; Save it in RAX. | ||
and rax, ~(1 << 12) ;; Clear bit 12. | ||
and rax, ~(1 << 13) ;; Clear bit 13. | ||
|
||
;; Now it should be zero and can only be accessed | ||
;; in ring zero. | ||
push rax ;; Push RAX back onto stack. | ||
popf ;; Pop it into FLAGS. | ||
retq |
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,10 @@ | ||
#ifndef IOPL_H | ||
#define IOPL_H | ||
|
||
// 2022 Ian Moffett <ian@kesscoin.com> | ||
|
||
|
||
void iopl_zero(); | ||
|
||
|
||
#endif |
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