mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-11-01 00:10:00 +01:00 
			
		
		
		
	* made pic-safe (by simply not accessing global variables from
assembler code anymore, as I don't see how to easily support
    PIC access to global variables for Darwin/i386)
git-svn-id: trunk@8663 -
			
			
This commit is contained in:
		
							parent
							
								
									e81d4b737f
								
							
						
					
					
						commit
						f51bac256d
					
				| @ -1216,16 +1216,24 @@ const | |||||||
| 
 | 
 | ||||||
| {$define FPC_SYSTEM_HAS_SYSRESETFPU} | {$define FPC_SYSTEM_HAS_SYSRESETFPU} | ||||||
| Procedure SysResetFPU;{$ifdef SYSTEMINLINE}inline;{$endif} | Procedure SysResetFPU;{$ifdef SYSTEMINLINE}inline;{$endif} | ||||||
|  |   var | ||||||
|  |     { these locals are so we don't have to hack pic code in the assembler } | ||||||
|  |     localmxcsr: dword; | ||||||
|  |     localfpucw: word; | ||||||
|   begin |   begin | ||||||
|  |     localfpucw:=Default8087CW; | ||||||
|     asm |     asm | ||||||
|       fninit |       fninit | ||||||
|       fldcw   Default8087CW |       fldcw   localfpucw | ||||||
|       fwait |       fwait | ||||||
|     end; |     end; | ||||||
|     if has_sse_support then |     if has_sse_support then | ||||||
|       asm |       begin | ||||||
|        { setup sse exceptions } |         localmxcsr:=mxcsr; | ||||||
|        ldmxcsr mxcsr |         asm | ||||||
|  |           { setup sse exceptions } | ||||||
|  |           ldmxcsr localmxcsr | ||||||
|  |         end; | ||||||
|       end; |       end; | ||||||
|     softfloat_exception_flags:=0; |     softfloat_exception_flags:=0; | ||||||
|     softfloat_exception_mask:=float_flag_underflow or float_flag_inexact or float_flag_denormal; |     softfloat_exception_mask:=float_flag_underflow or float_flag_inexact or float_flag_denormal; | ||||||
|  | |||||||
| @ -17,14 +17,15 @@ | |||||||
|                             FPU Control word |                             FPU Control word | ||||||
|  ****************************************************************************} |  ****************************************************************************} | ||||||
| 
 | 
 | ||||||
|     procedure Set8087CW(cw:word);assembler; |     procedure Set8087CW(cw:word); | ||||||
|       asm |       begin | ||||||
| {$ifndef REGCALL} |         { pic-safe ; cw will not be a regvar because it's accessed from } | ||||||
|         movw cw,%ax |         { assembler                                                     } | ||||||
| {$endif} |         default8087cw:=cw; | ||||||
|         movw %ax,default8087cw |         asm | ||||||
|         fnclex |           fnclex | ||||||
|         fldcw default8087cw |           fldcw cw | ||||||
|  |         end; | ||||||
|       end; |       end; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @ -120,20 +121,22 @@ | |||||||
| 
 | 
 | ||||||
|   {$define FPC_SYSTEM_HAS_EXP} |   {$define FPC_SYSTEM_HAS_EXP} | ||||||
|     function fpc_exp_real(d : ValReal) : ValReal;assembler;compilerproc; |     function fpc_exp_real(d : ValReal) : ValReal;assembler;compilerproc; | ||||||
|  |       var | ||||||
|  |         cw1,cw2: word; | ||||||
|       asm |       asm | ||||||
|         // comes from DJ GPP
 |         // comes from DJ GPP
 | ||||||
|         fldt        d |         fldt        d | ||||||
|         fldl2e |         fldl2e | ||||||
|         fmulp       %st,%st(1) |         fmulp       %st,%st(1) | ||||||
|         fstcw      .LCW1 |         fstcw       CW1 | ||||||
|         fstcw      .LCW2 |         fstcw       CW2 | ||||||
|         fwait |         fwait | ||||||
|         andw        $0xf3ff,.LCW2 |         andw        $0xf3ff,CW2 | ||||||
|         orw         $0x0400,.LCW2 |         orw         $0x0400,CW2 | ||||||
|         fldcw      .LCW2 |         fldcw       CW2 | ||||||
|         fld         %st(0) |         fld         %st(0) | ||||||
|         frndint |         frndint | ||||||
|         fldcw      .LCW1 |         fldcw       CW1 | ||||||
|         fxch        %st(1) |         fxch        %st(1) | ||||||
|         fsub        %st(1),%st |         fsub        %st(1),%st | ||||||
|         f2xm1 |         f2xm1 | ||||||
| @ -142,15 +145,6 @@ | |||||||
|         fscale |         fscale | ||||||
|         fstp        %st(1) |         fstp        %st(1) | ||||||
|         fclex |         fclex | ||||||
|         jmp         .LCW3 |  | ||||||
|         // store some help data in the data segment
 |  | ||||||
|     .data |  | ||||||
|     .LCW1: |  | ||||||
|         .word       0 |  | ||||||
|     .LCW2: |  | ||||||
|         .word       0 |  | ||||||
|     .text |  | ||||||
|     .LCW3: |  | ||||||
|      end; |      end; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Jonas Maebe
						Jonas Maebe