mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-20 04:56:32 +00:00
Add assembly memset
for fast filling zeros
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
a72c7dadf3
commit
aae9fdb331
@ -20,11 +20,7 @@ impl Device for Zero {
|
||||
|
||||
impl FileIo for Zero {
|
||||
fn read(&self, writer: &mut VmWriter) -> Result<usize> {
|
||||
// TODO: Use more efficient way when need to read a bunch of zeros once.
|
||||
let read_len = writer.avail();
|
||||
for _ in 0..read_len {
|
||||
writer.write_val(&0u8)?;
|
||||
}
|
||||
let read_len = writer.fill_zeros(writer.avail())?;
|
||||
Ok(read_len)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user