fix: amd64 getsp demo
This commit is contained in:
@@ -14,13 +14,9 @@ func getsp() unsafe.Pointer
|
|||||||
func asmFull(instruction string, regs map[string]any) uintptr { return 0 }
|
func asmFull(instruction string, regs map[string]any) uintptr { return 0 }
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var spPtr uintptr
|
sp := asmFull("movq %rsp, {}", nil)
|
||||||
|
|
||||||
asmFull("movq sp, {{addr}}", map[string]any{
|
if sp != uintptr(getsp()) {
|
||||||
"addr": unsafe.Pointer(&spPtr),
|
|
||||||
})
|
|
||||||
|
|
||||||
if spPtr != uintptr(getsp()) {
|
|
||||||
panic("invalid stack pointer")
|
panic("invalid stack pointer")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user