diff --git a/kernel/src/arch/x86_64/disk/ATA.cpp b/kernel/src/arch/x86_64/disk/ATA.cpp index 4b601c77..17ffc484 100644 --- a/kernel/src/arch/x86_64/disk/ATA.cpp +++ b/kernel/src/arch/x86_64/disk/ATA.cpp @@ -503,11 +503,17 @@ namespace ATA } else { - if (m_identify_data.big_lba) m_is_lba48 = true; + u8 buf[8]; + memcpy(buf, &m_identify_words[100], 8); - if (m_is_lba48) m_block_count = m_identify_data.sectors_48; - else - m_block_count = m_identify_data.sectors_28; + m_block_count = *reinterpret_cast(buf); + + if (!m_block_count) + { + memcpy(buf, &m_identify_words[60], 4); + m_block_count = *reinterpret_cast(buf); + } + else { m_is_lba48 = true; } // FIXME: Should we check for CHS?