1 ! lib1funcs.S for picoJava.
2 ! Copyright (C) 2000, 2001 Free Software Foundation, Inc.
4 ! This file is free software; you can redistribute it and/or modify it
5 ! under the terms of the GNU General Public License as published by the
6 ! Free Software Foundation; either version 2, or (at your option) any
9 ! In addition to the permissions in the GNU General Public License, the
10 ! Free Software Foundation gives you unlimited permission to link the
11 ! compiled version of this file into combinations with other programs,
12 ! and to distribute those combinations without any restriction coming
13 ! from the use of this file. (The General Public License restrictions
14 ! do apply in other respects; for example, they cover modification of
15 ! the file, and distribution when not linked into a combine
18 ! This file is distributed in the hope that it will be useful, but
19 ! WITHOUT ANY WARRANTY; without even the implied warranty of
20 ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 ! General Public License for more details.
23 ! You should have received a copy of the GNU General Public License
24 ! along with this program; see the file COPYING. If not, write to
25 ! the Free Software Foundation, 59 Temple Place - Suite 330,
26 ! Boston, MA 02111-1307, USA.
32 ! The vhelper copies unnamed args in a varargs function from the
33 ! opstack onto the aggregate stack. It is a bit tricky since the
34 ! opstack does not exist in real memory, so can not have its address taken,
35 ! and since the opstack is being played with, there is nowhere to stick
54 ! work out total size everything below the named args and
55 ! allocate that space on the aggregate stack + 3 extra words
60 ! g0+12 = last unnamed arg
66 ! tos = #named args provided by callee.
68 ! move down the aggstack to make room for all the unnamed args
69 ! and the 12 bytes of extra stuff we have to pay attention to.
70 ! g0 = old_g0 - ((vars - optop) + named_bytes + 12) - stuff we just pushed
76 isub ! tos = vars - optop (# bytes in all args)
78 isub ! subtract out fudge for current stuff on stack.
80 isub ! subtract out # words named.
85 ! store old global0 in new global0 spot.
91 ! store new global0 value into global0
94 ! work out address to stop copying, which is vars - #named args bytes
95 ! but since we will have pushed stuff onto the stack when the comparison
96 ! is made, adjust by the fudge factor.
103 ! optop= finish, vars, pc, ...
104 ! now pop off args from the opstack and copy to aggstack till all done.
105 ! during the loop the opstack looks like
106 ! (optop_finish_addr) (destination_addr) (named_n) (named_n-1) ....
107 ! each iteration pops off one more element.
121 dup2_x1 ; pop2 ; pop !leave pointer on top.
123 ! return to caller with varargs pointer as
124 ! the next argument and the restoring global0 as the next.
126 read_global0 ; load_word
128 ! restore returning pc and vars
129 read_global0 ; bipush 8; iadd; load_word
130 read_global0 ; bipush 4; iadd; load_word
138 #ifdef __LITTLE_ENDIAN__
151 ! like ucmpdi2, but returns <0,0,>0 depending on comparison input.
152 ! and returns answer on the stack, not in global1. - much like an
153 ! actual lucmp instruction would do if there was one.
156 ! vars-> 0 a low high
169 ! first see if we can compare the numbers using
170 ! the signed instruction.
174 if_icmpne high_words_diff
180 ! and low word if high word is equal.