loader: use all 24 bits for IniE size

Because ELF files can operate at byte offsets, we must use the full
byte-addressible address for sections.

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2020-03-12 15:04:07 +08:00
parent 829570713f
commit e1d97d88ca

View file

@ -155,9 +155,7 @@ pub struct MiniElfSection {
impl MiniElfSection {
pub fn len(&self) -> usize {
// Strip off the top four bits, which contain the flags.
// Also shift everything up by two bits, since it's in
// units of 32-bit words.
let len = (self.size_and_flags << 2) & !0xf000_0000;
let len = self.size_and_flags & !0xff00_0000;
len as usize
}