Merge pull request #1912 from lubinszARM:pr_kvm_build
PiperOrigin-RevId: 297492004
This commit is contained in:
commit
6ddeb35ed4
|
@ -81,12 +81,6 @@ func (c *vCPU) die(context *arch.SignalContext64, msg string) {
|
|||
// Save the death message, which will be thrown.
|
||||
c.dieState.message = msg
|
||||
|
||||
// Reload all registers to have an accurate stack trace when we return
|
||||
// to host mode. This means that the stack should be unwound correctly.
|
||||
if errno := c.getUserRegisters(&c.dieState.guestRegs); errno != 0 {
|
||||
throw(msg)
|
||||
}
|
||||
|
||||
// Setup the trampoline.
|
||||
dieArchSetup(c, context, &c.dieState.guestRegs)
|
||||
}
|
||||
|
|
|
@ -31,6 +31,12 @@ import (
|
|||
//
|
||||
//go:nosplit
|
||||
func dieArchSetup(c *vCPU, context *arch.SignalContext64, guestRegs *userRegs) {
|
||||
// Reload all registers to have an accurate stack trace when we return
|
||||
// to host mode. This means that the stack should be unwound correctly.
|
||||
if errno := c.getUserRegisters(&c.dieState.guestRegs); errno != 0 {
|
||||
throw(c.dieState.message)
|
||||
}
|
||||
|
||||
// If the vCPU is in user mode, we set the stack to the stored stack
|
||||
// value in the vCPU itself. We don't want to unwind the user stack.
|
||||
if guestRegs.RFLAGS&ring0.UserFlagsSet == ring0.UserFlagsSet {
|
||||
|
|
|
@ -29,30 +29,6 @@ import (
|
|||
"gvisor.dev/gvisor/pkg/usermem"
|
||||
)
|
||||
|
||||
// setMemoryRegion initializes a region.
|
||||
//
|
||||
// This may be called from bluepillHandler, and therefore returns an errno
|
||||
// directly (instead of wrapping in an error) to avoid allocations.
|
||||
//
|
||||
//go:nosplit
|
||||
func (m *machine) setMemoryRegion(slot int, physical, length, virtual uintptr) syscall.Errno {
|
||||
userRegion := userMemoryRegion{
|
||||
slot: uint32(slot),
|
||||
flags: 0,
|
||||
guestPhysAddr: uint64(physical),
|
||||
memorySize: uint64(length),
|
||||
userspaceAddr: uint64(virtual),
|
||||
}
|
||||
|
||||
// Set the region.
|
||||
_, _, errno := syscall.RawSyscall(
|
||||
syscall.SYS_IOCTL,
|
||||
uintptr(m.fd),
|
||||
_KVM_SET_USER_MEMORY_REGION,
|
||||
uintptr(unsafe.Pointer(&userRegion)))
|
||||
return errno
|
||||
}
|
||||
|
||||
type kvmVcpuInit struct {
|
||||
target uint32
|
||||
features [7]uint32
|
||||
|
|
Loading…
Reference in New Issue