Merge commit 'origin/master' into vm
[bpt/guile.git] / qt / md / arm.h
CommitLineData
f9482b31
MV
1/*
2 * QuickThreads -- Threads-building toolkit.
3 * Copyright (c) 1993 by David Keppel
4 * Copyright (c) 2002 by Marius Vollmer
5 *
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
12 * purpose.
13 */
14
15#ifndef QT_ARM_H
16#define QT_ARM_H
17
18typedef unsigned long qt_word_t;
19
20#define QT_GROW_DOWN
21
22/* Stack layout on the ARM:
23
24 Callee-save registers are: r4-r11 (f4-f7)
25 Also save r14, link register, and restore as pc.
26
27 +---
28 | lr/pc
29 | r11
30 | r10
31 | r9
32 | r8
33 | r7
34 | r6
35 | r5
36 | r4 <- sp of a suspended thread
37 +---
38
39 Startup:
40
41 +---
42 | only
43 | user
44 | argt
45 | argu <- sp on entry to qt_start
46 +---
47 | pc == qt_start
48 | r11
49 | r10
50 | r9
51 | r8
52 | r7
53 | r6
54 | r5
55 | r4
56 +---
57
58*/
59
60/* Stack must be word aligned. */
61#define QT_STKALIGN (4) /* Doubleword aligned. */
62
63/* How much space is allocated to hold all the crud for
64 initialization: r4-r11, r14, and the four args for qt_start. */
65
66#define QT_STKBASE ((9+4)*4)
67
68
69/* Offsets of various registers, in words, relative to final value of SP. */
70#define QT_LR 8
71#define QT_11 7
72#define QT_10 6
73#define QT_9 5
74#define QT_8 4
75#define QT_7 3
76#define QT_6 2
77#define QT_5 1
78#define QT_4 0
79
80
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.
84 */
85
86extern void qt_start(void);
87#define QT_ARGS_MD(sp) (QT_SPUT (sp, QT_LR, qt_start))
88
89
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)
95
96#endif /* ndef QT_ARM_H */