kexec.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __ASM_SH_KEXEC_H
  3. #define __ASM_SH_KEXEC_H
  4. #include <asm/ptrace.h>
  5. #include <asm/string.h>
  6. #include <linux/kernel.h>
  7. /*
  8. * KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return.
  9. * I.e. Maximum page that is mapped directly into kernel memory,
  10. * and kmap is not required.
  11. *
  12. * Someone correct me if FIXADDR_START - PAGEOFFSET is not the correct
  13. * calculation for the amount of memory directly mappable into the
  14. * kernel memory space.
  15. */
  16. /* Maximum physical address we can use pages from */
  17. #define KEXEC_SOURCE_MEMORY_LIMIT (-1UL)
  18. /* Maximum address we can reach in physical address mode */
  19. #define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL)
  20. /* Maximum address we can use for the control code buffer */
  21. #define KEXEC_CONTROL_MEMORY_LIMIT TASK_SIZE
  22. #define KEXEC_CONTROL_PAGE_SIZE 4096
  23. /* The native architecture */
  24. #define KEXEC_ARCH KEXEC_ARCH_SH
  25. #ifdef CONFIG_KEXEC
  26. /* arch/sh/kernel/machine_kexec.c */
  27. void reserve_crashkernel(void);
  28. static inline void crash_setup_regs(struct pt_regs *newregs,
  29. struct pt_regs *oldregs)
  30. {
  31. if (oldregs)
  32. memcpy(newregs, oldregs, sizeof(*newregs));
  33. else {
  34. __asm__ __volatile__ ("mov r0, %0" : "=r" (newregs->regs[0]));
  35. __asm__ __volatile__ ("mov r1, %0" : "=r" (newregs->regs[1]));
  36. __asm__ __volatile__ ("mov r2, %0" : "=r" (newregs->regs[2]));
  37. __asm__ __volatile__ ("mov r3, %0" : "=r" (newregs->regs[3]));
  38. __asm__ __volatile__ ("mov r4, %0" : "=r" (newregs->regs[4]));
  39. __asm__ __volatile__ ("mov r5, %0" : "=r" (newregs->regs[5]));
  40. __asm__ __volatile__ ("mov r6, %0" : "=r" (newregs->regs[6]));
  41. __asm__ __volatile__ ("mov r7, %0" : "=r" (newregs->regs[7]));
  42. __asm__ __volatile__ ("mov r8, %0" : "=r" (newregs->regs[8]));
  43. __asm__ __volatile__ ("mov r9, %0" : "=r" (newregs->regs[9]));
  44. __asm__ __volatile__ ("mov r10, %0" : "=r" (newregs->regs[10]));
  45. __asm__ __volatile__ ("mov r11, %0" : "=r" (newregs->regs[11]));
  46. __asm__ __volatile__ ("mov r12, %0" : "=r" (newregs->regs[12]));
  47. __asm__ __volatile__ ("mov r13, %0" : "=r" (newregs->regs[13]));
  48. __asm__ __volatile__ ("mov r14, %0" : "=r" (newregs->regs[14]));
  49. __asm__ __volatile__ ("mov r15, %0" : "=r" (newregs->regs[15]));
  50. __asm__ __volatile__ ("sts pr, %0" : "=r" (newregs->pr));
  51. __asm__ __volatile__ ("sts macl, %0" : "=r" (newregs->macl));
  52. __asm__ __volatile__ ("sts mach, %0" : "=r" (newregs->mach));
  53. __asm__ __volatile__ ("stc gbr, %0" : "=r" (newregs->gbr));
  54. __asm__ __volatile__ ("stc sr, %0" : "=r" (newregs->sr));
  55. newregs->pc = _THIS_IP_;
  56. }
  57. }
  58. #else
  59. static inline void reserve_crashkernel(void) { }
  60. #endif /* CONFIG_KEXEC */
  61. #endif /* __ASM_SH_KEXEC_H */