Created
June 11, 2026 01:50
-
-
Save tilkinsc/2dff96eeef2a4d254d944b0e2ab656ef to your computer and use it in GitHub Desktop.
C3 function declarations for assembly
This file contains hidden or 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
| module std::core::builtin; | |
| extern fn void cli() @builtin @inline; | |
| extern fn void sti() @builtin @inline; | |
| extern fn void hlt() @builtin @inline; | |
| extern fn char inb(ushort port) @builtin; | |
| extern fn void outb(ushort port, char value) @builtin @inline; | |
| extern fn ushort inw(ushort port) @builtin; | |
| extern fn void outw(ushort port, ushort value) @builtin @inline; | |
| extern fn uint inl(ushort port) @builtin; | |
| extern fn void outl(ushort port, uint value) @builtin @inline; | |
| fn void* get_rsp() @builtin @inline | |
| { | |
| void* rsp; | |
| asm { movq rsp, $rsp; } | |
| return rsp; | |
| } | |
| extern fn void load_fs(void* fs) @builtin @inline; | |
| extern fn void load_gdtr(void* gdtr) @builtin @inline; | |
| extern fn void load_tss(ushort selector) @builtin @inline; | |
| extern fn void load_cs(ulong selector) @builtin @inline; | |
| extern fn void reload_segments(ushort selector) @builtin @inline; | |
| extern fn void load_idtr(void* idtr) @builtin @inline; | |
| extern fn void get_cr2(ulong* cr2) @builtin @inline; | |
| extern fn void load_cr3(ulong cr3) @builtin @inline; | |
| extern fn void invlpg(ulong address) @builtin @inline; | |
| struct CpuidResult @packed | |
| { | |
| uint eax; | |
| uint ebx; | |
| uint ecx; | |
| uint edx; | |
| } | |
| extern fn void cpuid(uint leaf, uint subleaf, CpuidResult* out) @builtin @inline; | |
| extern fn ulong clz(ulong bitset) @builtin @inline; |
tilkinsc
commented
Jun 11, 2026
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment