/* Aurora B10B3: sync + reboot(LINUX_REBOOT_CMD_RESTART2, "bootloader") -> kernel reboot-mode (qcom-pon, mode-bootloader=2) * writes PON_SOFT_RB_SPARE[7:2]=2; lk1st (USE_PON_REBOOT_REG) then enters fastboot without RESET. Freestanding aarch64, no libc. */ static long sc(long n, long a, long b, long c, long d) { register long x8 asm("x8") = n, x0 asm("x0") = a, x1 asm("x1") = b, x2 asm("x2") = c, x3 asm("x3") = d; asm volatile("svc #0" : "+r"(x0) : "r"(x8), "r"(x1), "r"(x2), "r"(x3) : "memory"); return x0; } void _start(void) { static const char arg[] = "bootloader"; sc(81, 0, 0, 0, 0); /* sync */ sc(142, 0xfee1dead, 672274793, 0xA1B2C3D4, (long)arg); /* reboot(MAGIC1, MAGIC2, RESTART2, "bootloader") */ sc(93, 1, 0, 0, 0); /* exit(1) if reboot returned */ }