Chameleon

Chameleon Svn Source Tree

Root/branches/ErmaC/Trunk/i386/modules/uClibcxx/support.cpp

1/*Copyright (C) 2004 Garrett A. Kajmowicz
2
3This file is part of the uClibc++ Library.
4
5This library is free software; you can redistribute it and/or
6modify it under the terms of the GNU Lesser General Public
7License as published by the Free Software Foundation; either
8version 2.1 of the License, or (at your option) any later version.
9
10This library is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13Lesser General Public License for more details.
14
15You should have received a copy of the GNU Lesser General Public
16License along with this library; if not, write to the Free Software
17Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18*/
19
20#include <support>
21#ifdef __UCLIBCXX_EXCEPTION_SUPPORT__
22extern "C" void *__cxa_allocate_exception(size_t thrown_size)
23{
24void * retval;
25
26/*The amount of data needed is the size of the object *PLUS*
27the size of the header. The header is of struct __cxa_exception
28The address needs to be adjusted because the pointer we return
29should not point to the start of the memory, but to the point
30where the object being thrown actually starts*/
31
32retval = malloc(thrown_size + sizeof(__cxa_exception));
33
34//Check to see that we actuall allocated memory
35if(retval == 0){
36std::terminate();
37}
38
39//Need to do a typecast to char* otherwize we are doing math with
40//a void* which makes the compiler cranky (Like me)
41return ((char *)retval + sizeof(__cxa_exception));
42}
43
44extern "C" void __cxa_free_exception(void *thrown_exception){
45
46
47
48}
49
50extern "C" void __cxa_throw (void *thrown_exception, std::type_info *tinfo,void (*dest) (void *) ){
51
52}
53#endif
54
55

Archive Download this file

Revision: 1622