Set version to 1.3.0 and update coyprights throughout.
[platform/upstream/flac.git] / src / libFLAC / ia32 / cpu_asm.nasm
index 8787240..e4475dc 100644 (file)
@@ -1,5 +1,8 @@
+;  vim:filetype=nasm ts=8
+
 ;  libFLAC - Free Lossless Audio Codec library
-;  Copyright (C) 2001,2002,2003,2004,2005,2006  Josh Coalson
+;  Copyright (C) 2001-2009  Josh Coalson
+;  Copyright (C) 2011-2013  Xiph.Org Foundation
 ;
 ;  Redistribution and use in source and binary forms, with or without
 ;  modification, are permitted provided that the following conditions
 
        data_section
 
+cglobal FLAC__cpu_have_cpuid_asm_ia32
 cglobal FLAC__cpu_info_asm_ia32
 cglobal FLAC__cpu_info_extended_amd_asm_ia32
-cglobal FLAC__cpu_info_sse_test_asm_ia32
 
        code_section
 
 ; **********************************************************************
 ;
+; FLAC__uint32 FLAC__cpu_have_cpuid_asm_ia32()
+;
 
-have_cpuid:
+cident FLAC__cpu_have_cpuid_asm_ia32
+       push    ebx
        pushfd
        pop     eax
        mov     edx, eax
@@ -57,26 +63,42 @@ have_cpuid:
 .no_cpuid:
        xor     eax, eax
 .end:
+       pop     ebx
        ret
 
+; **********************************************************************
+;
+; void FLAC__cpu_info_asm_ia32(FLAC__uint32 *flags_edx, FLAC__uint32 *flags_ecx)
+;
+
 cident FLAC__cpu_info_asm_ia32
+       ;[esp + 8] == flags_edx
+       ;[esp + 12] == flags_ecx
+
        push    ebx
-       call    have_cpuid
+       call    FLAC__cpu_have_cpuid_asm_ia32
        test    eax, eax
        jz      .no_cpuid
        mov     eax, 1
        cpuid
-       mov     eax, edx
+       mov     ebx, [esp + 8]
+       mov     [ebx], edx
+       mov     ebx, [esp + 12]
+       mov     [ebx], ecx
        jmp     .end
 .no_cpuid:
        xor     eax, eax
-.end
+       mov     ebx, [esp + 8]
+       mov     [ebx], eax
+       mov     ebx, [esp + 12]
+       mov     [ebx], eax
+.end:
        pop     ebx
        ret
 
 cident FLAC__cpu_info_extended_amd_asm_ia32
        push    ebx
-       call    have_cpuid
+       call    FLAC__cpu_have_cpuid_asm_ia32
        test    eax, eax
        jz      .no_cpuid
        mov     eax, 0x80000000
@@ -87,14 +109,10 @@ cident FLAC__cpu_info_extended_amd_asm_ia32
        cpuid
        mov     eax, edx
        jmp     .end
-.no_cpuid
+.no_cpuid:
        xor     eax, eax
-.end
+.end:
        pop     ebx
        ret
 
-cident FLAC__cpu_info_sse_test_asm_ia32
-       xorps   xmm0, xmm0
-       pop     ebx
-
 end