Merge pull request #890 from lubinszARM:pr_phyap

PiperOrigin-RevId: 286299056
This commit is contained in:
gVisor bot 2019-12-18 17:37:30 -08:00
commit 98e8246ad1
4 changed files with 44 additions and 11 deletions

View File

@ -34,6 +34,8 @@ go_library(
"machine_arm64_unsafe.go", "machine_arm64_unsafe.go",
"machine_unsafe.go", "machine_unsafe.go",
"physical_map.go", "physical_map.go",
"physical_map_amd64.go",
"physical_map_arm64.go",
"virtual_map.go", "virtual_map.go",
], ],
importpath = "gvisor.dev/gvisor/pkg/sentry/platform/kvm", importpath = "gvisor.dev/gvisor/pkg/sentry/platform/kvm",

View File

@ -24,15 +24,6 @@ import (
"gvisor.dev/gvisor/pkg/sentry/usermem" "gvisor.dev/gvisor/pkg/sentry/usermem"
) )
const (
// reservedMemory is a chunk of physical memory reserved starting at
// physical address zero. There are some special pages in this region,
// so we just call the whole thing off.
//
// Other architectures may define this to be zero.
reservedMemory = 0x100000000
)
type region struct { type region struct {
virtual uintptr virtual uintptr
length uintptr length uintptr
@ -59,8 +50,7 @@ func fillAddressSpace() (excludedRegions []region) {
// We can cut vSize in half, because the kernel will be using the top // We can cut vSize in half, because the kernel will be using the top
// half and we ignore it while constructing mappings. It's as if we've // half and we ignore it while constructing mappings. It's as if we've
// already excluded half the possible addresses. // already excluded half the possible addresses.
vSize := uintptr(1) << ring0.VirtualAddressBits() vSize := ring0.UserspaceSize
vSize = vSize >> 1
// We exclude reservedMemory below from our physical memory size, so it // We exclude reservedMemory below from our physical memory size, so it
// needs to be dropped here as well. Otherwise, we could end up with // needs to be dropped here as well. Otherwise, we could end up with

View File

@ -0,0 +1,22 @@
// 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
const (
// reservedMemory is a chunk of physical memory reserved starting at
// physical address zero. There are some special pages in this region,
// so we just call the whole thing off.
reservedMemory = 0x100000000
)

View File

@ -0,0 +1,19 @@
// 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
const (
reservedMemory = 0
)