1/* 2 Title: rtsentry.h - Entry points to the run-time system 3 4 Copyright (c) 2016 David C. J. Matthews 5 6 This library is free software; you can redistribute it and/or 7 modify it under the terms of the GNU Lesser General Public 8 License version 2.1 as published by the Free Software Foundation. 9 10 This library is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 Lesser General Public License for more details. 14 15 You should have received a copy of the GNU Lesser General Public 16 License along with this library; if not, write to the Free Software 17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 19*/ 20 21#ifndef RTSENTRY_H_INCLUDED 22#define RTSENTRY_H_INCLUDED 23class SaveVecEntry; 24class TaskData; 25class PolyObject; 26 27typedef SaveVecEntry *Handle; 28 29extern Handle creatEntryPointObject(TaskData *taskData, Handle entryH, bool isFuncPtr); 30extern const char *getEntryPointName(PolyObject *p, bool *isFuncPtr); 31extern bool setEntryPoint(PolyObject *p); 32 33typedef void (*polyRTSFunction)(); 34 35typedef struct _entrypts { 36 const char *name; 37 polyRTSFunction entry; 38} *entrypts; 39 40// Ensure that the RTS calls can be found by the linker. 41#ifndef POLYEXTERNALSYMBOL 42#ifdef _MSC_VER 43#define POLYEXTERNALSYMBOL __declspec(dllexport) 44#else 45#define POLYEXTERNALSYMBOL 46#endif 47#endif 48 49#ifdef POLYML32IN64 50// This is needed for legacy only. RTS calls previously passed the 51// real address of the thread ID. They now pass a PolyWord containing 52// the thread ID. 53// Once we've fully bootstrapped FirstArgument can be replaced with PolyWord. 54union firstArgFull 55{ 56 operator PolyWord() 57 { if (value >= 0x100000000) return (PolyWord)((PolyObject*)value); else return PolyWord::FromUnsigned((POLYUNSIGNED)value); } 58 uintptr_t value; 59}; 60typedef union firstArgFull FirstArgument; 61#else 62typedef PolyWord FirstArgument; 63#endif 64 65#endif 66