| 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 |
type ArchFamilyType int |
| 9 |
|
| 10 |
// PtrSize is the size of a pointer in bytes - unsafe.Sizeof(uintptr(0)) but as an ideal constant. |
| 11 |
// It is also the size of the machine's native word size (that is, 4 on 32-bit systems, 8 on 64-bit). |
| 12 |
const PtrSize = 4 << (^uintptr(0) >> 63) |
| 13 |
|
| 14 |
// ArchFamily is the architecture family (AMD64, ARM, ...) |
| 15 |
const ArchFamily ArchFamilyType = _ArchFamily |
| 16 |
|
| 17 |
// BigEndian reports whether the architecture is big-endian. |
| 18 |
const BigEndian = _BigEndian |
| 19 |
|
| 20 |
// DefaultPhysPageSize is the default physical page size. |
| 21 |
const DefaultPhysPageSize = _DefaultPhysPageSize |
| 22 |
|
| 23 |
// PCQuantum is the minimal unit for a program counter (1 on x86, 4 on most other systems). |
| 24 |
// The various PC tables record PC deltas pre-divided by PCQuantum. |
| 25 |
const PCQuantum = _PCQuantum |
| 26 |
|
| 27 |
// Int64Align is the required alignment for a 64-bit integer (4 on 32-bit systems, 8 on 64-bit). |
| 28 |
const Int64Align = _Int64Align |
| 29 |
|
| 30 |
// MinFrameSize is the size of the system-reserved words at the bottom |
| 31 |
// of a frame (just above the architectural stack pointer). |
| 32 |
// It is zero on x86 and PtrSize on most non-x86 (LR-based) systems. |
| 33 |
// On PowerPC it is larger, to cover three more reserved words: |
| 34 |
// the compiler word, the link editor word, and the TOC save word. |
| 35 |
const MinFrameSize = _MinFrameSize |
| 36 |
|
| 37 |
// StackAlign is the required alignment of the SP register. |
| 38 |
// The stack must be at least word aligned, but some architectures require more. |
| 39 |
const StackAlign = _StackAlign |