From c97876bba0438405509cb2f001cb608643fc9005 Mon Sep 17 00:00:00 2001 From: apio Date: Sun, 21 Jul 2024 12:51:06 +0200 Subject: [PATCH] kernel/ATA: Avoid assuming endianness --- kernel/src/arch/x86_64/disk/ATA.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/src/arch/x86_64/disk/ATA.cpp b/kernel/src/arch/x86_64/disk/ATA.cpp index d82241d7..c0a8f551 100644 --- a/kernel/src/arch/x86_64/disk/ATA.cpp +++ b/kernel/src/arch/x86_64/disk/ATA.cpp @@ -7,6 +7,7 @@ #include "memory/MemoryManager.h" #include "thread/Clock.h" #include "thread/Scheduler.h" +#include #include #include #include @@ -517,9 +518,8 @@ namespace ATA m_is_lba48 = true; - // FIXME: This assumes the host machine is little-endian. - u32 last_lba = __builtin_bswap32(reply.last_lba); - u32 sector_size = __builtin_bswap32(reply.sector_size); + u32 last_lba = be32toh(reply.last_lba); + u32 sector_size = be32toh(reply.sector_size); m_block_count = last_lba + 1; m_block_size = sector_size;