2 * QuickThreads -- Threads-building toolkit.
3 * Copyright (c) 1993 by David Keppel
4 * Copyright (c) 2002 by Marius Vollmer
6 * Permission to use, copy, modify and distribute this software and
7 * its documentation for any purpose and without fee is hereby
8 * granted, provided that the above copyright notice and this notice
9 * appear in all copies. This software is provided as a
10 * proof-of-concept and for demonstration purposes; there is no
11 * representation about the suitability of this software for any
18 typedef unsigned long qt_word_t;
22 /* Stack layout on the ARM:
24 Callee-save registers are: r4-r11 (f4-f7)
25 Also save r14, link register, and restore as pc.
36 | r4 <- sp of a suspended thread
45 | argu <- sp on entry to qt_start
60 /* Stack must be word aligned. */
61 #define QT_STKALIGN (4) /* Doubleword aligned. */
63 /* How much space is allocated to hold all the crud for
64 initialization: r4-r11, r14, and the four args for qt_start. */
66 #define QT_STKBASE ((9+4)*4)
69 /* Offsets of various registers, in words, relative to final value of SP. */
81 /* When a never-before-run thread is restored, the return pc points
82 to a fragment of code that starts the thread running. For
83 non-vargs functions, it just calls the client's `only' function.
86 extern void qt_start(void);
87 #define QT_ARGS_MD(sp) (QT_SPUT (sp, QT_LR, qt_start))
90 /* The *index* (positive offset) of where to put each value. */
91 #define QT_ONLY_INDEX (12)
92 #define QT_USER_INDEX (11)
93 #define QT_ARGT_INDEX (10)
94 #define QT_ARGU_INDEX (9)
96 #endif /* ndef QT_ARM_H */