about summary refs log tree commit diff stats
path: root/318debug-counter.subx
blob: 74e1f4f84acc6994eb7efab8a055372ae085bfe7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# A rudimentary counter that can be called from anywhere.

== code

count-event:
    # . prologue
    55/push-ebp
    89/<- %ebp 4/r32/esp
    #
    ff 0/subop/increment *Foo
$count-event:end:
    # . epilogue
    89/<- %esp 5/r32/ebp
    5d/pop-to-ebp
    c3/return

count-of-events:  # -> _/eax: int
    # . prologue
    55/push-ebp
    89/<- %ebp 4/r32/esp
    #
    8b/-> *Foo 0/r32/eax
$count-of-events:end:
    # . epilogue
    89/<- %esp 5/r32/ebp
    5d/pop-to-ebp
    c3/return

== data
Foo:
  0/imm32