powerpc.c

Go to the documentation of this file.
00001 /*
00002  * QuickThreads -- Threads-building toolkit.
00003  * Copyright (c) 1993 by David Keppel
00004  *
00005  * Permission to use, copy, modify and distribute this software and
00006  * its documentation for any purpose and without fee is hereby
00007  * granted, provided that the above copyright notice and this notice
00008  * appear in all copies.  This software is provided as a
00009  * proof-of-concept and for demonstration purposes; there is no
00010  * representation about the suitability of this software for any
00011  * purpose.
00012  */
00013 
00014 
00015 #include <stdarg.h>
00016 #include "qt.h"
00017 
00018 // This static is used to find the end of the stack for variable
00019 
00020 static void *qt_sp_bottom_save;
00021 
00022 /* We actually don't know how the compiler accomodates arguments in the 
00023  * va_list. In some implementation (e.g. Linux PPC) we cannot scan the
00024  * list as an array. To avoid this problem, this version of "qt_varg",
00025  * retrieves arguments by means of the standard "va_arg" macro defined
00026  * in stdargs.h.
00027  *
00028  * Notice that we still suppose that the number of arguments is given
00029  * by nbytes/sizeof(qt_word_t) and we load the stack of "qt_vstart"
00030  * assuming that all parameters are alligned to the size of qt_word_t.
00031  *
00032  * Marco Bucci <marco.bucci@inwind.it>
00033  * December 2002
00034  */
00035 
00036 /*
00037 
00038 qt_t *qt_vargs (qt_t *sp, int nbytes, void *vargs,
00039       void *pt, qt_startup_t *startup,
00040       qt_vuserf_t *vuserf, qt_cleanup_t *cleanup)
00041       
00042 */
00043 
00044   qt_t *
00045 qt_vargs_stdarg (qt_t *sp, int nbytes, va_list vargs,
00046       void *pt, qt_startup_t *startup,
00047       qt_vuserf_t *vuserf, qt_cleanup_t *cleanup)
00048       
00049       
00050     
00051 {
00052     int i;
00053     qt_word_t arg;
00054 
00055     sp = QUICKTHREADS_VARGS_MD0 (sp, nbytes);
00056 
00057     for ( i=0;i<(int)(nbytes/sizeof(qt_word_t)); i++)
00058     {
00059         arg = va_arg(vargs, qt_word_t);
00060         QUICKTHREADS_SPUT (QUICKTHREADS_VARGS_ADJUST(sp), i, arg);
00061     }
00062 
00063     QUICKTHREADS_VARGS_MD1 (QUICKTHREADS_VADJ(sp));
00064     QUICKTHREADS_SPUT (QUICKTHREADS_VADJ(sp), QUICKTHREADS_VARGT_INDEX, pt);
00065     QUICKTHREADS_SPUT (QUICKTHREADS_VADJ(sp), QUICKTHREADS_VSTARTUP_INDEX, startup);
00066     QUICKTHREADS_SPUT (QUICKTHREADS_VADJ(sp), QUICKTHREADS_VUSERF_INDEX, vuserf);
00067     QUICKTHREADS_SPUT (QUICKTHREADS_VADJ(sp), QUICKTHREADS_VCLEANUP_INDEX, cleanup);
00068     return ((qt_t *)QUICKTHREADS_VADJ(sp));
00069 }

Generated on Wed Jan 21 15:32:10 2009 for SystemC by  doxygen 1.5.5