Commit Graph

1856 Commits

Author SHA1 Message Date
Danny Milosavljevic f9a6e1aed0
ARM: Add macro "strh___%r0,(%fp,+#$i8)".
* lib/arm-mes/arm.M1 (strh___%r0,(%fp,+#$i8)): New macro.
2019-09-09 18:34:07 +02:00
Danny Milosavljevic 0e2d6b4b84
ARM: Add macro "sxth__%r1,%r1".
* lib/arm-mes/arm.M1 (sxth__%r1,%r1): New macro.
2019-09-09 18:34:06 +02:00
Danny Milosavljevic 0d60769ea4
ARM: Add "strh___%r0,(%r1)" macro.
* lib/arm-mes/arm.M1 (strh___%r0,(%r1)): New macro.
2019-09-09 18:34:06 +02:00
Danny Milosavljevic 5874b709b8
ARM: Add __sys_call6, _sys_call6.
* lib/linux/arm-mes-mescc/syscall.c (__sys_call6): New procedure.
(_sys_call6): New procedure.
2019-09-09 18:34:06 +02:00
Danny Milosavljevic 371e11fd9e
ARM: Fix add____$i32,(%r0).
* lib/arm-mes/arm.M1 (add____$i32,(%r0)): Fix it.
2019-09-09 18:34:06 +02:00
Danny Milosavljevic 810d063d36
ARM: Use %fp in _start.
* lib/linux/arm-mes-mescc/crt1.c (_start): Use %fp instead of %sp.
2019-09-09 18:34:06 +02:00
Danny Milosavljevic d0e05a4a80
ARM: If "ADD"'s immediate is less than 0, subtract.
* lib/arm-mes/arm.M1 (sub____$i8,%r0): New macro.
(sub____$i8,%r1): New macro.
* module/mescc/armv4/as.scm (armv4:call-label): Add comment.
(armv4:r-byte-mem-add): Subtract if value is negative.
(armv4:r-word-mem-add): Subtract if value is negative.
(armv4:local-ptr->r): Subtract if value is negative.
(armv4:r+value): Subtract if value is negative.
(armv4:r0+value): Subtract if value is negative.
2019-09-09 18:34:06 +02:00
Danny Milosavljevic 20d0e0d950
ARM: Fix loads.
Follow-up to 7e40a92732c3035003ae779022e5beaf6562375f.

* lib/arm-mes-mescc/setjmp.c (longjmp): Disable.
* lib/linux/arm-mes-mescc/mini.c (_exit): Use ldr.
(_write): Use ldr.
* lib/linux/arm-mes-mescc/syscall.c (__sys_call): Use ldr.
(__sys_call1): Use ldr.
(__sys_call2): Use ldr.
(__sys_call3): Use ldr.
(__sys_call4): Use ldr.
2019-09-09 18:34:06 +02:00
Danny Milosavljevic 6fbead7479
ARM: Clean up comments.
* lib/arm-mes/arm.M1: Clean up comments.
2019-09-09 18:34:05 +02:00
Jan Nieuwenhuizen fb3f34b04f
Revert "Work around nyacc #define parsing/evaluation bug."
This reverts commit 7e8dfb474340b2fd809ee54e4d816b4a4275364d.
2019-09-09 18:34:05 +02:00
Danny Milosavljevic b9b744001a
ARM: Fix storing bytes in the stack frame.
* lib/arm-mes/arm.M1 (strb___%r0,0x8(%ebp)): Rename to...
(strb___%r0,(%fp,+#$i8)): ... this.
(strb___%r0,(%fp,-#$i8)): New macro.
* module/mescc/armv4/as.scm (armv4:byte-r->local+n): Use them.
2019-09-09 18:34:05 +02:00
Danny Milosavljevic cf0c7db11f
ARM: Fix handling of negative offsets in load/store instructions.
* lib/arm-mes/arm.M1 (ldr____%r0,(%fp,+#$i8)): New macro.
(ldr____%r1,(%fp,+#$i8)): New macro.
(ldr____%r2,(%fp,+#$i8)): New macro.
(ldr____%r3,(%fp,+#$i8)): New macro.
(ldr____%r4,(%fp,+#$i8)): New macro.
(ldr____%r5,(%fp,+#$i8)): New macro.
(ldr____%r7,(%fp,+#$i8)): New macro.
(ldr____%fp,(%fp,+#$i8)): New macro.
(ldr____%sp,(%fp,+#$i8)): New macro.
(ldr____%r0,(%fp,-#$i8)): New macro.
(ldr____%r1,(%fp,-#$i8)): New macro.
(ldr____%r2,(%fp,-#$i8)): New macro.
(ldr____%r3,(%fp,-#$i8)): New macro.
(ldr____%r4,(%fp,-#$i8)): New macro.
(ldr____%r5,(%fp,-#$i8)): New macro.
(ldr____%r7,(%fp,-#$i8)): New macro.
(ldr____%fp,(%fp,-#$i8)): New macro.
(ldr____%sp,(%fp,-#$i8)): New macro.
(str____%r0,(%fp,+#$i8)): New macro.
(str____%r1,(%fp,+#$i8)): New macro.
(str____%r2,(%fp,+#$i8)): New macro.
(str____%r3,(%fp,+#$i8)): New macro.
(str____%r4,(%fp,+#$i8)): New macro.
(str____%r5,(%fp,+#$i8)): New macro.
(str____%r7,(%fp,+#$i8)): New macro.
(str____%fp,(%fp,+#$i8)): New macro.
(str____%sp,(%fp,+#$i8)): New macro.
(str____%r0,(%fp,-#$i8)): New macro.
(str____%r1,(%fp,-#$i8)): New macro.
(str____%r2,(%fp,-#$i8)): New macro.
(str____%r3,(%fp,-#$i8)): New macro.
(str____%r4,(%fp,-#$i8)): New macro.
(str____%r5,(%fp,-#$i8)): New macro.
(str____%r7,(%fp,-#$i8)): New macro.
(str____%fp,(%fp,-#$i8)): New macro.
(str____%sp,(%fp,-#$i8)): New macro.
(mov____%r0,0x8(%ebp)): Delete macro.
(mov____%r1,0x8(%ebp)): Delete macro.
(mov____%r2,0x8(%ebp)): Delete macro.
(mov____%r3,0x8(%ebp)): Delete macro.
(mov____%r4,0x8(%ebp)): Delete macro.
(mov____%r5,0x8(%ebp)): Delete macro.
(mov____%r7,0x8(%ebp)): Delete macro.
(mov____0x8(%ebp),%r0): Delete macro.
(mov____0x8(%ebp),%r1): Delete macro.
(mov____0x8(%ebp),%r2): Delete macro.
(mov____0x8(%ebp),%r3): Delete macro.
(mov____0x8(%ebp),%r4): Delete macro.
(mov____0x8(%ebp),%r5): Delete macro.
(mov____0x8(%ebp),%r7): Delete macro.
(mov____0x8(%ebp),%ebp): Delete macro.
(mov____0x8(%ebp),%esp): Delete macro.
* module/mescc/armv4/as.scm (armv4:local->r): Use them.
(armv4:r->local+n): Use them.
2019-09-09 18:34:05 +02:00
Danny Milosavljevic a3988658ed
Add missing #include.
* lib/arm-mes-mescc/setjmp.c: Add missing #include.
2019-09-09 18:34:05 +02:00
Danny Milosavljevic 105cf743ff
ARM: Support negative values as immediate.
* lib/arm-mes/arm.M1 (mvn____%r0,$i8): New macro.
(mvn____%r1,$i8): New macro.
(mvn____%r7,$i8): New macro.
* module/mescc/armv4/as.scm (immediate->r0): Use it.
(armv4:value->r): Use it.
2019-09-09 18:34:05 +02:00
Danny Milosavljevic b82a2f1fad
ARM: Make "ret" macro do the right thing.
* lib/arm-mes/arm.M1 (ret): Make it do the right thing.
2019-09-09 18:34:05 +02:00
Danny Milosavljevic 92022f95ff
Work around nyacc #define parsing/evaluation bug.
* lib/linux/time.c: Use "#if defined" instead of "#if".
2019-09-09 18:34:04 +02:00
Danny Milosavljevic 8348e80589
ARM: Fix sub____%r1,%r0 encoding.
* lib/arm-mes/arm.M1 (sub____%r1,%r0): Fix encoding.
2019-09-09 18:34:04 +02:00
Danny Milosavljevic dd2a679fda
ARM: Remove OABI-only system call numbers.
* include/linux/arm/syscall.h (SYS_time): Delete definition.
2019-09-09 18:34:04 +02:00
Jan Nieuwenhuizen 4b40bdc0cb
ARM: Workarounds for running mescc.
* module/mescc.scm (mescc:main): Oops, handle -std=STANDARD.
* build-aux/build.sh.in (CFLAGS): Add -std=gnu99.  Fixes compilation
with gcc-4.9.
* src/reader.c (reader_read_identifier_or_number): Ugly hack: exit at
EOF.  Fixes running mescc.
2019-09-09 18:34:04 +02:00
Jan Nieuwenhuizen 35c746043f
ARM: Mes C Library: Compile fixes.
* lib/arm-mes-mescc/setjmp.c (setjmp): Do not use x86 registers.
* lib/arm-mes/arm.M1 (uxtb__%r1,%r1): New macro.
2019-09-09 18:34:04 +02:00
Danny Milosavljevic 58be0fd7e0
ARM: mescc: Handle command-line option "-marm".
* module/mescc/mescc.scm (arch-get): Handle command-line option "-marm".
2019-09-09 18:34:04 +02:00
Danny Milosavljevic c37eee6b3d
ARM: Prevent setjmp/longjmp inlining.
* lib/arm-mes-gcc/setjmp.c (longjmp): Prevent inlining.
(setjmp): Prevent inlining.
2019-09-09 18:34:03 +02:00
Danny Milosavljevic 3767477f5a
ARM: Add case for ARM.
* lib/tests/scaffold/76-pointer-arithmetic.c (main): Add case for ARM.
2019-09-09 18:34:03 +02:00
Danny Milosavljevic 807afb7d69
ARM: Implement setjmp/longjmp, part 2.
Follow-up to 102ccc27f6e619ca7207b6360ac918342711613a.

* include/setjmp.h (__jmp_buf): Add case for ARM.
2019-09-09 18:34:03 +02:00
Danny Milosavljevic fbe90fb293
ARM: Implement setjmp/longjmp.
* lib/arm-mes-gcc/setjmp.c (setjmp): Implement.
(longjmp): Implement.
2019-09-09 18:34:03 +02:00
Danny Milosavljevic 21bf8a0d92
ARM: Special-case "struct sigaction".
* include/signal.h (struct sigaction): Special-case for ARM.
2019-09-09 18:34:03 +02:00
Danny Milosavljevic 24299d80ff
ARM: Special-case O_DIRECTORY.
* include/fcntl.h (O_DIRECTORY): Special-case for ARM.
2019-09-09 18:34:03 +02:00
Danny Milosavljevic 1f6ff076b2
ARM: Fix test.
* lib/tests/scaffold/7k-for-each-elem.c: Fix test.
2019-09-09 18:34:03 +02:00
Danny Milosavljevic 53620890f4
ARM: Disable Thumb mode.
* build-aux/build.sh.in: Disable Thumb mode.
* build-aux/check.sh.in: Disable Thumb mode.
2019-09-09 18:34:02 +02:00
Danny Milosavljevic 44cfdd7e3c
ARM: Fix stat test.
* build-aux/test-c.sh: Increase test timeout to 20 s.
* lib/tests/io/90-stat.c: Add __arm__ case for stat structure.
2019-09-09 18:34:02 +02:00
Danny Milosavljevic 2363259435
ARM: Fix test.
* lib/tests/scaffold/85-sizeof.c: Fix test.
2019-09-09 18:34:02 +02:00
Danny Milosavljevic f3a266b960
ARM: Fix comment.
Follow-up to ca5425bfc4cd0ca0fee5002220e4cd329643d8c5.

* lib/mes/div.c: Fix comment.
2019-09-09 18:34:02 +02:00
Danny Milosavljevic cf0b648185
ARM: Provide __aeabi_* only for ARM.
Follow-up to 25b3ac2ba85d9833227f75f841503a6697aab45e.

* lib/mes/div.c (__aeabi_idivmod, __aeabi_idiv, __aeabi_uidivmod,
__aeabi_uidiv): Add guard for ARM.
2019-09-09 18:34:02 +02:00
Danny Milosavljevic b963db8342
ARM: Remove unused struct uidiv_t.
Follow-up to 25b3ac2ba85d9833227f75f841503a6697aab45e.

* lib/mes/div.c (uidiv_t): Delete.
2019-09-09 18:34:02 +02:00
Danny Milosavljevic 9a84e94a0a
ARM: Return both the quotient and the remainder.
* lib/mes/div.c (__aeabi_idivmod): Use ldiv.  Return both quotient and
remainder.
(__aeabi_uidivmod): Use __mesabi_uldiv.  Return both quotient and remainder.
2019-09-09 18:34:02 +02:00
Danny Milosavljevic 899b613dbc
ARM: Handle sign when dividing integers using gcc.
* lib/mes/div.c (__aeabi_idivmod): Use ldiv.
(__aeabi_idiv): Use ldiv.
2019-09-09 18:34:01 +02:00
Danny Milosavljevic 9ac6d37849
ARM: Delete _sys_call6 from arm-mes-gcc port.
* lib/linux/arm-mes-gcc/syscall.c (_sys_call6): Delete procedure.
2019-09-09 18:34:01 +02:00
Danny Milosavljevic 13fbd909d7
ARM: Specify R7 as changed.
* lib/linux/arm-mes-gcc/mini.c (_exit): Specify R7 as changed.
* lib/linux/arm-mes-gcc/syscall.c (_sys_call, _sys_call1, _sys_call2,
_sys_call3, _sys_call4): Specify R7 as changed.
2019-09-09 18:34:01 +02:00
Danny Milosavljevic e5f326040d
ARM: Fix system call handling in arm-mes-gcc.
* lib/linux/arm-mes-gcc/syscall.c (_sys_call, _sys_call1, _sys_call2,
_sys_call3, _sys_call4, _sys_call5, _sys_call6): Modify.
2019-09-09 18:34:01 +02:00
Danny Milosavljevic 25a0e13501
ARM: Fix environment setup.
* lib/linux/arm-mes-gcc/crt1.c (_start): Fix environment setup.
2019-09-09 18:34:01 +02:00
Danny Milosavljevic 149cc43baf
ARM: Clean up _start.
lib/linux/arm-mes-gcc/crt1.c (_start): Clean up the function.
2019-09-09 18:34:01 +02:00
Danny Milosavljevic a1217d71c1
ARM: Use GCC-emitted frame pointer.
* lib/linux/arm-mes-gcc/crt1.c (_start): Use GCC-emitted frame pointer.
2019-09-09 18:34:01 +02:00
Danny Milosavljevic 5199db9d8e
ARM: Fix arm-mes-gcc _start.
* lib/linux/arm-mes-gcc/crt1.c: Fix arm-mes-gcc _start.
2019-09-09 18:34:00 +02:00
Jan Nieuwenhuizen 37149aa84d
porting: arm scaffold WIP 2019-09-09 18:34:00 +02:00
Danny Milosavljevic b314c66b3b
ARM: Fix syscalls, part 2.
* include/linux/arm/syscall.h: Fix syscalls.
2019-09-09 18:34:00 +02:00
Danny Milosavljevic 01ca0678c1
ARM: Add macro "mov____$i32,%r7".
* lib/arm-mes/arm.M1: Add macro "mov____$i32,%r7".
2019-09-09 18:34:00 +02:00
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