mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-11-04 04:22:07 +01:00 
			
		
		
		
	+ cpu unit for arm (linux only so far)
git-svn-id: trunk@33184 -
This commit is contained in:
		
							parent
							
								
									d13246cea4
								
							
						
					
					
						commit
						84bb46a35d
					
				
							
								
								
									
										1
									
								
								.gitattributes
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitattributes
									
									
									
									
										vendored
									
									
								
							@ -8206,6 +8206,7 @@ rtl/android/mipsel/prt0.as svneol=native#text/plain
 | 
				
			|||||||
rtl/android/sysandroid.inc svneol=native#text/plain
 | 
					rtl/android/sysandroid.inc svneol=native#text/plain
 | 
				
			||||||
rtl/arm/arm.inc svneol=native#text/plain
 | 
					rtl/arm/arm.inc svneol=native#text/plain
 | 
				
			||||||
rtl/arm/armdefines.inc svneol=native#text/plain
 | 
					rtl/arm/armdefines.inc svneol=native#text/plain
 | 
				
			||||||
 | 
					rtl/arm/cpu.pp svneol=native#text/pascal
 | 
				
			||||||
rtl/arm/divide.inc svneol=native#text/plain
 | 
					rtl/arm/divide.inc svneol=native#text/plain
 | 
				
			||||||
rtl/arm/int64p.inc svneol=native#text/plain
 | 
					rtl/arm/int64p.inc svneol=native#text/plain
 | 
				
			||||||
rtl/arm/makefile.cpu svneol=native#text/plain
 | 
					rtl/arm/makefile.cpu svneol=native#text/plain
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										91
									
								
								rtl/arm/cpu.pp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										91
									
								
								rtl/arm/cpu.pp
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,91 @@
 | 
				
			|||||||
 | 
					{
 | 
				
			||||||
 | 
					    This file is part of the Free Pascal run time library.
 | 
				
			||||||
 | 
					    Copyright (c) 2016 by the Free Pascal development team
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    This unit contains some routines to get informations about the
 | 
				
			||||||
 | 
					    processor
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    See the file COPYING.FPC, included in this distribution,
 | 
				
			||||||
 | 
					    for details about the copyright.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    This program is distributed in the hope that it will be useful,
 | 
				
			||||||
 | 
					    but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
				
			||||||
 | 
					    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 **********************************************************************}
 | 
				
			||||||
 | 
					{$mode objfpc}
 | 
				
			||||||
 | 
					unit cpu;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  interface
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    function VFPv4Support : Boolean;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  implementation
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					     var
 | 
				
			||||||
 | 
					       has_vfpv4_support,
 | 
				
			||||||
 | 
					       gothwcaps : boolean;
 | 
				
			||||||
 | 
					       hwcaps : dword;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					     const
 | 
				
			||||||
 | 
					      AT_NULL         = 0;
 | 
				
			||||||
 | 
					      AT_HWCAPS       = 16;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    type
 | 
				
			||||||
 | 
					      TAuxiliaryValue = DWord;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      TInternalUnion = record
 | 
				
			||||||
 | 
					        a_val: DWord;           //* Integer value */
 | 
				
			||||||
 | 
					          {* We use to have pointer elements added here.  We cannot do that,
 | 
				
			||||||
 | 
					             though, since it does not work when using 32-bit definitions
 | 
				
			||||||
 | 
					             on 64-bit platforms and vice versa.  *}
 | 
				
			||||||
 | 
					      end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      Elf32_auxv_t = record
 | 
				
			||||||
 | 
					        a_type: DWord;              //* Entry type */
 | 
				
			||||||
 | 
					        a_un: TInternalUnion;
 | 
				
			||||||
 | 
					      end;
 | 
				
			||||||
 | 
					      TElf32AuxiliaryVector = Elf32_auxv_t;
 | 
				
			||||||
 | 
					      PElf32AuxiliaryVector = ^TElf32AuxiliaryVector;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    var
 | 
				
			||||||
 | 
					      psysinfo: LongWord = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    procedure InitHWCaps;
 | 
				
			||||||
 | 
					      var
 | 
				
			||||||
 | 
					        ep: PPChar;
 | 
				
			||||||
 | 
					        auxv: PElf32AuxiliaryVector;
 | 
				
			||||||
 | 
					      begin
 | 
				
			||||||
 | 
					        psysinfo := 0;
 | 
				
			||||||
 | 
					        ep := envp;
 | 
				
			||||||
 | 
					        while ep^ <> nil do
 | 
				
			||||||
 | 
					          Inc(ep);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Inc(ep);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        auxv := PElf32AuxiliaryVector(ep);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        while auxv^.a_type <> AT_NULL do
 | 
				
			||||||
 | 
					          begin
 | 
				
			||||||
 | 
					            if auxv^.a_type = AT_HWCAPS then
 | 
				
			||||||
 | 
					              begin
 | 
				
			||||||
 | 
					                hwcaps := auxv^.a_un.a_val;
 | 
				
			||||||
 | 
					                gothwcaps := true;
 | 
				
			||||||
 | 
					                Break;
 | 
				
			||||||
 | 
					            end;
 | 
				
			||||||
 | 
					            Inc(auxv);
 | 
				
			||||||
 | 
					          end;
 | 
				
			||||||
 | 
					      end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    function VFPv4Support : Boolean;
 | 
				
			||||||
 | 
					      begin
 | 
				
			||||||
 | 
					        Result:=has_vfpv4_support;
 | 
				
			||||||
 | 
					      end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					begin
 | 
				
			||||||
 | 
					  gothwcaps:=false;
 | 
				
			||||||
 | 
					  InitHWCaps;
 | 
				
			||||||
 | 
					  has_vfpv4_support:=gothwcaps and ((hwcaps and (1 shl 16))<>0);
 | 
				
			||||||
 | 
					end.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -363,6 +363,7 @@ override FPCOPT+=-Ur
 | 
				
			|||||||
endif
 | 
					endif
 | 
				
			||||||
ifeq ($(ARCH),arm)
 | 
					ifeq ($(ARCH),arm)
 | 
				
			||||||
override LOADERS+=ucprt0
 | 
					override LOADERS+=ucprt0
 | 
				
			||||||
 | 
					CPU_UNITS=cpu
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
SYSTEMUNIT=system
 | 
					SYSTEMUNIT=system
 | 
				
			||||||
ifdef RELEASE
 | 
					ifdef RELEASE
 | 
				
			||||||
 | 
				
			|||||||
@ -93,6 +93,7 @@ endif
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
ifeq ($(ARCH),arm)
 | 
					ifeq ($(ARCH),arm)
 | 
				
			||||||
override LOADERS+=ucprt0
 | 
					override LOADERS+=ucprt0
 | 
				
			||||||
 | 
					CPU_UNITS=cpu
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SYSTEMUNIT=system
 | 
					SYSTEMUNIT=system
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user