ArmPkg/Library/CompilerIntrinsicsLib: Enable VS2017/ARM builds

Introduce CRT assembly replacements for __rt_sdiv, __rt_udiv,
__rt_udiv64, __rt_sdiv64, __rt_srsh (by reusing the RVCT code)
as well as memcpy and memset.
For MSFT compatibility, some of the code needs to be explicitly
forced to ARM, and the /oldit assembly flag needs to be added.
Also, while RVCT_ASM_EXPORT macro invocations have been removed,
the replacement code is designed to be as close as possible to
the one that would have been generated if using the macros.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pete Batard <pete@akeo.ie>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
This commit is contained in:
Pete Batard
2018-01-12 21:33:29 +08:00
committed by Liming Gao
parent 30939ff2bc
commit e58427e396
7 changed files with 185 additions and 32 deletions

View File

@@ -1,6 +1,7 @@
//------------------------------------------------------------------------------
//
// Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
// Copyright (c) 2018, Pete Batard. All rights reserved.<BR>
//
// This program and the accompanying materials
// are licensed and made available under the terms and conditions of the BSD License
@@ -13,9 +14,30 @@
//------------------------------------------------------------------------------
EXPORT __aeabi_uldivmod
EXPORT __rt_udiv64
AREA s___aeabi_uldivmod, CODE, READONLY, ARM
INCLUDE AsmMacroExport.inc
ARM
;
;UINT64
;EFIAPI
;__rt_udiv64 (
; IN UINT64 Divisor
; IN UINT64 Dividend
; )
;
__rt_udiv64
; Swap r0-r1 and r2-r3
mov r12, r0
mov r0, r2
mov r2, r12
mov r12, r1
mov r1, r3
mov r3, r12
b __aeabi_uldivmod
;
;UINT64
@@ -25,7 +47,7 @@
; IN UINT64 Divisor
; )
;
RVCT_ASM_EXPORT __aeabi_uldivmod
__aeabi_uldivmod
stmdb sp!, {r4, r5, r6, lr}
mov r4, r1
mov r5, r0
@@ -261,7 +283,6 @@ _ll_div0
b __aeabi_ldiv0
__aeabi_ldiv0
BX r14
bx r14
END