]>
Commit | Line | Data |
---|---|---|
3402aac7 | 1 | //------------------------------------------------------------------------------\r |
1e57a462 | 2 | //\r |
3 | // Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r | |
4 | //\r | |
5 | // This program and the accompanying materials\r | |
6 | // are licensed and made available under the terms and conditions of the BSD License\r | |
7 | // which accompanies this distribution. The full text of the license may be found at\r | |
8 | // http://opensource.org/licenses/bsd-license.php\r | |
9 | //\r | |
10 | // THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | // WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | //\r | |
13 | //------------------------------------------------------------------------------\r | |
14 | \r | |
903e3124 | 15 | #include <AsmMacroIoLib.h>\r |
1e57a462 | 16 | \r |
17 | //\r | |
3402aac7 | 18 | // A pair of (unsigned) long longs is returned in {{r0, r1}, {r2, r3}},\r |
1e57a462 | 19 | // the quotient in {r0, r1}, and the remainder in {r2, r3}.\r |
20 | //\r | |
21 | //__value_in_regs lldiv_t\r | |
22 | //EFIAPI\r | |
23 | //__aeabi_ldivmod (\r | |
24 | // IN UINT64 Dividen\r | |
25 | // IN UINT64 Divisor\r | |
26 | // )//\r | |
27 | //\r | |
28 | \r | |
903e3124 | 29 | ASM_FUNC(__aeabi_ldivmod)\r |
1e57a462 | 30 | push {r4,lr}\r |
31 | asrs r4,r1,#1\r | |
32 | eor r4,r4,r3,LSR #1\r | |
33 | bpl L_Test1\r | |
34 | rsbs r0,r0,#0\r | |
35 | rsc r1,r1,#0\r | |
36 | L_Test1:\r | |
37 | tst r3,r3\r | |
38 | bpl L_Test2\r | |
39 | rsbs r2,r2,#0\r | |
40 | rsc r3,r3,#0\r | |
41 | L_Test2:\r | |
3402aac7 | 42 | bl ASM_PFX(__aeabi_uldivmod)\r |
1e57a462 | 43 | tst r4,#0x40000000\r |
44 | beq L_Test3\r | |
45 | rsbs r0,r0,#0\r | |
46 | rsc r1,r1,#0\r | |
47 | L_Test3:\r | |
48 | tst r4,#0x80000000\r | |
49 | beq L_Exit\r | |
50 | rsbs r2,r2,#0\r | |
51 | rsc r3,r3,#0\r | |
52 | L_Exit:\r | |
53 | pop {r4,pc}\r | |
3402aac7 | 54 | \r |
1e57a462 | 55 | \r |
56 | \r |