summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/platform/kvm/machine_arm64.go
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2019-10-30 23:06:40 +0000
committergVisor bot <gvisor-bot@google.com>2019-10-30 23:06:40 +0000
commit21183068596ef41bad15e8c08d8bf47b6e6ff1fb (patch)
tree04c8a079c6a636c5814dca6a6d508c530b895dbb /pkg/sentry/platform/kvm/machine_arm64.go
parent213c251889907379fbd639160e05d6e2dc64c7ea (diff)
parentca933329fa46ce219b39f4cf8cba1754b36cc2c2 (diff)
Merge release-20190806.1-348-gca93332 (automated)
Diffstat (limited to 'pkg/sentry/platform/kvm/machine_arm64.go')
-rwxr-xr-xpkg/sentry/platform/kvm/machine_arm64.go61
1 files changed, 61 insertions, 0 deletions
diff --git a/pkg/sentry/platform/kvm/machine_arm64.go b/pkg/sentry/platform/kvm/machine_arm64.go
new file mode 100755
index 000000000..b7e2cfb9d
--- /dev/null
+++ b/pkg/sentry/platform/kvm/machine_arm64.go
@@ -0,0 +1,61 @@
+// Copyright 2019 The gVisor Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package kvm
+
+// Get all read-only physicalRegions.
+func rdonlyRegionsForSetMem() (phyRegions []physicalRegion) {
+ var rdonlyRegions []region
+
+ applyVirtualRegions(func(vr virtualRegion) {
+ if excludeVirtualRegion(vr) {
+ return
+ }
+
+ if !vr.accessType.Write && vr.accessType.Read {
+ rdonlyRegions = append(rdonlyRegions, vr.region)
+ }
+ })
+
+ for _, r := range rdonlyRegions {
+ physical, _, ok := translateToPhysical(r.virtual)
+ if !ok {
+ continue
+ }
+
+ phyRegions = append(phyRegions, physicalRegion{
+ region: region{
+ virtual: r.virtual,
+ length: r.length,
+ },
+ physical: physical,
+ })
+ }
+
+ return phyRegions
+}
+
+// Get all available physicalRegions.
+func availableRegionsForSetMem() (phyRegions []physicalRegion) {
+ var excludeRegions []region
+ applyVirtualRegions(func(vr virtualRegion) {
+ if !vr.accessType.Write {
+ excludeRegions = append(excludeRegions, vr.region)
+ }
+ })
+
+ phyRegions = computePhysicalRegions(excludeRegions)
+
+ return phyRegions
+}