datapage.S 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 <linux/config.h>
  12. #include <asm/processor.h>
  13. #include <asm/ppc_asm.h>
  14. #include <asm/asm-offsets.h>
  15. #include <asm/unistd.h>
  16. #include <asm/vdso.h>
  17. .text
  18. V_FUNCTION_BEGIN(__get_datapage)
  19. .cfi_startproc
  20. /* We don't want that exposed or overridable as we want other objects
  21. * to be able to bl directly to here
  22. */
  23. .protected __get_datapage
  24. .hidden __get_datapage
  25. mflr r0
  26. .cfi_register lr,r0
  27. bcl 20,31,1f
  28. .global __kernel_datapage_offset;
  29. __kernel_datapage_offset:
  30. .long 0
  31. 1:
  32. mflr r3
  33. mtlr r0
  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)