diff options
author | Adin Scannell <ascannell@google.com> | 2018-05-30 15:13:36 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-05-30 15:14:44 -0700 |
commit | c59475599dbcc226e1ef516f40b581d6f2f3be75 (patch) | |
tree | 26eec98c27286aecb2ec91ee1f2c3484677c59d9 /pkg/sentry/platform/kvm/machine.go | |
parent | 812e83d3bbb99d4fa1ece4712a1ac85e84fe6ec3 (diff) |
Change ring0 & page tables arguments to structs.
This is a refactor of ring0 and ring0/pagetables that changes from
individual arguments to opts structures. This should involve no
functional changes, but sets the stage for subsequent changes.
PiperOrigin-RevId: 198627556
Change-Id: Id4460340f6a73f0c793cd879324398139cd58ae9
Diffstat (limited to 'pkg/sentry/platform/kvm/machine.go')
-rw-r--r-- | pkg/sentry/platform/kvm/machine.go | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/pkg/sentry/platform/kvm/machine.go b/pkg/sentry/platform/kvm/machine.go index 9b7e5130c..5a6109ced 100644 --- a/pkg/sentry/platform/kvm/machine.go +++ b/pkg/sentry/platform/kvm/machine.go @@ -186,10 +186,19 @@ func newMachine(vm int, vCPUs int) (*machine, error) { // physical pages are mapped on demand, see kernel_unsafe.go. applyPhysicalRegions(func(pr physicalRegion) bool { // Map everything in the lower half. - m.kernel.PageTables.Map(usermem.Addr(pr.virtual), pr.length, false /* kernel */, usermem.AnyAccess, pr.physical) + m.kernel.PageTables.Map( + usermem.Addr(pr.virtual), + pr.length, + pagetables.MapOpts{AccessType: usermem.AnyAccess}, + pr.physical) + // And keep everything in the upper half. - kernelAddr := usermem.Addr(ring0.KernelStartAddress | pr.virtual) - m.kernel.PageTables.Map(kernelAddr, pr.length, false /* kernel */, usermem.AnyAccess, pr.physical) + m.kernel.PageTables.Map( + usermem.Addr(ring0.KernelStartAddress|pr.virtual), + pr.length, + pagetables.MapOpts{AccessType: usermem.AnyAccess}, + pr.physical) + return true // Keep iterating. }) |