summaryrefslogtreecommitdiff
path: root/src/libFLAC/ia32
diff options
context:
space:
mode:
authorErik de Castro Lopo <erikd@mega-nerd.com>2017-02-27 20:35:21 +1100
committerErik de Castro Lopo <erikd@mega-nerd.com>2017-02-27 20:41:25 +1100
commit61e7dfa8bbdfdd3ad447d9fb8c21b769cc96ca25 (patch)
tree54883f8875bdeb3a524f919d4d6ad89c601b3eea /src/libFLAC/ia32
parent172146bd8a99bf2e695e580c7649182b95cba562 (diff)
downloadflac-61e7dfa8bbdfdd3ad447d9fb8c21b769cc96ca25.tar.gz
cpu.c: Merge ia32 and x86_64 CPU info functions
After the removal of the OS SSE detection stuff ia32_cpu_info() and x86_64_cpu_info() became very similar. Merging them makes sense. Patch-from: lvqcl <lvqcl.mail@gmail.com>
Diffstat (limited to 'src/libFLAC/ia32')
-rw-r--r--src/libFLAC/ia32/cpu_asm.nasm42
1 files changed, 31 insertions, 11 deletions
diff --git a/src/libFLAC/ia32/cpu_asm.nasm b/src/libFLAC/ia32/cpu_asm.nasm
index 31baa0a8..dc031d52 100644
--- a/src/libFLAC/ia32/cpu_asm.nasm
+++ b/src/libFLAC/ia32/cpu_asm.nasm
@@ -61,37 +61,57 @@ cident FLAC__cpu_have_cpuid_asm_ia32
popfd
ret
+
; **********************************************************************
;
-; void FLAC__cpu_info_asm_ia32(FLAC__uint32 *flags_edx, FLAC__uint32 *flags_ecx)
+; void FLAC__cpu_info_asm_ia32(FLAC__uint32 level, FLAC__uint32 *eax, FLAC__uint32 *ebx, FLAC__uint32 *ecx, FLAC__uint32 *edx)
;
cident FLAC__cpu_info_asm_ia32
- ;[esp + 8] == flags_edx
- ;[esp + 12] == flags_ecx
+ ;[esp + 8] == level
+ ;[esp + 12] == flags_eax
+ ;[esp + 16] == flags_ebx
+ ;[esp + 20] == flags_ecx
+ ;[esp + 24] == flags_edx
push ebx
call FLAC__cpu_have_cpuid_asm_ia32
test eax, eax
jz .no_cpuid
- mov eax, 0
+
+ mov eax, [esp + 8]
+ and eax, 0x80000000
cpuid
- cmp eax, 1
+ cmp eax, [esp + 8]
jb .no_cpuid
xor ecx, ecx
- mov eax, 1
+ mov eax, [esp + 8]
cpuid
- mov ebx, [esp + 8]
- mov [ebx], edx
- mov ebx, [esp + 12]
+
+ push ebx
+ ;[esp + 16] == flags_eax
+ mov ebx, [esp + 16]
+ mov [ebx], eax
+ pop eax
+ ;[esp + 16] == flags_ebx
+ mov ebx, [esp + 16]
+ mov [ebx], eax
+ mov ebx, [esp + 20]
mov [ebx], ecx
+ mov ebx, [esp + 24]
+ mov [ebx], edx
jmp .end
+
.no_cpuid:
xor eax, eax
- mov ebx, [esp + 8]
- mov [ebx], eax
mov ebx, [esp + 12]
mov [ebx], eax
+ mov ebx, [esp + 16]
+ mov [ebx], eax
+ mov ebx, [esp + 20]
+ mov [ebx], eax
+ mov ebx, [esp + 24]
+ mov [ebx], eax
.end:
pop ebx
ret