本文整理匯總了Golang中novmm/platform.Vm.Interrupt方法的典型用法代碼示例。如果您正苦於以下問題:Golang Vm.Interrupt方法的具體用法?Golang Vm.Interrupt怎麽用?Golang Vm.Interrupt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類novmm/platform.Vm
的用法示例。
在下文中一共展示了Vm.Interrupt方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Attach
func (pcidevice *PciDevice) Attach(vm *platform.Vm, model *Model) error {
// Find our pcibus.
var ok bool
var pcibus *PciBus
for _, device := range model.devices {
pcibus, ok = device.(*PciBus)
if pcibus != nil && ok {
break
}
}
if pcibus == nil {
return PciBusNotFound
}
// Rebuild our capabilities.
pcidevice.RebuildCapabilities()
// FIXME: Everything uses interrupt 1.
// This is gross, but we hard-coded the line to 1
// unless you're using MSI. This really should be
// fixed (if we actually plan on using PCI devices).
pcidevice.Config.Set8(PciConfigOffsetInterruptLine, 1)
pcidevice.Config.Set8(PciConfigOffsetInterruptPin, 1)
pcidevice.std_interrupt = func() error {
vm.Interrupt(platform.Irq(1), true)
vm.Interrupt(platform.Irq(1), false)
return nil
}
// Attach to the PciBus.
return pcibus.AddDevice(pcidevice)
}