proc-fns.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * Based on arch/arm/include/asm/proc-fns.h
  3. *
  4. * Copyright (C) 1997-1999 Russell King
  5. * Copyright (C) 2000 Deep Blue Solutions Ltd
  6. * Copyright (C) 2012 ARM Ltd.
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. #ifndef __ASM_PROCFNS_H
  21. #define __ASM_PROCFNS_H
  22. #ifdef __KERNEL__
  23. #ifndef __ASSEMBLY__
  24. #include <asm/page.h>
  25. struct mm_struct;
  26. extern void cpu_cache_off(void);
  27. extern void cpu_do_idle(void);
  28. extern void cpu_do_switch_mm(unsigned long pgd_phys, struct mm_struct *mm);
  29. extern void cpu_reset(unsigned long addr) __attribute__((noreturn));
  30. #include <asm/memory.h>
  31. #define cpu_switch_mm(pgd,mm) cpu_do_switch_mm(virt_to_phys(pgd),mm)
  32. #define cpu_get_pgd() \
  33. ({ \
  34. unsigned long pg; \
  35. asm("mrs %0, ttbr0_el1\n" \
  36. : "=r" (pg)); \
  37. pg &= ~0xffff000000003ffful; \
  38. (pgd_t *)phys_to_virt(pg); \
  39. })
  40. #endif /* __ASSEMBLY__ */
  41. #endif /* __KERNEL__ */
  42. #endif /* __ASM_PROCFNS_H */