ack.git
6 years agoWarning-fixed and ansified the Modula-2 library. dtrg-warnings
David Given [Mon, 25 Jun 2018 20:22:37 +0000 (22:22 +0200)]
Warning-fixed and ansified the Modula-2 library.

6 years agoMove the Modula-2 library includes into a directory in lang/m2 where they belong.
David Given [Sun, 24 Jun 2018 18:32:59 +0000 (20:32 +0200)]
Move the Modula-2 library includes into a directory in lang/m2 where they belong.

6 years agoMerge pull request #109 from davidgiven/dtrg-warnings
David Given [Sun, 24 Jun 2018 18:03:21 +0000 (20:03 +0200)]
Merge pull request #109 from davidgiven/dtrg-warnings

Rework the Linux include directories.

6 years agoAll the Linux include directories are the same, so common them all out into a
David Given [Sun, 24 Jun 2018 17:57:43 +0000 (19:57 +0200)]
All the Linux include directories are the same, so common them all out into a
single one, like OSX.

6 years agoMerge pull request #108 from davidgiven/dtrg-warnings
David Given [Sat, 23 Jun 2018 23:00:30 +0000 (01:00 +0200)]
Merge pull request #108 from davidgiven/dtrg-warnings

Warning-fix and protoise the basic library.

6 years agoWarning-fix and protoise the basic library.
David Given [Sat, 23 Jun 2018 22:35:51 +0000 (00:35 +0200)]
Warning-fix and protoise the basic library.

6 years agoMerge pull request #107 from davidgiven/dtrg-libc
David Given [Sat, 23 Jun 2018 22:21:29 +0000 (00:21 +0200)]
Merge pull request #107 from davidgiven/dtrg-libc

OpenBSD fixes

6 years agoMerge from trunk.
David Given [Sat, 23 Jun 2018 22:08:39 +0000 (00:08 +0200)]
Merge from trunk.

6 years agoRemove the dependency on the glibc-only byteswap.h.
David Given [Sat, 23 Jun 2018 22:01:06 +0000 (00:01 +0200)]
Remove the dependency on the glibc-only byteswap.h.

6 years agoRemove c99-isms.
David Given [Sat, 23 Jun 2018 21:56:34 +0000 (23:56 +0200)]
Remove c99-isms.

6 years agoRun through clang-format.
David Given [Sat, 23 Jun 2018 21:46:44 +0000 (23:46 +0200)]
Run through clang-format.

6 years agoMerge pull request #106 from davidgiven/dtrg-libc
David Given [Sat, 23 Jun 2018 21:28:21 +0000 (23:28 +0200)]
Merge pull request #106 from davidgiven/dtrg-libc

Refactor the libc

6 years agoRemove the attic.
David Given [Sat, 23 Jun 2018 21:16:22 +0000 (23:16 +0200)]
Remove the attic.

6 years agoMove mktemp to sys; attic getgrent as noone will ever use this.
David Given [Sat, 23 Jun 2018 21:15:42 +0000 (23:15 +0200)]
Move mktemp to sys; attic getgrent as noone will ever use this.

6 years agoMove the portable time code into core. clock() goes into sys (as it calls
David Given [Sat, 23 Jun 2018 17:49:29 +0000 (19:49 +0200)]
Move the portable time code into core. clock() goes into sys (as it calls
times()).

6 years agoMove time() into sys; change the name of the variable which controls it.
David Given [Sat, 23 Jun 2018 17:40:50 +0000 (19:40 +0200)]
Move time() into sys; change the name of the variable which controls it.

6 years agoMove the big gnarly functions like system() and popen() into sys, and make them
David Given [Sat, 23 Jun 2018 17:18:16 +0000 (19:18 +0200)]
Move the big gnarly functions like system() and popen() into sys, and make them
build.

6 years agoMove stdio into (mostly) sys.
David Given [Sat, 23 Jun 2018 16:54:40 +0000 (18:54 +0200)]
Move stdio into (mostly) sys.

6 years agoChange stdio to use atexit() rather than the internal __clean variable; this
David Given [Sat, 23 Jun 2018 16:35:45 +0000 (18:35 +0200)]
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.

6 years agoAll the opendir()/readdir() stuff is obsolete because it's all implemented in
David Given [Sat, 23 Jun 2018 16:25:26 +0000 (18:25 +0200)]
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.

6 years agoAdd the sys directory for libc functions which use system calls; move the
David Given [Sat, 23 Jun 2018 16:08:03 +0000 (18:08 +0200)]
Add the sys directory for libc functions which use system calls; move the
malloc functions in there.

6 years agoMove the errno functions into core.
David Given [Sat, 23 Jun 2018 15:52:15 +0000 (17:52 +0200)]
Move the errno functions into core.

6 years agoGet em22 working. Remove the leading-underscore system calls from its libsys.
David Given [Sat, 23 Jun 2018 13:57:57 +0000 (15:57 +0200)]
Get em22 working. Remove the leading-underscore system calls from its libsys.

6 years agoGet the pdp7 plat working; remove the leading-underscore syscalls.
David Given [Sat, 23 Jun 2018 13:18:26 +0000 (15:18 +0200)]
Get the pdp7 plat working; remove the leading-underscore syscalls.

6 years agoMade the rpi platform work with the new libc layout.
David Given [Sat, 23 Jun 2018 11:05:27 +0000 (13:05 +0200)]
Made the rpi platform work with the new libc layout.

6 years agoMade pc86 work with the new libc.
David Given [Sat, 23 Jun 2018 10:59:40 +0000 (12:59 +0200)]
Made pc86 work with the new libc.

6 years agoMade the two OSX platforms work with the new libc layout.
David Given [Sat, 23 Jun 2018 10:55:59 +0000 (12:55 +0200)]
Made the two OSX platforms work with the new libc layout.

6 years agoMake linuxppc work.
David Given [Sat, 23 Jun 2018 10:41:54 +0000 (12:41 +0200)]
Make linuxppc work.

6 years agoMade linux68k work; commoned up all the generic linux includes.
David Given [Sat, 23 Jun 2018 10:35:17 +0000 (12:35 +0200)]
Made linux68k work; commoned up all the generic linux includes.

6 years agoMake linux386 work with the new libc layout.
David Given [Sat, 23 Jun 2018 10:13:33 +0000 (12:13 +0200)]
Make linux386 work with the new libc layout.

6 years agoCreate a basic and probably wrong common unistd.h, which replaces the plat one.
David Given [Sat, 23 Jun 2018 09:46:55 +0000 (11:46 +0200)]
Create a basic and probably wrong common unistd.h, which replaces the plat one.
Made this work with cpm (but nothing else yet).

6 years agoMove assert into core.
David Given [Sat, 23 Jun 2018 09:16:06 +0000 (11:16 +0200)]
Move assert into core.

6 years agoWarning fix.
David Given [Sat, 23 Jun 2018 09:14:49 +0000 (11:14 +0200)]
Warning fix.

6 years agoDon't crash and burn if there are no tests to run.
David Given [Sat, 23 Jun 2018 09:14:40 +0000 (11:14 +0200)]
Don't crash and burn if there are no tests to run.

6 years agoMove the string-to-float functions into core, after marking them as
David Given [Sat, 23 Jun 2018 09:14:24 +0000 (11:14 +0200)]
Move the string-to-float functions into core, after marking them as
ACKCONF_WANT_FLOAT.

6 years agolibc floating point and stdio floating point can now be turned on and off using
David Given [Fri, 22 Jun 2018 22:04:14 +0000 (00:04 +0200)]
libc floating point and stdio floating point can now be turned on and off using
ACKCONF variables.

6 years agoRearrange the libc config files, ready for adding new options.
David Given [Fri, 22 Jun 2018 21:43:15 +0000 (23:43 +0200)]
Rearrange the libc config files, ready for adding new options.

6 years agoGet the em libc working again: remove the modula-2 termcap library, as it's a
David Given [Fri, 22 Jun 2018 21:17:14 +0000 (23:17 +0200)]
Get the em libc working again: remove the modula-2 termcap library, as it's a
straight copy of the libc one and having two symbols defined at once gets ass
upset.

6 years agoMerge from default.
David Given [Fri, 22 Jun 2018 20:43:02 +0000 (22:43 +0200)]
Merge from default.

6 years agoMerge pull request #105 from davidgiven/dtrg-ass
David Given [Fri, 22 Jun 2018 20:42:11 +0000 (22:42 +0200)]
Merge pull request #105 from davidgiven/dtrg-ass

Prevent ass crashing on error on 64-bit machines.

6 years agoReplace fake-varargs, which doesn't work on 64-bit machines, with real varargs.
David Given [Fri, 22 Jun 2018 20:29:52 +0000 (22:29 +0200)]
Replace fake-varargs, which doesn't work on 64-bit machines, with real varargs.

6 years agoReplace fake-varargs, which doesn't work on 64-bit machines, with real varargs.
David Given [Fri, 22 Jun 2018 20:29:52 +0000 (22:29 +0200)]
Replace fake-varargs, which doesn't work on 64-bit machines, with real varargs.

6 years agoMove some more libc functions into core.
David Given [Fri, 22 Jun 2018 20:20:02 +0000 (22:20 +0200)]
Move some more libc functions into core.

6 years agoRealise that the libc core can safely call other libc core functions, even if
David Given [Thu, 21 Jun 2018 21:24:23 +0000 (23:24 +0200)]
Realise that the libc core can safely call other libc core functions, even if
they're not defined in the core: so putw() can call stdio stuff, for example.
So the earlier concept of pureness isn't necessary. Rename accordingly.

6 years agoThe ctype functions are pure.
David Given [Thu, 21 Jun 2018 21:06:29 +0000 (23:06 +0200)]
The ctype functions are pure.

6 years agoThe maths library is pure.
David Given [Thu, 21 Jun 2018 21:00:33 +0000 (23:00 +0200)]
The maths library is pure.

6 years agoMoved the setjmp functions into the new pure directoy.
David Given [Thu, 21 Jun 2018 20:55:42 +0000 (22:55 +0200)]
Moved the setjmp functions into the new pure directoy.

6 years agoMove the pure locale functions into the new pure directory.
David Given [Thu, 21 Jun 2018 20:54:25 +0000 (22:54 +0200)]
Move the pure locale functions into the new pure directory.

6 years agoMove the pure stdlib functions into the new pure directory.
David Given [Thu, 21 Jun 2018 20:52:31 +0000 (22:52 +0200)]
Move the pure stdlib functions into the new pure directory.

6 years agoRethink the libc layout.
David Given [Thu, 21 Jun 2018 20:47:02 +0000 (22:47 +0200)]
Rethink the libc layout.

6 years agoMove the str and mem functions into the new src/core.
David Given [Thu, 21 Jun 2018 20:39:08 +0000 (22:39 +0200)]
Move the str and mem functions into the new src/core.

6 years agoRun libcc.ansi through clang-format.
David Given [Thu, 21 Jun 2018 20:33:47 +0000 (22:33 +0200)]
Run libcc.ansi through clang-format.

6 years agoMerge pull request #96 from kernigh/kernigh-emu-1
David Given [Wed, 20 Jun 2018 20:30:01 +0000 (22:30 +0200)]
Merge pull request #96 from kernigh/kernigh-emu-1

Fixes to build emulators, ass, int on OpenBSD

6 years agoMerge pull request #103 from davidgiven/dtrg-warnings
David Given [Mon, 18 Jun 2018 20:31:35 +0000 (22:31 +0200)]
Merge pull request #103 from davidgiven/dtrg-warnings

Fix a lot of warnings.

6 years agoTurns out that the compiler needs access to the libpc headers too; refactor
David Given [Mon, 18 Jun 2018 20:17:38 +0000 (22:17 +0200)]
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.

6 years agoAnsify and warning fix.
David Given [Sun, 17 Jun 2018 20:30:27 +0000 (22:30 +0200)]
Ansify and warning fix.

6 years agoRun C files through clang-format.
David Given [Sun, 17 Jun 2018 14:11:29 +0000 (16:11 +0200)]
Run C files through clang-format.

6 years agoUse cproto to extract all the prototypes.
David Given [Sun, 17 Jun 2018 14:10:57 +0000 (16:10 +0200)]
Use cproto to extract all the prototypes.

6 years agoAdded a pc.h to contain libpc prototypes; some ansification.
David Given [Sun, 17 Jun 2018 13:54:18 +0000 (15:54 +0200)]
Added a pc.h to contain libpc prototypes; some ansification.

6 years agoMove the private Pascal headers into libpc where they belong.
David Given [Sun, 17 Jun 2018 13:44:33 +0000 (15:44 +0200)]
Move the private Pascal headers into libpc where they belong.

6 years agoWarning fixes.
David Given [Sun, 17 Jun 2018 13:42:26 +0000 (15:42 +0200)]
Warning fixes.

6 years agoWarning fix.
David Given [Sun, 17 Jun 2018 13:34:29 +0000 (15:34 +0200)]
Warning fix.

6 years agoMerge pull request #102 from davidgiven/dtrg-powerpc
David Given [Sun, 17 Jun 2018 09:45:26 +0000 (11:45 +0200)]
Merge pull request #102 from davidgiven/dtrg-powerpc

Add a PowerPC simulator for running the tests.

6 years agoFix edge case in rlwnm when the mask is 32 bits wide. All tests now pass.
David Given [Sun, 17 Jun 2018 09:00:01 +0000 (11:00 +0200)]
Fix edge case in rlwnm when the mask is 32 bits wide. All tests now pass.

6 years agoTurns out that andi and andis only have . forms. Fixed; another test passes.
David Given [Sun, 17 Jun 2018 08:43:39 +0000 (10:43 +0200)]
Turns out that andi and andis only have . forms. Fixed; another test passes.

6 years agoTurns out I was returning values from syscalls in the wrong register; fixed.
David Given [Sun, 17 Jun 2018 08:22:20 +0000 (10:22 +0200)]
Turns out I was returning values from syscalls in the wrong register; fixed.
More tests pass.

6 years agoLots of floating point, bugfixes, and system calls. Most of the tests pass now.
David Given [Sun, 17 Jun 2018 07:24:01 +0000 (09:24 +0200)]
Lots of floating point, bugfixes, and system calls. Most of the tests pass now.

6 years agoDo a bit of floating point stuff; added brk(); fixed a horrible bug where
David Given [Sat, 16 Jun 2018 20:55:23 +0000 (22:55 +0200)]
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.

6 years agoFix a setcr0 bug which was trashing the condition register; some system
David Given [Sat, 16 Jun 2018 06:35:36 +0000 (08:35 +0200)]
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).

6 years agoMerge pull request #100 from kernigh/kernigh-pdp
David Given [Fri, 15 Jun 2018 06:40:24 +0000 (15:40 +0900)]
Merge pull request #100 from kernigh/kernigh-pdp

Two fixes for ack -mpdpv7

6 years agoPrevent crash in isatty()
George Koehler [Fri, 15 Jun 2018 04:48:29 +0000 (00:48 -0400)]
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.

6 years agoUse 2-byte alignment in pdpv7 to prevent SIGBUS.
George Koehler [Fri, 15 Jun 2018 04:17:12 +0000 (00:17 -0400)]
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.

6 years agoGot the emulator to the point where we're hitting the first major emulation bug
David Given [Thu, 14 Jun 2018 12:53:39 +0000 (05:53 -0700)]
Got the emulator to the point where we're hitting the first major emulation bug
(the calloc test hangs).

6 years agoSome code runs (up to needing setcr0).
David Given [Thu, 14 Jun 2018 11:41:21 +0000 (04:41 -0700)]
Some code runs (up to needing setcr0).

6 years agoImplement a non-functional skeleton of the PowerPC emulator (with, hopefully,
David Given [Thu, 14 Jun 2018 10:07:36 +0000 (03:07 -0700)]
Implement a non-functional skeleton of the PowerPC emulator (with, hopefully,
most of the instruction decode done).

6 years agoMerge pull request #99 from davidgiven/dtrg-ass
David Given [Thu, 14 Jun 2018 01:08:17 +0000 (10:08 +0900)]
Merge pull request #99 from davidgiven/dtrg-ass

Bodge together a buildable em22 plat for use with int.

6 years agoMerge from trunk.
David Given [Wed, 13 Jun 2018 12:47:25 +0000 (21:47 +0900)]
Merge from trunk.

6 years agoFile cleanup.
David Given [Wed, 13 Jun 2018 12:47:08 +0000 (21:47 +0900)]
File cleanup.

6 years agoBodge the ancient em monitor library into building as a libsys for the em22
David Given [Wed, 13 Jun 2018 12:44:25 +0000 (21:44 +0900)]
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.

6 years agoRename a function to avoid a clash with an em system call.
David Given [Wed, 13 Jun 2018 12:34:14 +0000 (21:34 +0900)]
Rename a function to avoid a clash with an em system call.

6 years agoAfter finding the em_table documentation, move it somewhere where other people
David Given [Wed, 13 Jun 2018 11:58:44 +0000 (20:58 +0900)]
After finding the em_table documentation, move it somewhere where other people
can find it.

6 years agoRemember to always link the libsys and libend.
David Given [Wed, 13 Jun 2018 11:57:31 +0000 (20:57 +0900)]
Remember to always link the libsys and libend.

6 years agoExpose our custom Lua interpreter to the build system so utility scripts can be
David Given [Wed, 13 Jun 2018 11:56:49 +0000 (20:56 +0900)]
Expose our custom Lua interpreter to the build system so utility scripts can be
written in it.

6 years agoMerge pull request #98 from davidgiven/dtrg-m68k
David Given [Tue, 12 Jun 2018 12:24:32 +0000 (14:24 +0200)]
Merge pull request #98 from davidgiven/dtrg-m68k

Fix sub-word-size type conversions for m68020.

6 years agoRemove bogus conversion from test which was causing failure; you're not allowed
David Given [Tue, 12 Jun 2018 12:04:27 +0000 (21:04 +0900)]
Remove bogus conversion from test which was causing failure; you're not allowed
to do cui or ciu with sizes smaller than a word.

6 years agoIt appears that the parameter to lol technically has to be word aligned; having
David Given [Tue, 12 Jun 2018 11:54:15 +0000 (20:54 +0900)]
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.

6 years agoGet moncalls.c to compile on OpenBSD.
George Koehler [Sun, 10 Jun 2018 20:29:52 +0000 (16:29 -0400)]
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.

6 years agoRename setmode() to set_mode() to avoid BSD prototype.
George Koehler [Sun, 10 Jun 2018 20:26:54 +0000 (16:26 -0400)]
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.

6 years agoRemove extra `#include <stdio.h>` to fix `uint`
George Koehler [Sun, 10 Jun 2018 20:24:35 +0000 (16:24 -0400)]
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.

6 years agoStop using <X11/Xfuncproto.h> from x86emu.
George Koehler [Sun, 10 Jun 2018 20:00:23 +0000 (16:00 -0400)]
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.

6 years agoMerge pull request #95 from davidgiven/dtrg-b
David Given [Sun, 10 Jun 2018 12:22:26 +0000 (21:22 +0900)]
Merge pull request #95 from davidgiven/dtrg-b

Fix occasional weird behaviour causing compilation failures in b.

6 years agoMerge.
David Given [Sun, 10 Jun 2018 11:26:10 +0000 (20:26 +0900)]
Merge.

6 years agoAdd the core of a simple em22 platform. Unfortunately it doesn't work; the old
David Given [Sun, 10 Jun 2018 11:25:48 +0000 (20:25 +0900)]
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.

6 years agoMerge.
David Given [Sun, 10 Jun 2018 09:09:18 +0000 (18:09 +0900)]
Merge.

6 years agoFix table underrun when looking up the character class of the EOF character,
David Given [Sun, 10 Jun 2018 08:52:45 +0000 (17:52 +0900)]
Fix table underrun when looking up the character class of the EOF character,
-1.

6 years agoMerge pull request #94 from davidgiven/dtrg-ass
David Given [Sat, 9 Jun 2018 13:44:24 +0000 (22:44 +0900)]
Merge pull request #94 from davidgiven/dtrg-ass

Get int and ass building.

6 years agoFile cleanup.
David Given [Sat, 9 Jun 2018 12:21:28 +0000 (21:21 +0900)]
File cleanup.

6 years agoMake ass and int built with clang --- surprisingly easy.
David Given [Sat, 9 Jun 2018 12:18:50 +0000 (21:18 +0900)]
Make ass and int built with clang --- surprisingly easy.

6 years agoMake the em interpreter build --- again, lots of warnings, so it probably won't
David Given [Sat, 9 Jun 2018 12:13:31 +0000 (21:13 +0900)]
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.

6 years agoGet ass running --- it's very K&R and almost certainly won't build on clang,
David Given [Sat, 9 Jun 2018 05:10:45 +0000 (14:10 +0900)]
Get ass running --- it's very K&R and almost certainly won't build on clang,
but it works on gcc.