If you want caching disabled, use PTE_NOCACHE. I'll be changing the specific PAT settings shortly so accessing those bits directly will cause trouble.
Regarding the change to compat.h, there's no difference between PTE_NOCACHE and just a raw PTE_PCD in Akaros as of right now (PCD == UC- and PCD|PWT == UC, and the minus only matters if MTRRs set WC, which they shouldn't). Reinstall your kernel headers. Signed-off-by: Barret Rhoden <[email protected]> --- kern/arch/x86/cpuinfo.c | 4 ++-- kern/arch/x86/pmap64.c | 2 +- kern/arch/x86/ros/mmu64.h | 10 +++++----- kern/drivers/net/udrvr/compat.h | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/kern/arch/x86/cpuinfo.c b/kern/arch/x86/cpuinfo.c index 613574120561..1fed0725b54a 100644 --- a/kern/arch/x86/cpuinfo.c +++ b/kern/arch/x86/cpuinfo.c @@ -217,8 +217,8 @@ void show_mapping(pgdir_t pgdir, uintptr_t start, size_t size) pte_is_jumbo(pte), pte_is_dirty(pte), pte_is_accessed(pte), - (pte_print(pte) & PTE_PCD) / PTE_PCD, - (pte_print(pte) & PTE_PWT) / PTE_PWT, + (pte_print(pte) & __PTE_PCD) / __PTE_PCD, + (pte_print(pte) & __PTE_PWT) / __PTE_PWT, (perm & PTE_U) / PTE_U, (perm & PTE_W) / PTE_W, pte_is_present(pte), diff --git a/kern/arch/x86/pmap64.c b/kern/arch/x86/pmap64.c index 523973487dcf..9fe20a6ce3fc 100644 --- a/kern/arch/x86/pmap64.c +++ b/kern/arch/x86/pmap64.c @@ -469,7 +469,7 @@ void vm_init(void) /* For the LAPIC and IOAPIC, we use PAT (but not *the* PAT flag) to make * these type UC */ map_segment(boot_pgdir, IOAPIC_BASE, APIC_SIZE, IOAPIC_PBASE, - PTE_PCD | PTE_PWT | PTE_KERN_RW | PTE_G, max_jumbo_shift); + PTE_NOCACHE | PTE_KERN_RW | PTE_G, max_jumbo_shift); /* VPT mapping: recursive PTE inserted at the VPT spot */ boot_kpt[PML4(VPT)] = PADDR(boot_kpt) | PTE_W | PTE_P; /* same for UVPT, accessible by userspace (RO). */ diff --git a/kern/arch/x86/ros/mmu64.h b/kern/arch/x86/ros/mmu64.h index 6018fc41b88d..9490401f5e9a 100644 --- a/kern/arch/x86/ros/mmu64.h +++ b/kern/arch/x86/ros/mmu64.h @@ -268,15 +268,15 @@ typedef struct x86_pgdir { #define PTE_P 0x001 /* Present */ #define PTE_W 0x002 /* Writeable */ #define PTE_U 0x004 /* User */ -#define PTE_PWT 0x008 /* Write-Through */ -#define PTE_PCD 0x010 /* Cache-Disable */ +#define __PTE_PWT 0x008 /* Write-Through */ +#define __PTE_PCD 0x010 /* Cache-Disable */ #define PTE_A 0x020 /* Accessed */ #define PTE_D 0x040 /* Dirty */ #define PTE_PS 0x080 /* Page Size */ -#define PTE_PAT 0x080 /* Page attribute table */ +#define __PTE_PAT 0x080 /* Page attribute table */ #define PTE_G 0x100 /* Global Page */ -#define PTE_JPAT 0x800 /* Jumbo PAT */ -#define PTE_NOCACHE (PTE_PWT | PTE_PCD) +#define __PTE_JPAT 0x800 /* Jumbo PAT */ +#define PTE_NOCACHE (__PTE_PWT | __PTE_PCD) /* Permissions fields and common access modes. These should be read as 'just * kernel or user too' and 'RO or RW'. USER_RO means read-only for everyone. */ diff --git a/kern/drivers/net/udrvr/compat.h b/kern/drivers/net/udrvr/compat.h index 9df9f06ecca8..d62897efb69d 100644 --- a/kern/drivers/net/udrvr/compat.h +++ b/kern/drivers/net/udrvr/compat.h @@ -62,14 +62,14 @@ typedef atomic_t atomic64_t; #define DEFINE_SPINLOCK(x) spinlock_t x = SPINLOCK_INITIALIZER /* - * Linux pgprot_noncached() adds _PAGE_PCD ie bit 4, which is akaros PTE_PCD. + * Linux pgprot_noncached() adds _PAGE_PCD ie bit 4, which is akaros __PTE_PCD. * Akaros PTE_NOCACHE also sets bit 3 ie _PAGE_PWT (which is overkill?). * Linux pgprot_writecombine() defaults to pgprot_noncached() when PAT is * not enabled, otherwise just sets bit 3 ie _PAGE_PWT. */ static unsigned long pgprot_noncached(int vmprot) { - unsigned long prot = PTE_P | PTE_U | PTE_A | PTE_PCD; + unsigned long prot = PTE_P | PTE_U | PTE_A | PTE_NOCACHE; if (vmprot & PROT_WRITE) prot |= PTE_W | PTE_D; -- 2.7.0.rc3.207.g0ac5344 -- You received this message because you are subscribed to the Google Groups "Akaros" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. For more options, visit https://groups.google.com/d/optout.
