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. add r3,r0,r3
  36. blr
  37. .cfi_endproc
  38. V_FUNCTION_END(__get_datapage)
  39. /*
  40. * void *__kernel_get_syscall_map(unsigned int *syscall_count) ;
  41. *
  42. * returns a pointer to the syscall map. the map is agnostic to the
  43. * size of "long", unlike kernel bitops, it stores bits from top to
  44. * bottom so that memory actually contains a linear bitmap
  45. * check for syscall N by testing bit (0x80000000 >> (N & 0x1f)) of
  46. * 32 bits int at N >> 5.
  47. */
  48. V_FUNCTION_BEGIN(__kernel_get_syscall_map)
  49. .cfi_startproc
  50. mflr r12
  51. .cfi_register lr,r12
  52. mr r4,r3
  53. bl __get_datapage@local
  54. mtlr r12
  55. addi r3,r3,CFG_SYSCALL_MAP32
  56. cmpli cr0,r4,0
  57. beqlr
  58. li r0,NR_syscalls
  59. stw r0,0(r4)
  60. crclr cr0*4+so
  61. blr
  62. .cfi_endproc
  63. V_FUNCTION_END(__kernel_get_syscall_map)
  64. /*
  65. * void unsigned long long __kernel_get_tbfreq(void);
  66. *
  67. * returns the timebase frequency in HZ
  68. */
  69. V_FUNCTION_BEGIN(__kernel_get_tbfreq)
  70. .cfi_startproc
  71. mflr r12
  72. .cfi_register lr,r12
  73. bl __get_datapage@local
  74. lwz r4,(CFG_TB_TICKS_PER_SEC + 4)(r3)
  75. lwz r3,CFG_TB_TICKS_PER_SEC(r3)
  76. mtlr r12
  77. crclr cr0*4+so
  78. blr
  79. .cfi_endproc
  80. V_FUNCTION_END(__kernel_get_tbfreq)