Mercurial > sdl-ios-xcode
annotate src/hermes/x86_main.asm @ 1626:a80e1e0880b8
Fixed bug #176
[I'm fixing this for the public headers, but I'm not going to bother for the SDL library code (yet)]
To clarify: Normaly, GCC (or, to be precise, the preprocessor) will ignore
this, and compile the code happily. However, one can specify -Wundef to get a
warning about this.
One can probably argue whether to consider this a bug or not; but I think that
(a) from a semantic point of view, using "#if FOO" when FOO is not defined is
strange, and (b) since it is possible to trigger a warning about this, and a
trivial fix exists, it should be corrected.
I can think of two alternative patches, BTW:
1) Simply use #define HAVE_FOO 0, instead of not defining HAVE_FOO at all
2) Change
#if HAVE_FOO
to
#if HAVE_FOO+0
which always does the right thing.
But I think I still prefer the attached patch :-).
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 13 Apr 2006 13:38:40 +0000 |
parents | 3202d727bb4b |
children | 393092a3ebf6 |
rev | line source |
---|---|
0 | 1 ; |
2 ; x86 format converters for HERMES | |
3 ; Some routines Copyright (c) 1998 Christian Nentwich (brn@eleet.mcb.at) | |
4 ; This source code is licensed under the GNU LGPL | |
5 ; | |
6 ; Please refer to the file COPYING.LIB contained in the distribution for | |
7 ; licensing conditions | |
8 ; | |
9 ; Most routines are (c) Glenn Fiedler (ptc@gaffer.org), used with permission | |
10 ; | |
11 | |
12 BITS 32 | |
13 | |
14 GLOBAL _ConvertX86 | |
15 GLOBAL _x86return | |
16 | |
17 GLOBAL _Hermes_X86_CPU | |
18 | |
19 SECTION .text | |
20 | |
21 ;; _ConvertX86: | |
22 ;; [ESP+8] ConverterInfo* | |
23 ;; -------------------------------------------------------------------------- | |
24 ;; ConverterInfo (ebp+..) | |
25 ;; 0: void *s_pixels | |
26 ;; 4: int s_width | |
27 ;; 8: int s_height | |
28 ;; 12: int s_add | |
29 ;; 16: void *d_pixels | |
30 ;; 20: int d_width | |
31 ;; 24: int d_height | |
32 ;; 28: int d_add | |
33 ;; 32: void (*converter_function)() | |
34 ;; 36: int32 *lookup | |
35 | |
36 _ConvertX86: | |
37 push ebp | |
38 mov ebp,esp | |
39 | |
40 ; Save the registers used by the blitters, necessary for optimized code | |
41 pusha | |
42 | |
43 mov eax,[ebp+8] | |
44 | |
45 cmp dword [eax+4],BYTE 0 | |
46 je endconvert | |
47 | |
48 mov ebp,eax | |
49 | |
50 mov esi,[ebp+0] | |
51 mov edi,[ebp+16] | |
52 | |
53 y_loop: | |
54 mov ecx,[ebp+4] | |
55 | |
56 jmp [ebp+32] | |
57 | |
58 _x86return: | |
59 add esi,[ebp+12] | |
60 add edi,[ebp+28] | |
61 | |
62 dec dword [ebp+8] | |
63 jnz y_loop | |
64 | |
65 ; Restore the registers used by the blitters, necessary for optimized code | |
66 popa | |
67 | |
68 pop ebp | |
69 | |
70 endconvert: | |
71 ret | |
72 | |
73 | |
74 | |
75 ;; Hermes_X86_CPU returns the CPUID flags in eax | |
76 | |
77 _Hermes_X86_CPU: | |
78 pushfd | |
79 pop eax | |
80 | |
81 mov ecx,eax | |
82 | |
83 xor eax,040000h | |
84 push eax | |
85 | |
86 popfd | |
87 pushfd | |
88 | |
89 pop eax | |
90 xor eax,ecx | |
91 jz .L1 ; Processor is 386 | |
92 | |
93 push ecx | |
94 popfd | |
95 | |
96 mov eax,ecx | |
97 xor eax,200000h | |
98 | |
99 push eax | |
100 popfd | |
101 pushfd | |
102 | |
103 pop eax | |
104 xor eax,ecx | |
105 je .L1 | |
106 | |
1227
3202d727bb4b
From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents:
1199
diff
changeset
|
107 push ebx |
3202d727bb4b
From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents:
1199
diff
changeset
|
108 |
0 | 109 mov eax,1 |
110 cpuid | |
1227
3202d727bb4b
From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents:
1199
diff
changeset
|
111 mov eax,edx |
0 | 112 |
1227
3202d727bb4b
From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents:
1199
diff
changeset
|
113 pop ebx |
0 | 114 |
115 .L1: | |
116 ret | |
1199
2d6dc7de1145
From: Mike Frysinger <vapier@gentoo.org>
Ryan C. Gordon <icculus@icculus.org>
parents:
1166
diff
changeset
|
117 |
2d6dc7de1145
From: Mike Frysinger <vapier@gentoo.org>
Ryan C. Gordon <icculus@icculus.org>
parents:
1166
diff
changeset
|
118 %ifidn __OUTPUT_FORMAT__,elf |
2d6dc7de1145
From: Mike Frysinger <vapier@gentoo.org>
Ryan C. Gordon <icculus@icculus.org>
parents:
1166
diff
changeset
|
119 section .note.GNU-stack noalloc noexec nowrite progbits |
2d6dc7de1145
From: Mike Frysinger <vapier@gentoo.org>
Ryan C. Gordon <icculus@icculus.org>
parents:
1166
diff
changeset
|
120 %endif |