Commit Graph

1810 Commits

Author SHA1 Message Date
Danny Milosavljevic 90c9fefeb4
ARM: Fix syscall numbers.
* lib/arm-mes/arm.M1: Fix syscall numbers.
2019-09-09 18:34:00 +02:00
Danny Milosavljevic 7788b9f263
ARM: Fix "bl" macro.
* lib/arm-mes/arm.M1: Fix "bl" macro.
2019-09-09 18:34:00 +02:00
Jan Nieuwenhuizen 89591a4c51
ARM: some build hacks REVERTME 2019-09-09 18:34:00 +02:00
Jan Nieuwenhuizen d977d39abc
ARM: Mes C Library: Support gcc __aeabi.
* lib/mes/div.c (__aeabi_idivmod, __aeabi_idiv, __aeabi_uidivmod,
__aeabi_uidiv): New function.
2019-09-09 18:33:59 +02:00
Jan Nieuwenhuizen 282abce86f
ARM: Mes C Library: Add compile stub for time.
* lib/linux/time.c (time)[SYS_gettimeofday]: Implemnt using gettimeofday.
(time)[!SYS_time && !SYS_gettimeofday]: Compile stub.
2019-09-09 18:33:59 +02:00
Jan Nieuwenhuizen bfe710d2a2
ARM: Mes C Library: Support gcc-sans-libc.
* lib/linux/arm-mes-gcc/crt1.c: New file.
* lib/linux/arm-mes-gcc/mini.c: New file.
* lib/linux/arm-mes-gcc/syscall.c: New file.
* lib/arm-mes-gcc/setjmp.c: New file.
2019-09-09 18:33:59 +02:00
Jan Nieuwenhuizen 92d60477c5
ARM: Mes C Library: Support abort.
* lib/stdlib/abort.c (abort): Support Arm.
* lib/arm-mes/arm.M1 (wfi): New macro.
2019-09-09 18:33:59 +02:00
Danny Milosavljevic 705be3f917
ARM: Fix instruction encoding for "add____$i8,%esp" in armv4:call-label.
* module/mescc/armv4/as.scm (armv4:call-label): Fix instruction encoding
for "add____$i8,%esp".
2019-09-09 18:33:59 +02:00
Danny Milosavljevic 07c907884b
ARM: Fix off-by-one error in "mov____%r0,0x32".
* lib/arm-mes/arm.M1: Fix off-by-one error in "mov____%r0,0x32".
2019-09-09 18:33:59 +02:00
Danny Milosavljevic f29cb12ec4
ARM: Make the ELF headers and footers very similar to x86 again.
* lib/arm-mes/elf32-0header.hex2: Modify.
* lib/arm-mes/elf32-footer-single-main.hex2: Modify.
* lib/arm-mes/elf32-header.hex2: Modify.
2019-09-09 18:33:58 +02:00
Danny Milosavljevic a725537f72
ARM: Define LONG_MIN etc.
* include/stdint.h: Define LONG_MIN etc for ARM.
2019-09-09 18:33:58 +02:00
Danny Milosavljevic eda0d8dca5
When emitting a function, also emit an aligner first.
* module/mescc/M1.scm (info->M1): When emitting a function, also emit
an aligner first.
2019-09-09 18:33:58 +02:00
Danny Milosavljevic 83e7c4cc9e
ARM: Delete r9-exposing macros.
* lib/arm-mes/arm.M1: Delete r9-exposing macros.
2019-09-09 18:33:58 +02:00
Danny Milosavljevic de9dd28743
ARM: Add macro "mov____%esp,%r0".
* lib/arm-mes/arm.M1: Add macro "mov____%esp,%r0".
2019-09-09 18:33:58 +02:00
Danny Milosavljevic f3a3df9e55
ARM: Assume that double and long double are 4 Byte for now (FIXME).
* module/mescc/armv4/info.scm (armv4:type-alist): Assume that double and
long double are 4 Byte for now (FIXME).
2019-09-09 18:33:58 +02:00
Danny Milosavljevic 9283e077b3
ARM: Fix "jmp____*%r1".
* lib/arm-mes/arm.M1: Fix "jmp____*%r1".
2019-09-09 18:33:58 +02:00
Danny Milosavljevic 8f1d2473bc
ARM: Add macro "uxtb__%r1,%r1".
* lib/arm-mes/arm.M1: Add macro "uxtb__%r1,%r1".
2019-09-09 18:33:57 +02:00
Danny Milosavljevic ba7338a466
ARM: Fix armv4:be?->r.
* module/mescc/armv4/as.scm (armv4:be?->r): Use "movhi__%r?,$i8".
2019-09-09 18:33:57 +02:00
Danny Milosavljevic badae1c4c4
ARM: Fix byte-mem-add.
* lib/arm-mes/arm.M1: Add macro "ldrb___%r0,(%r1)".
* module/mescc/armv4/as.scm (armv4:r-byte-mem-add): Use it.
2019-09-09 18:33:57 +02:00
Danny Milosavljevic eebcb57b36
ARM: Add macro "mov____0x32(%ebp),%r0".
* lib/arm-mes/arm.M1: Add macro "mov____0x32(%ebp),%r0".
2019-09-09 18:33:57 +02:00
Danny Milosavljevic 43e040dfd9
ARM: Use i386 struct stat.
* include/sys/stat.h: Use i386 struct stat for ARM.
2019-09-09 18:33:57 +02:00
Danny Milosavljevic 3bc75ab98b
ARM: Fix ldr*, str* references.
* module/mescc/armv4/as.scm (armv4:byte-r0->r1-mem): Fix output.
(armv4:word-mem->r): Fix output.
(armv4:byte-r0-mem->r1-mem): Fix output.
(armv4:byte-r->local+n): Fix output.
(armv4:word-r->local+n): Fix output.
2019-09-09 18:33:57 +02:00
Danny Milosavljevic 98e5fd7da6
ARM: Add macros like "ldrh___%r?,(%r?)", "strb___%r0,0x8(%ebp)", "push___0",
"add____$i32,%r?", "strb___%r0,0x32(%ebp)".
2019-09-09 18:33:57 +02:00
Danny Milosavljevic 41965ba2e1
ARM: Add "mov____0x8(%ebp),%esp" macro.
* lib/arm-mes/arm.M1: Add "mov____0x8(%ebp),%esp" macro.
2019-09-09 18:33:56 +02:00
Danny Milosavljevic ae53ac4542
ARM: Add "mov____0x8(%ebp),%ebp" macro.
* lib/arm-mes/arm.M1: Add "mov____0x8(%ebp),%ebp" macro.
2019-09-09 18:33:56 +02:00
Danny Milosavljevic c6366924e2
ARM: Fix setjmp.
* lib/arm-mes/setjmp.c: Fix setjmp.
2019-09-09 18:33:56 +02:00
Danny Milosavljevic 03c0e67a03
ARM: Add macros "mov____%r7,0x8(%ebp)", "mov____0x8(%ebp),%r7".
* lib/arm-mes/arm.M1: Add macros "mov____%r7,0x8(%ebp)", "mov____0x8(%ebp),%r7".
2019-09-09 18:33:56 +02:00
Danny Milosavljevic 50447ce307
ARM: Add macros like "mov??__%r1,$i8".
* lib/arm-mes/arm.M1: Add macros like "mov??__%r1,$i8".
2019-09-09 18:33:56 +02:00
Danny Milosavljevic c65c50b92a
ARM: Add macro "add____$i32,(%r0)".
* lib/arm-mes/arm.M1: Add macro "add____$i32,(%r0)".
2019-09-09 18:33:56 +02:00
Danny Milosavljevic 7e73c7adaf
ARM: Add macro "xchg___%r0,(%esp)".
* lib/arm-mes/arm.M1: Add macro "xchg___%r0,(%esp)".
2019-09-09 18:33:56 +02:00
Danny Milosavljevic f51d3a3356
ARM: Move r9 usage completely into "arm.M1".
* lib/arm-mes/arm.M1: Add "ret" macro.
* module/mescc/armv4/as.scm (armv4:ret): Use it.
* lib/arm-mes/arm.M1: Add macros "lsl____%r0,%r0,$i8", "lsl____%r1,%r1,$i8".
* module/mescc/armv4/as.scm (armv4:shl-r): Use them.
2019-09-09 18:33:55 +02:00
Danny Milosavljevic 794d242b9b
ARM: Division: Fix remainder pointer.
* module/mescc/armv4/as.scm (armv4:r0/r1): Fix remainder pointer.
2019-09-09 18:33:55 +02:00
Danny Milosavljevic 8a6092f2b4
ARM: Fix left shifts.
* lib/arm-mes/arm.M1: Add macros "lsl____%r0,%r0,%r9", "lsl____%r1,%r1,%r9",
"mov____$i8,%r9".
* module/mescc/armv4/as.scm (armv4:shl-r): Use them.
2019-09-09 18:33:55 +02:00
Danny Milosavljevic c72d349f53
ARM: Fix testing for zero.
* module/mescc/armv4/as.scm (armv4:r-zero?): Modify.
(armv4:xor-zf): Modify.
2019-09-09 18:33:55 +02:00
Danny Milosavljevic c4c94d68fe
ARM: Fix multiplication.
* lib/arm-mes/arm.M1: Delete "mul____%r1" macro.
Add "mul____%r1,%r0" and "mul____%r0,%r1" macros.
* module/mescc/armv4/as.scm (armv4:r0*r1): Use them.
2019-09-09 18:33:55 +02:00
Danny Milosavljevic 311a955b0b
ARM: Implement division and modulus.
* module/mescc/armv4/as.scm (armv4:r0/r1): Call "__mesabi_uldiv".
(armv4:r0%r1): Call "__mesabi_uldiv".
2019-09-09 18:33:55 +02:00
Danny Milosavljevic 26b6db0bbe
ARM: Introduce immediate->r0.
* module/mescc/armv4/as.scm (immediate->r0): New procedure.
(armv4:local-add): Use it.
(armv4:label-mem-add): Use it.
2019-09-09 18:33:55 +02:00
Danny Milosavljevic 7de32f00fc
ARM: Simplify source formatting.
* module/mescc/armv4/as.scm (armv4:local->r): Simplify.
(armv4:local-ptr->r): Indent.
(armv4:r+value): Simplify.
(armv4:r-cmp-value): Simplify.
(armv4:r0+value): Simplify.
2019-09-09 18:33:54 +02:00
Danny Milosavljevic b8f617d885
ARM: Add "add____%r0,%r1" macro.
* lib/arm-mes/arm.M1: Add "add____%r0,%r1" macro.
2019-09-09 18:33:54 +02:00
Danny Milosavljevic 0b4a9abafa
ARM: Add "mov____0x32(%ebp),%r1" macro.
* lib/arm-mes/arm.M1: Add "mov____0x32(%ebp),%r1" macro.
2019-09-09 18:33:54 +02:00
Danny Milosavljevic 3147550d19
ARM: Add "strb___%r0,(%r1)" macro.
* lib/arm-mes/arm.M1: Add "strb___%r0,(%r1)" macro.
2019-09-09 18:33:54 +02:00
Danny Milosavljevic 6c562bb065
ARM: Fix some typos.
* module/mescc/armv4/as.scm (armv4:r-byte-mem-add): Fix typo.
(armv4:r-word-mem-add): Fix typo.
(armv4:byte-r0->r1-mem): Fix typo.
(armv4:word-r0->r1-mem): Fix typo.
2019-09-09 18:33:54 +02:00
Danny Milosavljevic 898d74a63b
ARM: Add "mov____$i32,%r0", "mov____$i32,%r1", "mov____$i32,%r2" macros.
* lib/arm-mes/arm.M1: Add "mov____$i32,%r0", "mov____$i32,%r1",
"mov____$i32,%r2" macros.
2019-09-09 18:33:54 +02:00
Danny Milosavljevic f04484fdf3
ARM: Add "mul____%r1" macro.
* lib/arm-mes/arm.M1: Add "mul____%r1" macro.
2019-09-09 18:33:54 +02:00
Danny Milosavljevic ab0124eab7
ARM: Add sxtb__%r1,%r1.
* lib/arm-mes/arm.M1: Add "sxtb__%r1,%r1" macro.
2019-09-09 18:33:53 +02:00
Danny Milosavljevic 3b8961465f
ARM: Fix armv4:zf->r.
* module/mescc/armv4/as.scm (armv4:zf->r): Use the correct macros.
2019-09-09 18:33:53 +02:00
Danny Milosavljevic a252b9ac08
ARM: Fix armv4:xor-zf.
* module/mescc/armv4/as.scm (armv4:xor-zf): Use the correct macros.
2019-09-09 18:33:53 +02:00
Danny Milosavljevic 0f5651436b
waitpid: Add case for ARM.
* lib/linux/waitpid.c: Add case for ARM.
2019-09-09 18:33:53 +02:00
Danny Milosavljevic fd7c2d32cd
ARM: Fix function calls.
* lib/arm-mes/arm.M1: Delete "ret" macro.
Fix "push___%ebp" macro.
Add "pop____%lr" macro.
Add "push___%lr" macro.
Add "mov____%lr,%r9" macro.
Add "mov____%r9,%pc" macro.
* module/mescc/armv4/as.scm (armv4:function-preamble): Push lr, too.
(armv4:ret): Pop lr, too.  Return manually.
2019-09-09 18:33:53 +02:00
Danny Milosavljevic 59f22c5b86
ARM: Use architecture-dependent branch encoding for function calls.
* module/mescc/armv4/as.scm (armv4:call-label): Use architecture-dependent
branch encoding.
2019-09-09 18:33:53 +02:00