diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-04-23 03:45:55 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-04-23 03:45:55 +0200 |
commit | 243e1d84627c20a39f5464bb61cafae9fa2fe456 (patch) | |
tree | 12ca0a546ac87fd71b60babf8d31df91a585ee75 /Kernel/IO.h | |
parent | 37498c156653d2633000c9b4fd2fc60fcbf12a03 (diff) | |
download | serenity-243e1d84627c20a39f5464bb61cafae9fa2fe456.zip |
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. :^)
Diffstat (limited to 'Kernel/IO.h')
-rw-r--r-- | Kernel/IO.h | 11 |
1 files changed, 11 insertions, 0 deletions
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)); +} + } |