| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
package main |
| 19 |
|
| 20 |
import ( |
| 21 |
. "github.com/mmcloughlin/avo/build" |
| 22 |
"github.com/mmcloughlin/avo/reg" |
| 23 |
|
| 24 |
"github.com/vmware/vmw-guestinfo/asm" |
| 25 |
) |
| 26 |
|
| 27 |
func code(ctx *asm.AvoContext) error { |
| 28 |
ctx.Function("cpuid_low") |
| 29 |
ctx.Attributes(NOSPLIT) |
| 30 |
ctx.SignatureExpr("func(arg1, arg2 uint32) (eax, ebx, ecx, edx uint32)") |
| 31 |
|
| 32 |
ctx.Comment("From https://github.com/intel-go/cpuid/blob/master/cpuidlow_amd64.s") |
| 33 |
|
| 34 |
ctx.Load(ctx.Param("arg1"), reg.EAX) |
| 35 |
ctx.Load(ctx.Param("arg2"), reg.ECX) |
| 36 |
|
| 37 |
ctx.CPUID() |
| 38 |
|
| 39 |
ctx.Store(reg.EAX, ctx.Return("eax")) |
| 40 |
ctx.Store(reg.EBX, ctx.Return("ebx")) |
| 41 |
ctx.Store(reg.ECX, ctx.Return("ecx")) |
| 42 |
ctx.Store(reg.EDX, ctx.Return("edx")) |
| 43 |
|
| 44 |
ctx.RET() |
| 45 |
|
| 46 |
return nil |
| 47 |
} |
| 48 |
|
| 49 |
func main() { |
| 50 |
asm.GenAsm(code) |
| 51 |
} |