Commit graph

7686 commits

Author SHA1 Message Date
David Given 83e1b2ad94 Move the str and mem functions into the new src/core. 2018-06-21 22:39:08 +02:00
David Given 93f39e4bbf Run libcc.ansi through clang-format. 2018-06-21 22:33:47 +02:00
David Given 60b7d8de6e
Merge pull request #96 from kernigh/kernigh-emu-1
Fixes to build emulators, ass, int on OpenBSD
2018-06-20 22:30:01 +02:00
David Given 9eff7102e9
Merge pull request #103 from davidgiven/dtrg-warnings
Fix a lot of warnings.
2018-06-18 22:31:35 +02:00
David Given 698613cd7d Turns out that the compiler needs access to the libpc headers too; refactor
into a separate target to avoid build loops and make it work.
2018-06-18 22:17:38 +02:00
David Given 11854f4dfe Ansify and warning fix. 2018-06-17 22:30:27 +02:00
David Given 5784f5fabe Run C files through clang-format. 2018-06-17 16:11:29 +02:00
David Given 9ede428e3c Use cproto to extract all the prototypes. 2018-06-17 16:10:57 +02:00
David Given 9947e7ac63 Added a pc.h to contain libpc prototypes; some ansification. 2018-06-17 15:54:18 +02:00
David Given d1671fc2e3 Move the private Pascal headers into libpc where they belong. 2018-06-17 15:44:33 +02:00
David Given 13e195d19f Warning fixes. 2018-06-17 15:42:26 +02:00
David Given ce249649b2 Warning fix. 2018-06-17 15:34:29 +02:00
David Given ddca7276c0
Merge pull request #102 from davidgiven/dtrg-powerpc
Add a PowerPC simulator for running the tests.
2018-06-17 11:45:26 +02:00
David Given 89e8956bb2 Fix edge case in rlwnm when the mask is 32 bits wide. All tests now pass. 2018-06-17 11:00:01 +02:00
David Given 7ec9f54679 Turns out that andi and andis only have . forms. Fixed; another test passes. 2018-06-17 10:43:39 +02:00
David Given 78eaf836be Turns out I was returning values from syscalls in the wrong register; fixed.
More tests pass.
2018-06-17 10:22:20 +02:00
David Given ab660a44e9 Lots of floating point, bugfixes, and system calls. Most of the tests pass now. 2018-06-17 09:24:01 +02:00
David Given 67efbb5f7f Do a bit of floating point stuff; added brk(); fixed a horrible bug where
stores with 16-bit displacements were storing the register number and not the
contents of the register.
2018-06-16 22:55:23 +02:00
David Given 5d7cdd2c67 Fix a setcr0 bug which was trashing the condition register; some system
calls are now implemented. A few tests more-or-less pass (but crash on
exit).
2018-06-16 08:35:36 +02:00
David Given 39a49265ce
Merge pull request #100 from kernigh/kernigh-pdp
Two fixes for ack -mpdpv7
2018-06-15 15:40:24 +09:00
George Koehler 5db312a1c0 Prevent crash in isatty()
The existing code allocated 2 bytes (char*), but gtty() needs 6 bytes
(struct sgttyb), so isatty() smashed the stack and corrupted its
return address, probably causing SIGBUS or SIGSEGV.

Fix by switching to TIOCGETD, which needs 2 bytes.  TIOCGETD isn't in
the manual for tty(4), but does appear in
https://minnie.tuhs.org//cgi-bin/utree.pl?file=V7/usr/sys/dev/tty.c

This fixes hilo_c.pdpv7 and hilo_mod.pdpv7 in simh-pdp11.
2018-06-15 00:48:29 -04:00
George Koehler 5de5611c24 Use 2-byte alignment in pdpv7 to prevent SIGBUS.
Change the alignment in C structs (wa, pa, sa, and so on) from 1 to 2
bytes.  This prevents the SIGBUS when PDP-11 Unix V7 catches the
misalignment.  This fixes hilo_p.pdpv7 in simh-pdp11.

Change ALIGN to document that sections have 2-byte alignment.  This
change should have no effect, because the sections only contain 2-byte
values.
2018-06-15 00:17:12 -04:00
David Given 5111556d14 Got the emulator to the point where we're hitting the first major emulation bug
(the calloc test hangs).
2018-06-14 05:53:39 -07:00
David Given 853af4c4dd Some code runs (up to needing setcr0). 2018-06-14 04:41:21 -07:00
David Given b71145f79d Implement a non-functional skeleton of the PowerPC emulator (with, hopefully,
most of the instruction decode done).
2018-06-14 03:07:36 -07:00
David Given c9e5190a12
Merge pull request #99 from davidgiven/dtrg-ass
Bodge together a buildable em22 plat for use with int.
2018-06-14 10:08:17 +09:00
David Given 519eef933c Merge from trunk. 2018-06-13 21:47:25 +09:00
David Given 31c2ba3f94 File cleanup. 2018-06-13 21:47:08 +09:00
David Given 7eaa235fd1 Bodge the ancient em monitor library into building as a libsys for the em22
plat. It's completely untested, but it builds and makes e.out executables.
2018-06-13 21:44:25 +09:00
David Given 13a7abdd69 Rename a function to avoid a clash with an em system call. 2018-06-13 21:34:14 +09:00
David Given 670c7ce96f After finding the em_table documentation, move it somewhere where other people
can find it.
2018-06-13 20:58:44 +09:00
David Given 15161ebb35 Remember to always link the libsys and libend. 2018-06-13 20:57:31 +09:00
David Given 7f2ca76663 Expose our custom Lua interpreter to the build system so utility scripts can be
written in it.
2018-06-13 20:56:49 +09:00
David Given 2e93b8446e
Merge pull request #98 from davidgiven/dtrg-m68k
Fix sub-word-size type conversions for m68020.
2018-06-12 14:24:32 +02:00
David Given 3892b7e0e6 Remove bogus conversion from test which was causing failure; you're not allowed
to do cui or ciu with sizes smaller than a word.
2018-06-12 21:04:27 +09:00
David Given 6ae38887a7 It appears that the parameter to lol technically has to be word aligned; having
a non-word aligned parameter is illegal (but most of the toolchain accepts it).
So, word align data structures for em22.
2018-06-12 20:54:15 +09:00
George Koehler a000c62808 Get moncalls.c to compile on OpenBSD.
Remove some declarations (not all correct) and #include <errno.h>,
<time.h>, and <unistd.h> to get the correct declarations.

Disable mount(2), umount(2), and stime(2) because BSD (around
4.3BSD-Reno) lost compatibility with these Unix v7 functions.
2018-06-10 19:05:42 -04:00
George Koehler 250777d1ca Rename setmode() to set_mode() to avoid BSD prototype.
4.4BSD added a non-standard function setmode() to <unistd.h>; its
prototype is not compatible.
2018-06-10 19:04:51 -04:00
George Koehler 6f9e418f94 Remove extra #include <stdio.h> to fix uint
From my request at https://github.com/kstenerud/Musashi/pull/31

There was a conflict between Musahi's uint and OpenBSD's uint:

    $ cc -o m68kmake m68kmake.c
    $ ./m68kmake
    $ cc -DM68K_COMPILE_FOR_MAME=0 -c m68kcpu.c
    In file included from m68kcpu.c:565:
    In file included from /usr/include/stdio.h:46:
    /usr/include/sys/types.h:58:22: error: cannot combine with previous 'int'
          declaration specifier
    typedef unsigned int    uint;           /* Sys V compatibility */
                            ^
    ./m68kcpu.h:75:25: note: expanded from macro 'uint'
    #define uint   unsigned int
                            ^
    1 error generated.
2018-06-10 16:24:35 -04:00
George Koehler 5404dace3a Stop using <X11/Xfuncproto.h> from x86emu.
The code included <X11/Xfuncproto.h> only for _X_ATTRIBUTE_PRINTF,
which tells some compilers to check the printf format string.  Remove
so ACK doesn't need any X11 headers.

Some machines don't have the X11 headers, or they need a flag like
-I/usr/X11R[67]/include to find them.
2018-06-10 16:00:23 -04:00
David Given 7edc835626
Merge pull request #95 from davidgiven/dtrg-b
Fix occasional weird behaviour causing compilation failures in b.
2018-06-10 21:22:26 +09:00
David Given 4a249b1bdb Merge. 2018-06-10 20:26:10 +09:00
David Given d623440c77 Add the core of a simple em22 platform. Unfortunately it doesn't work; the old
em libmon vanished decades ago (or never existed), and also ass appears to have
a different idea of what the em opcodes are to everything else and gets
confused.
2018-06-10 20:25:48 +09:00
David Given cebb238036 Merge. 2018-06-10 18:09:18 +09:00
David Given 003799f898 Fix table underrun when looking up the character class of the EOF character,
-1.
2018-06-10 17:52:45 +09:00
David Given 5d519b79f7
Merge pull request #94 from davidgiven/dtrg-ass
Get int and ass building.
2018-06-09 22:44:24 +09:00
David Given e7124f3e3f File cleanup. 2018-06-09 21:21:28 +09:00
David Given a12181748b Make ass and int built with clang --- surprisingly easy. 2018-06-09 21:18:50 +09:00
David Given 59b383afd0 Make the em interpreter build --- again, lots of warnings, so it probably won't
work on clang. I have no idea whether it runs or not as building a e.out
program is quite hard and needs a special platform.
2018-06-09 21:13:31 +09:00
David Given d10a594c04 Get ass running --- it's very K&R and almost certainly won't build on clang,
but it works on gcc.
2018-06-09 14:10:45 +09:00