mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-09 13:33:39 +00:00
riscv: use 16-byte alignment everywhere
Source: https://riscv.org/wp-content/uploads/2015/01/riscv-calling.pdf
This commit is contained in:
@@ -6,6 +6,12 @@ import "device/riscv"
|
||||
|
||||
const deferExtraRegs = 0
|
||||
|
||||
// RISC-V has a maximum alignment of 16 bytes (both for RV32 and for RV64).
|
||||
// Source: https://riscv.org/wp-content/uploads/2015/01/riscv-calling.pdf
|
||||
func align(ptr uintptr) uintptr {
|
||||
return (ptr + 15) &^ 15
|
||||
}
|
||||
|
||||
func getCurrentStackPointer() uintptr {
|
||||
return uintptr(stacksave())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user