Skip to content

Latest commit

 

History

History
1431 lines (912 loc) · 24 KB

codescan.md

File metadata and controls

1431 lines (912 loc) · 24 KB

amx_assembly codescan

AMX Assembly Library: Compiled code scanning and pattern matching.

Enums

CodeScanMatcher:

Members

  • CodeScanMatcher_func = 0
  • CodeScanMatcher_user_data = 1
  • CodeScanMatcher_type = 2
  • CodeScanMatcher_code = 66
  • CodeScanMatcher_len = 130
  • CodeScanMatcher_offset = 131
  • CodeScanMatcher_start = 133
  • CodeScanMatcher_holeidx = 135
  • CodeScanMatcher_holes = 137
  • CodeScanMatcher_next = 169
  • CodeScanMatcher_flags = 170

CodeScanner:

Members

  • CodeScanMatch_func = 0
  • CodeScanMatch_size = 1
  • CodeScanMatch_type = 2
  • CodeScanMatch_heap = 3
  • CodeScanMatch_stack = 4
  • CodeScanMatch_params = 5
  • CodeScanMatch_cip = 6
  • CodeScanMatch_holes = 7
  • CodeScanMatch_hole_count = 23
  • CodeScanMatch_name = 24
  • CodeScanner_first = 40
  • CodeScanner_minn = 41
  • CodeScanner_jump_switch = 42
  • CodeScanner_jump_target = 74
  • CodeScanner_jump_stack = 106
  • CodeScanner_jump_heap = 138
  • CodeScanner_state = 170
  • CodeScanner_param = 171

Variables

gBase:

gCodBase:

gCodeScanCallback_match:

gDat:

gFakeMatcher:

gHdr:

gOP_CASETBL:

gOP_NOP:

gRelocateRequired:

Tag

bool:

Functions

CodeScanAddJumpTarget:

Syntax

CodeScanAddJumpTarget(cip, target, stk, hea, jumpTargets[], num)

Parameters

Name Info
cip
target
stk
hea
jumpTargets [172]
num

Depends on

Estimated stack usage

4 cells

CodeScanAddMatcher:

Syntax

CodeScanAddMatcher(scanner[], searcher[])

Parameters

Name Info
scanner [172]
searcher [171]

Depends on

Estimated stack usage

4 cells

CodeScanAddSwitchTarget:

Syntax

CodeScanAddSwitchTarget(cip, stk, hea, jumpTargets[], num)

Parameters

Name Info
cip
stk
hea
jumpTargets [172]
num

Depends on

Estimated stack usage

8 cells

CodeScanCheck:

Syntax

CodeScanCheck(op, dctx[], cs[], matcher__, fctx[], &next)

Parameters

Name Info
op Opcode
dctx [5]
cs [171]
matcher__
fctx [172]
next &

Tag

bool:

Depends on

Estimated stack usage

13 cells

CodeScanCheckJumpTarget:

Syntax

CodeScanCheckJumpTarget(cip, deloc, &stk, &hea, jumpTargets[], num)

Parameters

Name Info
cip
deloc
stk &
hea &
jumpTargets [172]
num

Tag

bool:

Depends on

Estimated stack usage

4 cells

CodeScanClone:

Syntax

CodeScanClone(dest[], src[])

Parameters

Name Info
dest [172]
src [172]

Depends on

Estimated stack usage

1 cells

CodeScanFindOneFastPattern2:

Syntax

CodeScanFindOneFastPattern2(matcher[], matcher__, &addr)

Parameters

Name Info
matcher [171]
matcher__
addr &

Tag

bool:

Depends on

Estimated stack usage

10 cells

CodeScanFindOneFastPattern3:

Syntax

CodeScanFindOneFastPattern3(matcher[], matcher__, addr, &cur)

Parameters

Name Info
matcher [171]
matcher__
addr
cur &

Tag

bool:

Depends on

Estimated stack usage

3 cells

CodeScanGetFuncName:

Syntax

CodeScanGetFuncName(addr, name[])

Parameters

Name Info
addr
name []

Tag

bool:

Depends on

Estimated stack usage

7 cells

CodeScanGetFunctionAsm:

Syntax

CodeScanGetFunctionAsm(csm[], ctx[], offset)

Parameters

Name Info
csm [172]
ctx [21]
offset

Depends on

Estimated stack usage

6 cells

CodeScanGetFunctionDisasm:

Syntax

CodeScanGetFunctionDisasm(csm[], ctx[], offset)

Parameters

Name Info
csm [172]
ctx [5]
offset

Depends on

Estimated stack usage

1 cells

CodeScanGetFunctionScanner:

Syntax

CodeScanGetFunctionScanner(csm[], ret[], ctx[])

Parameters

Name Info
csm [172]
ret [172]
ctx [5]

Depends on

Estimated stack usage

4 cells

CodeScanGetHoleCount:

Syntax

CodeScanGetHoleCount(csm[])

Parameters

Name Info
csm [172]

Depends on

Estimated stack usage

1 cells

CodeScanGetMatchAddress:

Syntax

CodeScanGetMatchAddress(csm[])

Parameters

Name Info
csm [172]

Depends on

Estimated stack usage

1 cells

CodeScanGetMatchAddressData:

Syntax

CodeScanGetMatchAddressData(csm[])

Parameters

Name Info
csm [172]

Depends on

Estimated stack usage

1 cells

CodeScanGetMatchAsm:

Syntax

CodeScanGetMatchAsm(csm[], ctx[], offset)

Parameters

Name Info
csm [172]
ctx [21]
offset

Depends on

Estimated stack usage

6 cells

CodeScanGetMatchDisasm:

Syntax

CodeScanGetMatchDisasm(csm[], ctx[], offset)

Parameters

Name Info
csm [172]
ctx [5]
offset

Depends on

Estimated stack usage

1 cells

CodeScanGetMatchFunc:

Syntax

CodeScanGetMatchFunc(csm[])

Parameters

Name Info
csm [172]

Depends on

Estimated stack usage

1 cells

CodeScanGetMatchFuncData:

Syntax

CodeScanGetMatchFuncData(csm[])

Parameters

Name Info
csm [172]

Depends on

Estimated stack usage

1 cells

CodeScanGetMatchHeap:

Syntax

CodeScanGetMatchHeap(csm[])

Parameters

Name Info
csm [172]

Depends on

Estimated stack usage

1 cells

CodeScanGetMatchHole:

Syntax

CodeScanGetMatchHole(csm[], idx)

Parameters

Name Info
csm [172]
idx

Depends on

Estimated stack usage

1 cells

CodeScanGetMatchLength:

Syntax

CodeScanGetMatchLength(csm[])

Parameters

Name Info
csm [172]

Depends on

Estimated stack usage

1 cells

CodeScanGetMatchName:

Syntax

CodeScanGetMatchName(csm[], name[])

Parameters

Name Info
csm [172]
name []

Depends on

Estimated stack usage

5 cells

CodeScanGetMatchScanner:

Syntax

CodeScanGetMatchScanner(csm[], ret[], ctx[], accurate)

Parameters

Name Info
csm [172]
ret [172]
ctx [5]
accurate bool

Depends on

Estimated stack usage

8 cells

CodeScanGetMatchStack:

Syntax

CodeScanGetMatchStack(csm[])

Parameters

Name Info
csm [172]

Depends on

Estimated stack usage

1 cells

CodeScanGetMatchType:

Syntax

CodeScanGetMatchType(csm[])

Parameters

Name Info
csm [172]

Depends on

Estimated stack usage

5 cells

CodeScanInit:

Syntax

CodeScanInit(scanner[])

Parameters

Name Info
scanner [172]

Depends on

Estimated stack usage

5 cells

CodeScanMatcherData:

Syntax

CodeScanMatcherData(searcher[], val)

Parameters

Name Info
searcher [171]
val

Depends on

Estimated stack usage

1 cells

CodeScanMatcherInit_:

Syntax

CodeScanMatcherInit_(searcher[], address, flags)

Parameters

Name Info
searcher [171]
address
flags

Depends on

Estimated stack usage

4 cells

CodeScanMatcherPattern_:

Syntax

CodeScanMatcherPattern_(searcher[], ...)

Parameters

Name Info
searcher [171]
... {Opcode,Float,_}

Depends on

Estimated stack usage

11 cells

CodeScanNOPMatch:

Syntax

CodeScanNOPMatch(csm[])

Parameters

Name Info
csm [172]

Depends on

Estimated stack usage

3 cells

CodeScanReset:

Syntax

CodeScanReset(cs[], matcher__, &next)

Parameters

Name Info
cs [171]
matcher__
next &

Depends on

Estimated stack usage

1 cells

CodeScanResetJumpTargets:

Syntax

CodeScanResetJumpTargets(jumpTargets[], num)

Parameters

Name Info
jumpTargets [172]
num

Depends on

Estimated stack usage

1 cells

CodeScanRun:

Syntax

CodeScanRun(csState[])

Parameters

Name Info
csState [172]

Tag

bool:

Depends on

Estimated stack usage

18 cells

CodeScanRunFast:

Syntax

CodeScanRunFast(csState[], searchFuncAddr)

Parameters

Name Info
csState [172]
searchFuncAddr

Tag

bool:

Depends on

Estimated stack usage

21 cells

CodeScanRunFastPrescanLocated:

Syntax

CodeScanRunFastPrescanLocated(&proc, &nextaddr, searchFuncAddr)

Parameters

Name Info
proc &
nextaddr &
searchFuncAddr

Depends on

Estimated stack usage

3 cells

CodeScanRunFastPrescanRelocate:

Syntax

CodeScanRunFastPrescanRelocate(&proc, &nextaddr, searchFuncAddr)

Parameters

Name Info
proc &
nextaddr &
searchFuncAddr

Depends on

Estimated stack usage

6 cells

CodeScanStep:

Syntax

CodeScanStep(dctx[], csState[])

Parameters

Name Info
dctx [5]
csState [172]

Tag

bool:

Depends on

Estimated stack usage

8 cells

CodeScanStepInternal:

Syntax

CodeScanStepInternal(dctx[], csState[], &parseState, &parseParam)

Parameters

Name Info
dctx [5]
csState [172]
parseState &
parseParam &

Tag

bool:

Depends on

Estimated stack usage

13 cells