kexec.h 1.0 KB

12345678910111213141516171819202122232425262728
  1. /* kexec: hot-reload the kernel over serial without a reboot (C-light variant). */
  2. #ifndef KEXEC_H
  3. #define KEXEC_H
  4. void program_kexec_main(void);
  5. /* Staging buffer for a received kernel image, and the maximum image size
  6. * (the kernel region 0x7E00..0x44000). Below the VGA window; see AGENTS.md. */
  7. #define KEXEC_STAGE 0x58000
  8. #define KEXEC_LOAD 0x7E00
  9. #define KEXEC_MAX 0x3C200
  10. /* Copy the staged image (KEXEC_STAGE, `size` bytes) over the kernel region,
  11. * relocate the trampoline and jump to `entry`. Never returns. */
  12. void kexec_jump(unsigned int entry, unsigned int size);
  13. /* Non-zero while a kexec receive is in progress (prevents double-trigger). */
  14. extern volatile int kexec_busy;
  15. /* Receive progress, in bytes. kexec_total is 0 until the header is parsed. */
  16. extern volatile unsigned int kexec_progress;
  17. extern volatile unsigned int kexec_total;
  18. /* Returns 1 if the serial ring buffer starts with the "KXEC" magic, i.e. the
  19. * host has begun sending a new kernel image. */
  20. int kexec_pending(void);
  21. #endif