source: project/chicken/trunk/apply-hack.sparc64.s @ 12937

Last change on this file since 12937 was 12937, checked in by felix winkelmann, 12 years ago

updateed copyright

File size: 2.3 KB
Line 
1/* apply-hack.ppc.s
2;
3; Copyright (c) 2008-2009, Peter Bex
4; All rights reserved.
5;
6; Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
7; conditions are met:
8;
9;   Redistributions of source code must retain the above copyright notice, this list of conditions and the following
10;     disclaimer.
11;   Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
12;     disclaimer in the documentation and/or other materials provided with the distribution.
13;   Neither the name of the author nor the names of its contributors may be used to endorse or promote
14;     products derived from this software without specific prior written permission.
15;
16; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
17; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
18; AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
19; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24; POSSIBILITY OF SUCH DAMAGE.
25*/
26
27        .text
28
29        .globl  _C_do_apply_hack
30        .align  8
31        .equ    BIAS, 2047
32       
33_C_do_apply_hack:
34        mov     %o1, %g4      /* buf */
35        sllx    %o2, 3, %o2   /* o2 <- count, in bytes */
36        subcc   %o2, 6*8, %o2 /* 6 params are in registers */
37        bg      l0
38        mov     %o0, %g1      /* proc (delay slot) */
39        udivx   %o2, -2, %o2  /* Offset in quads -> offset in words from l2 */
40        setx    l2, %o3, %o1
41        jmp     %o1+%o2
42        nop
43        /* Rest args on stack if > 6 args */
44l0:     sub     %sp, %o2, %sp /* Alloc space for additional args */
45        clr     %o1
46        add     %sp, BIAS+176, %o5
47        add     %g4, 6*8, %o3 /* 7th arg and up */
48l1:     ldx     [%o3], %o4
49        stx     %o4, [%o5+%o1]
50        add     %o1, 8, %o1
51        cmp     %o1, %o2
52        bl      l1
53        add     %o3, 8, %o3   /* (delay slot) */
54l2:     ldx     [%g4+40], %o5
55        ldx     [%g4+32], %o4
56        ldx     [%g4+24], %o3
57        ldx     [%g4+16], %o2
58        ldx     [%g4+8], %o1
59        ldx     [%g4+0], %o0
60       
61        jmp     %g1
62        nop
Note: See TracBrowser for help on using the repository browser.