| 1 | ; $Id: regfunc.asm,v 1.3 2000-01-31 22:31:25 sandervl Exp $ | 
|---|
| 2 |  | 
|---|
| 3 | ;/* | 
|---|
| 4 | ; * register functions in NTDLL | 
|---|
| 5 | ; * | 
|---|
| 6 | ; * Copyright 1999 Patrick Haller | 
|---|
| 7 | ; * | 
|---|
| 8 | ; * | 
|---|
| 9 | ; * Project Odin Software License can be found in LICENSE.TXT | 
|---|
| 10 | ; * | 
|---|
| 11 | ; */ | 
|---|
| 12 | .586P | 
|---|
| 13 | NAME    regfunc | 
|---|
| 14 |  | 
|---|
| 15 | CODE32         SEGMENT DWORD PUBLIC USE32 'CODE' | 
|---|
| 16 | align 4 | 
|---|
| 17 |  | 
|---|
| 18 | ; ---------------------------------------------------------------------------- | 
|---|
| 19 |  | 
|---|
| 20 | public  _chkstk | 
|---|
| 21 | public  _alloca_probe; _alloca_probe seems to be the same as _chkstk | 
|---|
| 22 | public  DbgBreakPoint | 
|---|
| 23 |  | 
|---|
| 24 |  | 
|---|
| 25 | ; ---------------------------------------------------------------------------- | 
|---|
| 26 |  | 
|---|
| 27 |  | 
|---|
| 28 | ; ---------------------------------------------------------------------------- | 
|---|
| 29 |  | 
|---|
| 30 |  | 
|---|
| 31 | ; ---------------------------------------------------------------------------- | 
|---|
| 32 | ; Name      : _chkstk | 
|---|
| 33 | ; Purpose   : | 
|---|
| 34 | ; Parameters: | 
|---|
| 35 | ; Variables : | 
|---|
| 36 | ; Result    : | 
|---|
| 37 | ; Remark    : | 
|---|
| 38 | ; Status    : VERIFIED | 
|---|
| 39 | ; | 
|---|
| 40 | ; Author    : Patrick Haller [Mon, 1999/11/08 23:44] | 
|---|
| 41 | ; ---------------------------------------------------------------------------- | 
|---|
| 42 | _chkstk proc near | 
|---|
| 43 |  | 
|---|
| 44 | arg_0          = byte ptr  8 | 
|---|
| 45 |  | 
|---|
| 46 | push    ecx             ; _alloca_probe | 
|---|
| 47 | cmp     eax, 1000h | 
|---|
| 48 | lea     ecx, [esp+arg_0] | 
|---|
| 49 | jb      short _chkstk_1 | 
|---|
| 50 |  | 
|---|
| 51 | _chkstk_2: | 
|---|
| 52 | sub     ecx, 1000h | 
|---|
| 53 | sub     eax, 1000h | 
|---|
| 54 | test    [ecx], eax | 
|---|
| 55 | cmp     eax, 1000h | 
|---|
| 56 | jnb     short _chkstk_2 | 
|---|
| 57 |  | 
|---|
| 58 | _chkstk_1: | 
|---|
| 59 | sub     ecx, eax | 
|---|
| 60 | mov     eax, esp | 
|---|
| 61 | test    [ecx], eax | 
|---|
| 62 | mov     esp, ecx | 
|---|
| 63 | mov     ecx, [eax] | 
|---|
| 64 | mov     eax, [eax+4] | 
|---|
| 65 | push    eax | 
|---|
| 66 | retn | 
|---|
| 67 | _chkstk        endp | 
|---|
| 68 |  | 
|---|
| 69 |  | 
|---|
| 70 | ; ---------------------------------------------------------------------------- | 
|---|
| 71 | ; Name      : _alloca_probe | 
|---|
| 72 | ; Purpose   : | 
|---|
| 73 | ; Parameters: | 
|---|
| 74 | ; Variables : | 
|---|
| 75 | ; Result    : | 
|---|
| 76 | ; Remark    : | 
|---|
| 77 | ; Status    : VERIFIED | 
|---|
| 78 | ; | 
|---|
| 79 | ; Author    : Patrick Haller [Mon, 1999/11/08 23:44] | 
|---|
| 80 | ; ---------------------------------------------------------------------------- | 
|---|
| 81 | _alloca_probe proc near | 
|---|
| 82 |  | 
|---|
| 83 | arg_0          = byte ptr  8 | 
|---|
| 84 |  | 
|---|
| 85 | push    ecx             ; _alloca_probe | 
|---|
| 86 | cmp     eax, 1000h | 
|---|
| 87 | lea     ecx, [esp+arg_0] | 
|---|
| 88 | jb      short _alloca_probe_1 | 
|---|
| 89 |  | 
|---|
| 90 | _alloca_probe_2: | 
|---|
| 91 | sub     ecx, 1000h | 
|---|
| 92 | sub     eax, 1000h | 
|---|
| 93 | test    [ecx], eax | 
|---|
| 94 | cmp     eax, 1000h | 
|---|
| 95 | jnb     short _alloca_probe_2 | 
|---|
| 96 |  | 
|---|
| 97 | _alloca_probe_1: | 
|---|
| 98 | sub     ecx, eax | 
|---|
| 99 | mov     eax, esp | 
|---|
| 100 | test    [ecx], eax | 
|---|
| 101 | mov     esp, ecx | 
|---|
| 102 | mov     ecx, [eax] | 
|---|
| 103 | mov     eax, [eax+4] | 
|---|
| 104 | push    eax | 
|---|
| 105 | retn | 
|---|
| 106 | _alloca_probe  endp | 
|---|
| 107 |  | 
|---|
| 108 |  | 
|---|
| 109 | ; ---------------------------------------------------------------------------- | 
|---|
| 110 | ; Name      : DbgBreakPoint | 
|---|
| 111 | ; Purpose   : | 
|---|
| 112 | ; Parameters: | 
|---|
| 113 | ; Variables : | 
|---|
| 114 | ; Result    : | 
|---|
| 115 | ; Remark    : NTDLL.20 | 
|---|
| 116 | ; Status    : VERIFIED | 
|---|
| 117 | ; | 
|---|
| 118 | ; Author    : Patrick Haller [Mon, 1999/11/08 23:44] | 
|---|
| 119 | ; ---------------------------------------------------------------------------- | 
|---|
| 120 | DbgBreakPoint  proc near | 
|---|
| 121 | int     3               ; Trap to Debugger | 
|---|
| 122 | retn | 
|---|
| 123 | DbgBreakPoint  endp | 
|---|
| 124 |  | 
|---|
| 125 |  | 
|---|
| 126 | ; ---------------------------------------------------------------------------- | 
|---|
| 127 | ; Name      : DbgUserBreakPoint | 
|---|
| 128 | ; Purpose   : | 
|---|
| 129 | ; Parameters: | 
|---|
| 130 | ; Variables : | 
|---|
| 131 | ; Result    : | 
|---|
| 132 | ; Remark    : NTDLL.28 | 
|---|
| 133 | ; Status    : VERIFIED | 
|---|
| 134 | ; | 
|---|
| 135 | ; Author    : Patrick Haller [Mon, 1999/11/08 23:44] | 
|---|
| 136 | ; ---------------------------------------------------------------------------- | 
|---|
| 137 | DbgUserBreakPoint proc near | 
|---|
| 138 | int     3               ; Trap to Debugger | 
|---|
| 139 | retn | 
|---|
| 140 | DbgUserBreakPoint endp | 
|---|
| 141 |  | 
|---|
| 142 |  | 
|---|
| 143 | ; ---------------------------------------------------------------------------- | 
|---|
| 144 | CODE32          ENDS | 
|---|
| 145 |  | 
|---|
| 146 | END | 
|---|