github.com/eh-steve/goloader@v0.0.0-20240111193454-90ff3cfdae39/reflectlite/internal/goarch/goarch.go (about) 1 // Copyright 2021 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // package goarch contains GOARCH-specific constants. 6 package goarch 7 8 // The next line makes 'go generate' write the zgoarch*.go files with 9 // per-arch information, including constants named $GOARCH for every 10 // GOARCH. The constant is 1 on the current system, 0 otherwise; multiplying 11 // by them is useful for defining GOARCH-specific constants. 12 // 13 //go:generate go run gengoarch.go 14 15 type ArchFamilyType int 16 17 const ( 18 AMD64 ArchFamilyType = iota 19 ARM 20 ARM64 21 I386 22 LOONG64 23 MIPS 24 MIPS64 25 PPC64 26 RISCV64 27 S390X 28 WASM 29 ) 30 31 // PtrSize is the size of a pointer in bytes - unsafe.Sizeof(uintptr(0)) but as an ideal constant. 32 // It is also the size of the machine's native word size (that is, 4 on 32-bit systems, 8 on 64-bit). 33 const PtrSize = 4 << (^uintptr(0) >> 63) 34 35 // ArchFamily is the architecture family (AMD64, ARM, ...) 36 const ArchFamily ArchFamilyType = _ArchFamily 37 38 // BigEndian reports whether the architecture is big-endian. 39 const BigEndian = IsArmbe|IsArm64be|IsMips|IsMips64|IsPpc|IsPpc64|IsS390|IsS390x|IsSparc|IsSparc64 == 1 40 41 // DefaultPhysPageSize is the default physical page size. 42 const DefaultPhysPageSize = _DefaultPhysPageSize 43 44 // PCQuantum is the minimal unit for a program counter (1 on x86, 4 on most other systems). 45 // The various PC tables record PC deltas pre-divided by PCQuantum. 46 const PCQuantum = _PCQuantum 47 48 // Int64Align is the required alignment for a 64-bit integer (4 on 32-bit systems, 8 on 64-bit). 49 const Int64Align = PtrSize 50 51 // MinFrameSize is the size of the system-reserved words at the bottom 52 // of a frame (just above the architectural stack pointer). 53 // It is zero on x86 and PtrSize on most non-x86 (LR-based) systems. 54 // On PowerPC it is larger, to cover three more reserved words: 55 // the compiler word, the link editor word, and the TOC save word. 56 const MinFrameSize = _MinFrameSize 57 58 // StackAlign is the required alignment of the SP register. 59 // The stack must be at least word aligned, but some architectures require more. 60 const StackAlign = _StackAlign