Skip to content

Commit 5b24574

Browse files
authored
Shrink range of addresses used for executable .text sections (theseus-os#984)
* The address calculation was slightly too large to accommodate branch (call/jump) instructions on aarch64. The range was correct on x86, but this feature isn't used on x86.
1 parent c27ea93 commit 5b24574

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

kernel/mod_mgmt/src/lib.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2897,16 +2897,14 @@ pub const KERNEL_TEXT_ADDR_RANGE: Option<PageRange> = {
28972897
None
28982898
}
28992899
#[cfg(target_arch = "aarch64")] {
2900-
use {memory::Page, kernel_config::memory::KERNEL_OFFSET};
2901-
29022900
const ONE_MIB: usize = 0x10_0000;
2903-
let start_vaddr = VirtualAddress::new_canonical(KERNEL_OFFSET + ONE_MIB);
2901+
let start_vaddr = VirtualAddress::new_canonical(kernel_config::memory::KERNEL_OFFSET);
29042902
let end_vaddr = VirtualAddress::new_canonical(start_vaddr.value() + (128 * ONE_MIB) - 1);
29052903
Some(PageRange::new(
29062904
// the start of the base kernel image's .text section.
2907-
Page::containing_address(start_vaddr),
2905+
memory::Page::containing_address(start_vaddr),
29082906
// the start of the base kernel image's .text section, plus 128 MiB.
2909-
Page::containing_address(end_vaddr),
2907+
memory::Page::containing_address(end_vaddr),
29102908
))
29112909
}
29122910
};

0 commit comments

Comments
 (0)