Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • K kernel
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 23
    • Issues 23
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 15
    • Merge requests 15
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • redox-os
  • kernel
  • Merge requests
  • !189

Draft: Simplify the GSBASE pointer

  • Review changes

  • Download
  • Email patches
  • Plain diff
Open 4lDO2 requested to merge 4lDO2/kernel:simpler_gsbase_pointer into master Dec 29, 2021
  • Overview 0
  • Commits 2
  • Changes 7

Previously, the KPCR including the TSS was stored as a regular thread-local variable, thus in the .tdata section at KERNEL_PERCPU_OFFSET. However, to simplify calculation in situations where GSBASE is unavailable, i.e. in paranoid entries, this will move the KPCR out of #[thread_local] and hardcode its offset to KERNEL_PERCPU_OFFSET + cpu_id * KERNEL_PERCPU_SIZE. The TLS sections moved one page past the KPCR start.

Alternatively, the KPCR could be stored the way it currently is, but that would require two fake GDT entries as opposed to one, or impose alignment. It also fixes a kernel bug when running the acid ptrace test.

It also removes some duplicate code by generating getters for link-time offsets using a macro.

Edited Dec 29, 2021 by 4lDO2
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: simpler_gsbase_pointer