_preos_program_stub.s 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. | Copyright (C) 2002-2003 Sebastian Reichelt.
  2. | Copyright (C) 2003 Kevin Kofler.
  3. | See License.txt for licensing conditions.
  4. | PreOs ("Kernel v6") Program Stub
  5. | This belongs to the kernel headers.
  6. .xdef __preos_program_stub,__no_kernel_msg,__kernel_too_old_msg
  7. .section _stl11
  8. | This is the kernel program stub starting point.
  9. __preos_program_stub:
  10. | Test the data at 0x34, which is nonzero if a kernel has been
  11. | installed.
  12. move.l 0x34,%d0
  13. | No kernel: Display failure message.
  14. jbeq .L__disp_no_kernel_msg
  15. | If the sign bit is not set, the kernel is too old: Display failure message.
  16. jbgt .L__disp_kernel_too_old_msg
  17. | We have a kernel. Move the location of the kernel launcher
  18. | (stored in memory location 0x34) to %a0.
  19. move.l %d0,%a0
  20. | Call the kernel launcher.
  21. jmp (%a0)
  22. | This routine is not a normal function: It returns from the entire program.
  23. .L__disp_msg:
  24. | Get the address of the jump table in %a0.
  25. move.l 0xC8,%a0
  26. | Get the address of ST_helpMsg in %a0.
  27. move.l (%a0,0xE6*4),%a0 /* ST_helpMsg */
  28. | Call ST_helpMsg.
  29. jsr (%a0)
  30. | Clean up the stack.
  31. | Remove the last return address as well
  32. | (from the bsr.w at the beginning of the program).
  33. addq.w #8,%sp
  34. | Return from the entire program.
  35. rts
  36. | This routine displays the "Kernel required" message in the status line.
  37. .L__disp_no_kernel_msg:
  38. | This does two things:
  39. | 1. Put the address of __no_kernel_msg on the stack.
  40. | 2. Jump to .L__disp_msg.
  41. | Note that it will not return normally, but remove even four more bytes from
  42. | the stack.
  43. jbsr .L__disp_msg
  44. __no_kernel_msg:
  45. .asciz "Kernel required"
  46. .even
  47. | This routine displays the "Kernel too old" message in the status line.
  48. .L__disp_kernel_too_old_msg:
  49. | This does two things:
  50. | 1. Put the address of __no_kernel_msg on the stack.
  51. | 2. Jump to .L__disp_msg.
  52. | Note that it will not return normally, but remove even four more bytes from
  53. | the stack.
  54. jbsr .L__disp_msg
  55. __kernel_too_old_msg:
  56. .asciz "Kernel too old"
  57. .even