This changes the BDOS call from CPM_BDOS_CONSOLE_INPUT to
CPN_BDOS_READ_CONSOLE_BUFFER. This allows commands like ^H to delete
characters and ^C to exit to CCP. This is more like how Unix read(2)
uses canonical mode of termios to read a line.
This change has a disadvantage: the user buffer to read(2) must now be
large enough for an entire line. This is because CP/M, unlike Unix,
lacks a kernel buffer to hold the rest of the line. If you use a
buffered input library like stdio to call read(2), then it works; but
if you try to read part of a line or a single character, then it
doesn't work.
Add a variable %{ackldflags} so I can pass `-fp`. This change seems
to cause the build to relink every ackprogram, because the link now
needs to use %{ackldflags} even if the flags are empty.
mandelbrot_c_cpm runs in YAZE-AG; startrek_c_cpm doesn't run because
it doesn't fit in the 16-bit address space.
Old .o files stop working if they use floating point. One must
recompile those files. Old files don't call libfp in the correct way,
and may use symbols that I removed from libem. I don't keep old
symbols in libem/flp.s, because a program that pulls both libfp and
flp.s would get "multiply defined" errors in the linker.
I teach mach/i80/ncg/table to use libfp by copying or adapting the
patterns from mach/i86/ncg/table. I did not test all the patterns,
but I did use `ack -mcpm -fp -O4` to compile examples/mandelbrot.c,
then I ran it in the emulator YAZE-AG. It worked, but it was slow.
This library is for software floating point. The i80 back end has
never implemented floating point, and might not be ready for libfp.
This commit only builds libfp without using it.
I edit first/build.lua and plat/build.lua to allow `ack -c.s`, then
use FP.script to edit the assembly code. I edit FP.script so it
writes the edited assembly code to stdout, not to the input file.
- Don't reverse bitfields; do use ego (41f3bf7).
- Use MACHOPT_F=-m2 (3dae9e4).
- Remove old trap.s (26de4c1).
At this commit, one can build qemuppc with mcg by editing the root
build.lua to uncomment "qemuppc" in "vars.plats". If one also
uncomments "qemuppc" from "vars.plats_with_tests", then mcg fails to
build the tests. If one uses ncg (by editing plat/qemuppc/descr to
change "mcg" to "ncg"), then the tests pass.
You may need to delete and recompile some .o files! This changes the
alignment of 8-byte values in C structs to match what Apple's gcc
does. See Apple's "32-bit PowerPC Function Calling Conventions" at
https://developer.apple.com
/library/content/documentation/DeveloperTools/Conceptual/LowLevelABI
/100-32-bit_PowerPC_Function_Calling_Conventions/32bitPowerPC.html
In the instruction list, put /* kills xer */ for sraw, srawi, subfic;
and correct the (now unused) "addi." and "lfdu".
Change MACHOPT_F from -m3 to -m2. This changes the code for 15 * i
from
slwi r3,r4,4
subfic r5,r4,0
add r3,r3,r5
to
mulli r3,r4,15
If the sequence "slwi subfic addi" takes 3 cycles and 12 bytes, and
mulli takes 3 cycles and 4 bytes, then mulli is better.
A signal handler might call sigaction(). We must block all signals,
not only our signal, to prevent a race between us and the next signal
handler.
Use /* comments */ because cpp might expand macros in ! comments
though such expansion is probably harmless.
The bridge is now shorter by 2 instructions.
Rename plat/linux/libsys/errno.s to plat/linux386/libsys/trapno.s and
stop building it for linux68k and linuxppc. It defines symbols for
mach/i386/libem.
In syscalls.h, the numbers after 165 are only for i386, so hide them
from 68k, ppc. These numbers are unused, because the system calls now
in libsys use the lower numbers.
Also teach the build system that libsys depends on the internal
headers in plat/linux/libsys/*.h
The new test rck_e.e segfaults on PowerPC unless I make some changes.
The inline code for _rck_ was wrong because it didn't allow the trap
handler to return. _sig_ forgot to push the old trap handler.
Move plat/linuxppc/libsys/trap.s to mach/powerpc/libem/trp.s and
rewrite it with simplified/extended mnemonics. Remove .trap alias for
.trp procedure. Add a missing `mtspr lr, r0` so we can return from
the trap handler. Call write() and _exit() so trp.s works with both
linuxppc and osxppc. Before, Mac OS X was wrongly using the trap.s
for Linux.
In powerpc/libem, simplify .aar4; teach .csa and .csb to raise the
trap if the default target is zero.
C programs don't need these changes. You may relink your C programs
with the changed .csa and .csb, but C code doesn't raise the trap.
Modula-2 code can raise traps, so you may want to relink your Modula-2
programs with the changed libem, but you might keep your old .o files
from Modula-2. You may need to recompile your Pascal programs (delete
old .o files from Pascal) because the Pascal compiler might use _rck_.
ack -mlinuxppc -O4 now runs more phases of ego, including the register
allocation phase, so ncg emits better code.
Set MACHOPT_F=-m3 as I did it for osxppc; see commit 0c2b6f5.
Remove CC_ALIGN=-Vr so bitfields agree with gcc for PowerPC Linux.
Remove unused C_LIB and OLD_C_LIB.
Linux passes the arguments in registers, but our compiler expects
arguments on the stack. Signal handlers got garbage instead of the
signal number. Some handlers, like the one in lang/m2/libm2/sigtrp.c,
need the correct signal number.
I write a "bridge" in PowerPC assembly that moves the arguments to the
stack. I put the bridge in sigaction(), so I provide a signal() that
calls sigaction(). I remove the *.c glob or wildcard from build.lua,
so linuxppc only compiles its own signal.c, not the other signal.c for
linux386 and linux68k.
My bridge uses sigprocmask(), so I also add sigprocmask(). Because
linux386 and linux68k use globs, they also get sigprocmask(). I sync
the header files so all three Linux platforms declare execve(),
sigprocmask(), and unlink(), but not remove(), because we have
remove() in <stdio.h>.
I am using sigaction.s to test some features that we recently added to
our PowerPC assembler. These are the "hi16[...]" and "lo16[...]"
syntax, and also the extended names like "beq", "cmpwi", "li", "subi".
possible values. Add the PowerPC ncg and mcg backend support to let the test
actually run, including modifying a bunch of PowrePC libem functions so that
they can be called from both ncg and mcg.
Without this, qemu-system-ppc spins the host cpu until I close its
window. I assume the default G3 emulation. The emulator yields the
host cpu if I set certain flags in hid0 then msr. The hid0 flag can
be any of DOZE, NAP, SLEEP, so I just set all 3. I encode mfmsr and
mtmsr with .data4, because our assembler doesn't know instructions for
supervisor mode.
Also move some common symbols from .rom to .bss. Our assembler puts
common symbols in any section.
Also clean up the file. Delete a comment about linuxppc that is wrong
here. Delete redundant .extern because .define is the same.
Telling osx386 and osxppc to build and run their own tools, not to
reuse the tools from linux386 and linuxppc. This wastes time to build
identical tools, but it removes some bogus dependencies. OS X tools
had wrongly depended on Linux descr files and aelflod; now they don't.
Discussion in https://github.com/davidgiven/ack/pull/23
Until now, I was always doing chmod +x before running my files on the
Mac. Now files get created +x. There's no change when overwriting
an existing file. I needed to gmake clean my build to remove the
example programs without +x, so cvmach can create them with +x.
If I want to check for overflow, then I should check it before I do
base + incr, not after.
Now that I have no check, I am passing the overflowed base + incr to
brk1(), where it will probably fail the nbreak < segment check.
This manual is in the new mdoc(7) format. All existing ack manuals
use the old man(7) format. This might be a problem if someone can't
display mdoc(7) files.
The build system doesn't install the cvmach(6) manual; that might
happen later. The current build system installs manuals in two
different places, and doesn't install some manuals, so I don't know
what to do.