Commit e61d8a2f by triazo

Make asm wrapper functions for inl and outl

parent 1f701d21
Showing with 18 additions and 1 deletions
......@@ -2,7 +2,8 @@
asm.h contains x86 specific functions for executing low level code
*/
#pragma once
#ifndef _ASM_INC
#define _ASM_INC
#include <stdint.h>
// Wrapper for outb
......@@ -20,6 +21,20 @@ inline uint8_t inb(uint16_t port)
return ret;
}
// Wrapper for outl
inline void outl(uint16_t port, uint32_t val)
{
asm volatile("outl %0, %1" : : "a"(val), "Nd"(port));
}
// Wrapper for inl
inline uint32_t inl(uint16_t port)
{
uint32_t ret;
asm volatile ("inl %1, %0" : "=a"(ret) : "Nd"(port));
return ret;
}
inline void disable_int()
{
asm volatile ("cli");
......@@ -29,3 +44,5 @@ inline void enable_int()
{
asm volatile ("sti");
}
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment