Index: arch/amd64/include/asm.h
===================================================================
--- arch/amd64/include/asm.h	(revision fa0dfaf69cdac637363e6904e18f89beb568591a)
+++ arch/amd64/include/asm.h	(revision 3de9e5ea4eb09f92326501d4c5c77977cd08ffcb)
@@ -33,4 +33,5 @@
 #include <config.h>
 
+
 void asm_delay_loop(__u32 t);
 
@@ -43,3 +44,76 @@
 static inline void cpu_sleep(void) { __asm__("hlt"); };
 
+
+static inline __u8 inb(__u16 port) 
+{
+	__u8 out;
+
+	asm (
+		"mov %0, %%dx;"
+		"inb %%dx,%%al;"
+		"mov %%al, %1;"
+		:"=m"(out)
+		:"m"(port)
+		:"dx","al"
+		);
+	return out;
+}
+
+static inline __u8 outb(__u16 port,__u8 b) 
+{
+	asm (
+		"mov %0,%%dx;"
+		"mov %1,%%al;"
+		"outb %%al,%%dx;"
+		:
+		:"m"( port), "m" (b)
+		:"dx","al"
+		);
+}
+
+/** Set priority level low
+ *
+ * Enable interrupts and return previous
+ * value of EFLAGS.
+ */
+static inline pri_t cpu_priority_low(void) {
+	pri_t v;
+	__asm__ volatile (
+		"pushfq\n"
+		"popq %0\n"
+		"sti\n"
+		: "=r" (v)
+	);
+	return v;
+}
+
+/** Set priority level high
+ *
+ * Disable interrupts and return previous
+ * value of EFLAGS.
+ */
+static inline pri_t cpu_priority_high(void) {
+	pri_t v;
+	__asm__ volatile (
+		"pushfq\n"
+		"popq %0\n"
+		"cli\n"
+		: "=r" (v)
+		);
+	return v;
+}
+
+/** Restore priority level
+ *
+ * Restore EFLAGS.
+ */
+static inline void cpu_priority_restore(pri_t pri) {
+	__asm__ volatile (
+		"pushq %0\n"
+		"popfq\n"
+		: : "r" (pri)
+		);
+}
+
+
 #endif
