Closed jeapostrophe closed 8 years ago
Thanks a lot! I'll boot OSX and look into this.
Hi again, I played around a bit more on OSX and fixed many little problems. The biggest issue was that the "as" shipped with OSX seems to ignore labels that are not starting with the letter "L" and generates empty jmps (jmps to 0) without warning – or at least treats them as external symbols to be linked later. So I adopted the "L…" labeling convention and it works. I also tweaked the stack align code a bit (thanks for that hint), which is probably inefficient. To make this bullet-proof on OSX, stack frame allocation will have to be redesigned. Anyway, it can load and display the shell now, though file operations inside the shell still crash.
Presently it doesn't work, because it can't eval shell.l. A function is called with a NULL pointer for the first argument. Not sure yet what the function is though.
Here's the present run:
[compiler] creating global env hash table… [compiler] init_allocator…
++ cell heap at 0x10a000000, 240000000 bytes reserved [allocator] initialized. [compiler] inserting symbols… [compiler] arithmetic… [compiler] compare… [compiler] flow… [compiler] lists… [compiler] strings… [compiler] write/eval… sledge knows 47 symbols. enter (symbols) to see them. [fs] mounted: /framebuffer [fs] mounted: /keyboard [fs] mounted: /sd sledge> JIT --------------------- movq $0x10a001f80, %rdi mov $0x10000c730, %rax subq $8, %rsp callq %rax # fs_open addq $8, %rsp movq %rax, %rdi mov $0x10000ce90, %rax subq $8, %rsp callq %rax # stream_read addq $8, %rsp movq %rax, %rdi mov $0x100009d40, %rax subq $8, %rsp callq %rax # read_string_cell addq $8, %rsp movq %rax, %rdi mov $0x1000071d0, %rax subq $8, %rsp callq %rax # platform_eval addq $8, %rsp
ret
<assembled bytes: 100 at: 0x1091fb000> warning: nm: no name list [open] found matching fs: /sd for path: /sd/os/shell.l [open] open_fn: 0x10000d8e0 filename: os/shell.l [posixfs] trying to read file of len 13594…
JIT --------------------- push %rdi jmp f1_0x10a026910 f0_0x10a026910: movq $0xf00000010a026911, %rsi push %rsi movq %r12, %rax movq (%rax), %rax cmp $0, %rax je else_1 movq %r13, %rax movq (%rax), %rax cmp $0, %rax je else_2 movq $0x10a0022b0, %rax jmp endif_3 else_2: movq $0x10a0022e0, %rax endif_3: jmp endif_4 else_1: movq $0x10a002328, %rax endif_4: addq $8, %rsp ret f1_0x10a026910: movq $0x10a026910, %rax movq %rax, %rsi pop %rdi movq $0x10a0020e8, %rdi mov $0x100001640, %rax subq $8, %rsp callq *%rax # insert_global_symbol addq $8, %rsp
ret
<assembled bytes: 139 at: 0x1091fd000> Process 90261 stopped