Browse Source

fix arm/rpi2 build

mntmn 8 years ago
parent
commit
8d5c8de190
2 changed files with 21 additions and 3 deletions
  1. 3 3
      devices/rpi2/main_rpi2.c
  2. 18 0
      sledge/jit_arm_raw.c

+ 3 - 3
devices/rpi2/main_rpi2.c

@@ -240,16 +240,16 @@ Cell* platform_eval(Cell* expr) {
     code = malloc(CODESZ);
     memset(code, 0, CODESZ);
     jit_init(0x400);
-    register void* sp asm ("sp"); // FIXME maybe unportable
+    register void* sp asm ("sp");
     Frame empty_frame = {NULL, 0, 0, sp};
-    int tag = compile_expr(c, &empty_frame, TAG_ANY);
+    Cell* res = compile_expr(c, &empty_frame, prototype_any);
 
     arm_dmb();
     arm_isb();
     arm_dsb();
     printf("compiled %d\r\n",i);
   
-    if (tag) {
+    if (res) {
       jit_ret();
       funcptr fn = (funcptr)code;
       //printf("~~ fn at %p\r\n",fn);

+ 18 - 0
sledge/jit_arm_raw.c

@@ -172,6 +172,15 @@ void jit_ldrb(int reg) {
   code[code_idx++] = op;
 }
 
+// 8 bit only from rdx! (R3)
+void jit_ldrs(int reg) {
+  uint32_t op = 0xe1d000b0; // ldrh
+  op |= 1<<22; // byte access
+  op |= (reg<<16); // r3
+  op |= (3<<12); // dreg
+  code[code_idx++] = op;
+}
+
 // 8 bit only from rdx! (R3)
 void jit_strb(int reg) {
   uint32_t op = 0xe5800000;
@@ -181,6 +190,15 @@ void jit_strb(int reg) {
   code[code_idx++] = op;
 }
 
+// 16 bit only from rdx! (R3)
+void jit_strs(int reg) {
+  uint32_t op = 0xe1c000b0; // strh
+  op |= 1<<22; // byte access
+  op |= (reg<<16); // r3
+  op |= (3<<12); // dreg
+  code[code_idx++] = op;
+}
+
 // 32 bit only from rdx!
 void jit_strw(int reg) {
   uint32_t op = 0xe5800000;