1 /*---------------------------------------------------------------------------* 2 Project: OS API 3 File: OSCoroutine.h 4 5 Copyright 1998-2010 Nintendo. All rights reserved. 6 7 These coded instructions, statements, and computer programs contain 8 proprietary information of Nintendo of America Inc. and/or Nintendo 9 Company Ltd., and are protected by Federal copyright law. They may 10 not be disclosed to third parties or copied or duplicated in any form, 11 in whole or in part, without the prior written consent of Nintendo. 12 13 *---------------------------------------------------------------------------*/ 14 15 #ifndef __OSCOROUTINE_H__ 16 #define __OSCOROUTINE_H__ 17 18 #ifdef __cplusplus 19 extern "C" { 20 #endif 21 22 #define VOLATILE_REG_NUM 14 23 #define NONVOLATILE_REG_NUM 18 24 25 typedef struct 26 { 27 u32 lr; 28 u32 cr; 29 u32 gqr1; 30 u32 r1; // stack pointer (sp) 31 u32 r2; // read-only small data 32 u32 r13; // read-write small data 33 u32 gpr[NONVOLATILE_REG_NUM]; 34 f64 fpr[NONVOLATILE_REG_NUM]; 35 f64 psr[NONVOLATILE_REG_NUM]; 36 } OSCoroutine; 37 38 void OSInitCoroutine(OSCoroutine *coroutine, void *pc, void *sp); 39 void OSLoadCoroutine(OSCoroutine *coroutine, void *retval); 40 void* OSSaveCoroutine(OSCoroutine *coroutine); 41 void OSSwitchCoroutine(OSCoroutine *current, OSCoroutine *next); 42 43 44 #ifdef __cplusplus 45 } 46 #endif 47 48 #endif // __OSCOROUTINE_H__ 49