src/hermes/x86_main.asm
branchSDL-1.2
changeset 3983 540466e900db
parent 1873 eb4d9d99849b
child 5392 30e4d724fe98
equal deleted inserted replaced
3982:0a0f8cccc77c 3983:540466e900db
    12 BITS 32
    12 BITS 32
    13 
    13 
    14 %include "common.inc"
    14 %include "common.inc"
    15 
    15 
    16 SDL_FUNC _ConvertX86
    16 SDL_FUNC _ConvertX86
    17 SDL_FUNC _x86return
       
    18 	
       
    19 SDL_FUNC _Hermes_X86_CPU
       
    20 
    17 
    21 SECTION .text
    18 SECTION .text
    22 		
    19 		
    23 ;; _ConvertX86:	 
    20 ;; _ConvertX86:	 
    24 ;; [ESP+8] ConverterInfo*
    21 ;; [ESP+8] ConverterInfo*
    53 	mov edi,[ebp+16]
    50 	mov edi,[ebp+16]
    54 	
    51 	
    55 y_loop:	
    52 y_loop:	
    56 	mov ecx,[ebp+4]
    53 	mov ecx,[ebp+4]
    57 
    54 
    58 	jmp [ebp+32]
    55 	call [ebp+32]
    59 
    56 
    60 _x86return:	
       
    61 	add esi,[ebp+12]
    57 	add esi,[ebp+12]
    62 	add edi,[ebp+28]
    58 	add edi,[ebp+28]
    63 	
    59 	
    64 	dec dword  [ebp+8]
    60 	dec dword  [ebp+8]
    65 	jnz y_loop
    61 	jnz y_loop
    72 endconvert:	
    68 endconvert:	
    73 	ret		
    69 	ret		
    74 
    70 
    75 
    71 
    76 
    72 
    77 ;; Hermes_X86_CPU returns the CPUID flags in eax
       
    78 	
       
    79 _Hermes_X86_CPU:
       
    80 	pushfd
       
    81 	pop eax
       
    82 	
       
    83 	mov ecx,eax
       
    84 	
       
    85 	xor eax,040000h
       
    86 	push eax
       
    87 	
       
    88 	popfd
       
    89 	pushfd
       
    90 
       
    91 	pop eax
       
    92 	xor eax,ecx
       
    93 	jz .L1			; Processor is 386
       
    94 
       
    95 	push ecx
       
    96 	popfd
       
    97 
       
    98 	mov eax,ecx
       
    99 	xor eax,200000h
       
   100 
       
   101 	push eax
       
   102 	popfd
       
   103 	pushfd
       
   104 
       
   105 	pop eax
       
   106 	xor eax,ecx
       
   107 	je .L1
       
   108 	
       
   109 	push ebx
       
   110 
       
   111 	mov eax,1
       
   112 	cpuid
       
   113 	mov eax,edx
       
   114 
       
   115 	pop ebx
       
   116 
       
   117 .L1:	
       
   118 	ret
       
   119 
       
   120 %ifidn __OUTPUT_FORMAT__,elf
    73 %ifidn __OUTPUT_FORMAT__,elf
   121 section .note.GNU-stack noalloc noexec nowrite progbits
    74 section .note.GNU-stack noalloc noexec nowrite progbits
   122 %endif
    75 %endif