Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / obp / obp / cpu / sparc / doccall.fth
CommitLineData
920dae64
AT
1\ ========== Copyright Header Begin ==========================================
2\
3\ Hypervisor Software File: doccall.fth
4\
5\ Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
6\
7\ - Do no alter or remove copyright notices
8\
9\ - Redistribution and use of this software in source and binary forms, with
10\ or without modification, are permitted provided that the following
11\ conditions are met:
12\
13\ - Redistribution of source code must retain the above copyright notice,
14\ this list of conditions and the following disclaimer.
15\
16\ - Redistribution in binary form must reproduce the above copyright notice,
17\ this list of conditions and the following disclaimer in the
18\ documentation and/or other materials provided with the distribution.
19\
20\ Neither the name of Sun Microsystems, Inc. or the names of contributors
21\ may be used to endorse or promote products derived from this software
22\ without specific prior written permission.
23\
24\ This software is provided "AS IS," without a warranty of any kind.
25\ ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
26\ INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
27\ PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
28\ MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
29\ ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
30\ DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN
31\ OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR
32\ FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
33\ DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
34\ ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
35\ SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
36\
37\ You acknowledge that this software is not designed, licensed or
38\ intended for use in the design, construction, operation or maintenance of
39\ any nuclear facility.
40\
41\ ========== Copyright Header End ============================================
42\ doccall.fth 2.4 94/08/13
43\ Copyright 1985-1990 Bradley Forthware
44
45\ Shared code for ccall interface. This file is used in conjunction with
46\ ccall.fth. The 2 files are separate because the code in this file must
47\ be resident, while the code in ccall.fth can be transient.
48\
49\ do-ccall is a shared subroutine which is called from code generated by
50\ "ccall". The calling sequence looks like:
51\
52\ <code to transfer arguments from the stack to registers>
53\ sethi %hi(c_entry_point), %l0
54\ call do-ccall
55\ or %l0, %lo(c_entry_point), %l0
56\ <code to push results, if any, on the stack>
57
58label do-ccall \ Subroutine address in %l0, return address in %o7
59
60 sp 'user saved-sp nput \ Save for callbacks
61 rp 'user saved-rp nput \ Save for callbacks
62
63 %o7 %l1 move \ Exchange %l0 and %o7
64 %l0 %o7 move
65 %l1 %l0 move
66
67 \ Save the globals in case C changes them
68 %g1 %l1 move
69 %g2 %l2 move
70 %g3 %l3 move
71 %g4 %l4 move
72 %g5 %l5 move
73 %g6 %l6 move
74 %o7 0 %o7 jmpl
75 %g7 %l7 move \ Delay slot
76
77 \ Restore the globals
78 %l1 %g1 move
79 %l2 %g2 move
80 %l3 %g3 move
81 %l4 %g4 move
82 %l5 %g5 move
83 %l6 %g6 move
84 %l0 8 %g0 jmpl \ Return
85 %l7 %g7 move
86end-code