1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-15 15:57:13 +00:00

157 Commits

Author SHA1 Message Date
Bruce Mitchener
0a057dec6b
Delete code related to NATIVETRAN feature. (#232)
* Delete code related to NATIVETRAN feature.

This was obsolete work that had been done for generating
native code from the bytecode.

Closes Interlisp/medley#89.

* Remove unused SaveD6.
2021-01-19 17:57:53 -08:00
Bruce Mitchener
c89b6fd611
Use the C99 floating point error code on Solaris. (#243)
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.
2021-01-19 19:35:00 +00:00
Nick Briggs
26857f3131
Change icon, cursor images and masks to const uint8_t (#239)
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*.
2021-01-19 10:16:08 -08:00
Bruce Mitchener
4c84412c84
Correct some ifdefs from ISC to RESWAPPEDCODESTREAM. (#227)
`RESWAPPEDCODESTREAM` was only used on ISC, so some `#ifdef`'s were
previously set up incorrectly.
2021-01-15 19:33:39 -08:00
Bruce Mitchener
3480ee9711
Fix typos. (#226) 2021-01-15 16:59:32 +00:00
Nick Briggs
ebc4a24d0b
Fix various spelling, grammatical, and punctuation errors (#222) 2021-01-13 23:08:35 -08:00
Bruce Mitchener
71a04ce117
Remove unused FileIOFlag, TimerFlag. (#221) 2021-01-13 10:58:58 -08:00
Bruce Mitchener
0fbf5e8281
Rename NOETHER to MAIKO_ENABLE_ETHERNET. (#219)
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
```
2021-01-13 17:54:54 +00:00
Bruce Mitchener
62a8d400ce
Use sig_atomic_t for FP_error when using FP exceptions. (#220)
`sig_atomic_t` is usually `int`, but is the typedef that one
should use for flags written to from a signal handler.
2021-01-13 17:52:53 +00:00
Bruce Mitchener
d3efbc3441
Remove HAS_GETHOSTID. (#218)
This is only true on DOS now. It was previously true on older
unsupported platforms, but they are gone now.
2021-01-12 20:10:21 -08:00
Bruce Mitchener
7145f0d380
Rename NOFORN to MAIKO_ENABLE_FOREIGN_FUNCTION_INTERFACE. (#217)
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.
2021-01-12 20:04:23 -08:00
Bruce Mitchener
7b979dd789
Add maiko/platform.h to detect OS + CPU. (#216)
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.
2021-01-13 03:01:49 +00:00
Bruce Mitchener
19329883d5
Add missing foreigndefs.h, includes to foreign.c. (#214) 2021-01-12 17:14:19 -08:00
Bruce Mitchener
5cb18c0710
Merge hacks.c into foreign.c. (#212)
This code was not really valid ANSI C in the way that it was
used, and it was only used by foreign.c, which is #ifdef'd out.
2021-01-11 22:45:49 -08:00
Bruce Mitchener
ec04803b53
Switch s_char uses to signed char. Remove s_char alias. (#208) 2021-01-11 19:00:33 -08:00
Bruce Mitchener
5a8f20c0ca
Default NOFORN to defined. (#209)
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.
2021-01-11 18:17:42 -08:00
Bruce Mitchener
fa1adadd31
Remove SunOS 4 version of aref_switch. (#205)
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.
2021-01-11 17:11:48 -08:00
Alex Segura
68d7908ee6
Support building on OpenBSD, x86-64 (#207)
* 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>
2021-01-11 17:10:57 -08:00
Bruce Mitchener
0058cacc12
Remove I386 version of N_MakeFloat. (#204)
This used to differ, but the differences were dead code and
removed. We have no need for this extra bit of baggage.
2021-01-10 17:24:07 -08:00
Bruce Mitchener
2b5f8eae1c
Remove sysatms.h/c (#201)
The C file was empty, and the H file only had unused constants
in it.
2021-01-10 17:23:32 -08:00
Bruce Mitchener
0e3d3acd4e
Replace int_timer_on|off with int_(un)block. (#193)
Both were used, but one just called the other, so simplify
the API.
2021-01-08 21:38:54 -08:00
Bruce Mitchener
f3b52564e4
Remove OCR code. (#195)
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.
2021-01-08 21:20:18 -08:00
Bruce Mitchener
2dcdf14334
Migrate to POSIX signals. (#190)
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.
2021-01-09 04:55:39 +00:00
Nick Briggs
a093d80fa5
Add include guards to all the include files in inc/ which were missing them. (#189)
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.
2021-01-07 03:06:42 +00:00
Nick Briggs
ebfa196372
Clean up warnings when compiling with ethernet enabled (#188)
* 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
2021-01-05 23:41:18 -08:00
Bruce Mitchener
12b431dbd0
Remove I386-only, undefined macro usages: I386Round, I386Reset. (#185)
These macros aren't actually defined anywhere in our code and
aren't used outside of the old support for the Sun I386 hardware.
2021-01-05 10:26:42 -08:00
Bruce Mitchener
cb815c34a1
Remove REGISTER define. (#184)
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.
2021-01-05 10:26:22 -08:00
Bruce Mitchener
5b54a8c4eb
Use const more. (#183) 2021-01-05 10:26:02 -08:00
Blake McBride
dd4596099c
Pointer math correction (#171)
* Pointer math correction
* Change pointer diff size type to size_t
2021-01-04 19:08:58 -08:00
Nick Briggs
96ab979e7a
Change lisp_string_to_c_string length parameter to be size_t (#179)
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.
2021-01-05 01:23:11 +00:00
Nick Briggs
79b7a300a9
Clean up some mixed signedness issues (#175) 2021-01-04 16:50:21 -08:00
Bruce Mitchener
b549324eb1
Remove inlsparc.h, duplicate of inlnSPARC.h. (#159) 2021-01-03 10:35:42 -08:00
Bruce Mitchener
4d00e0b2a1
Remove #ifdef I386 def for N_GETINUMBER. (#166)
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.
2021-01-03 09:43:45 -08:00
Bruce Mitchener
a271917a61 Switch to using POSIX pseudoterminals.
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`.

Closes interlisp/medley#121.
2021-01-02 12:57:23 +07:00
Larry Masinter
67d6a799db
Merge pull request #158 from Interlisp/unwind-int-unsigned-ptr-confusion
Correct handling of return value of N_OP_unwind()
2021-01-01 14:29:44 -08:00
Nick Briggs
12c5f3231e Correct handling of return value of N_OP_unwind()
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
2021-01-01 14:08:41 -08:00
Bruce Mitchener
fc3908f19a
Fix typos. (#157) 2021-01-01 08:55:24 -08:00
Bruce Mitchener
848177aa95
The SYSVONLY flag is no longer used or needed. (#153)
Welcome to the world of being mostly POSIX!
2020-12-31 17:13:05 -08:00
Bruce Mitchener
d717946929
Cleanup byteswap.c a bit (#154)
* 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.
2020-12-31 10:29:19 -08:00
Bruce Mitchener
f1647df8b1
Default to NOETHER, only enable on Solaris. (#149)
* 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.
2020-12-31 01:33:58 +00:00
Bruce Mitchener
7f7952cbad
Remove USETIMEFN define. (#143)
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.
2020-12-30 14:38:58 -08:00
Bruce Mitchener
01926fc232
NEW_STORAGE is no longer new. (#135)
* 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.
2020-12-28 10:10:43 -08:00
Bruce Mitchener
023cf609f2
init_Xcursor takes Window, not int for window. (#137)
`Window` is an X11 typedef for `unsigned long` (via `XID`). We should
pass it as that, not an `int`, to avoid 64 bit conversion issues.
2020-12-28 07:19:30 +00:00
Bruce Mitchener
0880b2f3dd
Remove UNSAFE flag. (#134)
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.
2020-12-26 20:53:47 +00:00
Bruce Mitchener
e295a34484
Remove inlnMIPS.h. (#133)
We removed support for MIPs platforms, so this code is unused.
2020-12-26 10:43:35 -08:00
Bruce Mitchener
bf2855be58
Use the real gethostid on Solaris. (#121)
* 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`.
2020-12-23 19:55:58 -08:00
Bruce Mitchener
3ef2d12115
Use memset instead of bzero. (#131) 2020-12-23 10:34:27 -08:00
Bruce Mitchener
72948ae0fd
Clean up medleyfp.h. (#127)
* 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.
2020-12-22 23:23:26 -08:00
Bruce Mitchener
0c8ae869b9
Remove comment reference to SIGNED_CHARS define. (#126)
None exists or is used, so no need to discuss it.
2020-12-22 23:17:28 -08:00
Bruce Mitchener
1b9a90add6
Remove XWINDOWS define from FreeBSD, Linux, and macOS builds. (#124)
The right define is `XWINDOW` which is already defined via the
build system.
2020-12-22 23:08:00 -08:00