Move x86 state definition to its own file.

PiperOrigin-RevId: 294271541
This commit is contained in:
Brad Burlage
2020-02-10 12:00:46 -08:00
committed by gVisor bot
parent 0efa8168c7
commit 20840bfec0
5 changed files with 58 additions and 29 deletions
+1
View File
@@ -14,6 +14,7 @@ go_library(
"arch_state_aarch64.go",
"arch_state_x86.go",
"arch_x86.go",
"arch_x86_impl.go",
"auxv.go",
"signal.go",
"signal_act.go",
+2 -2
View File
@@ -43,8 +43,8 @@ func (e ErrFloatingPoint) Error() string {
// and SSE state, so this is the equivalent XSTATE_BV value.
const fxsaveBV uint64 = cpuid.XSAVEFeatureX87 | cpuid.XSAVEFeatureSSE
// afterLoad is invoked by stateify.
func (s *State) afterLoad() {
// afterLoadFPState is invoked by afterLoad.
func (s *State) afterLoadFPState() {
old := s.x86FPState
// Recreate the slice. This is done to ensure that it is aligned
-15
View File
@@ -155,21 +155,6 @@ func NewFloatingPointData() *FloatingPointData {
return (*FloatingPointData)(&(newX86FPState()[0]))
}
// State contains the common architecture bits for X86 (the build tag of this
// file ensures it's only built on x86).
//
// +stateify savable
type State struct {
// The system registers.
Regs syscall.PtraceRegs `state:".(syscallPtraceRegs)"`
// Our floating point state.
x86FPState `state:"wait"`
// FeatureSet is a pointer to the currently active feature set.
FeatureSet *cpuid.FeatureSet
}
// Proto returns a protobuf representation of the system registers in State.
func (s State) Proto() *rpb.Registers {
regs := &rpb.AMD64Registers{
+43
View File
@@ -0,0 +1,43 @@
// Copyright 2020 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.
// +build amd64 i386
package arch
import (
"syscall"
"gvisor.dev/gvisor/pkg/cpuid"
)
// State contains the common architecture bits for X86 (the build tag of this
// file ensures it's only built on x86).
//
// +stateify savable
type State struct {
// The system registers.
Regs syscall.PtraceRegs `state:".(syscallPtraceRegs)"`
// Our floating point state.
x86FPState `state:"wait"`
// FeatureSet is a pointer to the currently active feature set.
FeatureSet *cpuid.FeatureSet
}
// afterLoad is invoked by stateify.
func (s *State) afterLoad() {
s.afterLoadFPState()
}
+12 -12
View File
@@ -3,22 +3,28 @@
go_suffixes = [
"_386",
"_386_unsafe",
"_amd64",
"_amd64_unsafe",
"_aarch64",
"_aarch64_unsafe",
"_amd64",
"_amd64_unsafe",
"_arm",
"_arm_unsafe",
"_arm64",
"_arm64_unsafe",
"_arm_unsafe",
"_impl",
"_impl_unsafe",
"_linux",
"_linux_unsafe",
"_mips",
"_mips_unsafe",
"_mipsle",
"_mipsle_unsafe",
"_mips64",
"_mips64_unsafe",
"_mips64le",
"_mips64le_unsafe",
"_mips_unsafe",
"_mipsle",
"_mipsle_unsafe",
"_opts",
"_opts_unsafe",
"_ppc64",
"_ppc64_unsafe",
"_ppc64le",
@@ -31,10 +37,4 @@ go_suffixes = [
"_sparc64_unsafe",
"_wasm",
"_wasm_unsafe",
"_linux",
"_linux_unsafe",
"_opts",
"_opts_unsafe",
"_impl",
"_impl_unsafe",
]