Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 08ffc84

Browse files
Improve raw framebuffer interface documentation
1 parent 31585ae commit 08ffc84

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

‎src/proto/console/gop.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,16 @@ impl GraphicsOutput {
253253
///
254254
/// To use this pointer safely, a caller must...
255255
/// - Honor the pixel format specificed by the mode info
256+
/// - Keep pointer accesses in bound
256257
/// - Use volatile writes so that the compiler does not optimize out or
257-
/// aggressively reorder the framebuffer accesses.
258+
/// aggressively reorder framebuffer accesses
259+
/// - Make sure that the pointer is not used beyond its validity limit
260+
///
261+
/// Although the UEFI spec makes no clear statement about framebuffer
262+
/// pointer validity, it seems reasonable to expect the framebuffer pointer
263+
/// to be valid until the next mode change. In the future, a safer interface
264+
/// may be introduced, which would enforce volatile writes and automatically
265+
/// check for dangling pointers using Rust's borrow checker.
258266
pub fn frame_buffer(&mut self) -> (*mut u8, usize) {
259267
assert!(
260268
self.mode.info.format != PixelFormat::BltOnly,

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /