src/hermes/x86_main.asm
author Sam Lantinga <slouken@libsdl.org>
Sun, 21 Sep 2003 18:32:04 +0000
changeset 720 f90d80d68071
parent 0 74212992fb08
child 1166 da33b7e6d181
permissions -rw-r--r--
N Sep 17 8791 Sam Lantinga Re: tks source released
Date: Sun, 07 Sep 2003 02:51:58 +0200
From: Stephane Marchesin
Subject: [SDL] Two little patches

Compiling SDL with a recent gcc (gcc 3.3.1, 3.3 doesn't have this
behaviour) gives some nasty warnings :

SDL_blit_A.c: In function `BlitRGBtoRGBSurfaceAlpha128MMX':
SDL_blit_A.c:223: warning: integer constant is too large for "long" type
SDL_blit_A.c:225: warning: integer constant is too large for "long" type
SDL_blit_A.c:227: warning: integer constant is too large for "long" type
[...]

The first attached patch (longlongfix.patch) tells gcc to really treat
those constants as unsigned long long and not long.

The second patch (nasinclude.patch) fixes an include problem I had while
compiling nas audio : when the <audio/audiolib.h> file lies in
/usr/X11R6/include, a -I/usr/X11R6/include option is needed or the file
isn't found.
slouken@0
     1
;
slouken@0
     2
; x86 format converters for HERMES
slouken@0
     3
; Some routines Copyright (c) 1998 Christian Nentwich (brn@eleet.mcb.at)
slouken@0
     4
; This source code is licensed under the GNU LGPL
slouken@0
     5
; 
slouken@0
     6
; Please refer to the file COPYING.LIB contained in the distribution for
slouken@0
     7
; licensing conditions		
slouken@0
     8
;
slouken@0
     9
; Most routines are (c) Glenn Fiedler (ptc@gaffer.org), used with permission
slouken@0
    10
; 
slouken@0
    11
slouken@0
    12
BITS 32
slouken@0
    13
slouken@0
    14
GLOBAL _ConvertX86
slouken@0
    15
GLOBAL _x86return
slouken@0
    16
	
slouken@0
    17
GLOBAL _Hermes_X86_CPU
slouken@0
    18
slouken@0
    19
slouken@0
    20
SECTION .data
slouken@0
    21
	
slouken@0
    22
cpu_flags dd 0
slouken@0
    23
	
slouken@0
    24
		
slouken@0
    25
SECTION .text
slouken@0
    26
		
slouken@0
    27
;; _ConvertX86:	 
slouken@0
    28
;; [ESP+8] ConverterInfo*
slouken@0
    29
;; --------------------------------------------------------------------------
slouken@0
    30
;; ConverterInfo (ebp+..)
slouken@0
    31
;;   0:	void *s_pixels
slouken@0
    32
;;   4:	int s_width
slouken@0
    33
;;   8:	int s_height
slouken@0
    34
;;  12:	int s_add
slouken@0
    35
;;  16:	void *d_pixels
slouken@0
    36
;;  20:	int d_width
slouken@0
    37
;;  24:	int d_height
slouken@0
    38
;;  28:	int d_add
slouken@0
    39
;;  32:	void (*converter_function)() 
slouken@0
    40
;;  36: int32 *lookup
slouken@0
    41
	
slouken@0
    42
_ConvertX86:
slouken@0
    43
	push ebp
slouken@0
    44
	mov ebp,esp
slouken@0
    45
slouken@0
    46
; Save the registers used by the blitters, necessary for optimized code
slouken@0
    47
	pusha
slouken@0
    48
slouken@0
    49
	mov eax,[ebp+8]
slouken@0
    50
slouken@0
    51
        cmp dword [eax+4],BYTE 0
slouken@0
    52
	je endconvert
slouken@0
    53
	
slouken@0
    54
	mov ebp,eax
slouken@0
    55
	
slouken@0
    56
	mov esi,[ebp+0]
slouken@0
    57
	mov edi,[ebp+16]
slouken@0
    58
	
slouken@0
    59
y_loop:	
slouken@0
    60
	mov ecx,[ebp+4]
slouken@0
    61
slouken@0
    62
	jmp [ebp+32]
slouken@0
    63
slouken@0
    64
_x86return:	
slouken@0
    65
	add esi,[ebp+12]
slouken@0
    66
	add edi,[ebp+28]
slouken@0
    67
	
slouken@0
    68
	dec dword  [ebp+8]
slouken@0
    69
	jnz y_loop
slouken@0
    70
slouken@0
    71
; Restore the registers used by the blitters, necessary for optimized code
slouken@0
    72
	popa
slouken@0
    73
	
slouken@0
    74
	pop ebp
slouken@0
    75
slouken@0
    76
endconvert:	
slouken@0
    77
	ret		
slouken@0
    78
slouken@0
    79
slouken@0
    80
slouken@0
    81
;; Hermes_X86_CPU returns the CPUID flags in eax
slouken@0
    82
	
slouken@0
    83
_Hermes_X86_CPU:
slouken@0
    84
	pushfd
slouken@0
    85
	pop eax
slouken@0
    86
	
slouken@0
    87
	mov ecx,eax
slouken@0
    88
	
slouken@0
    89
	xor eax,040000h
slouken@0
    90
	push eax
slouken@0
    91
	
slouken@0
    92
	popfd
slouken@0
    93
	pushfd
slouken@0
    94
slouken@0
    95
	pop eax
slouken@0
    96
	xor eax,ecx
slouken@0
    97
	jz .L1			; Processor is 386
slouken@0
    98
slouken@0
    99
	push ecx
slouken@0
   100
	popfd
slouken@0
   101
slouken@0
   102
	mov eax,ecx
slouken@0
   103
	xor eax,200000h
slouken@0
   104
slouken@0
   105
	push eax
slouken@0
   106
	popfd
slouken@0
   107
	pushfd
slouken@0
   108
slouken@0
   109
	pop eax
slouken@0
   110
	xor eax,ecx
slouken@0
   111
	je .L1
slouken@0
   112
	
slouken@0
   113
	pusha
slouken@0
   114
	
slouken@0
   115
	mov eax,1
slouken@0
   116
	cpuid
slouken@0
   117
slouken@0
   118
	mov [cpu_flags],edx
slouken@0
   119
slouken@0
   120
	popa
slouken@0
   121
slouken@0
   122
	mov eax,[cpu_flags]
slouken@0
   123
slouken@0
   124
.L1:	
slouken@0
   125
	ret