From 243e1d84627c20a39f5464bb61cafae9fa2fe456 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 23 Apr 2019 03:45:55 +0200 Subject: Kernel: Use rep insw/outsw for IDE transfers. There are much faster ways to do disk transfers, but I'm not implementing those today. In the meantime, this is slightly nicer. :^) --- Kernel/IO.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'Kernel/IO.h') diff --git a/Kernel/IO.h b/Kernel/IO.h index cf99ca5ee6..5453b98494 100644 --- a/Kernel/IO.h +++ b/Kernel/IO.h @@ -25,6 +25,11 @@ inline dword in32(word port) return value; } +inline void repeated_in16(word port, byte* buffer, int buffer_size) +{ + asm volatile("rep insw" : "+D"(buffer), "+c"(buffer_size) : "d"(port) : "memory"); +} + inline void out8(word port, byte value) { asm volatile("outb %0, %1"::"a"(value), "Nd"(port)); @@ -39,4 +44,10 @@ inline void out32(word port, dword value) { asm volatile("outl %0, %1"::"a"(value), "Nd"(port)); } + +inline void repeated_out16(word port, const byte* data, int data_size) +{ + asm volatile("rep outsw" : "+S"(data), "+c"(data_size) : "d"(port)); +} + } -- cgit v1.2.3