syscall.S 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. #include <ppc_asm.tmpl>
  2. #include <ppc_defs.h>
  3. #include <syscall.h>
  4. #ifdef CONFIG_ARM /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
  5. #warning ARM version not implemented yet /* XXXXXXXXXXXXXXXXXXXXXXXXXXXX */
  6. .global mon_getc
  7. .type mon_getc,function
  8. mon_getc:
  9. .global mon_tstc
  10. .type mon_tstc,function
  11. mon_tstc:
  12. .global mon_putc
  13. .type mon_putc,function
  14. mon_putc:
  15. .global mon_puts
  16. .type mon_puts,function
  17. mon_puts:
  18. .global mon_printf
  19. .type mon_printf,function
  20. mon_printf:
  21. .global mon_install_hdlr
  22. .type mon_install_hdlr,function
  23. mon_install_hdlr:
  24. .global mon_free_hdlr
  25. .type mon_free_hdlr,function
  26. mon_free_hdlr:
  27. .global mon_malloc
  28. .type mon_malloc,function
  29. mon_malloc:
  30. .global mon_free
  31. .type mon_free,function
  32. mon_free:
  33. @ args = 0, pretend = 0, frame = 0
  34. @ frame_needed = 1, current_function_anonymous_args = 0
  35. mov ip, sp
  36. stmfd sp!, {fp, ip, lr, pc}
  37. sub fp, ip, #4
  38. ldmea fp, {fp, sp, pc}
  39. #elif defined(CONFIG_MIPS)/* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
  40. #warning MIPS version not implemented yet
  41. .global mon_getc
  42. .type mon_getc,function
  43. mon_getc:
  44. .global mon_tstc
  45. .type mon_tstc,function
  46. mon_tstc:
  47. .global mon_putc
  48. .type mon_putc,function
  49. mon_putc:
  50. .global mon_puts
  51. .type mon_puts,function
  52. mon_puts:
  53. .global mon_printf
  54. .type mon_printf,function
  55. mon_printf:
  56. .global mon_install_hdlr
  57. .type mon_install_hdlr,function
  58. mon_install_hdlr:
  59. .global mon_free_hdlr
  60. .type mon_free_hdlr,function
  61. mon_free_hdlr:
  62. .global mon_malloc
  63. .type mon_malloc,function
  64. mon_malloc:
  65. .global mon_free
  66. .type mon_free,function
  67. mon_free:
  68. #else
  69. #ifdef CONFIG_I386 /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
  70. #define SYMBOL_NAME(X) X
  71. #define SYMBOL_NAME_LABEL(X) X##:
  72. #define SYSCALL(name,n) \
  73. .globl SYMBOL_NAME(name) ; \
  74. SYMBOL_NAME_LABEL(name) ; \
  75. movl $n, %eax ;\
  76. pushl %ebx; \
  77. pushl %ecx; \
  78. int $0x40 ;\
  79. #endif /* CONFIG_I386 */
  80. #ifdef CONFIG_PPC
  81. #define SYSCALL(name,n) \
  82. .globl name ; \
  83. name: ; \
  84. li r0,n ; \
  85. sc ; \
  86. blr
  87. #endif /* CONFIG_PPC */
  88. .text
  89. /*
  90. * Make sure these functions are in the same order as they
  91. * appear in the "include/syscall.h" header file !!!
  92. */
  93. SYSCALL(mon_getc,SYSCALL_GETC)
  94. SYSCALL(mon_tstc,SYSCALL_TSTC)
  95. SYSCALL(mon_putc,SYSCALL_PUTC)
  96. SYSCALL(mon_puts,SYSCALL_PUTS)
  97. SYSCALL(mon_printf,SYSCALL_PRINTF)
  98. SYSCALL(mon_install_hdlr,SYSCALL_INSTALL_HDLR)
  99. SYSCALL(mon_free_hdlr,SYSCALL_FREE_HDLR)
  100. SYSCALL(mon_malloc,SYSCALL_MALLOC)
  101. SYSCALL(mon_free,SYSCALL_FREE)
  102. SYSCALL(mon_udelay,SYSCALL_UDELAY)
  103. SYSCALL(mon_get_timer,SYSCALL_GET_TIMER)
  104. #endif /* CONFIG_ARM XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */