* Delete code related to NATIVETRAN feature.
This was obsolete work that had been done for generating
native code from the bytecode.
ClosesInterlisp/medley#89.
* Remove unused SaveD6.
Previously, we were building as C89 and the new code required
the C99 flag on Solaris with Sun Studio. Now that we build as
C99, this should work now and we can remove the special case
code.
The predefined cursors (image and mask) are better represented
as arrays of const uint8_t rather than char. Likewise for the
window icon. Track this change in the functions that take the
image and mask as arguments, casting only when we get to the
X library functions that take char*.
Like the renaming of NOFORN, this gets rid of some double
negatives. It also removes some patterns where we had:
```
#ifdef NOETHER
#else
...
#endif
```
and replaces them with:
```
#ifdef MAIKO_ENABLE_ETHERNET
...
#endif
```
This lets us get rid of double-negatives, which are confusing,
and starts a naming scheme that is easier to see when something
is a Maiko flag versus something else.
This also adds a bit to the `-info` output to say which OS and CPU
are being targeted.
This can be used in subsequent commits to drive whether or not
we need `BYTESWAP` and whether or not unaligned memory access
is okay.
We'll be able to remove per-platform defines from all of the
makefiles and cmake.
The NOFORN flag controls foreign function interface code, which
was written using the dld_* APIs which haven't existed in years.
There was a GNU dld that provided this API, but it was withdrawn
in 2006.
If this code is to be re-enabled, it will have to be changed to
use the `dlopen` family of APIs.
When compiling for SunOS4, we would have a macro-ized version
of this function which required a slightly different call-site.
This removes all of that as it isn't used or needed.
* Support building on OpenBSD, x86-64
* Clean up OpenBSD Makefile
* Add OpenBSD to cmake build
* Use clang as CC for OpenBSD
Co-authored-by: Alex Segura <alex@lispm.dev>
This is very dated code that assumes there's a `/dev/ocr0`.
I'm not sure what system this was for, but it doesn't appear to
be one that exists currently.
Discussed in interlisp/medley#126.
This removes SYSVSIGNALS as we're always and only using POSIX
signals now.
Some platform differences have been papered over. We used to
only ignore SIGPIPE when using BSD signals, but we now ignore
it all the time.
While the SIGFPE code will now compile, it hasn't been updated
to work on modern OSes fully yet as it will need to enable
the correct FP exceptions.
As a prerequisite for cleaning up some other include issues, all the
include files in inc/ should have an include guard. All the xxxdefs.h
were created with them, but most older files were not.
* Clean up warnings when compiling with ethernet enabled
Add a dlpidefs.h header for prototypes of the dlpi.c functions.
Convert from bcopy() to memcpy().
Change some char to u_char as needed.
* Neither ether_addr_equal nor init_uid need to be defined if NOETHER is defined
This was used to indicate that the value was allowed to live
in a register. Compilers are much better now and can handle
this themselves.
This helps get rid of more platform-specific ifdef-ery.
The argument passed to the length parameter of lisp_string_to_c_string is
always the sizeof an array, and since it is compared to the Lisp unsigned
length of the Lisp string is more appropriately a size_t than an int.
Likewise for the index into a string.
There were 2 definitions for `N_GETINUMBER`, one for `I386` and one
for `I386` not being defined. Whether they differed or not in the
past isn't known, but they're identical now, so we don't need
two definitions.
Previously, we were using SysV pseudo-terminals on Solaris and BSD
pseudo-terminals on other Unix platforms. BSD pseudo-terminals have
been deprecated on Linux and are no longer available in some kernel
configurations.
The POSIX API is basically the same as the SysV API, apart from using
`posix_openpt` instead of `open` with `/dev/ptmx`.
Closesinterlisp/medley#121.
The return value of N_OP_unwind is really of type LispPTR *, however it was
declared as UNSIGNED (effectively uintptr_t) so that the ERROR_EXIT macro
could be used to return an error indication (-1, =UINT_MAX). The call site
checked for the error condition with (int)result < 0, not accounting for the
case where a native pointer may have the high-order bit set.
We correct this problem by declaring the return type as LispPTR *,
and expand the ERROR_EXIT macro in place substituting (LispPTR *)(-1)
as the error return value, and at the single call site check for equality
with that same value.
The test case was executing the opcode tester on a Raspberry Pi or
a BeagleBone Black/Debian 10.3 where the non-error result was > 0xB0000000
modified: inc/inlineC.h
modified: inc/unwinddefs.h
modified: src/unwind.c
* Remove word_swap_longword.
This was the same as `swapx` and not used except in one place which
now uses `swapx` instead.
* Remove assembly versions of swapx, byte_swap_word, word_swap_page.
`swapx` and `byte_swap_word` were defined as:
```
extern inline const unsigned int swapx (unsigned int word)
{
asm("roll $16,%0" : "=g" (word) : "0" (word));
return(word);
}
extern inline const unsigned short byte_swap_word (unsigned short word)
{
asm("rolw $8,%0" : "=r" (word) : "0" (word));
return(word);
}
```
But the generated code from the C version is:
```
(lldb) disassemble -n swapx
ldex`swapx:
ldex[0x10002e0d0] <+0>: pushq %rbp
ldex[0x10002e0d1] <+1>: movq %rsp, %rbp
ldex[0x10002e0d4] <+4>: movl %edi, %eax
ldex[0x10002e0d6] <+6>: roll $0x10, %eax
ldex[0x10002e0d9] <+9>: popq %rbp
ldex[0x10002e0da] <+10>: retq
(lldb) disassemble -n byte_swap_word
ldex`byte_swap_word:
ldex[0x10002e0e0] <+0>: pushq %rbp
ldex[0x10002e0e1] <+1>: movq %rsp, %rbp
ldex[0x10002e0e4] <+4>: rolw $0x8, %di
ldex[0x10002e0e8] <+8>: movzwl %di, %eax
ldex[0x10002e0eb] <+11>: popq %rbp
ldex[0x10002e0ec] <+12>: retq
```
So we don't really stand to gain by re-enabling this old assembler code.
We would gain from switching to C99 or C11 and improving our
inlining.
* Remove 386 asm version of bit_reverse_region.
This is implemented in C and the code isn't actually set up to
allow using the assembler version.
* Default to NOETHER, only enable on Solaris.
* DOS: NOETHER controlled by inc/version.h
We set NOETHER by default on DOS, so no need for it here in the
build system.
In the past, we didn't use `gettimeofday()` on all non-DOS platforms
because it wasn't available, so we had to fall back to `time()`.
Those days are long gone and we have `gettimeofday()` on all non-DOS
platforms.
This also removes some code that used `times()` when it used `time()`.
This leaves us using `getrusage()` on all non-DOS platforms. This,
much like `gettimeofday()`, is now available everywhere. Not all of
the fields used here are guaranteed by POSIX, but the ones used
here shouldn't be an issue for now.
* Always follow NEW_STORAGE code paths.
This removes the code paths for the pre-NEW_STORAGE code.
* Remove NEW_STORAGE from build system.
The code no longer refers to `NEW_STORAGE`, so we can remove
this from the build system.
This flag was for SunOS 3 and 4 on sun3 hardware (68k).
It enabled some unsafe optimizations via assembler. This hasn't
actually been built since the DOS port (since the header for this
was renamed, but the code in `xc.c` wasn't updated).
The optimizations here made assumptions that were specific to the
68k hardware and register allocation. They aren't likely to be
of much use moving forward, and we've got plenty of safe performance
improvements from the last 30 years of hardware advances.
* Use the real gethostid on Solaris.
Solaris has this, so we might as well use it like we do on other
platforms. This value is used in response to queries from it from
Lisp.
* Improve undefining of HAS_GETHOSTID.
Enable it on Solaris in `inc/version.h`. This file already
disables it on DOS, so no need to do so again in `src/initsout.c`.
* Include <ieeefp.h> for Solaris.
* Remove sections for sparc and Sun i386 for non-Solaris.
* Have Linux use the same code as FreeBSD and macOS.
* Make the FreeBSD / Linux / macOS code path the default, if nothing
special is defined since it is the modern way.
* Remove fpstatus_() usage from the ancient days.