datapage.S 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * Access to the shared data page by the vDSO & syscall map
  3. *
  4. * Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org), IBM Corp.
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the License, or (at your option) any later version.
  10. */
  11. #include <asm/processor.h>
  12. #include <asm/ppc_asm.h>
  13. #include <asm/asm-offsets.h>
  14. #include <asm/unistd.h>
  15. #include <asm/vdso.h>
  16. .text
  17. .global __kernel_datapage_offset;
  18. __kernel_datapage_offset:
  19. .long 0
  20. V_FUNCTION_BEGIN(__get_datapage)
  21. .cfi_startproc
  22. /* We don't want that exposed or overridable as we want other objects
  23. * to be able to bl directly to here
  24. */
  25. .protected __get_datapage
  26. .hidden __get_datapage
  27. mflr r0
  28. .cfi_register lr,r0
  29. bcl 20,31,data_page_branch
  30. data_page_branch:
  31. mflr r3
  32. mtlr r0
  33. addi r3, r3, __kernel_datapage_offset-data_page_branch
  34. lwz r0,0(r3)
  35. .cfi_restore lr
  36. add r3,r0,r3
  37. blr
  38. .cfi_endproc
  39. V_FUNCTION_END(__get_datapage)
  40. /*
  41. * void *__kernel_get_syscall_map(unsigned int *syscall_count) ;
  42. *
  43. * returns a pointer to the syscall map. the map is agnostic to the
  44. * size of "long", unlike kernel bitops, it stores bits from top to
  45. * bottom so that memory actually contains a linear bitmap
  46. * check for syscall N by testing bit (0x80000000 >> (N & 0x1f)) of
  47. * 32 bits int at N >> 5.
  48. */
  49. V_FUNCTION_BEGIN(__kernel_get_syscall_map)
  50. .cfi_startproc
  51. mflr r12
  52. .cfi_register lr,r12
  53. mr r4,r3
  54. bl __get_datapage@local
  55. mtlr r12
  56. addi r3,r3,CFG_SYSCALL_MAP32
  57. cmpli cr0,r4,0
  58. beqlr
  59. li r0,NR_syscalls
  60. stw r0,0(r4)
  61. crclr cr0*4+so
  62. blr
  63. .cfi_endproc
  64. V_FUNCTION_END(__kernel_get_syscall_map)
  65. /*
  66. * void unsigned long long __kernel_get_tbfreq(void);
  67. *
  68. * returns the timebase frequency in HZ
  69. */
  70. V_FUNCTION_BEGIN(__kernel_get_tbfreq)
  71. .cfi_startproc
  72. mflr r12
  73. .cfi_register lr,r12
  74. bl __get_datapage@local
  75. lwz r4,(CFG_TB_TICKS_PER_SEC + 4)(r3)
  76. lwz r3,CFG_TB_TICKS_PER_SEC(r3)
  77. mtlr r12
  78. crclr cr0*4+so
  79. blr
  80. .cfi_endproc
  81. V_FUNCTION_END(__kernel_get_tbfreq)