Debian Codegraph @

vmcheck/asm.go

raw symbols SCIP
1 // Copyright 2016-2017 VMware, Inc. All Rights Reserved.
2 // Copyright 2020 Google LLC
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15
16 // +build ignore
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 }