-
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.
- Loading branch information
Marcin Kościelnicki
committed
Jun 12, 2018
1 parent
41b4dc3
commit 7596688
Showing
5 changed files
with
241 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
static inline void outb(uint16_t port, uint8_t val) { | ||
__asm__ volatile( | ||
"outb %0, %1\n" | ||
: | ||
: "a"(val), "d"(port) | ||
); | ||
} | ||
|
||
static inline uint8_t inb(uint16_t port) { | ||
uint8_t res; | ||
__asm__ volatile( | ||
"inb %1, %0\n" | ||
: "=a"(res) | ||
: "d"(port) | ||
); | ||
return res; | ||
} |
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,9 @@ | ||
static inline void wrmsr(uint32_t reg, uint64_t val) { | ||
uint32_t lo = val; | ||
uint32_t hi = val >> 32; | ||
__asm__ volatile ( | ||
"wrmsr" | ||
: | ||
: "a"(lo), "d"(hi), "c"(reg) | ||
); | ||
} |
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 @@ | ||
/home/mwk/zzad/z1/prog |