initcode 779 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #include "/sys/src/libc/9syscall/sys.h"
  2. /*
  3. * we pass in the argument of the exec parameters as 0(FP)
  4. */
  5. TEXT main(SB),$16
  6. MOVQ $setSB(SB), R29
  7. MOVQ $boot(SB), R0
  8. ADDQ $24, R30, R1 /* get a pointer to 0(FP) */
  9. MOVL R0, 8(R30)
  10. MOVL R1, 12(R30)
  11. JSR exec(SB)
  12. MOVQ $(1<<4), R0
  13. MOVL R0, 8(R30)
  14. MOVQ $RFORK, R0
  15. CALL_PAL $0x83
  16. MOVQ $RFORK, R0
  17. CALL_PAL $0x83
  18. MOVQ $RFORK, R0
  19. CALL_PAL $0x83
  20. again:
  21. ADDL $1, R1
  22. MOVQ $0, R0 /* print r1 */
  23. CALL_PAL $0x83
  24. MOVQ $100000000, R2
  25. foo:
  26. SUBQ $1, R2
  27. BNE R2, foo
  28. MOVQ $1000, R0
  29. MOVL R0, 8(R30)
  30. MOVQ $SLEEP, R0
  31. CALL_PAL $0x83
  32. JMP again
  33. TEXT exec(SB), $0
  34. MOVQ $EXEC, R0
  35. CALL_PAL $0x83
  36. RET
  37. DATA boot+0(SB)/5,$"/boot"
  38. DATA boot+5(SB)/5,$"/boot"
  39. DATA bootv+0(SB)/4,$boot+6(SB)
  40. GLOBL boot+0(SB),$11
  41. GLOBL bootv+0(SB),$8