-
Notifications
You must be signed in to change notification settings - Fork 0
/
arch.go
40 lines (33 loc) · 899 Bytes
/
arch.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright (c) 2021 Timo Savola. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package ga
// Specific value per CPU architecture.
type Specific struct {
AMD64 int
ARM64 int
}
// Reg ister per CPU architecture.
type Reg struct {
AMD64 RegAMD64
ARM64 RegARM64
Use string
}
// As returns the same register with different usage.
func (r Reg) As(use string) Reg {
r.Use = use
return r
}
// Syscall number per CPU architecture.
type Syscall Specific
// Arch itecture of CPU.
type Arch interface {
Machine() string // GNU-style CPU architecture name (x86_64, aarch64).
Specify(Specific) int // Get value for the CPU architecture.
newAssembly(*System, *buffer) ArchAssembly
}
// Indexed by Go-style CPU architecture name (amd64, arm64).
var Archs = map[string]Arch{
"amd64": AMD64,
"arm64": ARM64,
}