1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:37:45 +00:00

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. :^)
This commit is contained in:
Andreas Kling 2019-04-23 03:45:55 +02:00
parent 37498c1566
commit 243e1d8462
2 changed files with 17 additions and 15 deletions

View file

@ -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));
}
}