mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Move x86 state definition to its own file.
PiperOrigin-RevId: 294271541
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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{
|
||||
|
||||
@@ -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
@@ -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",
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user