Commit graph

7613 commits

Author SHA1 Message Date
David Given f3bc9ef92a Call proper Linux system calls proper-like. 2018-09-09 18:57:12 +02:00
David Given bb15c03339 Remember to preserve input registers if we're going to be reading from them
after writing to the output register.
2018-09-09 18:53:49 +02:00
David Given e88670dad4 Yikes! Turns out that FPU registers are only 32 bits wide, and doubles are
stored in pairs, just like on the PowerPC!
2018-09-09 18:25:00 +02:00
David Given ec46643124 Allow the ELF processor flags to be set. Generate MIPS ELF executables, not
PowerPC ones.
2018-09-09 14:29:34 +02:00
David Given 5dfef6f180 Rework relocations again: add RELO2HI and RELO2HISAD for the high two bytes of
a word.
2018-09-09 14:11:11 +02:00
David Given 95dd6f0141 Fix some niggling issues --- we have our first binary now! 2018-09-09 12:24:22 +02:00
David Given b3b7c684c6 Simplify MIPS relocations. Add RELS2 (for generic high-word relocations). Add
support for MIPS branch-and-jump relocations.
2018-09-09 12:23:59 +02:00
David Given 0d8d98fd0f Warning fix. 2018-09-09 12:22:59 +02:00
David Given d2a1d4dcda Added some very untested csa and csb implementations, based on the PowerPC
ones.
2018-09-08 23:12:57 +02:00
David Given 75308901bc Added hi[] and lo[] functions to the assembler; fix things enough that we now
get to the point of failing to link programs.
2018-09-08 22:42:06 +02:00
David Given 379c1a4a3c Rework floating point conversion. Bash enough of the table into workingness
that the libraries build now.
2018-09-08 22:06:38 +02:00
David Given d2c14ca44f Precisely one stack hreg gets allocated for each vreg/congruence group for
eviction; this prevents us from having to worry about moving values from stack
slot to stack slot, which is hard.
2018-09-08 18:59:55 +02:00
David Given b7a1c96986 MIPS appears to hate converting unsigneds to floats and vice versa. 2018-09-05 23:53:38 +02:00
David Given fc0b0ae178 (Slightly) better errors on phi congruence group mismatches. 2018-09-05 23:53:08 +02:00
David Given 7fbce066f8 We attempt to compile the first library function; we fail. 2018-09-05 00:13:01 +02:00
David Given 26fe3f7530 Added library skeletons. 2018-09-05 00:07:07 +02:00
David Given 98afb42095 Added a boot.o based on the PowerPC one. 2018-09-05 00:00:13 +02:00
David Given 26c0228b14 The examples all compile now (probably incorrectly, and the libc doesn't
compile yet).
2018-09-04 23:55:28 +02:00
David Given 9d80756253 Lots of assembler and rule bugfixing. 2018-09-04 23:43:24 +02:00
David Given fe5ca5a85f Added li and la instructions. 2018-09-03 22:47:41 +02:00
David Given 26f9b4ceae Add in floating point support to the code generator. 2018-09-03 22:06:05 +02:00
David Given 83cf1be6a8 mcgg now checks that registers have at most one type attribute set. 2018-09-03 22:03:57 +02:00
David Given f8e71d888b Add some painfully untested FPU instructions. 2018-09-02 21:36:09 +02:00
David Given 1d6ecddcf4 The MIPS backend is still full of holes, and cut-and-pasted PowerPC code, but
is beginning to look like an actual code generator.
2018-09-02 18:57:25 +02:00
David Given a023fd8591 Better error reporting for unterminated strings. 2018-09-02 18:55:44 +02:00
David Given 4741ed8e14 Add a completely non-tested table-based MIPS assembler. 2018-09-01 19:35:31 +02:00
David Given 8d321900b4
Merge pull request #110 from davidgiven/dtrg-warnings
Fix warnings and convert the Modula-2 library to ANSI C.
2018-06-25 22:29:47 +02:00
David Given 7971bdba5a Warning-fixed and ansified the Modula-2 library. 2018-06-25 22:22:37 +02:00
David Given f8ba7ef962 Move the Modula-2 library includes into a directory in lang/m2 where they belong. 2018-06-24 20:32:59 +02:00
David Given aa19c08512
Merge pull request #109 from davidgiven/dtrg-warnings
Rework the Linux include directories.
2018-06-24 20:03:21 +02:00
David Given ab7002c0ee All the Linux include directories are the same, so common them all out into a
single one, like OSX.
2018-06-24 19:57:43 +02:00
David Given 47bdd9cc49
Merge pull request #108 from davidgiven/dtrg-warnings
Warning-fix and protoise the basic library.
2018-06-24 01:00:30 +02:00
David Given 1702d873ea Warning-fix and protoise the basic library. 2018-06-24 00:35:51 +02:00
David Given a6742a7d55
Merge pull request #107 from davidgiven/dtrg-libc
OpenBSD fixes
2018-06-24 00:21:29 +02:00
David Given bbb98240fe Merge from trunk. 2018-06-24 00:08:39 +02:00
David Given f45b357740 Remove the dependency on the glibc-only byteswap.h. 2018-06-24 00:01:06 +02:00
David Given 1fc20e90c0 Remove c99-isms. 2018-06-23 23:56:34 +02:00
David Given 205c8d0a35 Run through clang-format. 2018-06-23 23:46:44 +02:00
David Given 91a978fa95
Merge pull request #106 from davidgiven/dtrg-libc
Refactor the libc
2018-06-23 23:28:21 +02:00
David Given fd94e219d4 Remove the attic. 2018-06-23 23:16:22 +02:00
David Given 59dbdea48a Move mktemp to sys; attic getgrent as noone will ever use this. 2018-06-23 23:15:42 +02:00
David Given 3f10299f43 Move the portable time code into core. clock() goes into sys (as it calls
times()).
2018-06-23 19:49:29 +02:00
David Given 64ae1d7583 Move time() into sys; change the name of the variable which controls it. 2018-06-23 19:40:50 +02:00
David Given bb78fd158c Move the big gnarly functions like system() and popen() into sys, and make them
build.
2018-06-23 19:18:16 +02:00
David Given 6a729b846a Move stdio into (mostly) sys. 2018-06-23 18:54:40 +02:00
David Given af22b7ea85 Change stdio to use atexit() rather than the internal __clean variable; this
breaks the dependency between exit/atexit and stdio. Buffers are no longer
flushed on abort() (because it's pretty risky). Move the relevant functions
into sys/core.
2018-06-23 18:35:45 +02:00
David Given f744a21699 All the opendir()/readdir() stuff is obsolete because it's all implemented in
terms of open() and read(), which isn't how it's done any more; move the
functions into an attic.
2018-06-23 18:25:26 +02:00
David Given df1cdf7762 Add the sys directory for libc functions which use system calls; move the
malloc functions in there.
2018-06-23 18:08:03 +02:00
David Given c4e4505a73 Move the errno functions into core. 2018-06-23 17:52:15 +02:00
David Given 538eefb573 Get em22 working. Remove the leading-underscore system calls from its libsys. 2018-06-23 15:57:57 +02:00