1 //*****************************************************************************
2 // aeabi_romdiv_patch.s
3 // - Provides "patch" versions of the aeabi integer divide functions to
4 // replace the standard ones pulled in from the C library, which vector
5 // integer divides onto the rom division functions contained in
6 // specific NXP MCUs such as LPC11Uxx and LPC12xx.
7 // - Note that this patching will only occur if "__USE_ROMDIVIDE" is
8 // defined for the project build for both the compiler and assembler.
9 //*****************************************************************************
11 // Copyright(C) NXP Semiconductors, 2013
12 // All rights reserved.
14 // Software that is described herein is for illustrative purposes only
15 // which provides customers with programming information regarding the
16 // LPC products. This software is supplied "AS IS" without any warranties of
17 // any kind, and NXP Semiconductors and its licensor disclaim any and
18 // all warranties, express or implied, including all implied warranties of
19 // merchantability, fitness for a particular purpose and non-infringement of
20 // intellectual property rights. NXP Semiconductors assumes no responsibility
21 // or liability for the use of the software, conveys no license or rights under any
22 // patent, copyright, mask work right, or any other intellectual property rights in
23 // or to any products. NXP Semiconductors reserves the right to make changes
24 // in the software without notification. NXP Semiconductors also makes no
25 // representation or warranty that such application will be suitable for the
26 // specified use without further testing or modification.
28 // Permission to use, copy, modify, and distribute this software and its
29 // documentation is hereby granted, under NXP Semiconductors' and its
30 // licensor's relevant copyrights in the software, without fee, provided that it
31 // is used in conjunction with NXP Semiconductors microcontrollers. This
32 // copyright, permission, and disclaimer notice must appear in all copies of
34 //*****************************************************************************
35 #if defined(__USE_ROMDIVIDE)
37 // Note that the romdivide "divmod" functions are not actually called from
38 // the below code, as these functions are actually just wrappers to the
39 // main romdivide "div" functions which push the quotient and remainder onto
40 // the stack, so as to be compatible with the way that C returns structures.
42 // This is not needed for the aeabi "divmod" functions, as the compiler
43 // automatically generates code that handles the return values being passed
44 // back in registers when it generates inline calls to __aeabi_idivmod and
45 // __aeabi_uidivmod routines.
50 // ========= __aeabi_idiv & __aeabi_idivmod =========
52 .section .text.__aeabi_idiv
55 .set __aeabi_idivmod, __aeabi_idiv // make __aeabi_uidivmod an alias
56 .global __aeabi_idivmod
57 .global pDivRom_idiv // pointer to the romdivide 'idiv' functione
60 .type __aeabi_idiv, %function
65 ldr r3, [r3, #0] // Load address of function
66 blx r3 // Call divide function
71 // ======== __aeabi_uidiv & __aeabi_uidivmod ========
74 .section .text.__aeabi_uidiv
77 .set __aeabi_uidivmod, __aeabi_uidiv // make __aeabi_uidivmod an alias
78 .global __aeabi_uidivmod
79 .global pDivRom_uidiv // pointer to the romdivide 'uidiv' function
82 .type __aeabi_uidiv, %function
86 ldr r3, =pDivRom_uidiv
87 ldr r3, [r3, #0] // Load address of function
88 blx r3 // Call divide function
93 #endif // (__USE_ROMDIVIDE)