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 <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. V_FUNCTION_BEGIN(__get_datapage)
  18. .cfi_startproc
  19. /* We don't want that exposed or overridable as we want other objects
  20. * to be able to bl directly to here
  21. */
  22. .protected __get_datapage
  23. .hidden __get_datapage
  24. mflr r0
  25. .cfi_register lr,r0
  26. bcl 20,31,1f
  27. .global __kernel_datapage_offset;
  28. __kernel_datapage_offset:
  29. .long 0
  30. 1:
  31. mflr r3
  32. mtlr r0
  33. lwz r0,0(r3)
  34. add r3,r0,r3
  35. blr
  36. .cfi_endproc
  37. V_FUNCTION_END(__get_datapage)
  38. /*
  39. * void *__kernel_get_syscall_map(unsigned int *syscall_count) ;
  40. *
  41. * returns a pointer to the syscall map. the map is agnostic to the
  42. * size of "long", unlike kernel bitops, it stores bits from top to
  43. * bottom so that memory actually contains a linear bitmap
  44. * check for syscall N by testing bit (0x80000000 >> (N & 0x1f)) of
  45. * 32 bits int at N >> 5.
  46. */
  47. V_FUNCTION_BEGIN(__kernel_get_syscall_map)
  48. .cfi_startproc
  49. mflr r12
  50. .cfi_register lr,r12
  51. mr r4,r3
  52. bl __get_datapage@local
  53. mtlr r12
  54. addi r3,r3,CFG_SYSCALL_MAP32
  55. cmpli cr0,r4,0
  56. beqlr
  57. li r0,__NR_syscalls
  58. stw r0,0(r4)
  59. crclr cr0*4+so
  60. blr
  61. .cfi_endproc
  62. V_FUNCTION_END(__kernel_get_syscall_map)
  63. /*
  64. * void unsigned long long __kernel_get_tbfreq(void);
  65. *
  66. * returns the timebase frequency in HZ
  67. */
  68. V_FUNCTION_BEGIN(__kernel_get_tbfreq)
  69. .cfi_startproc
  70. mflr r12
  71. .cfi_register lr,r12
  72. bl __get_datapage@local
  73. lwz r4,(CFG_TB_TICKS_PER_SEC + 4)(r3)
  74. lwz r3,CFG_TB_TICKS_PER_SEC(r3)
  75. mtlr r12
  76. crclr cr0*4+so
  77. blr
  78. .cfi_endproc
  79. V_FUNCTION_END(__kernel_get_tbfreq)