The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
pat.c File Reference
#include "pat.h"

Macros

#define MSR_PAT   0x277u
 the page attribute table (Intel SDM volume 3, section 13.12).
#define PAT_UC   0x00ull
#define PAT_WC   0x01ull
#define PAT_WB   0x06ull
#define PAT_UCM   0x07ull

Functions

void pat_init (void)
 program the PAT of the core that runs the call so that a page with PWT set and PCD clear is write-combining.
bool pat_has_write_combining (void)
 true if pat_init could set up write-combining (the CPU has a PAT).

Macro Definition Documentation

◆ MSR_PAT

#define MSR_PAT   0x277u

the page attribute table (Intel SDM volume 3, section 13.12).

the PAT, PCD and PWT bits of a page table entry select one of eight memory types in the IA32_PAT MSR. the power-on value maps PWT to write-through. the kernel changes entries 1 and 5 (PWT set, PCD clear) to write-combining: writes to the framebuffer are then combined into bursts, which is much faster than uncached writes. the other entries keep their power-on types, so ordinary pages do not change.

◆ PAT_UC

#define PAT_UC   0x00ull

◆ PAT_WC

#define PAT_WC   0x01ull

◆ PAT_WB

#define PAT_WB   0x06ull

◆ PAT_UCM

#define PAT_UCM   0x07ull

Function Documentation

◆ pat_init()

void pat_init ( void )

program the PAT of the core that runs the call so that a page with PWT set and PCD clear is write-combining.

the boot core calls it at boot, before such pages are mapped; each other core calls it when it starts, because all cores must give a page the same memory type.

◆ pat_has_write_combining()

bool pat_has_write_combining ( void )

true if pat_init could set up write-combining (the CPU has a PAT).