Created
April 4, 2023 05:07
-
-
Save penryu/55fd1fced9dd2434122e2b26a26009a3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
// #include <linux/reboot.h> | |
// typedef unsigned int* magic; | |
// void get_magicks(magic amulet) { | |
// *amulet++ = LINUX_REBOOT_MAGIC1; | |
// *amulet++ = LINUX_REBOOT_MAGIC2; | |
// *amulet++ = LINUX_REBOOT_MAGIC2A; | |
// *amulet++ = LINUX_REBOOT_MAGIC2B; | |
// *amulet++ = LINUX_REBOOT_MAGIC2C; | |
// } | |
import "C" | |
import "fmt" | |
func main() { | |
var magicks [5]C.uint | |
C.get_magicks(&magicks[0]) | |
names := []string{ "MAGIC1", "MAGIC2", "MAGIC2A", "MAGIC2C", "MAGIC2C" } | |
for i, v := range names { | |
fmt.Printf("%8s => %08x\n", v, magicks[i]) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment