mirror of
https://github.com/hanzoai/visor.git
synced 2026-09-24 17:04:14 +00:00
Since `arch.Context64` is the only concrete implementation of `arch.Context`, this does not functionally change anything. While `arch.Context64` *can* mean multiple things in the codebase, since the `arch` module uses conditional compilation to create different builds for AMD64 vs ARM64, the `Context64` type is still singular within each possible version this can compile to. This avoids the overhead involved in calling interface functions in Go: https://github.com/teh-cmc/go-internals/blob/master/chapter2_interfaces/README.md#dynamic-dispatch This overhead is particularly painful for functions like `SyscallSaveOrig` which is a no-op on AMD64. On KVM, this reduces syscall latency by 4~5%: ``` name old wall_ns/op new wall_ns/op delta Getpid 602 ± 4% 579 ± 3% -3.94% (p=0.000 n=66+195) GetpidOpt 604 ± 3% 573 ± 3% -5.10% (p=0.000 n=71+194) name old cpu_ns/op new cpu_ns/op delta Getpid 604 ± 5% 581 ± 0% -3.81% (p=0.000 n=75+130) GetpidOpt 604 ± 2% 574 ± 3% -4.95% (p=0.000 n=71+196) ``` PiperOrigin-RevId: 461742893
29 lines
894 B
Go
29 lines
894 B
Go
// Copyright 2018 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.
|
|
|
|
//go:build arm64
|
|
// +build arm64
|
|
|
|
package platform
|
|
|
|
import (
|
|
"gvisor.dev/gvisor/pkg/context"
|
|
"gvisor.dev/gvisor/pkg/sentry/arch"
|
|
)
|
|
|
|
// TryCPUIDEmulate always returns false: there is no cpuid.
|
|
func TryCPUIDEmulate(ctx context.Context, mm MemoryManager, ac *arch.Context64) bool {
|
|
return false
|
|
}
|