kernel/ATA: Fix sector number calculation for ATA drives
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
apio 2023-09-07 11:28:46 +02:00
parent 6065b63801
commit 66e3d71dbc
Signed by: apio
GPG Key ID: B8A7D06E42258954

View File

@ -503,11 +503,17 @@ namespace ATA
} }
else 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; m_block_count = *reinterpret_cast<u64*>(buf);
else
m_block_count = m_identify_data.sectors_28; if (!m_block_count)
{
memcpy(buf, &m_identify_words[60], 4);
m_block_count = *reinterpret_cast<u32*>(buf);
}
else { m_is_lba48 = true; }
// FIXME: Should we check for CHS? // FIXME: Should we check for CHS?