Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. proc crash.crc32 _crc, _data, _len, _callback, _msglen
  2.   .begin:
  3.         mov     ecx, [_len]
  4.         test    ecx, ecx
  5.         jz      .callback
  6.         mov     eax, [_crc]
  7.         mov     eax, [eax]
  8.         mov     esi, [_data]
  9.   .head:
  10.         mov     ebx, [_data]
  11.         and     ebx, 3
  12.         jz      .body
  13.     @@:
  14.         dec     ecx
  15.         js      .done
  16.         movzx   edx, al
  17.         xor     dl, byte[esi]
  18.         add     esi, 1
  19.         shr     eax, 8
  20.         xor     eax, [crash._.crc32_table + edx*4]
  21.         dec     ebx
  22.         jnz     @b
  23.   .body:
  24.         mov     ebx, ecx
  25.         and     ecx, 15
  26.         shr     ebx, 4
  27.         test    ebx, ebx
  28.         jz      .tail
  29.     @@:
  30. repeat 4
  31.         mov     edx, eax
  32.         mov     eax, [esi]
  33.         add     esi, 4
  34.         xor     eax, edx
  35. repeat 4
  36.         movzx   edx, al
  37.         shr     eax, 8
  38.         xor     eax, [crash._.crc32_table + edx*4]
  39. end repeat
  40. end repeat
  41.         dec     ebx
  42.         jnz     @b
  43.   .tail:
  44.         test    ecx, ecx
  45.         jz      .done
  46.     @@:
  47.         movzx   edx, al
  48.         xor     dl, byte[esi]
  49.         add     esi, 1
  50.         shr     eax, 8
  51.         xor     eax, [crash._.crc32_table + edx*4]
  52.         dec     ecx
  53.         jnz     @b
  54.   .done:
  55.         mov     ecx, [_crc]
  56.         mov     [ecx], eax
  57.   .callback:
  58.         mov     eax, [_callback]
  59.         test    eax, eax
  60.         jz      @f
  61.         call    eax
  62.         mov     [_len], eax
  63.         test    eax, eax
  64.         jnz     .begin
  65.     @@:
  66.         mov     ecx, [_crc]
  67.         mov     eax, [ecx]
  68.         xor     eax, 0xffffffff
  69.         bswap   eax
  70.         mov     [ecx], eax
  71.  
  72.         ret
  73. endp
  74.