VMware vSphere Integrated Containers provider (#206)
* Add Virtual Kubelet provider for VIC Initial virtual kubelet provider for VMware VIC. This provider currently handles creating and starting of a pod VM via the VIC portlayer and persona server. Image store handling via the VIC persona server. This provider currently requires the feature/wolfpack branch of VIC. * Added pod stop and delete. Also added node capacity. Added the ability to stop and delete pod VMs via VIC. Also retrieve node capacity information from the VCH. * Cleanup and readme file Some file clean up and added a Readme.md markdown file for the VIC provider. * Cleaned up errors, added function comments, moved operation code 1. Cleaned up error handling. Set standard for creating errors. 2. Added method prototype comments for all interface functions. 3. Moved PodCreator, PodStarter, PodStopper, and PodDeleter to a new folder. * Add mocking code and unit tests for podcache, podcreator, and podstarter Used the unit test framework used in VIC to handle assertions in the provider's unit test. Mocking code generated using OSS project mockery, which is compatible with the testify assertion framework. * Vendored packages for the VIC provider Requires feature/wolfpack branch of VIC and a few specific commit sha of projects used within VIC. * Implementation of POD Stopper and Deleter unit tests (#4) * Updated files for initial PR
This commit is contained in:
104
vendor/github.com/vmware/vmw-guestinfo/bdoor/bdoor.go
generated
vendored
Normal file
104
vendor/github.com/vmware/vmw-guestinfo/bdoor/bdoor.go
generated
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
// Copyright 2016-2017 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// 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.
|
||||
|
||||
package bdoor
|
||||
|
||||
const (
|
||||
BackdoorPort = uint16(0x5658)
|
||||
BackdoorHighBWPort = uint16(0x5659)
|
||||
|
||||
CommandGetVersion = uint32(10)
|
||||
|
||||
CommandMessage = uint16(0x1e)
|
||||
CommandHighBWMessage = uint16(0)
|
||||
CommandFlagCookie = uint32(0x80000000)
|
||||
)
|
||||
|
||||
func (p *BackdoorProto) InOut() *BackdoorProto {
|
||||
p.DX.AsUInt32().Low = BackdoorPort
|
||||
p.AX.SetValue(BackdoorMagic)
|
||||
|
||||
retax, retbx, retcx, retdx, retsi, retdi, retbp := bdoor_inout(
|
||||
p.AX.Value(),
|
||||
p.BX.Value(),
|
||||
p.CX.Value(),
|
||||
p.DX.Value(),
|
||||
p.SI.Value(),
|
||||
p.DI.Value(),
|
||||
p.BP.Value(),
|
||||
)
|
||||
|
||||
ret := &BackdoorProto{}
|
||||
ret.AX.SetValue(retax)
|
||||
ret.BX.SetValue(retbx)
|
||||
ret.CX.SetValue(retcx)
|
||||
ret.DX.SetValue(retdx)
|
||||
ret.SI.SetValue(retsi)
|
||||
ret.DI.SetValue(retdi)
|
||||
ret.BP.SetValue(retbp)
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
func (p *BackdoorProto) HighBandwidthOut() *BackdoorProto {
|
||||
p.DX.AsUInt32().Low = BackdoorHighBWPort
|
||||
p.AX.SetValue(BackdoorMagic)
|
||||
|
||||
retax, retbx, retcx, retdx, retsi, retdi, retbp := bdoor_hbout(
|
||||
p.AX.Value(),
|
||||
p.BX.Value(),
|
||||
p.CX.Value(),
|
||||
p.DX.Value(),
|
||||
p.SI.Value(),
|
||||
p.DI.Value(),
|
||||
p.BP.Value(),
|
||||
)
|
||||
|
||||
ret := &BackdoorProto{}
|
||||
ret.AX.SetValue(retax)
|
||||
ret.BX.SetValue(retbx)
|
||||
ret.CX.SetValue(retcx)
|
||||
ret.DX.SetValue(retdx)
|
||||
ret.SI.SetValue(retsi)
|
||||
ret.DI.SetValue(retdi)
|
||||
ret.BP.SetValue(retbp)
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
func (p *BackdoorProto) HighBandwidthIn() *BackdoorProto {
|
||||
p.DX.AsUInt32().Low = BackdoorHighBWPort
|
||||
p.AX.SetValue(BackdoorMagic)
|
||||
|
||||
retax, retbx, retcx, retdx, retsi, retdi, retbp := bdoor_hbin(
|
||||
p.AX.Value(),
|
||||
p.BX.Value(),
|
||||
p.CX.Value(),
|
||||
p.DX.Value(),
|
||||
p.SI.Value(),
|
||||
p.DI.Value(),
|
||||
p.BP.Value(),
|
||||
)
|
||||
|
||||
ret := &BackdoorProto{}
|
||||
ret.AX.SetValue(retax)
|
||||
ret.BX.SetValue(retbx)
|
||||
ret.CX.SetValue(retcx)
|
||||
ret.DX.SetValue(retdx)
|
||||
ret.SI.SetValue(retsi)
|
||||
ret.DI.SetValue(retdi)
|
||||
ret.BP.SetValue(retbp)
|
||||
|
||||
return ret
|
||||
}
|
||||
48
vendor/github.com/vmware/vmw-guestinfo/bdoor/bdoor_386.go
generated
vendored
Normal file
48
vendor/github.com/vmware/vmw-guestinfo/bdoor/bdoor_386.go
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
// Copyright 2016-2017 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// 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.
|
||||
|
||||
package bdoor
|
||||
|
||||
const (
|
||||
BackdoorMagic = uint32(0x564D5868)
|
||||
)
|
||||
|
||||
type BackdoorProto struct {
|
||||
// typedef union {
|
||||
// struct {
|
||||
// DECLARE_REG_NAMED_STRUCT(ax);
|
||||
// size_t size; /* Register bx. */
|
||||
// DECLARE_REG_NAMED_STRUCT(cx);
|
||||
// DECLARE_REG_NAMED_STRUCT(dx);
|
||||
// DECLARE_REG_NAMED_STRUCT(si);
|
||||
// DECLARE_REG_NAMED_STRUCT(di);
|
||||
// } in;
|
||||
// struct {
|
||||
// DECLARE_REG_NAMED_STRUCT(ax);
|
||||
// DECLARE_REG_NAMED_STRUCT(bx);
|
||||
// DECLARE_REG_NAMED_STRUCT(cx);
|
||||
// DECLARE_REG_NAMED_STRUCT(dx);
|
||||
// DECLARE_REG_NAMED_STRUCT(si);
|
||||
// DECLARE_REG_NAMED_STRUCT(di);
|
||||
// } out;
|
||||
// } proto;
|
||||
|
||||
AX, BX, CX, DX, SI, DI, BP UInt32
|
||||
size uint32
|
||||
}
|
||||
|
||||
func bdoor_inout(ax, bx, cx, dx, si, di, bp uint32) (retax, retbx, retcx, retdx, retsi, retdi, retbp uint32)
|
||||
func bdoor_hbout(ax, bx, cx, dx, si, di, bp uint32) (retax, retbx, retcx, retdx, retsi, retdi, retbp uint32)
|
||||
func bdoor_hbin(ax, bx, cx, dx, si, di, bp uint32) (retax, retbx, retcx, retdx, retsi, retdi, retbp uint32)
|
||||
func bdoor_inout_test(ax, bx, cx, dx, si, di, bp uint32) (retax, retbx, retcx, retdx, retsi, retdi, retbp uint32)
|
||||
112
vendor/github.com/vmware/vmw-guestinfo/bdoor/bdoor_386.s
generated
vendored
Normal file
112
vendor/github.com/vmware/vmw-guestinfo/bdoor/bdoor_386.s
generated
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
#include "textflag.h"
|
||||
|
||||
// Doc of the golang plan9 assembler
|
||||
// http://p9.nyx.link/labs/sys/doc/asm.html
|
||||
//
|
||||
// A good primer of how to write golang with some plan9 flavored assembly
|
||||
// http://www.doxsey.net/blog/go-and-assembly
|
||||
//
|
||||
// Some x86 references
|
||||
// http://www.eecg.toronto.edu/~amza/www.mindsec.com/files/x86regs.html
|
||||
// https://cseweb.ucsd.edu/classes/sp10/cse141/pdf/02/S01_x86_64.key.pdf
|
||||
// https://en.wikibooks.org/wiki/X86_Assembly/Other_Instructions
|
||||
//
|
||||
// (This one is invaluable. Has a working example of how a standard function
|
||||
// call looks on the stack with the associated assembly.)
|
||||
// https://www.recurse.com/blog/7-understanding-c-by-learning-assembly
|
||||
//
|
||||
// Reference with raw form of the Opcode
|
||||
// http://x86.renejeschke.de/html/file_module_x86_id_139.html
|
||||
//
|
||||
// Massive x86_64 reference
|
||||
// http://ref.x86asm.net/coder64.html#xED
|
||||
//
|
||||
// Adding instructions to the go assembler
|
||||
// https://blog.klauspost.com/adding-unsupported-instructions-in-golang-assembler/
|
||||
//
|
||||
// Backdoor commands
|
||||
// https://sites.google.com/site/chitchatvmback/backdoor
|
||||
|
||||
// func bdoor_inout(ax, bx, cx, dx, si, di, bp uint32) (retax, retbx, retcx, retdx, retsi, retdi, retbp uint32)
|
||||
TEXT ·bdoor_inout(SB), NOSPLIT|WRAPPER, $0
|
||||
MOVL ax+0(FP), AX
|
||||
MOVL bx+4(FP), BX
|
||||
MOVL cx+8(FP), CX
|
||||
MOVL dx+12(FP), DX
|
||||
MOVL si+16(FP), SI
|
||||
MOVL di+20(FP), DI
|
||||
MOVL bp+24(FP), BP
|
||||
|
||||
// IN to DX from EAX
|
||||
INL
|
||||
|
||||
MOVL AX, retax+28(FP)
|
||||
MOVL BX, retbx+32(FP)
|
||||
MOVL CX, retcx+36(FP)
|
||||
MOVL DX, retdx+40(FP)
|
||||
MOVL SI, retsi+44(FP)
|
||||
MOVL DI, retdi+48(FP)
|
||||
MOVL BP, retbp+52(FP)
|
||||
RET
|
||||
|
||||
// func bdoor_hbout(ax, bx, cx, dx, si, di, bp uint32) (retax, retbx, retcx, retdx, retsi, retdi, retbp uint32)
|
||||
TEXT ·bdoor_hbout(SB), NOSPLIT|WRAPPER, $0
|
||||
MOVL ax+0(FP), AX
|
||||
MOVL bx+4(FP), BX
|
||||
MOVL cx+8(FP), CX
|
||||
MOVL dx+12(FP), DX
|
||||
MOVL si+16(FP), SI
|
||||
MOVL di+20(FP), DI
|
||||
MOVL bp+24(FP), BP
|
||||
|
||||
CLD; REP; OUTSB
|
||||
|
||||
MOVL AX, retax+28(FP)
|
||||
MOVL BX, retbx+32(FP)
|
||||
MOVL CX, retcx+36(FP)
|
||||
MOVL DX, retdx+40(FP)
|
||||
MOVL SI, retsi+44(FP)
|
||||
MOVL DI, retdi+48(FP)
|
||||
MOVL BP, retbp+52(FP)
|
||||
RET
|
||||
|
||||
// func bdoor_hbin(ax, bx, cx, dx, si, di, bp uint32) (retax, retbx, retcx, retdx, retsi, retdi, retbp uint32)
|
||||
TEXT ·bdoor_hbin(SB), NOSPLIT|WRAPPER, $0
|
||||
MOVL ax+0(FP), AX
|
||||
MOVL bx+4(FP), BX
|
||||
MOVL cx+8(FP), CX
|
||||
MOVL dx+12(FP), DX
|
||||
MOVL si+16(FP), SI
|
||||
MOVL di+20(FP), DI
|
||||
MOVL bp+24(FP), BP
|
||||
|
||||
CLD; REP; INSB
|
||||
|
||||
MOVL AX, retax+28(FP)
|
||||
MOVL BX, retbx+32(FP)
|
||||
MOVL CX, retcx+40(FP)
|
||||
MOVL DX, retdx+44(FP)
|
||||
MOVL SI, retsi+48(FP)
|
||||
MOVL DI, retdi+52(FP)
|
||||
MOVL BP, retbp+56(FP)
|
||||
RET
|
||||
|
||||
// func bdoor_inout_test(ax, bx, cx, dx, si, di, bp uint32) (retax, retbx, retcx, retdx, retsi, retdi, retbp uint32)
|
||||
TEXT ·bdoor_inout_test(SB), NOSPLIT|WRAPPER, $0
|
||||
MOVL ax+0(FP), AX
|
||||
MOVL bx+4(FP), BX
|
||||
MOVL cx+8(FP), CX
|
||||
MOVL dx+12(FP), DX
|
||||
MOVL si+16(FP), SI
|
||||
MOVL di+20(FP), DI
|
||||
MOVL bp+24(FP), BP
|
||||
|
||||
MOVL AX, retax+28(FP)
|
||||
MOVL BX, retbx+32(FP)
|
||||
MOVL CX, retcx+36(FP)
|
||||
MOVL DX, retdx+40(FP)
|
||||
MOVL SI, retsi+44(FP)
|
||||
MOVL DI, retdi+48(FP)
|
||||
MOVL BP, retbp+52(FP)
|
||||
RET
|
||||
|
||||
43
vendor/github.com/vmware/vmw-guestinfo/bdoor/bdoor_386_test.go
generated
vendored
Normal file
43
vendor/github.com/vmware/vmw-guestinfo/bdoor/bdoor_386_test.go
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
// Copyright 2016 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// 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.
|
||||
|
||||
package bdoor
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/vmware/vmw-guestinfo/util"
|
||||
)
|
||||
|
||||
func TestBdoorArgAlignment(t *testing.T) {
|
||||
a := uint32(0xFFFFFFFF)
|
||||
b := uint32(33)
|
||||
c := uint32(44)
|
||||
d := uint32(55)
|
||||
si := uint32(0xBADDECAF)
|
||||
di := uint32(0xBAADA555)
|
||||
bp := uint32(0xDEADBEEF)
|
||||
|
||||
oa, ob, oc, od, osi, odi, obp := bdoor_inout_test(a, b, c, d, si, di, bp)
|
||||
|
||||
if !util.AssertEqual(t, a, oa) ||
|
||||
!util.AssertEqual(t, b, ob) ||
|
||||
!util.AssertEqual(t, c, oc) ||
|
||||
!util.AssertEqual(t, d, od) ||
|
||||
!util.AssertEqual(t, si, osi) ||
|
||||
!util.AssertEqual(t, di, odi) ||
|
||||
!util.AssertEqual(t, bp, obp) {
|
||||
return
|
||||
}
|
||||
}
|
||||
48
vendor/github.com/vmware/vmw-guestinfo/bdoor/bdoor_amd64.go
generated
vendored
Normal file
48
vendor/github.com/vmware/vmw-guestinfo/bdoor/bdoor_amd64.go
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
// Copyright 2016-2017 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// 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.
|
||||
|
||||
package bdoor
|
||||
|
||||
const (
|
||||
BackdoorMagic = uint64(0x564D5868)
|
||||
)
|
||||
|
||||
type BackdoorProto struct {
|
||||
// typedef union {
|
||||
// struct {
|
||||
// DECLARE_REG_NAMED_STRUCT(ax);
|
||||
// size_t size; /* Register bx. */
|
||||
// DECLARE_REG_NAMED_STRUCT(cx);
|
||||
// DECLARE_REG_NAMED_STRUCT(dx);
|
||||
// DECLARE_REG_NAMED_STRUCT(si);
|
||||
// DECLARE_REG_NAMED_STRUCT(di);
|
||||
// } in;
|
||||
// struct {
|
||||
// DECLARE_REG_NAMED_STRUCT(ax);
|
||||
// DECLARE_REG_NAMED_STRUCT(bx);
|
||||
// DECLARE_REG_NAMED_STRUCT(cx);
|
||||
// DECLARE_REG_NAMED_STRUCT(dx);
|
||||
// DECLARE_REG_NAMED_STRUCT(si);
|
||||
// DECLARE_REG_NAMED_STRUCT(di);
|
||||
// } out;
|
||||
// } proto;
|
||||
|
||||
AX, BX, CX, DX, SI, DI, BP UInt64
|
||||
size uint32
|
||||
}
|
||||
|
||||
func bdoor_inout(ax, bx, cx, dx, si, di, bp uint64) (retax, retbx, retcx, retdx, retsi, retdi, retbp uint64)
|
||||
func bdoor_hbout(ax, bx, cx, dx, si, di, bp uint64) (retax, retbx, retcx, retdx, retsi, retdi, retbp uint64)
|
||||
func bdoor_hbin(ax, bx, cx, dx, si, di, bp uint64) (retax, retbx, retcx, retdx, retsi, retdi, retbp uint64)
|
||||
func bdoor_inout_test(ax, bx, cx, dx, si, di, bp uint64) (retax, retbx, retcx, retdx, retsi, retdi, retbp uint64)
|
||||
112
vendor/github.com/vmware/vmw-guestinfo/bdoor/bdoor_amd64.s
generated
vendored
Normal file
112
vendor/github.com/vmware/vmw-guestinfo/bdoor/bdoor_amd64.s
generated
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
#include "textflag.h"
|
||||
|
||||
// Doc of the golang plan9 assembler
|
||||
// http://p9.nyx.link/labs/sys/doc/asm.html
|
||||
//
|
||||
// A good primer of how to write golang with some plan9 flavored assembly
|
||||
// http://www.doxsey.net/blog/go-and-assembly
|
||||
//
|
||||
// Some x86 references
|
||||
// http://www.eecg.toronto.edu/~amza/www.mindsec.com/files/x86regs.html
|
||||
// https://cseweb.ucsd.edu/classes/sp10/cse141/pdf/02/S01_x86_64.key.pdf
|
||||
// https://en.wikibooks.org/wiki/X86_Assembly/Other_Instructions
|
||||
//
|
||||
// (This one is invaluable. Has a working example of how a standard function
|
||||
// call looks on the stack with the associated assembly.)
|
||||
// https://www.recurse.com/blog/7-understanding-c-by-learning-assembly
|
||||
//
|
||||
// Reference with raw form of the Opcode
|
||||
// http://x86.renejeschke.de/html/file_module_x86_id_139.html
|
||||
//
|
||||
// Massive x86_64 reference
|
||||
// http://ref.x86asm.net/coder64.html#xED
|
||||
//
|
||||
// Adding instructions to the go assembler
|
||||
// https://blog.klauspost.com/adding-unsupported-instructions-in-golang-assembler/
|
||||
//
|
||||
// Backdoor commands
|
||||
// https://sites.google.com/site/chitchatvmback/backdoor
|
||||
|
||||
// func bdoor_inout(ax, bx, cx, dx, si, di, bp uint64) (retax, retbx, retcx, retdx, retsi, retdi, retbp uint64)
|
||||
TEXT ·bdoor_inout(SB), NOSPLIT|WRAPPER, $0
|
||||
MOVQ ax+0(FP), AX
|
||||
MOVQ bx+8(FP), BX
|
||||
MOVQ cx+16(FP), CX
|
||||
MOVQ dx+24(FP), DX
|
||||
MOVQ si+32(FP), SI
|
||||
MOVQ di+40(FP), DI
|
||||
MOVQ bp+48(FP), BP
|
||||
|
||||
// IN to DX from EAX
|
||||
INL
|
||||
|
||||
MOVQ AX, retax+56(FP)
|
||||
MOVQ BX, retbx+64(FP)
|
||||
MOVQ CX, retcx+72(FP)
|
||||
MOVQ DX, retdx+80(FP)
|
||||
MOVQ SI, retsi+88(FP)
|
||||
MOVQ DI, retdi+96(FP)
|
||||
MOVQ BP, retbp+104(FP)
|
||||
RET
|
||||
|
||||
// func bdoor_hbout(ax, bx, cx, dx, si, di, bp uint64) (retax, retbx, retcx, retdx, retsi, retdi, retbp uint64)
|
||||
TEXT ·bdoor_hbout(SB), NOSPLIT|WRAPPER, $0
|
||||
MOVQ ax+0(FP), AX
|
||||
MOVQ bx+8(FP), BX
|
||||
MOVQ cx+16(FP), CX
|
||||
MOVQ dx+24(FP), DX
|
||||
MOVQ si+32(FP), SI
|
||||
MOVQ di+40(FP), DI
|
||||
MOVQ bp+48(FP), BP
|
||||
|
||||
CLD; REP; OUTSB
|
||||
|
||||
MOVQ AX, retax+56(FP)
|
||||
MOVQ BX, retbx+64(FP)
|
||||
MOVQ CX, retcx+72(FP)
|
||||
MOVQ DX, retdx+80(FP)
|
||||
MOVQ SI, retsi+88(FP)
|
||||
MOVQ DI, retdi+96(FP)
|
||||
MOVQ BP, retbp+104(FP)
|
||||
RET
|
||||
|
||||
// func bdoor_hbin(ax, bx, cx, dx, si, di, bp uint64) (retax, retbx, retcx, retdx, retsi, retdi, retbp uint64)
|
||||
TEXT ·bdoor_hbin(SB), NOSPLIT|WRAPPER, $0
|
||||
MOVQ ax+0(FP), AX
|
||||
MOVQ bx+8(FP), BX
|
||||
MOVQ cx+16(FP), CX
|
||||
MOVQ dx+24(FP), DX
|
||||
MOVQ si+32(FP), SI
|
||||
MOVQ di+40(FP), DI
|
||||
MOVQ bp+48(FP), BP
|
||||
|
||||
CLD; REP; INSB
|
||||
|
||||
MOVQ AX, retax+56(FP)
|
||||
MOVQ BX, retbx+64(FP)
|
||||
MOVQ CX, retcx+72(FP)
|
||||
MOVQ DX, retdx+80(FP)
|
||||
MOVQ SI, retsi+88(FP)
|
||||
MOVQ DI, retdi+96(FP)
|
||||
MOVQ BP, retbp+104(FP)
|
||||
RET
|
||||
|
||||
// func bdoor_inout_test(ax, bx, cx, dx, si, di, bp uint64) (retax, retbx, retcx, retdx, retsi, retdi, retbp uint64)
|
||||
TEXT ·bdoor_inout_test(SB), NOSPLIT|WRAPPER, $0
|
||||
MOVQ ax+0(FP), AX
|
||||
MOVQ bx+8(FP), BX
|
||||
MOVQ cx+16(FP), CX
|
||||
MOVQ dx+24(FP), DX
|
||||
MOVQ si+32(FP), SI
|
||||
MOVQ di+40(FP), DI
|
||||
MOVQ bp+48(FP), BP
|
||||
|
||||
MOVQ AX, retax+56(FP)
|
||||
MOVQ BX, retbx+64(FP)
|
||||
MOVQ CX, retcx+72(FP)
|
||||
MOVQ DX, retdx+80(FP)
|
||||
MOVQ SI, retsi+88(FP)
|
||||
MOVQ DI, retdi+96(FP)
|
||||
MOVQ BP, retbp+104(FP)
|
||||
RET
|
||||
|
||||
43
vendor/github.com/vmware/vmw-guestinfo/bdoor/bdoor_amd64_test.go
generated
vendored
Normal file
43
vendor/github.com/vmware/vmw-guestinfo/bdoor/bdoor_amd64_test.go
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
// Copyright 2016 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// 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.
|
||||
|
||||
package bdoor
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/vmware/vmw-guestinfo/util"
|
||||
)
|
||||
|
||||
func TestBdoorArgAlignment(t *testing.T) {
|
||||
a := uint64(0xFFFFFFFF0000022)
|
||||
b := uint64(33)
|
||||
c := uint64(44)
|
||||
d := uint64(55)
|
||||
si := uint64(0xFFFFFFFF0000066)
|
||||
di := uint64(0xFFFAAFFF0000077)
|
||||
bp := uint64(0xFFFFFFFFAAAAAAA)
|
||||
|
||||
oa, ob, oc, od, osi, odi, obp := bdoor_inout_test(a, b, c, d, si, di, bp)
|
||||
|
||||
if !util.AssertEqual(t, a, oa) ||
|
||||
!util.AssertEqual(t, b, ob) ||
|
||||
!util.AssertEqual(t, c, oc) ||
|
||||
!util.AssertEqual(t, d, od) ||
|
||||
!util.AssertEqual(t, si, osi) ||
|
||||
!util.AssertEqual(t, di, odi) ||
|
||||
!util.AssertEqual(t, bp, obp) {
|
||||
return
|
||||
}
|
||||
}
|
||||
77
vendor/github.com/vmware/vmw-guestinfo/bdoor/word.go
generated
vendored
Normal file
77
vendor/github.com/vmware/vmw-guestinfo/bdoor/word.go
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
// Copyright 2016-2017 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// 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.
|
||||
|
||||
package bdoor
|
||||
|
||||
import "unsafe"
|
||||
|
||||
type UInt32 struct {
|
||||
High uint16
|
||||
Low uint16
|
||||
}
|
||||
|
||||
func (u *UInt32) Word() uint32 {
|
||||
return uint32(u.High)<<16 + uint32(u.Low)
|
||||
}
|
||||
|
||||
func (u *UInt32) SetWord(w uint32) {
|
||||
u.High = uint16(w >> 16)
|
||||
u.Low = uint16(w)
|
||||
}
|
||||
|
||||
func (u *UInt32) AsUInt32() *UInt32 {
|
||||
return u
|
||||
}
|
||||
|
||||
func (u *UInt32) Value() uint32 {
|
||||
return u.Word()
|
||||
}
|
||||
|
||||
func (u *UInt32) SetValue(val uint32) {
|
||||
u.SetWord(val)
|
||||
}
|
||||
|
||||
func (u *UInt32) SetPointer(p unsafe.Pointer) {
|
||||
u.SetWord(uint32(uintptr(p)))
|
||||
}
|
||||
|
||||
type UInt64 struct {
|
||||
High UInt32
|
||||
Low UInt32
|
||||
}
|
||||
|
||||
func (u *UInt64) Quad() uint64 {
|
||||
return uint64(u.High.Word())<<32 + uint64(u.Low.Word())
|
||||
}
|
||||
|
||||
func (u *UInt64) SetQuad(w uint64) {
|
||||
u.High.SetWord(uint32(w >> 32))
|
||||
u.Low.SetWord(uint32(w))
|
||||
}
|
||||
|
||||
func (u *UInt64) AsUInt32() *UInt32 {
|
||||
return &u.Low
|
||||
}
|
||||
|
||||
func (u *UInt64) Value() uint64 {
|
||||
return u.Quad()
|
||||
}
|
||||
|
||||
func (u *UInt64) SetValue(val uint64) {
|
||||
u.SetQuad(val)
|
||||
}
|
||||
|
||||
func (u *UInt64) SetPointer(p unsafe.Pointer) {
|
||||
u.SetQuad(uint64(uintptr(p)))
|
||||
}
|
||||
39
vendor/github.com/vmware/vmw-guestinfo/bdoor/word_386_test.go
generated
vendored
Normal file
39
vendor/github.com/vmware/vmw-guestinfo/bdoor/word_386_test.go
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
// Copyright 2016 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// 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.
|
||||
|
||||
package bdoor
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/vmware/vmw-guestinfo/util"
|
||||
)
|
||||
|
||||
func TestSetWord(t *testing.T) {
|
||||
inLow := uint16(0xEEFF)
|
||||
inHigh := uint16(0xBBBB)
|
||||
|
||||
out := &UInt32{}
|
||||
//out.SetWord(uint32(0xBBBBEEFF))
|
||||
out.Low = inLow
|
||||
out.High = inHigh
|
||||
|
||||
if !util.AssertEqual(t, inLow, out.Low) || !util.AssertEqual(t, inHigh, out.High) {
|
||||
return
|
||||
}
|
||||
|
||||
if !util.AssertEqual(t, uint32(0xBBBBEEFF), out.Word()) {
|
||||
return
|
||||
}
|
||||
}
|
||||
70
vendor/github.com/vmware/vmw-guestinfo/bdoor/word_amd64_test.go
generated
vendored
Normal file
70
vendor/github.com/vmware/vmw-guestinfo/bdoor/word_amd64_test.go
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
// Copyright 2016 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// 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.
|
||||
|
||||
package bdoor
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"github.com/vmware/vmw-guestinfo/util"
|
||||
)
|
||||
|
||||
func TestSetWord(t *testing.T) {
|
||||
inLow := uint16(0xEEFF)
|
||||
inHigh := uint16(0xBBBB)
|
||||
|
||||
out := &UInt32{}
|
||||
//out.SetWord(uint32(0xBBBBEEFF))
|
||||
out.Low = inLow
|
||||
out.High = inHigh
|
||||
|
||||
if !util.AssertEqual(t, inLow, out.Low) || !util.AssertEqual(t, inHigh, out.High) {
|
||||
return
|
||||
}
|
||||
|
||||
if !util.AssertEqual(t, uint32(0xBBBBEEFF), out.Word()) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func TestQuadToHighLow(t *testing.T) {
|
||||
in := uint64(0xFFFFFFFF0000000A)
|
||||
|
||||
var u UInt64
|
||||
u.SetQuad(in)
|
||||
if !util.AssertEqual(t, uint32(in), u.Low.Word()) {
|
||||
return
|
||||
}
|
||||
|
||||
if !util.AssertEqual(t, uint32(in>>32), u.High.Word()) {
|
||||
return
|
||||
}
|
||||
|
||||
if !util.AssertEqual(t, in, u.Quad()) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func TestHighLowToQuad(t *testing.T) {
|
||||
inHigh := uint16(0xff)
|
||||
inLow := uint16(0xaa)
|
||||
|
||||
u := UInt64{
|
||||
High: UInt32{High: inHigh},
|
||||
Low: UInt32{Low: inLow},
|
||||
}
|
||||
|
||||
if !util.AssertEqual(t, (uint64(inHigh)<<48)+uint64(inLow), u.Quad()) {
|
||||
return
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user