> For the complete documentation index, see [llms.txt](https://book.bsdcn.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://book.bsdcn.org/man/man9/pmap.9.md).

# pmap.9

`pmap` — 虚拟内存子系统的机器相关部分

## 名称

`pmap`

## 概要

```c
#include <sys/param.h>
```

```c
#include <vm/vm.h>
```

```c
#include <vm/pmap.h>
```

## 描述

`pmap` 模块是 FreeBSD VM（虚拟内存）子系统的机器相关部分。此处记录的每个函数都必须有自己的架构相关实现。

`pmap` 模块负责管理硬件相关对象，如页表、地址映射、TLB 等。

机器相关代码必须提供头文件

```c
#include <machine/pmap.h>
```

此文件包含 `pmap` 结构的定义：

```c
struct pmap {
        /* 内容由 pmap 实现定义。 */
};
typedef struct pmap *pmap_t;
```

此头文件还可以定义 `pmap` 实现使用的其他数据结构。

头文件

```c
#include <vm/pmap.h>
```

定义了用于跟踪 `pmap` 统计信息的结构（见下文）。此结构定义为：

```c
struct pmap_statistics {
        long        resident_count; /* 已映射页面的数量 */
        long        wired_count;    /* 已固定页面的数量 */
};
```

实现的 `struct pmap` 必须包含一个名为 `pm_stats` 的此结构实例，并且必须在每次相关 `pmap` 操作后由实现更新。

## 参见

[pmap\_activate(9)](/man/man9/pmap_activate.9.md), [pmap\_clear\_modify(9)](/man/man9/pmap_clear_modify.9.md), [pmap\_copy(9)](/man/man9/pmap_copy.9.md), pmap\_copy\_page(9), [pmap\_enter(9)](/man/man9/pmap_enter.9.md), [pmap\_extract(9)](/man/man9/pmap_extract.9.md), pmap\_extract\_and\_hold(9), [pmap\_growkernel(9)](/man/man9/pmap_growkernel.9.md), [pmap\_init(9)](/man/man9/pmap_init.9.md), [pmap\_is\_modified(9)](/man/man9/pmap_is_modified.9.md), [pmap\_is\_prefaultable(9)](/man/man9/pmap_is_prefaultable.9.md), [pmap\_kextract(9)](/man/man9/pmap_kextract.9.md), [pmap\_map(9)](/man/man9/pmap_map.9.md), [pmap\_mincore(9)](/man/man9/pmap_mincore.9.md), [pmap\_object\_init\_pt(9)](/man/man9/pmap_object_init_pt.9.md), [pmap\_page\_exists\_quick(9)](/man/man9/pmap_page_exists_quick.9.md), [pmap\_page\_init(9)](/man/man9/pmap_page_init.9.md), [pmap\_pinit(9)](/man/man9/pmap_pinit.9.md), pmap\_pinit0(9), [pmap\_protect(9)](/man/man9/pmap_protect.9.md), [pmap\_qenter(9)](/man/man9/pmap_qenter.9.md), pmap\_qremove(9), [pmap\_quick\_enter\_page(9)](/man/man9/pmap_quick_enter_page.9.md), pmap\_quick\_remove\_page(9), [pmap\_release(9)](/man/man9/pmap_release.9.md), [pmap\_remove(9)](/man/man9/pmap_remove.9.md), pmap\_remove\_all(9), pmap\_remove\_pages(9), [pmap\_resident\_count(9)](/man/man9/pmap_resident_count.9.md), pmap\_ts\_referenced(9), [pmap\_unwire(9)](/man/man9/pmap_unwire.9.md), pmap\_wired\_count(9), pmap\_zero\_area(9), [pmap\_zero\_page(9)](/man/man9/pmap_zero_page.9.md), [vm\_map(9)](/man/man9/vm_map.9.md)

## 作者

本手册页由 Bruce M Simpson <bms@spc.org> 编写。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://book.bsdcn.org/man/man9/pmap.9.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
