//------------------------------------------------------------------------------\r
//\r
// Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
+// Copyright (c) 2018, Pete Batard. All rights reserved.<BR>\r
//\r
// This program and the accompanying materials\r
// are licensed and made available under the terms and conditions of the BSD License\r
EXPORT __aeabi_uidivmod\r
EXPORT __aeabi_idiv\r
EXPORT __aeabi_idivmod\r
+ EXPORT __rt_udiv\r
+ EXPORT __rt_sdiv\r
\r
AREA Math, CODE, READONLY\r
\r
;\r
;UINT32\r
;EFIAPI\r
-;__aeabi_uidivmode (\r
-; IN UINT32 Dividen\r
+;__aeabi_uidivmod (\r
+; IN UINT32 Dividend\r
; IN UINT32 Divisor\r
; );\r
;\r
-\r
__aeabi_uidiv\r
__aeabi_uidivmod\r
RSBS r12, r1, r0, LSR #4\r
MOV r3, #0\r
B __arm_div_large\r
\r
+;\r
+;UINT64\r
+;EFIAPI\r
+;__rt_udiv (\r
+; IN UINT32 Divisor,\r
+; IN UINT32 Dividend\r
+; );\r
+;\r
+__rt_udiv\r
+ ; Swap R0 and R1\r
+ MOV r12, r0\r
+ MOV r0, r1\r
+ MOV r1, r12\r
+ B __aeabi_uidivmod\r
+\r
+;\r
+;UINT64\r
+;EFIAPI\r
+;__rt_sdiv (\r
+; IN INT32 Divisor,\r
+; IN INT32 Dividend\r
+; );\r
+;\r
+__rt_sdiv\r
+ ; Swap R0 and R1\r
+ MOV r12, r0\r
+ MOV r0, r1\r
+ MOV r1, r12\r
+ B __aeabi_idivmod\r
+\r
;\r
;INT32\r
;EFIAPI\r
-;__aeabi_idivmode (\r
-; IN INT32 Dividen\r
+;__aeabi_idivmod (\r
+; IN INT32 Dividend\r
; IN INT32 Divisor\r
; );\r
;\r
BX r14\r
\r
END\r
-\r
//------------------------------------------------------------------------------\r
//\r
// Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
+// Copyright (c) 2018, Pete Batard. All rights reserved.<BR>\r
//\r
// This program and the accompanying materials\r
// are licensed and made available under the terms and conditions of the BSD License\r
//------------------------------------------------------------------------------\r
\r
\r
- EXTERN __aeabi_uldivmod\r
+ IMPORT __aeabi_uldivmod\r
+ EXPORT __aeabi_ldivmod\r
+ EXPORT __rt_sdiv64\r
\r
- INCLUDE AsmMacroExport.inc\r
+ AREA s___aeabi_ldivmod, CODE, READONLY, ARM\r
+\r
+ ARM\r
\r
;\r
-;UINT32\r
+;INT64\r
;EFIAPI\r
-;__aeabi_uidivmode (\r
-; IN UINT32 Dividen\r
-; IN UINT32 Divisor\r
+;__rt_sdiv64 (\r
+; IN INT64 Divisor\r
+; IN INT64 Dividend\r
; );\r
;\r
+__rt_sdiv64\r
+ ; Swap r0-r1 and r2-r3\r
+ MOV r12, r0\r
+ MOV r0, r2\r
+ MOV r2, r12\r
+ MOV r12, r1\r
+ MOV r1, r3\r
+ MOV r3, r12\r
+ B __aeabi_ldivmod\r
\r
- RVCT_ASM_EXPORT __aeabi_ldivmod\r
+;\r
+;INT64\r
+;EFIAPI\r
+;__aeabi_ldivmod (\r
+; IN INT64 Dividend\r
+; IN INT64 Divisor\r
+; );\r
+;\r
+__aeabi_ldivmod\r
PUSH {r4,lr}\r
ASRS r4,r1,#1\r
EOR r4,r4,r3,LSR #1\r
RSBS r2,r2,#0\r
RSC r3,r3,#0\r
L_Test2\r
- BL __aeabi_uldivmod ;\r
+ BL __aeabi_uldivmod\r
TST r4,#0x40000000\r
BEQ L_Test3\r
RSBS r0,r0,#0\r
POP {r4,pc}\r
\r
END\r
-\r
-\r
//------------------------------------------------------------------------------\r
//\r
// Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
+// Copyright (c) 2018, Pete Batard. All rights reserved.<BR>\r
//\r
// This program and the accompanying materials\r
// are licensed and made available under the terms and conditions of the BSD License\r
//\r
//------------------------------------------------------------------------------\r
\r
+ EXPORT __aeabi_llsr\r
+ EXPORT __rt_srsh\r
\r
+ AREA s___aeabi_llsr, CODE, READONLY, ARM\r
\r
- INCLUDE AsmMacroExport.inc\r
+ ARM\r
\r
;\r
;VOID\r
;EFIAPI\r
;__aeabi_llsr (\r
-; IN VOID *Destination,\r
-; IN VOID *Source,\r
-; IN UINT32 Size\r
-; );\r
+; IN UINT64 Value,\r
+; IN UINT32 Shift\r
+;)\r
;\r
- RVCT_ASM_EXPORT __aeabi_llsr\r
+__aeabi_llsr\r
+__rt_srsh\r
SUBS r3,r2,#0x20\r
- BPL {pc} + 0x18 ; 0x1c\r
+ BPL __aeabi_llsr_label1\r
RSB r3,r2,#0x20\r
LSR r0,r0,r2\r
ORR r0,r0,r1,LSL r3\r
LSR r1,r1,r2\r
BX lr\r
+__aeabi_llsr_label1\r
LSR r0,r1,r3\r
MOV r1,#0\r
BX lr\r
\r
END\r
-\r
-\r
-\r
//------------------------------------------------------------------------------\r
//\r
// Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
+// Copyright (c) 2018, Pete Batard. All rights reserved.<BR>\r
//\r
// This program and the accompanying materials\r
// are licensed and made available under the terms and conditions of the BSD License\r
//------------------------------------------------------------------------------\r
\r
\r
+ EXPORT __aeabi_uldivmod\r
+ EXPORT __rt_udiv64\r
\r
+ AREA s___aeabi_uldivmod, CODE, READONLY, ARM\r
\r
- INCLUDE AsmMacroExport.inc\r
+ ARM\r
+\r
+;\r
+;UINT64\r
+;EFIAPI\r
+;__rt_udiv64 (\r
+; IN UINT64 Divisor\r
+; IN UINT64 Dividend\r
+; )\r
+;\r
+__rt_udiv64\r
+ ; Swap r0-r1 and r2-r3\r
+ mov r12, r0\r
+ mov r0, r2\r
+ mov r2, r12\r
+ mov r12, r1\r
+ mov r1, r3\r
+ mov r3, r12\r
+ b __aeabi_uldivmod\r
\r
;\r
;UINT64\r
; IN UINT64 Divisor\r
; )\r
;\r
- RVCT_ASM_EXPORT __aeabi_uldivmod\r
+__aeabi_uldivmod\r
stmdb sp!, {r4, r5, r6, lr}\r
mov r4, r1\r
mov r5, r0\r
b __aeabi_ldiv0\r
\r
__aeabi_ldiv0\r
- BX r14\r
+ bx r14\r
\r
END\r
-\r
LIBRARY_CLASS = CompilerIntrinsicsLib\r
\r
[Sources]\r
- memcpy.c\r
- memset.c\r
+ memcpy.c | RVCT\r
+ memcpy.c | GCC\r
+ memcpy_ms.c | MSFT\r
+ memset.c | RVCT\r
+ memset.c | GCC\r
+ memset_ms.c | MSFT\r
\r
[Sources.ARM]\r
Arm/mullu.asm | RVCT\r
Arm/llsr.S | GCC\r
Arm/llsl.S | GCC\r
\r
+ Arm/div.asm | MSFT\r
+ Arm/uldiv.asm | MSFT\r
+ Arm/ldivmod.asm | MSFT\r
+ Arm/llsr.asm | MSFT\r
\r
[Packages]\r
MdePkg/MdePkg.dec\r
\r
[LibraryClasses]\r
\r
+[BuildOptions]\r
+ MSFT:*_*_ARM_CC_FLAGS = /GL-\r
+ MSFT:*_*_ARM_ASM_FLAGS = /oldit\r
+ MSFT:*_*_AARCH64_CC_FLAGS = /GL-\r
--- /dev/null
+//------------------------------------------------------------------------------\r
+//\r
+// Copyright (c) 2017, Pete Batard. All rights reserved.<BR>\r
+//\r
+// This program and the accompanying materials are licensed and made\r
+// available under the terms and conditions of the BSD License which\r
+// accompanies this distribution. The full text of the license may be\r
+// found at http://opensource.org/licenses/bsd-license.php\r
+//\r
+// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR\r
+// IMPLIED.\r
+//\r
+//------------------------------------------------------------------------------\r
+\r
+#if defined(_M_ARM64)\r
+typedef unsigned __int64 size_t;\r
+#else\r
+typedef unsigned __int32 size_t;\r
+#endif\r
+\r
+void* memcpy(void *, const void *, size_t);\r
+#pragma intrinsic(memcpy)\r
+#pragma function(memcpy)\r
+void* memcpy(void *dest, const void *src, size_t n)\r
+{\r
+ unsigned char *d = dest;\r
+ unsigned char const *s = src;\r
+\r
+ while (n--)\r
+ *d++ = *s++;\r
+\r
+ return dest;\r
+}\r
--- /dev/null
+//------------------------------------------------------------------------------\r
+//\r
+// Copyright (c) 2017, Pete Batard. All rights reserved.<BR>\r
+//\r
+// This program and the accompanying materials are licensed and made\r
+// available under the terms and conditions of the BSD License which\r
+// accompanies this distribution. The full text of the license may be\r
+// found at http://opensource.org/licenses/bsd-license.php\r
+//\r
+// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR\r
+// IMPLIED.\r
+//\r
+//------------------------------------------------------------------------------\r
+\r
+#if defined(_M_ARM64)\r
+typedef unsigned __int64 size_t;\r
+#else\r
+typedef unsigned __int32 size_t;\r
+#endif\r
+\r
+void* memset(void *, int, size_t);\r
+#pragma intrinsic(memset)\r
+#pragma function(memset)\r
+void *memset(void *s, int c, size_t n)\r
+{\r
+ unsigned char *d = s;\r
+\r
+ while (n--)\r
+ *d++ = (unsigned char)c;\r
+\r
+ return s;\r
+}\r