Classes | |
struct | mtrr_range |
mtrr_reconfigure keeps a list of MEM_WB ranges. This structure describes one item in the list. More... | |
Functions | |
void | init_pat_mtrr () |
Initializes PAT (Page Attribute Table) and MTRRs. More... | |
void | mtrr_begin_change () |
void | mtrr_end_change () |
void | mtrr_reconfigure () |
Helper procedure for MTRR initialization. Takes MTRR configured by BIOS and tries to recongifure them in order to allow non-UC data at top of 4G memory. Example: if low part of physical memory is 3.5G = 0xE0000000 bytes wide, BIOS can configure two MTRRs so that the first MTRR describes [0, 4G) as WB and the second MTRR describes [3.5G, 4G) as UC; WB+UC=UC, so the resulting memory map would be as needed, but in this configuration our attempts to map LFB at (say) 0xE8000000 as WC would be ignored, WB+UC+WC is still UC. So we must keep top of 4G memory not covered by MTRRs, using three WB MTRRs [0,2G) + [2G,3G) + [3G,3.5G), this gives the same memory map, but allows to add further entries. See mtrrtest.asm for detailed input/output from real hardware+BIOS. More... | |
void | set_mtrr (dword base, dword size, dword mem_type) |
Allocate&set one MTRR for given range. size must be power of 2 that divides base. More... | |
void | mtrr_get_real_type () |
Helper procedure for mtrr_validate. Calculates memory type for given address according to variable-range MTRRs. Assumes that MTRRs are enabled. in: ebx = 32-bit physical address out: eax = memory type for ebx. More... | |
void | mtrr_validate () |
If MTRRs are configured improperly, this is not obvious to the user; everything works, but the performance can be horrible. Try to detect this and let the user know that the low performance is caused by some problem and is not a global property of the system. Let's hope he would report it to developers... More... | |
Variables | |
dd | num_variable_mtrrs |
number of variable-range MTRRs More... | |
dd | _phys_reserved_mask |
dd | _first_range |
dd | _first_free_range |
dd | _num_used_mtrrs |
dd | _mtrrs_end |
rq | _mtrrs |
void init_pat_mtrr | ( | ) |
Initializes PAT (Page Attribute Table) and MTRRs.
void mtrr_begin_change | ( | ) |
void mtrr_end_change | ( | ) |
void mtrr_get_real_type | ( | ) |
Helper procedure for mtrr_validate. Calculates memory type for given address according to variable-range MTRRs. Assumes that MTRRs are enabled. in: ebx = 32-bit physical address out: eax = memory type for ebx.
void mtrr_reconfigure | ( | ) |
Helper procedure for MTRR initialization. Takes MTRR configured by BIOS and tries to recongifure them in order to allow non-UC data at top of 4G memory. Example: if low part of physical memory is 3.5G = 0xE0000000 bytes wide, BIOS can configure two MTRRs so that the first MTRR describes [0, 4G) as WB and the second MTRR describes [3.5G, 4G) as UC; WB+UC=UC, so the resulting memory map would be as needed, but in this configuration our attempts to map LFB at (say) 0xE8000000 as WC would be ignored, WB+UC+WC is still UC. So we must keep top of 4G memory not covered by MTRRs, using three WB MTRRs [0,2G) + [2G,3G) + [3G,3.5G), this gives the same memory map, but allows to add further entries. See mtrrtest.asm for detailed input/output from real hardware+BIOS.
void mtrr_validate | ( | ) |
If MTRRs are configured improperly, this is not obvious to the user; everything works, but the performance can be horrible. Try to detect this and let the user know that the low performance is caused by some problem and is not a global property of the system. Let's hope he would report it to developers...
void set_mtrr | ( | dword | base, |
dword | size, | ||
dword | mem_type | ||
) |
Allocate&set one MTRR for given range. size must be power of 2 that divides base.
dd _first_free_range |
dd _first_range |
rq _mtrrs |
dd _mtrrs_end |
dd _num_used_mtrrs |
dd _phys_reserved_mask |
dd num_variable_mtrrs |