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

Add clang-format file

Also run it across the whole tree to get everything using the One True Style.
We don't yet run this in an automated fashion as it's a little slow, but
there is a snippet to do so in makeall.sh.
This commit is contained in:
Robin Burchell 2019-05-28 11:53:16 +02:00 committed by Andreas Kling
parent c11351ac50
commit 0dc9af5f7e
286 changed files with 3244 additions and 2424 deletions

View file

@ -7,47 +7,58 @@ namespace IO {
inline byte in8(word port)
{
byte value;
asm volatile("inb %1, %0":"=a"(value):"Nd"(port));
asm volatile("inb %1, %0"
: "=a"(value)
: "Nd"(port));
return value;
}
inline word in16(word port)
{
word value;
asm volatile("inw %1, %0":"=a"(value):"Nd"(port));
asm volatile("inw %1, %0"
: "=a"(value)
: "Nd"(port));
return value;
}
inline dword in32(word port)
{
dword value;
asm volatile("inl %1, %0":"=a"(value):"Nd"(port));
asm volatile("inl %1, %0"
: "=a"(value)
: "Nd"(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");
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));
asm volatile("outb %0, %1" ::"a"(value), "Nd"(port));
}
inline void out16(word port, word value)
{
asm volatile("outw %0, %1"::"a"(value), "Nd"(port));
asm volatile("outw %0, %1" ::"a"(value), "Nd"(port));
}
inline void out32(word port, dword value)
{
asm volatile("outl %0, %1"::"a"(value), "Nd"(port));
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));
asm volatile("rep outsw"
: "+S"(data), "+c"(data_size)
: "d"(port));
}
}