source: branches/arm/lisp-kernel/arm-subprims.s @ 13789

Last change on this file since 13789 was 13789, checked in by gb, 9 years ago

Lots of (mostly small) changes.

File size: 2.8 KB
Line 
1/*   Copyright (C) 2010 Clozure Associates */
2/*   This file is part of Clozure CL.  */
3
4/*   Clozure CL is licensed under the terms of the Lisp Lesser GNU Public */
5/*   License , known as the LLGPL and distributed with Clozure CL as the */
6/*   file "LICENSE".  The LLGPL consists of a preamble and the LGPL, */
7/*   which is distributed with Clozure CL as the file "LGPL".  Where these */
8/*   conflict, the preamble takes precedence.   */
9
10/*   Clozure CL is referenced in the preamble as the "LIBRARY." */
11
12/*   The LLGPL is also available online at */
13/*   http://opensource.franz.com/preamble.html */
14
15
16        .syntax unified
17        .arm
18       
19        include(lisp.s)
20        _beginfile
21
22        .globl _SPmkcatch1v
23        .globl _SPnthrow1value
24
25
26/* This is called from a lisp-style context and calls a lisp function. */
27/* This does the moral equivalent of */
28/*   (loop  */
29/*      (let* ((fn (%function_on_top_of_lisp_stack))) */
30/*        (if fn */
31/*           (catch %toplevel-catch% */
32/*             (funcall fn)) */
33/*            (return nil)))) */
34
35_exportfn(toplevel_loop)
36        __(build_lisp_frame(imm0))
37        __(b local_label(test))
38local_label(loop):
39        __(ref_nrs_value(arg_z,toplcatch))
40        __(bl _SPmkcatch1v)     /* preserves nfn, at the moment */
41        __(b local_label(test)) /* cleanup address, not really a branch */
42        __(set_nargs(0))
43        __(funcall_nfn())
44        __(mov arg_z,#nil_value)
45        __(mov imm0,fixnum_one)
46        __(bl _SPnthrow1value)
47local_label(test):
48        __(ldr nfn,[vsp,#0])
49        __(cmp nfn,#nil_value)
50        __(bne local_label(loop))
51        __(return_lisp_frame(imm0))
52        _endfn
53
54
55/* This gets called with R3 pointing to the current TCR. */
56/* r4 is 0 if we want to start the whole thing rolling, */
57/* non-zero if we want to reset the current process */
58/* by throwing to toplevel */
59
60        .globl _SPreset
61_exportfn(C(start_lisp))
62        __(stmdb sp!,{r4,r5,r6,r7,r8,r9,r10,r11,r12,lr})
63        __(mov rcontext,r0)
64        __(mov arg_z,#0)
65        __(mov arg_y,#0)
66        __(mov arg_x,#0)
67        __(mov temp0,#0)
68        __(mov temp1,#0)
69        __(mov temp2,#0)
70        __(mov allocptr,#VOID_ALLOCPTR)
71        __(mov fn,#0)
72        __(ldr vsp,[rcontext,#tcr.save_vsp])
73        __(ldr imm2,[rcontext,#tcr.last_lisp_frame])
74        __(sub imm0,imm2,sp)
75        __(add imm0,imm0,#node_size)
76        __(mov imm0,imm0,lsl #num_subtag_bits-word_shift)
77        __(orr imm0,imm0,#subtag_u32_vector)
78        __(stmdb sp!,{imm0,imm2})
79        __(mov imm0,#TCR_STATE_LISP)
80        __(str imm0,[rcontext,#tcr.valence])
81        __(ldr allocptr,[rcontext,#tcr.save_allocptr])
82        __(bl toplevel_loop)
83        __(ldmia sp!,{imm0,imm1})
84        __(mov imm0,#TCR_STATE_FOREIGN)
85        __(str imm1,[rcontext,#tcr.last_lisp_frame])
86        __(str imm0,[rcontext,#tcr.valence])
87        __(mov imm0,#nil_value)
88        __(ldmia sp!,{r4,r5,r6,r7,r8,r9,r10,r11,r12,lr})
89        __(bx lr)
90
91_exportfn(_SPsp_end)
92        __(nop)
93        _endfile
94
Note: See TracBrowser for help on using the repository browser.