home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / enforcer / lawbreaker.asm < prev    next >
Assembly Source File  |  1997-07-19  |  7KB  |  191 lines

  1. ******* LawBreaker ************************************************************
  2. *
  3. *   NAME
  4. *    LawBreaker - A quicky test of Enforcer
  5. *
  6. *   SYNOPSIS
  7. *    This is a quick test of Enforcer and its reporting abilities.
  8. *
  9. *   FUNCTION
  10. *    This program is used to make sure that Enforcer is correctly
  11. *    installed and operating.  LawBreaker works from either the CLI
  12. *    or Workbench.  It will try to read and write certain memory
  13. *    areas that will cause an Enforcer hit or four.
  14. *
  15. *    LawBreaker will also do an Alert to show how Enforcer reports
  16. *    an Alert.
  17. *
  18. *    Note that the LawBreaker executable has debugging information
  19. *    in it (standard LINE format debug hunk) such that you can
  20. *    try the FindHit program to find the line that causes the hit.
  21. *
  22. *   INPUTS
  23. *    Just run it...
  24. *
  25. *   RESULTS
  26. *    When running Enforcer, you will see some output from Enforcer.
  27. *    Output on a 68030 machine would look something like this:
  28. *
  29. *25-Jul-93  17:15:04
  30. *WORD-WRITE to  00000000        data=0000       PC: 0763857C
  31. *USP:  07657C14 SR: 0004 SW: 04C1  (U0)(-)(-)  TCB: 07642F70
  32. *Data: DDDD0000 DDDD1111 DDDD2222 DDDD3333 0763852A DDDD5555 DDDD6666 DDDD7777
  33. *Addr: AAAA0000 AAAA1111 AAAA2222 AAAA3333 AAAA4444 0763852A 07400810 --------
  34. *Stck: 00000000 0752EE9A 00002800 07643994 00000000 076786D8 000208B0 2EAC80EE
  35. *Stck: 487AFD12 486C82C4 4EBA3D50 4EBAEA28 4FEF0014 52ACE2E4 204D43EC 88BC203C
  36. *----> 0763857C - "lawbreaker"  Hunk 0000 Offset 00000074
  37. *Name: "Shell"  CLI: "LawBreaker"  Hunk 0000 Offset 00000074
  38. *
  39. *25-Jul-93  17:15:04
  40. *LONG-READ from AAAA4444                        PC: 07638580
  41. *USP:  07657C14 SR: 0015 SW: 0501  (U0)(F)(-)  TCB: 07642F70
  42. *Data: DDDD0000 DDDD1111 DDDD2222 DDDD3333 0763852A DDDD5555 DDDD6666 DDDD7777
  43. *Addr: AAAA0000 AAAA1111 AAAA2222 AAAA3333 AAAA4444 0763852A 07400810 --------
  44. *Stck: 00000000 0752EE9A 00002800 07643994 00000000 076786D8 000208B0 2EAC80EE
  45. *Stck: 487AFD12 486C82C4 4EBA3D50 4EBAEA28 4FEF0014 52ACE2E4 204D43EC 88BC203C
  46. *----> 07638580 - "lawbreaker"  Hunk 0000 Offset 00000078
  47. *Name: "Shell"  CLI: "LawBreaker"  Hunk 0000 Offset 00000078
  48. *
  49. *25-Jul-93  17:15:04
  50. *BYTE-WRITE to  00000101        data=11         PC: 0763858A
  51. *USP:  07657C14 SR: 0010 SW: 04A1  (U0)(F)(D)  TCB: 07642F70
  52. *Data: 00000000 DDDD1111 DDDD2222 DDDD3333 0763852A DDDD5555 DDDD6666 DDDD7777
  53. *Addr: AAAA0000 AAAA1111 AAAA2222 AAAA3333 AAAA4444 0763852A 07400810 --------
  54. *Stck: 00000000 0752EE9A 00002800 07643994 00000000 076786D8 000208B0 2EAC80EE
  55. *Stck: 487AFD12 486C82C4 4EBA3D50 4EBAEA28 4FEF0014 52ACE2E4 204D43EC 88BC203C
  56. *----> 0763858A - "lawbreaker"  Hunk 0000 Offset 00000082
  57. *Name: "Shell"  CLI: "LawBreaker"  Hunk 0000 Offset 00000082
  58. *
  59. *25-Jul-93  17:15:04
  60. *LONG-WRITE to  00000102        data=00000000   PC: 07638592
  61. *USP:  07657C14 SR: 0014 SW: 0481  (U0)(-)(D)  TCB: 07642F70
  62. *Data: 00000000 DDDD1111 DDDD2222 DDDD3333 0763852A DDDD5555 DDDD6666 DDDD7777
  63. *Addr: AAAA0000 AAAA1111 AAAA2222 AAAA3333 AAAA4444 0763852A 07400810 --------
  64. *Stck: 00000000 0752EE9A 00002800 07643994 00000000 076786D8 000208B0 2EAC80EE
  65. *Stck: 487AFD12 486C82C4 4EBA3D50 4EBAEA28 4FEF0014 52ACE2E4 204D43EC 88BC203C
  66. *----> 07638592 - "lawbreaker"  Hunk 0000 Offset 0000008A
  67. *Name: "Shell"  CLI: "LawBreaker"  Hunk 0000 Offset 0000008A
  68. *
  69. *25-Jul-93  17:15:06
  70. *Alert !! Alert 35000000     TCB: 07642F70     USP: 07657C10
  71. *Data: 00000000 DDDD1111 DDDD2222 DDDD3333 0763852A DDDD5555 DDDD6666 35000000
  72. *Addr: AAAA0000 AAAA1111 AAAA2222 AAAA3333 AAAA4444 0763852A 07400810 --------
  73. *Stck: 076385A0 00000000 0752EE9A 00002800 07643994 00000000 0762F710 076305F0
  74. *----> 076385A0 - "lawbreaker"  Hunk 0000 Offset 00000098
  75. *
  76. *    Now, using FindHit, you would type:
  77. *
  78. *    FindHit LawBreaker 0:82
  79. *
  80. *    and it will tell you the source file name and the line number
  81. *    where the hit happened.  See the FindHit documentation.
  82. *
  83. *   NOTES
  84. *    If enforcer is not running, the program should not cause the
  85. *    system to crash.  It will, however, write to certain areas
  86. *    of low memory.  Also, it will cause read access of some
  87. *    addresses that may not exist.  This may cause bus faults.
  88. *
  89. *   SEE ALSO
  90. *    "Quantum Physics:  The Dreams that Stuff is made of." - Michael Sinz
  91. *
  92. *   BUGS
  93. *    There are 4 known Enforcer hits in this code and 1 alert, however,
  94. *    they will not be fixed.  ;^)
  95. *
  96. *******************************************************************************
  97. *
  98.         INCLUDE    "exec/types.i"
  99.         INCLUDE    "exec/execbase.i"
  100.         INCLUDE    "exec/macros.i"
  101.         INCLUDE    "exec/alerts.i"
  102.         INCLUDE    "dos/dosextens.i"
  103. *
  104. *******************************************************************************
  105. *
  106. * This turns on the HX68 (and CAPE) source line debugging information
  107. * This is required for FindHit to work in assembly files...
  108. *
  109.         DEBUG
  110. *
  111. *******************************************************************************
  112. *
  113. * The main code...
  114. *
  115. LawBreaker:    move.l    4.w,a6        ; Get ExecBase...
  116.         clr.l    -(sp)        ; Clear the message pointer...
  117.         move.l    ThisTask(a6),a4    ; Get our process pointer...
  118.         tst.l    pr_CLI(a4)    ; Are we a CLI?
  119.         bne.s    Do_Law        ; If NULL, we are a WB run program...
  120. *
  121. * Handle Workbench Startup...
  122. *
  123.         lea    pr_MsgPort(a4),a4    ; Get message port...
  124.         move.l    a4,a0        ; We first wait for the WB Startup MSG
  125.         JSRLIB    WaitPort    ; (it should be here very quickly)
  126.         move.l    a4,a0        ; Now we get the message...
  127.         JSRLIB    GetMsg        ; Get it...
  128.         move.l    d0,(sp)        ; Now, store it on the stack...
  129. *
  130. * Ok, now be nasty...
  131. *
  132. * First fill up the registers with patterns
  133. *
  134. Do_Law:        move.l    #$AAAA0000,a0
  135.         move.l    #$AAAA1111,a1
  136.         move.l    #$AAAA2222,a2
  137.         move.l    #$AAAA3333,a3
  138.         move.l    #$AAAA4444,a4
  139.         lea    Do_Law(pc),a5
  140.         move.l    #$DDDD0000,d0
  141.         move.l    #$DDDD1111,d1
  142.         move.l    #$DDDD2222,d2
  143.         move.l    #$DDDD3333,d3
  144.         move.l    a5,d4
  145.         move.l    #$DDDD5555,d5
  146.         move.l    #$DDDD6666,d6
  147.         move.l    #$DDDD7777,d7
  148. *
  149.         move.w    d0,$0000    ; Ping location 0 (to 0)
  150.         JSRLIB    Forbid
  151.         move.l    (a4),d0        ; Ping another spot
  152.         JSRLIB    Disable
  153.         move.b    d1,$0101    ; Ping one more...
  154.         JSRLIB    Permit
  155.         move.l    d0,$0102    ; One last one...
  156.         JSRLIB    Enable
  157. *
  158. * Now do an Alert just to show what would happen:
  159. *
  160.         move.l    #AN_Unknown,d7    ; An unknown alert...
  161.         JSRLIB    Alert        ; Display it...
  162. *
  163. * Ok, so now we quit...
  164. *
  165.         move.l    (sp)+,d0    ; Get message...
  166.         beq.s    Done        ; If we have one, do WB exit...
  167. *
  168. * We have a Workbench message, so reply it...
  169. *
  170.         JSRLIB    Forbid        ; We need to FORBID for a bit...
  171.         move.l    d0,a1        ; Get message into register
  172.         JSRLIB    ReplyMsg    ; Reply the workbench message...
  173. *
  174. Done:        rts            ; Return with NULL...
  175. *
  176. *******************************************************************************
  177. *
  178. * The version string...
  179. *
  180.         INCLUDE    "lawbreaker_rev.i"
  181.         VERSTAG
  182. *
  183. *******************************************************************************
  184. *
  185. * "A master's secrets are only as good as the
  186. *  master's ability to explain them to others."  -  Michael Sinz
  187. *
  188. *******************************************************************************
  189. *
  190.         END
  191.