Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • P project3035746
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Terraform modules
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • 每天都是星期六
  • project3035746
  • Merge requests
  • !3

feat(syscall+mm+gui): MMIO framebuffer mapping and CoW-based snapshot features

  • Review changes

  • Download
  • Patches
  • Plain diff
Merged 每天都是星期六 requested to merge sunky/syscall-extension into main Dec 28, 2025
  • Overview 0
  • Commits 11
  • Pipelines 0
  • Changes 33

Overview

This merge request extends the kernel memory management and system call infrastructure to support safe hardware memory mapping and advanced Copy-on-Write (CoW) based features.

The changes enable user programs to directly access GPU framebuffer memory via MMIO while preserving kernel memory safety, and demonstrate the performance advantage of CoW through snapshot and time-travel mechanisms.


Key Changes

1. Memory Management (MM)

  • Introduced MapType::Mmio to explicitly mark hardware-mapped memory.
  • Prevented accidental deallocation of MMIO pages during address space teardown.
  • Added insert_mmio_area to map fixed physical addresses into user space.
  • Ensured correct handling of MMIO regions during munmap and process exit.
  • Implemented shared mapping strategy for MMIO regions during address space duplication (fork / checkpoint) to ensure visual continuity and prevent invalid memory allocation.

2. System Call Layer

  • Fixed incorrect virtual-to-physical address usage in framebuffer-related syscalls.
  • Implemented kernel virtual address → physical address translation before mapping.
  • Replaced hard-coded user virtual addresses with dynamic free-region allocation.

3. Driver Interface

  • Extended the GPU driver interface to expose the raw framebuffer physical address.
  • Enabled the syscall layer to safely obtain MMIO information from the device driver.

4. User Library & Applications

  • Refactored framebuffer APIs to avoid naming conflicts with syscalls.
  • Enabled automatic resolution detection in user-space display initialization.
  • Updated GUI demo programs to use the new framebuffer mapping mechanism.
  • Added snapshot / save-load support for the GUI snake game based on CoW.

Demonstration & Validation

  • User-level GUI programs render correctly using MMIO-mapped framebuffer memory.
  • Verified that MMIO regions persist correctly across snapshots without triggering kernel panics.
  • Snapshot and time-travel tests demonstrate constant-time fork() behavior regardless of memory size, validating the effectiveness of CoW.
  • No hardware memory is mistakenly freed during process exit or unmapping.

Notes for Reviewers

  • MMIO regions are explicitly protected and never passed to the frame allocator.
  • All framebuffer mappings are created using translated physical addresses.
  • The changes are backward-compatible with existing user programs.
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: sunky/syscall-extension