summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatrixAeria <upezu@student.kit.edu>2021-04-16 16:24:49 +0200
committerNatrixAeria <upezu@student.kit.edu>2021-04-16 16:24:49 +0200
commitdb5f26fe55527521a0ae8ca7cad01f0ba8eb0c49 (patch)
tree449afeebd7daf9ce0a3b088e82bd28d4ce7e2a90
parent75bd5249ada7825ff751e61434a4a7fc7b4f140a (diff)
Remove wrong size_of multiplier in memcpy, memset
-rw-r--r--kernel/src/io/vga_text.rs22
1 files changed, 4 insertions, 18 deletions
diff --git a/kernel/src/io/vga_text.rs b/kernel/src/io/vga_text.rs
index 890defb..e44d341 100644
--- a/kernel/src/io/vga_text.rs
+++ b/kernel/src/io/vga_text.rs
@@ -167,18 +167,12 @@ impl<'a> VgaTerminalControllerLock<'a> {
core::intrinsics::volatile_copy_memory(
self.start(),
self.start().offset(offset as isize),
- (self.area() - offset) * core::mem::size_of::<VgaChar>(),
+ self.area() - offset,
);
}
let pos = self.area() - offset;
*self.lock = unsafe { self.start().offset(pos as isize) };
- unsafe {
- core::intrinsics::volatile_set_memory(
- *self.lock,
- 0u8,
- offset * core::mem::size_of::<VgaChar>(),
- )
- }
+ unsafe { core::intrinsics::volatile_set_memory(*self.lock, 0u8, offset) }
}
pub fn set_color_state(&mut self, fg: Color, bg: Color) {
@@ -187,11 +181,7 @@ impl<'a> VgaTerminalControllerLock<'a> {
pub fn clear(&mut self) {
unsafe {
- core::intrinsics::volatile_set_memory(
- *self.lock,
- 0u8,
- self.area() * core::mem::size_of::<VgaChar>(),
- );
+ core::intrinsics::volatile_set_memory(*self.lock, 0u8, self.area());
*self.lock = self.start();
}
}
@@ -218,11 +208,7 @@ impl<'a> VgaTerminalControllerLock<'a> {
);
}
unsafe {
- core::intrinsics::volatile_copy_memory(
- *self.lock,
- chars.as_ptr(),
- core::mem::size_of::<VgaChar>() * chars.len(),
- );
+ core::intrinsics::volatile_copy_memory(*self.lock, chars.as_ptr(), chars.len());
*self.lock = self.lock.offset(chars.len() as isize);
}
}