MCPcopy Create free account
hub / github.com/chyyuu/os_kernel_lab / sys_framebuffer

Function sys_framebuffer

os/src/syscall/gui.rs:7–29  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5const FB_VADDR: usize = 0x10000000;
6
7pub fn sys_framebuffer() -> isize {
8 let fb = GPU_DEVICE.get_framebuffer();
9 let len = fb.len();
10 // println!("[kernel] FrameBuffer: addr 0x{:X}, len {}", fb.as_ptr() as usize , len);
11 let fb_start_pa = PhysAddr::from(fb.as_ptr() as usize);
12 assert!(fb_start_pa.aligned());
13 let fb_start_ppn = fb_start_pa.floor();
14 let fb_start_vpn = VirtAddr::from(FB_VADDR).floor();
15 let pn_offset = fb_start_ppn.0 as isize - fb_start_vpn.0 as isize;
16
17 let current_process = current_process();
18 let mut inner = current_process.inner_exclusive_access();
19 inner.memory_set.push(
20 MapArea::new(
21 (FB_VADDR as usize).into(),
22 (FB_VADDR + len as usize).into(),
23 MapType::Linear(pn_offset),
24 MapPermission::R | MapPermission::W | MapPermission::U,
25 ),
26 None,
27 );
28 FB_VADDR as isize
29}
30
31pub fn sys_framebuffer_flush() -> isize {
32 GPU_DEVICE.flush();

Callers 1

syscallFunction · 0.70

Calls 6

current_processFunction · 0.85
get_framebufferMethod · 0.80
lenMethod · 0.80
floorMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected