You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

分页(多页)场景下跨页地址访问映射机制咨询

How x86 Paging Handles Unmapped Virtual Addresses

Great question—this cuts right to how x86 paging operates at its core, so let’s break it down plainly:

Short Answer

Your program P1 will NOT automatically map to the second page if it accesses an address beyond the first page’s upper limit. Instead, the CPU will immediately trigger a page fault interrupt (#PF, interrupt number 14).

Detailed Explanation

Here’s why this works the way it does:

  • x86 paging is an explicit mapping system, not an implicit or auto-filling one. Every virtual address your program uses must have a corresponding, valid entry in the page tables (starting with the page directory pointed to by CR3).
  • When you registered two non-contiguous pages in the page directory, you only created mappings for those specific virtual address ranges. Any virtual address outside those ranges has no valid entry in the page tables.
  • When P1 tries to access an unmapped address:
    1. The CPU checks the relevant page directory entry (and page table entry, if using 2-level paging) for that virtual address.
    2. Since there’s no valid entry (either the entry is missing, or the Present bit P is set to 0), the CPU raises a page fault.
    3. The kernel’s page fault handler will then handle this—usually by either allocating a new physical page and setting up the mapping, or terminating the program if the access is invalid.

There’s no logic in the CPU that assumes "if you have a mapping for page X, you must want page X+1 mapped to the next physical page". Every single virtual-to-physical mapping has to be explicitly configured in the page tables.


内容的提问来源于stack exchange,提问作者Leosa99 _

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.11 07:22:55