home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / Amiga / Workbench / Patches / enforcer.lha / LawBreaker.asm < prev    next >
Assembly Source File  |  1998-04-11  |  8KB  |  209 lines

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