diff options
Diffstat (limited to 'dte-asm.S')
-rw-r--r-- | dte-asm.S | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/dte-asm.S b/dte-asm.S new file mode 100644 index 0000000..7fc9563 --- /dev/null +++ b/dte-asm.S @@ -0,0 +1,70 @@ +.text +.align 4 + +.global dte_reset +.type dte_reset, @function + +dte_reset: + push %ecx + push %edi + movl $0x10000, %ecx + movl $dte_counters, %edi + xorl %eax, %eax + rep stosl + movl %eax, dte_counter + movl %eax, dte_most + pop %edi + pop %ecx + ret + +.global build_dte +.type build_dte, @function + +build_dte: + push %eax + push %ebx + push %ecx + push %edx + push %esi + push %edi + movl dte_text_size, %ecx + movl dte_text, %esi + movl $dte_flags, %edi + movl $dte_counters, %ebx + + + lodsl + movl %eax, %edx + + jmp innerjump + +loop: + lodsb + shrd $8, %eax, %edx + +innerjump: + push %edx + + andl $0xffff, %edx + testb $0xff, (%edi, %edx) + jnz invalid + incl (%ebx, %edx, 4) + movl (%ebx, %edx, 4), %eax + cmpl %eax, dte_counter + ja invalid + movl %edx, dte_most + movl %eax, dte_counter + +invalid: + pop %edx + + decl %ecx + jnz loop + + pop %edi + pop %esi + pop %edx + pop %ecx + pop %ebx + pop %eax + ret |