Browse Source

fix arg nesting flaw on arm

mntmn 9 years ago
parent
commit
febe112c04
3 changed files with 9 additions and 5 deletions
  1. 1 1
      devices/posixfs.c
  2. 4 2
      sledge/compiler_new.c
  3. 4 2
      sledge/tests/font.l

+ 1 - 1
devices/posixfs.c

@@ -35,7 +35,7 @@ Cell* posixfs_open(Cell* cpath) {
         fseek(f, 0L, SEEK_SET);
         
         printf("[posixfs] trying to read file of len %d…\r\n",len);
-        Cell* res = alloc_num_string(len);
+        Cell* res = alloc_num_bytes(len);
         int read_len = fread(res->addr, len, 1, f);
         // TODO: close?
         _file_cell = res;

+ 4 - 2
sledge/compiler_new.c

@@ -359,7 +359,7 @@ int compile_expr(Cell* expr, Frame* frame, int return_type) {
         if (argi>0) {
           // save registers
           // FIXME RETHINK
-          jit_push(R1,R1+argi-1);
+          jit_push(ARGR0,ARGR0+argi-1);
           frame->sp+=(1+argi-1);
         }
         given_tag = compile_expr(arg, frame, signature_arg->value);
@@ -377,7 +377,7 @@ int compile_expr(Cell* expr, Frame* frame, int return_type) {
         }
         
         if (argi>0) {
-          jit_pop(R1,R1+argi-1);
+          jit_pop(ARGR0,ARGR0+argi-1);
           frame->sp-=(1+argi-1);
         }
       }
@@ -941,7 +941,9 @@ int compile_expr(Cell* expr, Frame* frame, int return_type) {
     }
     case BUILTIN_OPEN: {
       load_cell(ARGR0,argdefs[0], frame);
+      push_frame_regs(frame->f);
       jit_call(fs_open,"fs_open");
+      pop_frame_regs(frame->f);
       break;
     }
     case BUILTIN_RECV: {

+ 4 - 2
sledge/tests/font.l

@@ -1,8 +1,7 @@
 (def fb (mmap "/framebuffer"))
 
 (def f (open "/sd/unifont.565"))
-
-(do (def unifont (recv f)) 0)
+(def unifont (recv f))
 
 (def unifont-pitch 8256)
 
@@ -14,11 +13,14 @@
   (print (cons sx sy))
   (let so (+ (* sx 2) (* sy unifont-pitch)))
   (let do (+ (*  x 2) (*  y screen-pitch)))
+  (print (list "sx" sx "sx*2" (* sx 2) "sy*up" (* sy unifont-pitch)))
+  (print (list "so" so "do" do))
   (let iy 0)
   
   (while (lt iy 16) (do
     (let ix 0)
     (while (lt ix 32) (do
+      (print (list "line" iy "so" so "ix" ix))
       (let c (get unifont (+ so ix)))
       (put fb (+ do ix) c)
       (put fb (+ (+ do ix) 1) c)