Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP3:GA
xen.8005
5aec744b-8-x86-xpti-cr3-helpers.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 5aec744b-8-x86-xpti-cr3-helpers.patch of Package xen.8005
From 1a32c9868711b4ee883ebb6f8807e08d70a920be Mon Sep 17 00:00:00 2001 From: Juergen Gross <jgross@suse.com> Date: Thu, 26 Apr 2018 13:33:17 +0200 Subject: [PATCH] xen/x86: add some cr3 helpers Add some helper macros to access the address and pcid parts of cr3. Use those helpers where appropriate. Signed-off-by: Juergen Gross <jgross@suse.com> Reviewed-by: Jan Beulich <jbeulich@suse.com> --- a/xen/arch/x86/debug.c +++ b/xen/arch/x86/debug.c @@ -98,7 +98,7 @@ dbg_pv_va2mfn(dbgva_t vaddr, struct doma l2_pgentry_t l2e, *l2t; l1_pgentry_t l1e, *l1t; unsigned long cr3 = (pgd3val ? pgd3val : dp->vcpu[0]->arch.cr3); - unsigned long mfn = cr3 >> PAGE_SHIFT; + unsigned long mfn = paddr_to_pfn(cr3_pa(cr3)); DBGP2("vaddr:%lx domid:%d cr3:%lx pgd3:%lx\n", vaddr, dp->domain_id, cr3, pgd3val); --- a/xen/arch/x86/domain_page.c +++ b/xen/arch/x86/domain_page.c @@ -50,7 +50,7 @@ static inline struct vcpu *mapcache_curr if ( (v = idle_vcpu[smp_processor_id()]) == current ) sync_local_execstate(); /* We must now be running on the idle page table. */ - ASSERT(read_cr3() == __pa(idle_pg_table)); + ASSERT(cr3_pa(read_cr3()) == __pa(idle_pg_table)); } return v; --- a/xen/include/asm-x86/processor.h +++ b/xen/include/asm-x86/processor.h @@ -69,6 +69,13 @@ #define X86_CR0_PG 0x80000000 /* Paging (RW) */ /* + * Intel CPU flags in CR3 + */ +#define X86_CR3_NOFLUSH (_AC(1, ULL) << 63) +#define X86_CR3_ADDR_MASK (PAGE_MASK & PADDR_MASK) +#define X86_CR3_PCID_MASK _AC(0x0fff, ULL) /* Mask for PCID */ + +/* * Intel CPU features in CR4 */ #define X86_CR4_VME 0x0001 /* enable vm86 extensions */ @@ -314,6 +321,16 @@ static inline void write_cr3(unsigned lo asm volatile ( "mov %0, %%cr3" : : "r" (val) : "memory" ); } +static inline unsigned long cr3_pa(unsigned long cr3) +{ + return cr3 & X86_CR3_ADDR_MASK; +} + +static inline unsigned long cr3_pcid(unsigned long cr3) +{ + return cr3 & X86_CR3_PCID_MASK; +} + DECLARE_PER_CPU(unsigned long, cr4); static inline unsigned long read_cr4(void)
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor