183 #pragma warning off (10350) /* N pad byte(s) inserted after data member */ |
151 #pragma warning off (10350) /* N pad byte(s) inserted after data member */ |
184 #endif |
152 #endif |
185 #endif |
153 #endif |
186 |
154 |
187 |
155 |
188 |
156 // |
189 #if defined(__GCC32__) |
157 // GCC (ARM) compiler |
|
158 // |
|
159 #if defined(__GCC32__) && defined(__MARM__) |
|
160 #ifndef __GNUC__ /* GCC98r2 doesn't define this for some reason */ |
|
161 #define __GNUC__ 2 |
|
162 #endif |
190 #define __NO_CLASS_CONSTS__ |
163 #define __NO_CLASS_CONSTS__ |
191 #define __NORETURN__ __attribute__ ((noreturn)) |
164 #define __NORETURN__ __attribute__ ((noreturn)) |
192 #ifdef __GCCV3__ |
165 #ifdef __GCCV3__ |
193 #define __NORETURN_TERMINATOR() |
166 #define __NORETURN_TERMINATOR() |
194 #else |
167 #else |
195 #define __NORETURN_TERMINATOR() abort() |
168 #define __NORETURN_TERMINATOR() abort() |
196 #endif |
169 #endif |
197 #define IMPORT_C |
170 #define IMPORT_C |
|
171 #define IMPORT_D |
198 #if !defined __WINS__ && defined _WIN32 /* VC++ Browser Hack */ |
172 #if !defined __WINS__ && defined _WIN32 /* VC++ Browser Hack */ |
199 #define EXPORT_C |
173 #define EXPORT_C |
|
174 #define EXPORT_D |
200 /** @internalTechnology */ |
175 /** @internalTechnology */ |
201 #define asm(x) |
176 #define asm(x) |
202 #else |
177 #else |
203 #define EXPORT_C __declspec(dllexport) |
178 #define EXPORT_C __declspec(dllexport) |
|
179 #define EXPORT_D __declspec(dllexport) |
204 #endif |
180 #endif |
205 #define NONSHARABLE_CLASS(x) class x |
181 #define NONSHARABLE_CLASS(x) class x |
206 #define NONSHARABLE_STRUCT(x) struct x |
182 #define NONSHARABLE_STRUCT(x) struct x |
207 #define __NO_THROW |
183 #define __NO_THROW |
208 #define __THROW(t) |
184 #define __THROW(t) |
209 #ifdef __EABI__ |
185 #ifdef __EABI__ |
210 #define TEMPLATE_SPECIALIZATION template<> |
186 #define TEMPLATE_SPECIALIZATION template<> |
211 #else |
187 #else |
212 #define TEMPLATE_SPECIALIZATION |
188 #define TEMPLATE_SPECIALIZATION |
213 #endif |
189 #endif |
214 #endif |
|
215 |
|
216 |
|
217 |
|
218 #ifdef __GCC32__ |
|
219 /** |
190 /** |
220 @publishedAll |
191 @publishedAll |
221 @released |
192 @released |
222 */ |
193 */ |
223 #define __DOUBLE_WORDS_SWAPPED__ |
194 #define __DOUBLE_WORDS_SWAPPED__ |
224 #endif |
195 #endif |
225 |
|
226 |
196 |
227 |
197 |
228 /** @internalTechnology */ |
198 /** @internalTechnology */ |
229 #define __NO_MUTABLE_KEYWORD |
199 #define __NO_MUTABLE_KEYWORD |
230 #if defined(__NO_MUTABLE_KEYWORD) |
200 #if defined(__NO_MUTABLE_KEYWORD) |
1655 |
1617 |
1656 @see RAllocator::TAllocFail |
1618 @see RAllocator::TAllocFail |
1657 */ |
1619 */ |
1658 #define __UHEAP_CHECKFAILURE User::__DbgCheckFailure(FALSE) |
1620 #define __UHEAP_CHECKFAILURE User::__DbgCheckFailure(FALSE) |
1659 |
1621 |
1660 |
|
1661 |
|
1662 |
|
1663 /** |
|
1664 @publishedPartner |
|
1665 @released |
|
1666 |
|
1667 Marks the start of Kernel heap checking. |
|
1668 |
|
1669 Checking the Kernel heap is only useful when developing Kernel side code such |
|
1670 as device drivers and media drivers. |
|
1671 |
|
1672 This macro is defined only for debug builds. |
|
1673 |
|
1674 This macro must be matched by a corresponding call to __KHEAP_MARKEND or __KHEAP_MARKENDC. |
|
1675 Calls to this macro can be nested but each call must be matched by corresponding |
|
1676 call to __KHEAP_MARKEND or __KHEAP_MARKENDC. |
|
1677 |
|
1678 @see User::__DbgMarkStart() |
|
1679 @see __KHEAP_MARKEND |
|
1680 @see __KHEAP_MARKENDC |
|
1681 */ |
|
1682 #define __KHEAP_MARK User::__DbgMarkStart(TRUE) |
|
1683 |
|
1684 |
|
1685 |
|
1686 |
|
1687 /** |
|
1688 @publishedPartner |
|
1689 @released |
|
1690 |
|
1691 Checks that the number of allocated cells at the current nested level of the |
|
1692 Kernel heap is the same as the specified value. This macro is defined only |
|
1693 for debug builds. Checking the Kernel heap is only useful when developing |
|
1694 Kernel side code such as device drivers and media drivers. |
|
1695 |
|
1696 The macro also takes the name of the file containing this source code statement |
|
1697 and the line number of this source code statement; they are displayed as part |
|
1698 of the panic category, if the checks fail. |
|
1699 |
|
1700 @param aCount The number of heap cells expected to be allocated at |
|
1701 the current nest level. |
|
1702 |
|
1703 @see User::__DbgMarkCheck() |
|
1704 @see __UHEAP_CHECK |
|
1705 */ |
|
1706 #define __KHEAP_CHECK(aCount) User::__DbgMarkCheck(TRUE,FALSE,aCount,(TText8*)__FILE__,__LINE__) |
|
1707 |
|
1708 |
|
1709 |
|
1710 |
|
1711 /** |
|
1712 @publishedPartner |
|
1713 @released |
|
1714 |
|
1715 Checks that the total number of allocated cells on the Kernel heap is the same |
|
1716 as the specified value. |
|
1717 |
|
1718 It is only useful when developing Kernel side code such as device drivers |
|
1719 and media drivers. |
|
1720 |
|
1721 The macro also takes the name of the file containing this source code statement |
|
1722 and the line number of this source code statement; they are displayed as part |
|
1723 of the panic category, if the checks fail. |
|
1724 |
|
1725 This macro is defined only for debug builds. |
|
1726 |
|
1727 @param aCount The total number of heap cells expected to be allocated |
|
1728 |
|
1729 @see User::__DbgMarkCheck() |
|
1730 @see __UHEAP_CHECKALL |
|
1731 */ |
|
1732 #define __KHEAP_CHECKALL(aCount) User::__DbgMarkCheck(TRUE,TRUE,aCount,(TText8*)__FILE__,__LINE__) |
|
1733 |
|
1734 |
|
1735 |
|
1736 |
|
1737 /** |
|
1738 @publishedPartner |
|
1739 @released |
|
1740 |
|
1741 Marks the end of Kernel heap checking. The macro expects zero heap cells to |
|
1742 remain allocated at the current nest level. |
|
1743 |
|
1744 This macro is defined only for debug builds. Checking the Kernel heap is only |
|
1745 useful when developing Kernel side code such as device drivers and media drivers. |
|
1746 |
|
1747 This macro must match an earlier call to __KHEAP_MARK. |
|
1748 |
|
1749 @see User::__DbgMarkEnd() |
|
1750 @see __KHEAP_MARK |
|
1751 */ |
|
1752 #define __KHEAP_MARKEND User::__DbgMarkEnd(TRUE,0) |
|
1753 |
|
1754 |
|
1755 |
|
1756 |
|
1757 /** |
|
1758 @publishedPartner |
|
1759 @released |
|
1760 |
|
1761 Marks the end of Kernel heap checking. The macro expects aCount heap cells |
|
1762 to remain allocated at the current nest level. |
|
1763 |
|
1764 This macro is defined only for debug builds. |
|
1765 |
|
1766 This macro must match an earlier call to __KHEAP_MARK. |
|
1767 |
|
1768 @param aCount The number of heap cells expected to remain allocated at |
|
1769 the current nest level. |
|
1770 |
|
1771 @see User::__DbgMarkEnd() |
|
1772 @see __KHEAP_MARK |
|
1773 */ |
|
1774 #define __KHEAP_MARKENDC(aCount) User::__DbgMarkEnd(TRUE,aCount) |
|
1775 |
|
1776 |
|
1777 |
|
1778 |
|
1779 /** |
|
1780 @publishedPartner |
|
1781 @released |
|
1782 |
|
1783 Simulates Kernel heap allocation failure. The failure occurs on the next call |
|
1784 to new or any of the functions which allocate memory from the heap. This macro |
|
1785 is defined only for debug builds. |
|
1786 |
|
1787 Checking the Kernel heap is only useful when developing Kernel side code such |
|
1788 as device drivers and media drivers. |
|
1789 |
|
1790 @param aCount The rate of failure - heap allocation fails every aCount attempt. |
|
1791 |
|
1792 @see User::__DbgSetAllocFail() |
|
1793 */ |
|
1794 #define __KHEAP_FAILNEXT(aCount) User::__DbgSetAllocFail(TRUE,RAllocator::EFailNext,aCount) |
|
1795 |
|
1796 /** |
|
1797 @publishedPartner |
|
1798 @released |
|
1799 |
|
1800 Simulates Kernel heap allocation failures. aBurst failures will occur on the next call |
|
1801 to new or any of the functions which allocate memory from the heap. This macro |
|
1802 is defined only for debug builds. |
|
1803 |
|
1804 Checking the Kernel heap is only useful when developing Kernel side code such |
|
1805 as device drivers and media drivers. |
|
1806 |
|
1807 @param aCount The heap allocation will fail after aCount-1 allocation attempts. |
|
1808 Note when used with RHeap the maximum value aCount can be set |
|
1809 to is KMaxTUint16. |
|
1810 @param aBurst The number of allocations that will fail after aCount-1 allocation |
|
1811 attempts. Note when used with RHeap the maximum value aBurst can be |
|
1812 set to is KMaxTUint16. |
|
1813 |
|
1814 |
|
1815 @see User::__DbgSetBurstAllocFail() |
|
1816 */ |
|
1817 #define __KHEAP_BURSTFAILNEXT(aCount,aBurst) User::__DbgSetBurstAllocFail(TRUE,RAllocator::EBurstFailNext,aCount,aBurst) |
|
1818 |
|
1819 |
|
1820 /** |
|
1821 @publishedPartner |
|
1822 @released |
|
1823 |
|
1824 Simulates Kernel heap allocation failure. |
|
1825 |
|
1826 The failure occurs on subsequent calls to new or any of the functions which |
|
1827 allocate memory from this heap. |
|
1828 |
|
1829 This macro is defined only for debug builds. |
|
1830 |
|
1831 @param aType The type of failure to be simulated. |
|
1832 @param aRate The failure rate. |
|
1833 |
|
1834 @see RAllocator::TAllocFail |
|
1835 @see User::__DbgSetAllocFail() |
|
1836 */ |
|
1837 #define __KHEAP_SETFAIL(aType,aRate) User::__DbgSetAllocFail(TRUE,aType,aRate) |
|
1838 |
|
1839 /** |
|
1840 @publishedPartner |
|
1841 @released |
|
1842 |
|
1843 Simulates Kernel heap allocation failure. |
|
1844 |
|
1845 The failure occurs on subsequent calls to new or any of the functions which |
|
1846 allocate memory from this heap. |
|
1847 |
|
1848 This macro is defined only for debug builds. |
|
1849 |
|
1850 @param aType The type of failure to be simulated. |
|
1851 @param aRate The failure rate. Note when used with RHeap the maximum value |
|
1852 aRate can be set to is KMaxTUint16. |
|
1853 @param aBurst The number of consecutive allocations that will fail. Note |
|
1854 when used with RHeap the maximum value aBurst can be set to |
|
1855 is KMaxTUint16. |
|
1856 |
|
1857 @see RAllocator::TAllocFail |
|
1858 @see User::__DbgSetBurstAllocFail() |
|
1859 */ |
|
1860 #define __KHEAP_SETBURSTFAIL(aType,aRate,aBurst) User::__DbgSetBurstAllocFail(TRUE,aType,aRate,aBurst) |
|
1861 |
|
1862 |
|
1863 |
|
1864 /** |
|
1865 @publishedPartner |
|
1866 @released |
|
1867 |
|
1868 Cancels simulated Kernel heap allocation failure. |
|
1869 |
|
1870 Checking the Kernel heap is only useful when developing Kernel side code such |
|
1871 as device drivers and media drivers. |
|
1872 |
|
1873 This macro is defined only for debug builds. |
|
1874 |
|
1875 @see User::__DbgSetAllocFail() |
|
1876 */ |
|
1877 #define __KHEAP_RESET User::__DbgSetAllocFail(TRUE,RAllocator::ENone,1) |
|
1878 |
|
1879 |
|
1880 |
|
1881 |
|
1882 /** |
|
1883 @publishedPartner |
|
1884 @released |
|
1885 |
|
1886 Cancels simulated kernel heap allocation failure. |
|
1887 It walks the the heap and sets the nesting level for all allocated |
|
1888 cells to zero. |
|
1889 |
|
1890 Checking the kernel heap is only useful when developing kernel side code such |
|
1891 as device drivers and media drivers. |
|
1892 |
|
1893 This macro is defined only for debug builds. |
|
1894 */ |
|
1895 #define __KHEAP_TOTAL_RESET User::__DbgSetAllocFail(TRUE,RAllocator::EReset,1) |
|
1896 |
|
1897 /** |
1622 /** |
1898 @publishedAll |
1623 @publishedAll |
1899 @released |
1624 @released |
1900 |
1625 |
1901 Returns the number of kernel heap allocation failures the current debug |
1626 Returns the number of kernel heap allocation failures the current debug |
2486 |
2211 |
2487 @see RAllocator::TAllocFail |
2212 @see RAllocator::TAllocFail |
2488 */ |
2213 */ |
2489 #define __UHEAP_CHECKFAILURE ((TUint)0) |
2214 #define __UHEAP_CHECKFAILURE ((TUint)0) |
2490 |
2215 |
2491 |
|
2492 /** |
|
2493 @publishedPartner |
|
2494 @released |
|
2495 |
|
2496 Marks the start of Kernel heap checking. |
|
2497 |
|
2498 Checking the Kernel heap is only useful when developing Kernel side code such |
|
2499 as device drivers and media drivers. |
|
2500 |
|
2501 This macro is defined only for debug builds. |
|
2502 |
|
2503 This macro must be matched by a corresponding call to __KHEAP_MARKEND or __KHEAP_MARKENDC. |
|
2504 Calls to this macro can be nested but each call must be matched by corresponding |
|
2505 call to __KHEAP_MARKEND or __KHEAP_MARKENDC. |
|
2506 |
|
2507 @see User::__DbgMarkStart() |
|
2508 @see __KHEAP_MARKEND |
|
2509 @see __KHEAP_MARKENDC |
|
2510 */ |
|
2511 #define __KHEAP_MARK |
|
2512 |
|
2513 |
|
2514 |
|
2515 |
|
2516 /** |
|
2517 @publishedPartner |
|
2518 @released |
|
2519 |
|
2520 Checks that the number of allocated cells at the current nested level of the |
|
2521 Kernel heap is the same as the specified value. This macro is defined only |
|
2522 for debug builds. Checking the Kernel heap is only useful when developing |
|
2523 Kernel side code such as device drivers and media drivers. |
|
2524 |
|
2525 The macro also takes the name of the file containing this source code statement |
|
2526 and the line number of this source code statement; they are displayed as part |
|
2527 of the panic category, if the checks fail. |
|
2528 |
|
2529 @param aCount The number of heap cells expected to be allocated at |
|
2530 the current nest level. |
|
2531 |
|
2532 @see User::__DbgMarkCheck() |
|
2533 @see __UHEAP_CHECK |
|
2534 */ |
|
2535 #define __KHEAP_CHECK(aCount) |
|
2536 |
|
2537 |
|
2538 |
|
2539 |
|
2540 /** |
|
2541 @publishedPartner |
|
2542 @released |
|
2543 |
|
2544 Checks that the total number of allocated cells on the Kernel heap is the same |
|
2545 as the specified value. |
|
2546 |
|
2547 It is only useful when developing Kernel side code such as device drivers |
|
2548 and media drivers. |
|
2549 |
|
2550 The macro also takes the name of the file containing this source code statement |
|
2551 and the line number of this source code statement; they are displayed as part |
|
2552 of the panic category, if the checks fail. |
|
2553 |
|
2554 This macro is defined only for debug builds. |
|
2555 |
|
2556 @param aCount The total number of heap cells expected to be allocated |
|
2557 |
|
2558 @see User::__DbgMarkCheck() |
|
2559 @see __UHEAP_CHECKALL |
|
2560 */ |
|
2561 #define __KHEAP_CHECKALL(aCount) |
|
2562 |
|
2563 |
|
2564 |
|
2565 |
|
2566 /** |
|
2567 @publishedPartner |
|
2568 @released |
|
2569 |
|
2570 Marks the end of Kernel heap checking. The macro expects zero heap cells to |
|
2571 remain allocated at the current nest level. |
|
2572 |
|
2573 This macro is defined only for debug builds. Checking the Kernel heap is only |
|
2574 useful when developing Kernel side code such as device drivers and media drivers. |
|
2575 |
|
2576 This macro must match an earlier call to __KHEAP_MARK. |
|
2577 |
|
2578 @see User::__DbgMarkEnd() |
|
2579 @see __KHEAP_MARK |
|
2580 */ |
|
2581 #define __KHEAP_MARKEND |
|
2582 |
|
2583 |
|
2584 |
|
2585 |
|
2586 /** |
|
2587 @publishedPartner |
|
2588 @released |
|
2589 |
|
2590 Marks the end of Kernel heap checking. The macro expects aCount heap cells |
|
2591 to remain allocated at the current nest level. |
|
2592 |
|
2593 This macro is defined only for debug builds. |
|
2594 |
|
2595 This macro must match an earlier call to __KHEAP_MARK. |
|
2596 |
|
2597 @param aCount The number of heap cells expected to remain allocated at |
|
2598 the current nest level. |
|
2599 |
|
2600 @see User::__DbgMarkEnd() |
|
2601 @see __KHEAP_MARK |
|
2602 */ |
|
2603 #define __KHEAP_MARKENDC(aCount) |
|
2604 |
|
2605 |
|
2606 |
|
2607 |
|
2608 /** |
|
2609 @publishedPartner |
|
2610 @released |
|
2611 |
|
2612 Simulates Kernel heap allocation failure. The failure occurs on the next call |
|
2613 to new or any of the functions which allocate memory from the heap. This macro |
|
2614 is defined only for debug builds. |
|
2615 |
|
2616 Checking the Kernel heap is only useful when developing Kernel side code such |
|
2617 as device drivers and media drivers. |
|
2618 |
|
2619 @param aCount The rate of failure - heap allocation fails every aCount attempt. |
|
2620 |
|
2621 @see User::__DbgSetAllocFail() |
|
2622 */ |
|
2623 #define __KHEAP_FAILNEXT(aCount) |
|
2624 |
|
2625 /** |
|
2626 @publishedPartner |
|
2627 @released |
|
2628 |
|
2629 Simulates Kernel heap allocation failures. aBurst failures will occur on the next call |
|
2630 to new or any of the functions which allocate memory from the heap. This macro |
|
2631 is defined only for debug builds. |
|
2632 |
|
2633 Checking the Kernel heap is only useful when developing Kernel side code such |
|
2634 as device drivers and media drivers. |
|
2635 |
|
2636 @param aCount The heap allocation will fail after aCount-1 allocation attempts. |
|
2637 Note when used with RHeap the maximum value aCount can be set |
|
2638 to is KMaxTUint16. |
|
2639 @param aBurst The number of allocations that will fail after aCount-1 allocation |
|
2640 attempts. Note when used with RHeap the maximum value aBurst can |
|
2641 be set to is KMaxTUint16. |
|
2642 |
|
2643 @see User::__DbgSetBurstAllocFail() |
|
2644 */ |
|
2645 #define __KHEAP_BURSTFAILNEXT(aCount,aBurst) |
|
2646 |
|
2647 |
|
2648 |
|
2649 /** |
|
2650 @publishedPartner |
|
2651 @released |
|
2652 |
|
2653 Simulates Kernel heap allocation failure. |
|
2654 |
|
2655 The failure occurs on subsequent calls to new or any of the functions which |
|
2656 allocate memory from this heap. |
|
2657 |
|
2658 This macro is defined only for debug builds. |
|
2659 |
|
2660 @param aType The type of failure to be simulated. |
|
2661 @param aRate The failure rate. |
|
2662 |
|
2663 @see User::__DbgSetAllocFail() |
|
2664 */ |
|
2665 #define __KHEAP_SETFAIL(aType,aRate) |
|
2666 |
|
2667 /** |
|
2668 @publishedPartner |
|
2669 @released |
|
2670 |
|
2671 Simulates Kernel heap allocation failure. |
|
2672 |
|
2673 The failure occurs on subsequent calls to new or any of the functions which |
|
2674 allocate memory from this heap. |
|
2675 |
|
2676 This macro is defined only for debug builds. |
|
2677 |
|
2678 @param aType The type of failure to be simulated. |
|
2679 @param aRate The failure rate. Note when used with RHeap the maximum value |
|
2680 aRate can be set to is KMaxTUint16. |
|
2681 @param aBurst The number of consecutive allocations that will fail. Note |
|
2682 when used with RHeap the maximum value aBurst can be set |
|
2683 to is KMaxTUint16. |
|
2684 |
|
2685 @see User::__DbgSetBurstAllocFail() |
|
2686 */ |
|
2687 #define __KHEAP_SETBURSTFAIL(aType,aRate,aBurst) |
|
2688 |
|
2689 |
|
2690 |
|
2691 /** |
|
2692 @publishedPartner |
|
2693 @released |
|
2694 |
|
2695 Cancels simulated Kernel heap allocation failure. |
|
2696 |
|
2697 Checking the Kernel heap is only useful when developing Kernel side code such |
|
2698 as device drivers and media drivers. |
|
2699 |
|
2700 This macro is defined only for debug builds. |
|
2701 |
|
2702 @see User::__DbgSetAllocFail() |
|
2703 */ |
|
2704 #define __KHEAP_RESET |
|
2705 |
|
2706 |
|
2707 |
|
2708 /** |
|
2709 @publishedPartner |
|
2710 @released |
|
2711 |
|
2712 Cancels simulated kernel heap allocation failure. |
|
2713 It walks the the heap and sets the nesting level for all allocated |
|
2714 cells to zero. |
|
2715 |
|
2716 Checking the kernel heap is only useful when developing kernel side code such |
|
2717 as device drivers and media drivers. |
|
2718 |
|
2719 This macro is defined only for debug builds. |
|
2720 */ |
|
2721 #define __KHEAP_TOTAL_RESET |
|
2722 |
|
2723 |
|
2724 /** |
2216 /** |
2725 @publishedAll |
2217 @publishedAll |
2726 @released |
2218 @released |
2727 |
2219 |
2728 Returns the number of kernel heap allocation failures the current debug |
2220 Returns the number of kernel heap allocation failures the current debug |