File tree 1 file changed +6
-4
lines changed
tests/test_kernels/lower_memory_free/src/bin
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ use bootloader_api::{
7
7
use test_kernel_lower_memory_free:: { exit_qemu, QemuExitCode } ;
8
8
9
9
const LOWER_MEMORY_END_PAGE : u64 = 0x0010_0000 ;
10
+ const WRITE_TEST_UNTIL : u64 = 0x4000_0000 ;
10
11
11
12
pub const BOOTLOADER_CONFIG : BootloaderConfig = {
12
13
let mut config = BootloaderConfig :: new_default ( ) ;
@@ -34,16 +35,17 @@ fn kernel_main(boot_info: &'static mut BootInfo) -> ! {
34
35
. unwrap ( ) ;
35
36
if region. kind == MemoryRegionKind :: Usable && region. start < LOWER_MEMORY_END_PAGE {
36
37
let end = core:: cmp:: min ( region. end , LOWER_MEMORY_END_PAGE ) ;
37
-
38
+ let pages = ( end - region. start ) / 4096 ;
39
+ count += pages;
40
+ }
41
+ if region. kind == MemoryRegionKind :: Usable && region. start < WRITE_TEST_UNTIL {
42
+ let end = core:: cmp:: min ( region. end , WRITE_TEST_UNTIL ) ;
38
43
// ensure region is actually writable
39
44
let addr = phys_mem_offset + region. start ;
40
45
let size = end - region. start ;
41
46
unsafe {
42
47
core:: ptr:: write_bytes ( addr as * mut u8 , 0xff , size as usize ) ;
43
48
}
44
-
45
- let pages = ( end - region. start ) / 4096 ;
46
- count += pages;
47
49
}
48
50
}
49
51
You can’t perform that action at this time.
0 commit comments