Skip to content

Commit

Permalink
fix arm/rpi2 build
Browse files Browse the repository at this point in the history
  • Loading branch information
mntmn committed Nov 16, 2015
1 parent ef09551 commit 8d5c8de
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
6 changes: 3 additions & 3 deletions devices/rpi2/main_rpi2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
18 changes: 18 additions & 0 deletions sledge/jit_arm_raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 8d5c8de

Please sign in to comment.