1
0
mirror of https://github.com/rcore-os/rCore.git synced 2024-11-23 08:26:17 +04:00

make clear_bss faster

This commit is contained in:
WangRunji 2018-12-23 03:10:59 +08:00
parent 1d1d4109c3
commit 70b6db4282

View File

@ -86,10 +86,11 @@ fn remap_the_kernel() {
static mut SATP: usize = 0;
pub unsafe fn clear_bss() {
let bss_start = sbss as usize;
let bss_end = ebss as usize;
for i in bss_start..bss_end {
(i as *mut u8).write(0);
let start = sbss as usize;
let end = ebss as usize;
let step = core::mem::size_of::<usize>();
for i in (start..end).step_by(step) {
(i as *mut usize).write(0);
}
}