RSDP checksum and ext_checksum are not particularly useful
dlrobertson opened this issue · 3 comments
Summary
A correct calculation of the RSDP checksum requires access to enum members that are private or reserved.
Description
AFAIK the RsdpV1Tag::checksum, RsdpV2Tag::checksum, and RsdpV2Tag::ext_checksum are not particularly useful in their current form. From ACPI 6.3 Section 5.2.5.3 Table 5-27:
The Checksum
This is the checksum of the fields... This includes only the first 20 bytes of this table, bytes 0 to 19, including the checksum field. These bytes must sum to zero.
The Extended Checksum
This is a checksum of the entire table, including both checksum fields.
A correct calculation of either checksum requires access to private members of the RsdpV1Tag and RsdpV2Tag for which there is no access function defined.
Possible Solution
Instead of surfacing these members like RsdpV2Tag::_rsdt_address and RsdpV2Tag::length provide the RsdpV1Tag::verify_checksum, RsdpV2Tag::verify_checksum, and RsdpV2Tag::verify_ext_checksum functions that perform the calculation.
I have a simple implementation working locally. If the proposed approach seems reasonable, I can post a PR.
@rust-osdev/multiboot2 Does anyone have time to look into this issue?
Hi - I seem to have written this code so am happy to look into this.
Yes the current getters seem pretty useless and replacing them with some sort of validation method seems sensible to me.
However, for revision 2.0 and above (the V2 tag), there's no need to validate both checksums, instead you just add the entire contents of the table and see if it sums to 0. For an example of how acpi validates both versions of the RSDP, see this method. It seems sensible to just have a validate method on both tags that does the right thing.
Happy to review a PR doing this, just tag me for review :)