Re: [hatari-devel] Basic cpu testsuite

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


On Samstag, 28. April 2018 08:53:30 CEST Thomas Huth wrote:
> Sorry, but I did not see any patch attached to that mail.

The patch was in the archive ;) Ok, a bit confusing, so just again. The 
archive now also contains the whole tests/cpu directory. The patch is in a 
separate attachment. The only difference is that the patch also has 2 small 
changes, to .hgignore and tests/CMakeLists.txt.

# HG changeset patch
# User Thorsten Otto <admin@xxxxxxxxxxx>
# Date 1524747361 -7200
#      Thu Apr 26 14:56:01 2018 +0200
# Node ID 41f2e8a1ac81838832c74c26ce9143d675f0b54f
# Parent  3d5c93e19e03a11dfdfc6ad6dfa7cfff8645ab72
Add basic cpu testsuite

diff -r 3d5c93e19e03 -r 41f2e8a1ac81 .hgignore
--- a/.hgignore	Thu Apr 26 14:44:55 2018 +0200
+++ b/.hgignore	Thu Apr 26 14:56:01 2018 +0200
@@ -47,3 +47,5 @@
 build/*
 Hatari.build/*
 Release/*
+
+tests/cpu/*.ttp
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/CMakeLists.txt
--- a/tests/CMakeLists.txt	Thu Apr 26 14:44:55 2018 +0200
+++ b/tests/CMakeLists.txt	Thu Apr 26 14:56:01 2018 +0200
@@ -6,3 +6,4 @@
 	add_subdirectory(natfeats)
 	add_subdirectory(xbios)
 endif(UNIX)
+add_subdirectory(cpu)
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/cpu/CMakeLists.txt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/cpu/CMakeLists.txt	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,100 @@
+
+set(testrunner ${CMAKE_CURRENT_SOURCE_DIR}/run_test.sh)
+
+find_program(M68K_GCC_EXECUTABLE NAMES m68k-atari-mint-gcc DOC "path to the m68k assembler")
+mark_as_advanced(M68K_GCC_EXECUTABLE)
+
+if(M68K_GCC_EXECUTABLE)
+    exec_program(${M68K_GCC_EXECUTABLE} ARGS -print-libgcc-file-name OUTPUT_VARIABLE M68K_LIBGCC)
+endif()
+
+function(M68K_GCC_TARGET Name Input Output)
+    set(keywordArgs)
+    set(oneValueArgs COMPILE_FLAGS)
+    set(multiValueArgs)
+    set(LIBCMINI_DIR ../libcmini)
+    set(M68K_CFLAGS -O2 -nostdlib -nostdinc -I${LIBCMINI_DIR}/include)
+    set(M68K_LDFLAGS -s)
+    set(M68K_LIBS -L${LIBCMINI_DIR} -lcmini ${M68K_LIBGCC})
+    
+    cmake_parse_arguments(
+      M68K_GCC_TARGET_ARG
+      "${keywordArgs}"
+      "${oneValueArgs}"
+      "${multiValueArgs}"
+      ${ARGN}
+      )
+
+    add_custom_command(OUTPUT "${Output}"
+      COMMAND ${M68K_GCC_EXECUTABLE} ${M68K_CFLAGS} ${M68K_LDFLAGS} ${M68K_GCC_TARGET_ARG_COMPILE_FLAGS} -o ${Output} ${LIBCMINI_DIR}/crt0.o ${Input} ${M68K_LIBS}
+      DEPENDS ${Input}
+      COMMENT "[M68K_GCC][${Name}] Compiling C code with M68K-cross-compiler ${M68K_GCC_VERSION}"
+      WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+
+    set(M68K_GCC_${Name}_DEFINED TRUE)
+    set(M68K_GCC_${Name}_OUTPUTS ${Output})
+    set(M68K_GCC_${Name}_INPUT ${Input})
+endfunction()
+
+function(add_m68k_test Name)
+   set(keywordArgs)
+   set(oneValueArgs INPUT OUTPUT COMPILE_FLAGS)
+   set(multiValueArgs CPUS)
+   
+   cmake_parse_arguments(M68K_TEST "${keywordArgs}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+   if(NOT M68K_TEST_INPUT)
+     set(M68K_TEST_INPUT ${Name}.c)
+   endif()
+   if(NOT M68K_TEST_OUTPUT)
+     set(M68K_TEST_OUTPUT ${Name}.ttp)
+   endif()
+   if(NOT M68K_TEST_CPUS)
+     set(M68K_TEST_CPUS 0 1 2 3 4 6)
+   endif()
+   
+   add_custom_target(${Name} ALL DEPENDS ${M68K_TEST_OUTPUT})
+   M68K_GCC_TARGET(${Name} "${M68K_TEST_INPUT}" "${M68K_TEST_OUTPUT}" COMPILE_FLAGS "${M68K_TEST_COMPILE_FLAGS}")
+
+   foreach (lvl IN LISTS M68K_TEST_CPUS)
+     if(ENABLE_WINUAE_CPU OR (lvl LESS 6))
+       add_test(NAME ${Name}-680${lvl}0 COMMAND ${testrunner} $<TARGET_FILE:hatari> ${M68K_TEST_OUTPUT} ${lvl} --mmu false)
+     endif()
+     if(ENABLE_WINUAE_CPU)
+       if (lvl GREATER_EQUAL 3)
+         add_test(NAME ${Name}-680${lvl}0-mmu COMMAND ${testrunner} $<TARGET_FILE:hatari> ${M68K_TEST_OUTPUT} ${lvl} --mmu true)
+       endif()
+     endif(ENABLE_WINUAE_CPU)
+   endforeach(lvl)
+endfunction()
+
+if(M68K_GCC_EXECUTABLE)
+   set(m68k_hardfloat "-m68020-60")
+
+   add_m68k_test(hello)
+   add_m68k_test(test_abcd_c)
+   add_m68k_test(test_add_c)
+   add_m68k_test(test_adda_c)
+   add_m68k_test(test_addi_c)
+   add_m68k_test(test_addq_c)
+   add_m68k_test(test_addx_c)
+   add_m68k_test(test_asl_c)
+   add_m68k_test(test_lsl_c)
+   add_m68k_test(test_rol_c)
+   add_m68k_test(test_svs_c)
+
+   add_m68k_test(test_bfext_c CPUS 2 3 4 6 COMPILE_FLAGS "-m68020")
+   add_m68k_test(test_bfins_c CPUS 2 3 4 6 COMPILE_FLAGS "-m68020")
+
+   add_m68k_test(test_fabs_c CPUS 3 4 6 COMPILE_FLAGS ${m68k_hardfloat})
+   add_m68k_test(test_fadd_c CPUS 3 4 6 COMPILE_FLAGS ${m68k_hardfloat})
+   add_m68k_test(test_fdiv_c CPUS 3 4 6 COMPILE_FLAGS ${m68k_hardfloat})
+   add_m68k_test(test_fetox_c CPUS 3 4 6 COMPILE_FLAGS ${m68k_hardfloat})
+   add_m68k_test(test_fgetexp_c CPUS 3 4 6 COMPILE_FLAGS ${m68k_hardfloat})
+   add_m68k_test(test_flogn_c CPUS 3 4 6 COMPILE_FLAGS ${m68k_hardfloat})
+   add_m68k_test(test_fmove_c CPUS 3 4 6 COMPILE_FLAGS ${m68k_hardfloat})
+   add_m68k_test(test_fmovecr_c CPUS 3 4 6 COMPILE_FLAGS ${m68k_hardfloat})
+   add_m68k_test(test_fmul_c CPUS 3 4 6 COMPILE_FLAGS ${m68k_hardfloat})
+   add_m68k_test(test_fscale_c CPUS 3 4 6 COMPILE_FLAGS ${m68k_hardfloat})
+   add_m68k_test(test_fsub_c CPUS 3 4 6 COMPILE_FLAGS ${m68k_hardfloat})
+   add_m68k_test(test_inf_c CPUS 3 4 6 COMPILE_FLAGS ${m68k_hardfloat})
+endif()
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/cpu/hello.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/cpu/hello.c	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+int main(void)
+{
+	puts("Hello, world");
+	return 0;
+}
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/cpu/run_test.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/cpu/run_test.sh	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+if [ $# -lt 3 -o "$1" = "-h" -o "$1" = "--help" ]; then
+	echo "Usage: $0 <hatari> <program> <cpulevel> ..."
+	exit 1;
+fi
+
+hatari="$1"
+shift
+if [ ! -x "$hatari" ]; then
+	echo "First parameter must point to valid hatari executable."
+	exit 1;
+fi;
+
+program="$1"
+shift
+if [ ! -f "$program" ]; then
+	echo "Second parameter must point to valid gemdos executable."
+	exit 1;
+fi;
+
+cpulevel="$1"
+shift
+fpu="--fpu none"
+case "$cpulevel" in
+0|1|2) ;;
+3) fpu="--fpu 68882" ;;
+4|6) fpu="--fpu internal" ;;
+*)
+	echo "Third parameter must be cpulevel in range 0..4, or 6."
+	exit 1
+	;;
+esac
+
+basedir=$(dirname $0)
+testdir=$(mktemp -d)
+
+remove_temp() {
+  if test "$program" != test-inf.ttp; then rm -rf "$testdir"; fi
+}
+trap remove_temp EXIT
+
+export SDL_VIDEODRIVER=dummy
+export SDL_AUDIODRIVER=dummy
+
+RUNTEST_ARGS="$hatari --log-level debug --sound off --cpuclock 32 \
+	--tos none -d $testdir --run-vbls 500 --bios-intercept on --cpulevel $cpulevel $fpu --fpu-softfloat 1 $@ $basedir/$program"
+	
+echo HOME="$testdir" $RUNTEST_ARGS > "$testdir/out.txt"
+HOME="$testdir" $RUNTEST_ARGS 2>> "$testdir/out.txt"
+exitstat=$?
+if [ $exitstat -ne 0 ]; then
+	echo "Running hatari failed. Status=${exitstat}."
+	cat "$testdir/out.txt"
+	exit 1
+fi
+
+exit 0
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/cpu/test_abcd_c.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/cpu/test_abcd_c.c	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,56 @@
+#include "testdriver.h"
+
+int numtests;
+
+int main(void)
+{
+	char fail;
+	int status;
+	long d0, d1, result;
+	
+	status = 0;
+	
+	++numtests;
+	/* test that ABCD clears Z only if result is nonzero */
+	__asm__ __volatile__(
+		"\tclr.l %[d0]\n"
+		"\tmove.l #1,%[d1]\n"
+		"\tabcd %[d0],%[d0]\n"
+		"\tseq %[fail]\n"
+	: [fail] "=dm"(fail), [d0]"=d"(d0), [d1]"=d"(d1)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #1,%[d1]\n"
+		"\tclr.l %[d0]\n"
+		"\tabcd %[d1],%[d1]\n"
+		"\tseq %[fail]\n"
+	: [fail] "=dm"(fail), [d0]"=d"(d0), [d1]"=d"(d1)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #0x033,%[result]\n"
+		"\tmove.l #0x044,%[d0]\n"
+		"\tabcd %[d0],%[result]\n"
+	: [result]"=d"(result), [d0]"=d"(d0)
+	:
+	: "cc", "memory");
+	EXPECT(result, 0x77L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #0x155,%[result]\n"
+		"\tabcd %[result],%[result]\n"
+	: [result]"=d"(result)
+	:
+	: "cc", "memory");
+	EXPECT(result, 0x110L);
+	
+	return status;
+}
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/cpu/test_add_c.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/cpu/test_add_c.c	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,104 @@
+#include "testdriver.h"
+
+int numtests;
+
+int main(void)
+{
+	char fail, fail2;
+	int status;
+	long d0, result;
+	
+	status = 0;
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tsub.l %[d0],%[d0]\n"
+		"\tsne %[fail]\n"
+	: [fail]"=dm"(fail), [d0]"=d"(d0)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.b #0x80,%[d0]\n"
+		"\tadd.b %[d0],%[d0]\n"
+		"\tsne %[fail]\n"
+	: [fail]"=dm"(fail), [d0]"=d"(d0)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.w #0x8000,%[d0]\n"
+		"\tadd.w %[d0],%[d0]\n"
+		"\tsne %[fail]\n"
+	: [fail]"=dm"(fail), [d0]"=d"(d0)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #0x80000000,%[d0]\n"
+		"\tadd.l %[d0],%[d0]\n"
+		"\tsne %[fail]\n"
+	: [fail]"=dm"(fail), [d0]"=d"(d0)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #0x55667778,%[result]\n"
+		"\tmove.l #0x11223388,%[d0]\n"
+		"\tadd.b %[d0],%[result]\n"
+		"\tsne %[fail]\n"
+		"\tscc %[fail2]\n"
+	: [result]"=d"(result), [fail]"=dm"(fail), [fail2]"=dm"(fail2), [d0]"=d"(d0)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	CHECK(fail2);
+	EXPECT(result, 0x55667700L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #0x55667788,%[result]\n"
+		"\tmove.l #0x11223344,%[d0]\n"
+		"\tadd.w %[d0],%[result]\n"
+		"\tscs %[fail]\n"
+	: [result]"=d"(result), [fail]"=dm"(fail), [d0]"=d"(d0)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	EXPECT(result, 0x5566aaccL);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #0x55667788,%[result]\n"
+		"\tmove.l #0x11223344,%[d0]\n"
+		"\tadd.l %[d0],%[result]\n"
+		"\tscs %[fail]\n"
+	: [result]"=d"(result), [fail]"=dm"(fail), [d0]"=d"(d0)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	EXPECT(result, 0x6688aaccL);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #0x80000000,%[result]\n"
+		"\tadd.l %[result],%[result]\n"
+		"\tscc %[fail]\n"
+		"\tsvc %[fail2]\n"
+	: [result]"=d"(result), [fail]"=dm"(fail), [fail2]"=dm"(fail2)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	CHECK(fail2);
+	EXPECT(result, 0L);
+	
+	return status;
+}
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/cpu/test_adda_c.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/cpu/test_adda_c.c	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,78 @@
+#include "testdriver.h"
+
+int numtests;
+
+int main(void)
+{
+	char fail;
+	int status;
+	long a0;
+	long d0;
+	
+	status = 0;
+	
+	/* test that ADDA does not modify CCR */
+	++numtests;
+	__asm__ __volatile__(
+		"\tsuba.l %[a0],%[a0]\n"
+		"\tmove #0,ccr\n"
+		"\tadda.l %[a0],%[a0]\n"
+		"\tseq %[fail]\n"
+	: [fail]"=dm"(fail), [a0]"=a"(a0)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #0x80000000,%[a0]\n"
+		"\tmove #0,ccr\n"
+		"\tadda.l %[a0],%[a0]\n"
+		"\tscs %[fail]\n"
+	: [fail]"=dm"(fail), [a0]"=a"(a0)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #0x80000000,%[a0]\n"
+		"\tmove #0,ccr\n"
+		"\tadda.l %[a0],%[a0]\n"
+		"\tsvs %[fail]\n"
+	: [fail]"=dm"(fail), [a0]"=a"(a0)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #0x40000000,%[a0]\n"
+		"\tmove #0,ccr\n"
+		"\tadda.l %[a0],%[a0]\n"
+		"\tsmi %[fail]\n"
+	: [fail]"=dm"(fail), [a0]"=a"(a0)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #0x80000000,%[a0]\n"
+		"\tclr.l %[d0]\n"
+		"\tmove #0,ccr\n"
+		"\tadda.l %[a0],%[a0]\n"
+#if defined(__mc68010__) || defined(__mc68020__) || defined(__mc68030__) || defined(__mc68040__) || defined(__mc68060__)
+		"\tmove ccr,%[d0]\n"
+#else
+		"\tmove sr,%[d0]\n"
+#endif
+		"\ttst.b %[d0]\n"
+		"\tsne %[fail]\n"
+	: [fail]"=dm"(fail), [a0]"=a"(a0), [d0]"=d"(d0)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	
+	return status;
+}
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/cpu/test_addi_c.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/cpu/test_addi_c.c	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,86 @@
+#include "testdriver.h"
+
+int numtests;
+
+int main(void)
+{
+	char fail, fail2;
+	int status;
+	long d0, result;
+	
+	status = 0;
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tsub.l %[d0],%[d0]\n"
+		"\tsne %[fail]\n"
+	: [fail]"=dm"(fail), [d0]"=d"(d0)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tsub.l %[d0],%[d0]\n"
+		"\taddi.b #0,%[d0]\n"
+		"\tsne %[fail]\n"
+	: [fail]"=dm"(fail), [d0]"=d"(d0)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tsub.l %[d0],%[d0]\n"
+		"\taddi.w #0,%[d0]\n"
+		"\tsne %[fail]\n"
+	: [fail]"=dm"(fail), [d0]"=d"(d0)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tsub.l %[d0],%[d0]\n"
+		"\taddi.l #0,%[d0]\n"
+		"\tsne %[fail]\n"
+	: [fail]"=dm"(fail), [d0]"=d"(d0)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #0x55667778,%[result]\n"
+		"\taddi.b #0x88,%[result]\n"
+		"\tsne %[fail]\n"
+		"\tscc %[fail2]\n"
+	: [fail]"=dm"(fail), [fail2]"=dm"(fail2), [result]"=d"(result)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	CHECK(fail2);
+	EXPECT(result, 0x55667700L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #0x55667788,%[result]\n"
+		"\taddi.w #0x3344,%[result]\n"
+		"\tscs %[fail]\n"
+	: [fail]"=dm"(fail), [result]"=d"(result)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	EXPECT(result, 0x5566aaccL);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #0x55667788,%[result]\n"
+		"\taddi.l #0x11223344,%[result]\n"
+	: [result]"=d"(result)
+	:
+	: "cc", "memory");
+	EXPECT(result, 0x6688aaccL);
+	
+	return status;
+}
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/cpu/test_addq_c.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/cpu/test_addq_c.c	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,58 @@
+#include "testdriver.h"
+
+int numtests;
+
+int main(void)
+{
+	char fail, fail2, fail3;
+	int status;
+	long d0, result;
+	
+	status = 0;
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tsub.l %[d0],%[d0]\n"
+		"\tsne %[fail]\n"
+	: [fail]"=dm"(fail), [d0]"=d"(d0)
+	: 
+	: "cc", "memory");
+	CHECK(fail);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tsub.l %[d0],%[d0]\n"
+		"\taddq.b #1,%[d0]\n"
+		"\tseq %[fail]\n"
+	: [fail]"=dm"(fail), [d0]"=d"(d0)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tsub.l %[d0],%[d0]\n"
+		"\taddq.w #1,%[d0]\n"
+		"\tseq %[fail]\n"
+	: [fail]"=dm"(fail), [d0]"=d"(d0)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #0x55667778,%[result]\n"
+		"\taddq.b #8,%[result]\n"
+		"\tscs %[fail]\n"
+		"\tspl %[fail2]\n"
+		"\tsvc %[fail3]\n"
+	: [result]"=d"(result), [fail]"=dm"(fail), [fail2]"=dm"(fail2), [fail3]"=dm"(fail3)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	CHECK(fail2);
+	CHECK(fail3);
+	EXPECT(result, 0x55667780L);
+	
+	return status;
+}
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/cpu/test_addx_c.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/cpu/test_addx_c.c	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,37 @@
+#include "testdriver.h"
+
+int numtests;
+
+int main(void)
+{
+	char fail;
+	int status;
+	long d0, d1;
+	
+	status = 0;
+	
+	/* test that ADDX does clears Z only if result is nonzero */
+	++numtests;
+	__asm__ __volatile__(
+		"\tclr.l %[d0]\n"
+		"\tmove.l #1,%[d1]\n"
+		"\taddx %[d0],%[d0]\n"
+		"\tseq %[fail]\n"
+	: [fail]"=dm"(fail), [d0]"=d"(d0), [d1]"=d"(d1)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #1,%[d1]\n"
+		"\tclr.l %[d0]\n"
+		"\taddx %[d1],%[d1]\n"
+		"\tseq %[fail]\n"
+	: [fail]"=dm"(fail), [d0]"=d"(d0), [d1]"=d"(d1)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	
+	return status;
+}
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/cpu/test_asl_c.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/cpu/test_asl_c.c	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,33 @@
+#include "testdriver.h"
+
+int numtests;
+
+int main(void)
+{
+	char fail, fail2;
+	int status;
+	long d1, d2, d3, result;
+	
+	status = 0;
+	
+	/* test that both C & X flags are set to the last bit shifted out */
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #0,%[d1]\n"
+		"\tmove.l #1,%[d2]\n"
+		"\tmove.l #1,%[d3]\n"
+		"\tmove.l #0,%[result]\n"
+		"\tlsr.l %[d2],%[d3]\n" /* should set X & C */
+		"\tscc %[fail]\n"
+	    "\tasl #1,%[d1]\n"   /* should clear C and X */
+	    "\tscs %[fail2]\n"
+		"\taddx.l %[result],%[result]\n"
+	: [result]"=d"(result), [fail]"=dm"(fail), [fail2]"=dm"(fail2), [d1]"=d"(d1), [d2]"=d"(d2), [d3]"=d"(d3)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	CHECK(fail2);
+	EXPECT(result, 0L);
+	
+	return status;
+}
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/cpu/test_bfext_c.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/cpu/test_bfext_c.c	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,190 @@
+#include "testdriver.h"
+
+int numtests;
+
+int main(void)
+{
+	int status;
+	char fail;
+	long d0, result;
+	long data[2];
+	
+	status = 0;
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #-1,%[result]\n"
+		"\tmove.l %[result],%[d0]\n"
+		"\tbfextu %[d0]{1:3},%[result]\n"
+		"\tspl %[fail]\n"
+	: [result]"=d"(result), [fail]"=dm"(fail), [d0]"=d"(d0)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	EXPECT(result, 0x7L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #-1,%[result]\n"
+		"\tmove.l %[result],%[d0]\n"
+		"\tbfexts %[d0]{1:3},%[result]\n"
+		"\tspl %[fail]\n"
+	: [result]"=d"(result), [fail]"=dm"(fail), [d0]"=d"(d0)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	EXPECT(result, -1L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #0xf0f0f0f0,%[d0]\n"
+		"\tbfextu %[d0]{2:3},%[result]\n"
+	: [result]"=d"(result), [d0]"=d"(d0)
+	:
+	: "cc", "memory");
+	EXPECT(result, 0x06L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #0xf0f0f0f0,%[d0]\n"
+		"\tbfextu %[d0]{7:3},%[result]\n"
+		"\tsmi %[fail]\n"
+	: [result]"=d"(result), [fail]"=dm"(fail), [d0]"=d"(d0)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	EXPECT(result, 0x03L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #0xf0f0f0f0,%[d0]\n"
+		"\tbfexts %[d0]{2:3},%[result]\n"
+	: [result]"=d"(result), [d0]"=d"(d0)
+	:
+	: "cc", "memory");
+	EXPECT(result, 0xfffffffeL);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #0xf0f0f0f0,%[d0]\n"
+		"\tbfexts %[d0]{7:3},%[result]\n"
+		"\tsmi %[fail]\n"
+	: [result]"=d"(result), [fail]"=dm"(fail), [d0]"=d"(d0)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	EXPECT(result, 0x03L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #0xf0f0f0f0,%[d0]\n"
+		"\tbfextu %[d0]{31:31},%[result]\n"
+	: [result]"=d"(result), [d0]"=d"(d0)
+	:
+	: "cc", "memory");
+	EXPECT(result, 0x3c3c3c3cL);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #0xf0f0f0f0,%[d0]\n"
+		"\tbfextu %[d0]{24:9},%[result]\n"
+	: [result]"=d"(result), [d0]"=d"(d0)
+	:
+	: "cc", "memory");
+	EXPECT(result, 0x1e1L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #0x1e1,%[result]\n"
+		"\tbfclr %[result]{24:1}\n"
+	: [result]"=d"(result)
+	:
+	: "cc", "memory");
+	EXPECT(result, 0x161L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #0x161,%[result]\n"
+		"\tbfset %[result]{24:5}\n"
+	: [result]"=d"(result)
+	:
+	: "cc", "memory");
+	EXPECT(result, 0x1f9L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #0x1f9,%[result]\n"
+		"\tbfchg %[result]{27:3}\n"
+	: [result]"=d"(result)
+	:
+	: "cc", "memory");
+	EXPECT(result, 0x1e5L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #-1,%[d0]\n"
+		"\tmove.l %[d0],(%[a0])\n"
+		"\tmove.l %[d0],%[result]\n"
+		"\tbfextu (%[a0]){1:3},%[result]\n"
+		"\tspl %[fail]\n"
+	: [result]"=d"(result), [fail]"=dm"(fail), [d0]"=d"(d0)
+	: [a0]"a"(data)
+	: "cc", "memory");
+	CHECK(fail);
+	EXPECT(result, 0x7L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #-1,%[d0]\n"
+		"\tmove.l %[d0],(%[a0])\n"
+		"\tmove.l #0,%[result]\n"
+		"\tbfexts (%[a0]){1:3},%[result]\n"
+		"\tspl %[fail]\n"
+	: [result]"=d"(result), [fail]"=dm"(fail), [d0]"=d"(d0)
+	: [a0]"a"(data)
+	: "cc", "memory");
+	CHECK(fail);
+	EXPECT(result, -1L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #0xf0f0f0f0,%[d0]\n"
+		"\tmove.l %[d0],(%[a0])\n"
+		"\tmove.l #0,%[result]\n"
+		"\tbfextu (%[a0]){2:3},%[result]\n"
+		"\tspl %[fail]\n"
+	: [result]"=d"(result), [fail]"=dm"(fail), [d0]"=d"(d0)
+	: [a0]"a"(data)
+	: "cc", "memory");
+	CHECK(fail);
+	EXPECT(result, 6L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #0xf0f0f0f0,%[d0]\n"
+		"\tmove.l %[d0],(%[a0])\n"
+		"\tmove.l #0,%[result]\n"
+		"\tbfexts (%[a0]){2:3},%[result]\n"
+		"\tspl %[fail]\n"
+	: [result]"=d"(result), [fail]"=dm"(fail), [d0]"=d"(d0)
+	: [a0]"a"(data)
+	: "cc", "memory");
+	CHECK(fail);
+	EXPECT(result, 0xfffffffeL);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #0xf0f0f0f0,%[d0]\n"
+		"\tmove.l %[d0],(%[a0])\n"
+		"\tmove.l %[d0],4(%[a0])\n"
+		"\tmove.l #0,%[result]\n"
+		"\tbfextu (%[a0]){24:9},%[result]\n"
+		"\tspl %[fail]\n"
+	: [result]"=d"(result), [fail]"=dm"(fail), [d0]"=d"(d0)
+	: [a0]"a"(data)
+	: "cc", "memory");
+	CHECK(fail);
+	EXPECT(result, 0x1e1L);
+	
+	return status;
+}
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/cpu/test_bfins_c.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/cpu/test_bfins_c.c	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,86 @@
+#include "testdriver.h"
+
+int numtests;
+
+int main(void)
+{
+	int status;
+	long d0, result;
+	long data[2];
+	
+	status = 0;
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #-1,%[result]\n"
+		"\tmove.l #1,%[d0]\n"
+		"\tbfins %[d0],%[result]{4:4}\n"
+	: [result]"=d"(result), [d0]"=d"(d0)
+	:
+	: "cc", "memory");
+	EXPECT(result, 0xf1ffffffL);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #0xf1ffffff,%[result]\n"
+		"\tmove.l #3,%[d0]\n"
+		"\tbfins %[d0],%[result]{5:2}\n"
+	: [result]"=d"(result), [d0]"=d"(d0)
+	:
+	: "cc", "memory");
+	EXPECT(result, 0xf7ffffffL);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #0xf7ffffff,%[result]\n"
+		"\tmove.l #0,%[d0]\n"
+		"\tbfins %[d0],%[result]{8:16}\n"
+	: [result]"=d"(result), [d0]"=d"(d0)
+	:
+	: "cc", "memory");
+	EXPECT(result, 0xf70000ffL);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #1,%[d0]\n"
+		"\tmove.l #-1,(%[a0])\n"
+		"\tbfins %[d0],(%[a0]){4:4}\n"
+	: [d0]"=d"(d0)
+	: [a0]"a"(data)
+	: "cc", "memory");
+	EXPECT(data[0], 0xf1ffffffL);
+	
+	++numtests;
+	data[0] = 0xf1ffffffL;
+	__asm__ __volatile__(
+		"\tmove.l #3,%[d0]\n"
+		"\tbfins %[d0],(%[a0]){5:2}\n"
+	: [d0]"=d"(d0)
+	: [a0]"a"(data)
+	: "cc", "memory");
+	EXPECT(data[0], 0xf7ffffffL);
+	
+	++numtests;
+	data[0] = 0xf7ffffffL;
+	__asm__ __volatile__(
+		"\tmove.l #0,%[d0]\n"
+		"\tbfins %[d0],(%[a0]){8:16}\n"
+	: [d0]"=d"(d0)
+	: [a0]"a"(data)
+	: "cc", "memory");
+	EXPECT(data[0], 0xf70000ffL);
+	
+	++numtests;
+	data[0] = 0xf70000ffL;
+	data[1] = -1L;
+	__asm__ __volatile__(
+		"\tmove.l #0,%[d0]\n"
+		"\tbfins %[d0],(%[a0]){31:2}\n"
+	: [d0]"=d"(d0)
+	: [a0]"a"(data)
+	: "cc", "memory");
+	EXPECT(data[0], 0xf70000feL);
+	EXPECT(data[1], 0x7fffffffL);
+	
+	return status;
+}
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/cpu/test_fabs_c.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/cpu/test_fabs_c.c	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,38 @@
+/*
+ * Test:USES_FPU
+ */
+#include "testdriver.h"
+
+#ifndef __HAVE_68881__
+ #error "must be compiled with FPU support"
+#endif
+
+int numtests;
+
+
+int main(void)
+{
+	int status;
+	union ld_union fp0;
+	
+	status = 0;
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfabs.b #-55,%[fp0]\n"
+	: [fp0]"=f"(fp0.d)
+	:
+	: "cc", "memory");
+	EXPECT_FP(fp0, 0x40040000L, 0xdc000000L, 0x00000000L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmove.l #-1024,%[fp0]\n"
+		"\tfabs.x %[fp0]\n"
+	: [fp0]"=f"(fp0.d)
+	:
+	: "cc", "memory");
+	EXPECT_FP(fp0, 0x40090000L, 0x80000000L, 0x00000000L);
+	
+	return status;
+}
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/cpu/test_fadd_c.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/cpu/test_fadd_c.c	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,33 @@
+/*
+ * Test:USES_FPU
+ */
+#include "testdriver.h"
+
+#ifndef __HAVE_68881__
+ #error "must be compiled with FPU support"
+#endif
+
+int numtests;
+
+
+int main(void)
+{
+	int status;
+	union ld_union fp0;
+	union ld_union fp1;
+	
+	status = 0;
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmovecr.x #0x00,%[fp0]\n"
+		"\tfmove.b #3,%[fp1]\n"
+		"\tfadd.x %[fp1],%[fp0]\n"
+	: [fp0]"=f"(fp0.d), [fp1]"=f"(fp1.d)
+	:
+	: "cc", "memory");
+	EXPECT_FP(fp0, 0x40010000L, 0xc487ed51L, 0x10b4611aL);
+	EXPECT_FP(fp1, 0x40000000L, 0xc0000000L, 0x00000000L);
+	
+	return status;
+}
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/cpu/test_fdiv_c.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/cpu/test_fdiv_c.c	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,33 @@
+/*
+ * Test:USES_FPU
+ */
+#include "testdriver.h"
+
+#ifndef __HAVE_68881__
+ #error "must be compiled with FPU support"
+#endif
+
+int numtests;
+
+
+int main(void)
+{
+	int status;
+	union ld_union fp0;
+	union ld_union fp1;
+	
+	status = 0;
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmove.b #10,%[fp0]\n"
+		"\tfmove.b #3,%[fp1]\n"
+		"\tfdiv.x %[fp1],%[fp0]\n"
+	: [fp0]"=f"(fp0.d), [fp1]"=f"(fp1.d)
+	:
+	: "cc", "memory");
+	EXPECT_FP(fp0, 0x40000000L, 0xd5555555L, 0x55555555L);
+	EXPECT_FP(fp1, 0x40000000L, 0xc0000000L, 0x00000000L);
+	
+	return status;
+}
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/cpu/test_fetox_c.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/cpu/test_fetox_c.c	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,30 @@
+/*
+ * Test:USES_FPU
+ */
+#include "testdriver.h"
+
+#ifndef __HAVE_68881__
+ #error "must be compiled with FPU support"
+#endif
+
+int numtests;
+
+
+int main(void)
+{
+	int status;
+	union ld_union fp0;
+	
+	status = 0;
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmove.l #1,%[fp0]\n"
+		"\tfetox.x %[fp0],%[fp0]\n"
+	: [fp0]"=f"(fp0.d)
+	:
+	: "cc", "memory");
+	EXPECT_FP(fp0, 0x40000000L, 0xadf85458L, 0xa2bb4a9bL);
+	
+	return status;
+}
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/cpu/test_fgetexp_c.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/cpu/test_fgetexp_c.c	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,35 @@
+/*
+ * Test:USES_FPU
+ */
+#include "testdriver.h"
+
+#ifndef __HAVE_68881__
+ #error "must be compiled with FPU support"
+#endif
+
+int numtests;
+
+
+int main(void)
+{
+	int status;
+	union ld_union fp0;
+	union ld_union fp1;
+	long d0;
+	
+	status = 0;
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmove.l #4096,%[fp0]\n"
+		"\tfgetexp.x %[fp0],%[fp1]\n"
+		"\tfmove.l %[fp1],%[d0]\n"
+	: [fp0]"=f"(fp0.d), [fp1]"=f"(fp1.d), [d0]"=d"(d0)
+	:
+	: "cc", "memory");
+	EXPECT_FP(fp0, 0x400b0000L, 0x80000000L, 0x00000000L);
+	EXPECT_FP(fp1, 0x40020000L, 0xc0000000L, 0x00000000L);
+	EXPECT(d0, 12L);
+	
+	return status;
+}
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/cpu/test_flogn_c.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/cpu/test_flogn_c.c	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,36 @@
+/*
+ * Test:USES_FPU
+ */
+#include "testdriver.h"
+
+#ifndef __HAVE_68881__
+ #error "must be compiled with FPU support"
+#endif
+
+int numtests;
+
+
+int main(void)
+{
+	int status;
+	union ld_union fp0;
+	union ld_union fp1;
+	long d0;
+	
+	status = 0;
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmovecr.x #0x0C,%[fp0]\n" /* e */
+		"\tflogn.x %[fp0],%[fp1]\n"	/* 1 */
+		"\tfmove.l %[fp1],%[d0]\n"
+		
+	: [fp0]"=f"(fp0.d), [fp1]"=f"(fp1.d), [d0]"=d"(d0)
+	:
+	: "cc", "memory");
+	EXPECT_FP(fp0, 0x40000000L, 0xadf85458L, 0xa2bb4a9aL);
+	EXPECT_FP(fp1, 0x3ffe0000L, 0xffffffffL, 0xffffffffL);
+	EXPECT(d0, 1L);
+	
+	return status;
+}
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/cpu/test_fmove_c.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/cpu/test_fmove_c.c	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,244 @@
+/*
+ * Test:USES_FPU
+ */
+#include "testdriver.h"
+
+#ifndef __HAVE_68881__
+ #error "must be compiled with FPU support"
+#endif
+
+int numtests;
+
+union ld_union pi = { { 0x40000000L, 0xc90fdaa2L, 0x2168C235L } };
+
+int main(void)
+{
+	int status;
+	union ld_union fp0;
+	union ld_union fp1;
+	char fail;
+	union {
+		char c[12];
+		short w[6];
+		long l[3];
+	} data;
+	long d3;
+	
+	status = 0;
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmove.x %[pi],%[fp0]\n"
+		"\tfmovecr.x #0x00,%[fp1]\n"
+		"\tfcmp.x %[fp0],%[fp1]\n"
+		"\tfsne %[fail]\n"
+	: [fp0]"=f"(fp0.d), [fp1]"=f"(fp1.d), [fail]"=dm"(fail)
+	: [pi]"m"(pi)
+	: "cc", "memory");
+	CHECK(fail);
+	EXPECT_FP(fp0, 0x40000000L, 0xc90fdaa2L, 0x2168C235L);
+	EXPECT_FP(fp1, 0x40000000L, 0xc90fdaa2L, 0x2168C235L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmove.x %[pi],%[fp0]\n"
+		"\tfmove.b %[fp0],%[data]\n"
+	: [fp0]"=f"(fp0.d)
+	: [pi]"m"(pi), [data]"m"(data)
+	: "cc", "memory");
+	EXPECT((long)data.c[0], 3L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmove.x %[pi],%[fp0]\n"
+		"\tfmove.w %[fp0],%[data]\n"
+	: [fp0]"=f"(fp0.d)
+	: [pi]"m"(pi), [data]"m"(data)
+	: "cc", "memory");
+	EXPECT((long)data.w[0], 3L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmove.x %[pi],%[fp0]\n"
+		"\tfmove.l %[fp0],%[data]\n"
+	: [fp0]"=f"(fp0.d)
+	: [pi]"m"(pi), [data]"m"(data)
+	: "cc", "memory");
+	EXPECT((long)data.l[0], 3L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmove.x %[pi],%[fp0]\n"
+		"\tfmove.s %[fp0],%[data]\n"
+	: [fp0]"=f"(fp0.d)
+	: [pi]"m"(pi), [data]"m"(data)
+	: "cc", "memory");
+	EXPECT(data.l[0], 0x40490fdbL);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmove.x %[pi],%[fp0]\n"
+		"\tfmove.d %[fp0],%[data]\n"
+	: [fp0]"=f"(fp0.d)
+	: [pi]"m"(pi), [data]"m"(data)
+	: "cc", "memory");
+	EXPECT(data.l[0], 0x400921fbL);
+	EXPECT(data.l[1], 0x54442d18L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmove.x %[pi],%[fp0]\n"
+		"\tfmove.x %[fp0],%[data]\n"
+	: [fp0]"=f"(fp0.d)
+	: [pi]"m"(pi), [data]"m"(data)
+	: "cc", "memory");
+	EXPECT(data.l[0], 0x40000000L);
+	EXPECT(data.l[1], 0xc90fdaa2L);
+	EXPECT(data.l[2], 0x2168C235L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #-1,%[d3]\n"
+		"\tfmove.b %[d3],%[fp0]\n"
+		"\tftst.x %[fp0]\n"
+		"\tfsuge %[fail]\n"
+	: [fp0]"=f"(fp0.d), [d3]"=d"(d3), [fail]"=dm"(fail)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #-1,%[d3]\n"
+		"\tfmove.w %[d3],%[fp0]\n"
+		"\tftst.x %[fp0]\n"
+		"\tfsuge %[fail]\n"
+	: [fp0]"=f"(fp0.d), [d3]"=d"(d3), [fail]"=dm"(fail)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #-1,%[d3]\n"
+		"\tfmove.l %[d3],%[fp0]\n"
+		"\tftst.x %[fp0]\n"
+		"\tfsuge %[fail]\n"
+	: [fp0]"=f"(fp0.d), [d3]"=d"(d3), [fail]"=dm"(fail)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #-1,%[d3]\n"
+		"\tfmove.s %[d3],%[fp0]\n"
+		"\tftst.x %[fp0]\n"
+		"\tfsoge %[fail]\n"
+	: [fp0]"=f"(fp0.d), [d3]"=d"(d3), [fail]"=dm"(fail)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #1,%[d3]\n"
+		"\tfmove.b %[d3],%[fp0]\n"
+		"\tftst.x %[fp0]\n"
+		"\tfsult %[fail]\n"
+	: [fp0]"=f"(fp0.d), [d3]"=d"(d3), [fail]"=dm"(fail)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #1,%[d3]\n"
+		"\tfmove.w %[d3],%[fp0]\n"
+		"\tftst.x %[fp0]\n"
+		"\tfsult %[fail]\n"
+	: [fp0]"=f"(fp0.d), [d3]"=d"(d3), [fail]"=dm"(fail)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #1,%[d3]\n"
+		"\tfmove.l %[d3],%[fp0]\n"
+		"\tftst.x %[fp0]\n"
+		"\tfsult %[fail]\n"
+	: [fp0]"=f"(fp0.d), [d3]"=d"(d3), [fail]"=dm"(fail)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #1,%[d3]\n"
+		"\tfmove.s %[d3],%[fp0]\n"
+		"\tftst.x %[fp0]\n"
+		"\tfsult %[fail]\n"
+	: [fp0]"=f"(fp0.d), [d3]"=d"(d3), [fail]"=dm"(fail)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmove.b #0xff,%[fp0]\n"
+	: [fp0]"=f"(fp0.d)
+	:
+	: "cc", "memory");
+	EXPECT_FP(fp0, 0xbfff0000L, 0x80000000L, 0x00000000L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmove.w #0xFABC,%[fp0]\n"
+	: [fp0]"=f"(fp0.d)
+	:
+	: "cc", "memory");
+	EXPECT_FP(fp0, 0xc0090000L, 0xa8800000L, 0x00000000L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmove.l #0xFABCDEFA,%[fp0]\n"
+	: [fp0]"=f"(fp0.d)
+	:
+	: "cc", "memory");
+	EXPECT_FP(fp0, 0xc0190000L, 0xa86420c0L, 0x00000000L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmove.s #0xDEADBEAF,%[fp0]\n"
+	: [fp0]"=f"(fp0.d)
+	:
+	: "cc", "memory");
+	EXPECT_FP(fp0, 0xc03d0000L, 0xadbeaf00L, 0x00000000L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmove.d #0x3ABCDEFADEADBEAF,%[fp0]\n"
+	: [fp0]"=f"(fp0.d)
+	:
+	: "cc", "memory");
+	EXPECT_FP(fp0, 0x3fab0000L, 0xe6f7d6f5L, 0x6df57800L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmove.x #0xc7000000DEADBEAF12345678,%[fp0]\n"
+	: [fp0]"=f"(fp0.d)
+	:
+	: "cc", "memory");
+	EXPECT_FP(fp0, 0xc7000000L, 0xdeadbeafL, 0x12345678L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmove.p #0x088800012345678912345678,%[fp0]\n"
+	: [fp0]"=f"(fp0.d)
+	:
+	: "cc", "memory");
+	EXPECT_FP(fp0, 0x4b850000L, 0x909f850eL, 0x1505981aL);
+	
+	return status;
+}
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/cpu/test_fmovecr_c.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/cpu/test_fmovecr_c.c	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,197 @@
+/*
+ * Test:USES_FPU
+ */
+#include "testdriver.h"
+
+#ifndef __HAVE_68881__
+ #error "must be compiled with FPU support"
+#endif
+
+int numtests;
+
+
+int main(void)
+{
+	int status;
+	union ld_union fp0;
+	
+	status = 0;
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmovecr #0x0,%[fp0]\n" /* Pi */
+	: [fp0]"=f"(fp0.d)
+	:
+	: "cc", "memory");
+	EXPECT_FP(fp0, 0x40000000L, 0xc90fdaa2L, 0x2168c235L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmovecr #0x0b,%[fp0]\n" /* log10(2) */
+	: [fp0]"=f"(fp0.d)
+	:
+	: "cc", "memory");
+	EXPECT_FP(fp0, 0x3ffd0000L, 0x9a209a84L, 0xfbcff798L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmovecr #0x0c,%[fp0]\n" /* E */
+	: [fp0]"=f"(fp0.d)
+	:
+	: "cc", "memory");
+	EXPECT_FP(fp0, 0x40000000L, 0xadf85458L, 0xa2bb4a9aL);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmovecr #0x0d,%[fp0]\n" /* log2(e) */
+	: [fp0]"=f"(fp0.d)
+	:
+	: "cc", "memory");
+	EXPECT_FP(fp0, 0x3fff0000L, 0xb8aa3b29L, 0x5c17f0bcL);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmovecr #0x0e,%[fp0]\n" /* log10(e) */
+	: [fp0]"=f"(fp0.d)
+	:
+	: "cc", "memory");
+	EXPECT_FP(fp0, 0x3ffd0000L, 0xde5bd8a9L, 0x37287195L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmovecr #0x0f,%[fp0]\n" /* +0 */
+	: [fp0]"=f"(fp0.d)
+	:
+	: "cc", "memory");
+	EXPECT_FP(fp0, 0x00000000L, 0x00000000L, 0x00000000L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmovecr #0x30,%[fp0]\n" /* ln(2) */
+	: [fp0]"=f"(fp0.d)
+	:
+	: "cc", "memory");
+	EXPECT_FP(fp0, 0x3ffe0000L, 0xb17217f7L, 0xd1cf79acL);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmovecr #0x31,%[fp0]\n" /* ln(10) */
+	: [fp0]"=f"(fp0.d)
+	:
+	: "cc", "memory");
+	EXPECT_FP(fp0, 0x40000000L, 0x935d8dddL, 0xaaa8ac17L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmovecr #0x32,%[fp0]\n" /* 1e0 */
+	: [fp0]"=f"(fp0.d)
+	:
+	: "cc", "memory");
+	EXPECT_FP(fp0, 0x3fff0000L, 0x80000000L, 0x00000000L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmovecr #0x33,%[fp0]\n" /* 1e1 */
+	: [fp0]"=f"(fp0.d)
+	:
+	: "cc", "memory");
+	EXPECT_FP(fp0, 0x40020000L, 0xa0000000L, 0x00000000L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmovecr #0x34,%[fp0]\n" /* 1e2 */
+	: [fp0]"=f"(fp0.d)
+	:
+	: "cc", "memory");
+	EXPECT_FP(fp0, 0x40050000L, 0xc8000000L, 0x00000000L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmovecr #0x35,%[fp0]\n" /* 1e4 */
+	: [fp0]"=f"(fp0.d)
+	:
+	: "cc", "memory");
+	EXPECT_FP(fp0, 0x400c0000L, 0x9c400000L, 0x00000000L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmovecr #0x36,%[fp0]\n" /* 1e8 */
+	: [fp0]"=f"(fp0.d)
+	:
+	: "cc", "memory");
+	EXPECT_FP(fp0, 0x40190000L, 0xbebc2000L, 0x00000000L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmovecr #0x37,%[fp0]\n" /* 1e16 */
+	: [fp0]"=f"(fp0.d)
+	:
+	: "cc", "memory");
+	EXPECT_FP(fp0, 0x40340000L, 0x8e1bc9bfL, 0x04000000L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmovecr #0x38,%[fp0]\n" /* 1e32 */
+	: [fp0]"=f"(fp0.d)
+	:
+	: "cc", "memory");
+	EXPECT_FP(fp0, 0x40690000L, 0x9dc5ada8L, 0x2b70b59eL)
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmovecr #0x39,%[fp0]\n" /* 1e64 */
+	: [fp0]"=f"(fp0.d)
+	:
+	: "cc", "memory");
+	EXPECT_FP(fp0, 0x40d30000L, 0xc2781f49L, 0xffcfa6d5L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmovecr #0x3A,%[fp0]\n" /* 1e128 */
+	: [fp0]"=f"(fp0.d)
+	:
+	: "cc", "memory");
+	EXPECT_FP(fp0, 0x41a80000L, 0x93ba47c9L, 0x80e98ce0L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmovecr #0x3B,%[fp0]\n" /* 1e256 */
+	: [fp0]"=f"(fp0.d)
+	:
+	: "cc", "memory");
+	EXPECT_FP(fp0, 0x43510000L, 0xaa7eebfbL, 0x9df9de8eL);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmovecr #0x3C,%[fp0]\n" /* 1e512 */
+	: [fp0]"=f"(fp0.d)
+	:
+	: "cc", "memory");
+	EXPECT_FP(fp0, 0x46a30000L, 0xe319a0aeL, 0xa60e91c7L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmovecr #0x3D,%[fp0]\n" /* 1e1024 */
+	: [fp0]"=f"(fp0.d)
+	:
+	: "cc", "memory");
+	EXPECT_FP(fp0, 0x4d480000L, 0xc9767586L, 0x81750c17L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmovecr #0x3E,%[fp0]\n" /* 1e2048 */
+	: [fp0]"=f"(fp0.d)
+	:
+	: "cc", "memory");
+	EXPECT_FP(fp0, 0x5a920000L, 0x9e8b3b5dL, 0xc53d5de5L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmovecr #0x3F,%[fp0]\n" /* 1e4096 */
+	: [fp0]"=f"(fp0.d)
+	:
+	: "cc", "memory");
+	EXPECT_FP(fp0, 0x75250000L, 0xc4605202L, 0x8a20979bL);
+	
+	return status;
+}
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/cpu/test_fmul_c.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/cpu/test_fmul_c.c	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,33 @@
+/*
+ * Test:USES_FPU
+ */
+#include "testdriver.h"
+
+#ifndef __HAVE_68881__
+ #error "must be compiled with FPU support"
+#endif
+
+int numtests;
+
+
+int main(void)
+{
+	int status;
+	union ld_union fp0;
+	union ld_union fp1;
+	
+	status = 0;
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmove.b #255,%[fp0]\n"
+		"\tfmove.w #1023,%[fp1]\n"
+		"\tfmul.x %[fp1],%[fp0]\n"
+	: [fp0]"=f"(fp0.d), [fp1]"=f"(fp1.d)
+	:
+	: "cc", "memory");
+	EXPECT_FP(fp0, 0xc0080000L, 0xffc00000L, 0x00000000L);
+	EXPECT_FP(fp1, 0x40080000L, 0xffc00000L, 0x00000000L);
+	
+	return status;
+}
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/cpu/test_fscale_c.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/cpu/test_fscale_c.c	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,33 @@
+/*
+ * Test:USES_FPU
+ */
+#include "testdriver.h"
+
+#ifndef __HAVE_68881__
+ #error "must be compiled with FPU support"
+#endif
+
+int numtests;
+
+
+int main(void)
+{
+	int status;
+	union ld_union fp0;
+	union ld_union fp1;
+	
+	status = 0;
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmove.l #2,%[fp0]\n"
+		"\tfmovecr.x #0x00,%[fp1]\n"
+		"\tfscale.x %[fp0],%[fp1]\n"
+	: [fp0]"=f"(fp0.d), [fp1]"=f"(fp1.d)
+	:
+	: "cc", "memory");
+	EXPECT_FP(fp0, 0x40000000L, 0x80000000L, 0x00000000L);
+	EXPECT_FP(fp1, 0x40020000L, 0xc90fdaa2L, 0x2168c235L);
+	
+	return status;
+}
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/cpu/test_fsub_c.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/cpu/test_fsub_c.c	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,33 @@
+/*
+ * Test:USES_FPU
+ */
+#include "testdriver.h"
+
+#ifndef __HAVE_68881__
+ #error "must be compiled with FPU support"
+#endif
+
+int numtests;
+
+
+int main(void)
+{
+	int status;
+	union ld_union fp0;
+	union ld_union fp1;
+	
+	status = 0;
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfmovecr.x #0x00,%[fp0]\n"
+		"\tfmove.b #3,%[fp1]\n"
+		"\tfsub.x %[fp1],%[fp0]\n"
+	: [fp0]"=f"(fp0.d), [fp1]"=f"(fp1.d)
+	:
+	: "cc", "memory");
+	EXPECT_FP(fp0, 0x3ffc0000L, 0x90fdaa22L, 0x168c2350L);
+	EXPECT_FP(fp1, 0x40000000L, 0xc0000000L, 0x00000000L);
+	
+	return status;
+}
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/cpu/test_inf_c.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/cpu/test_inf_c.c	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,56 @@
+/*
+ * Test:USES_FPU
+ */
+#include "testdriver.h"
+
+#ifndef __HAVE_68881__
+ #error "must be compiled with FPU support"
+#endif
+
+int numtests;
+
+/*
+ * 2^16381, should
+ */
+union ld_union inf_div_4 = { { 0x7ffd0000, 0x80000000, 0x0 } };
+union ld_union inf_div_2 = { { 0x7ffe0000, 0x80000000, 0x0 } };
+
+
+int main(void)
+{
+	char fail;
+	int status;
+	union ld_union fp0, fp1;
+	
+	status = 0;
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfadd.x %[fp0],%[fp1]\n"
+		"\tfmul.l #2,%[fp0]\n"
+		"\tfcmp.x %[fp0],%[fp1]\n"
+		"\tfsne %[fail]\n"
+	: [fail]"=dm"(fail), [fp0]"=f"(fp0.d), [fp1]"=f"(fp1.d)
+	: "1"(inf_div_4.d), "2"(inf_div_4.d)
+	: "cc", "memory");
+	CHECK(fail);
+	
+	EXPECT_FP(fp0, 0x7ffe0000L, 0x80000000L, 0x0L);
+	EXPECT_FP(fp1, 0x7ffe0000L, 0x80000000L, 0x0L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tfadd.x %[fp0],%[fp1]\n"
+		"\tfmul.l #2,%[fp0]\n"
+		"\tfcmp.x %[fp0],%[fp1]\n"
+		"\tfsne %[fail]\n"
+	: [fail]"=dm"(fail), [fp0]"=f"(fp0.d), [fp1]"=f"(fp1.d)
+	: "1"(inf_div_2.d), "2"(inf_div_2.d)
+	: "cc", "memory");
+	CHECK(fail);
+	
+	EXPECT_FP(fp0, 0x7fff0000L, 0x0L, 0x0L);
+	EXPECT_FP(fp1, 0x7fff0000L, 0x0L, 0x0L);
+
+	return status;
+}
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/cpu/test_lsl_c.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/cpu/test_lsl_c.c	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,117 @@
+#include "testdriver.h"
+
+int numtests;
+
+int main(void)
+{
+	char fail, fail2;
+	int status;
+	long d1, d2, d3, result;
+	
+	status = 0;
+	
+	/* test that lsl is modulo 64 */
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #33,%[d1]\n"
+		"\tmove.l #1,%[result]\n"
+		"\tlsl.l %[d1],%[result]\n"
+	: [result]"=d"(result), [d1]"=d"(d1)
+	:
+	: "cc", "memory");
+	EXPECT(result, 0L);
+	
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #65,%[d1]\n"
+		"\tmove.l #1,%[result]\n"
+		"\tlsl.l %[d1],%[result]\n"
+	: [result]"=d"(result), [d1]"=d"(d1)
+	:
+	: "cc", "memory");
+	EXPECT(result, 2L);
+
+	/* test that zero shift does not affect X flag */
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #0,%[d1]\n"
+		"\tmove.l #1,%[d2]\n"
+		"\tmove.l #1,%[d3]\n"
+		"\tmove.l #0,%[result]\n"
+		"\tlsr.l %[d2],%[d3]\n" /* should set X & C */
+		"\tscc %[fail]\n"
+		"\tlsr.l %[d1],%[result]\n" /* should not affect X & clear C */
+		"\tscs %[fail2]\n"
+		"\taddx.l %[result],%[result]\n"
+	: [result]"=d"(result), [fail]"=dm"(fail), [fail2]"=dm"(fail2), [d1]"=d"(d1), [d2]"=d"(d2), [d3]"=d"(d3)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	CHECK(fail2);
+	EXPECT(result, 1L);
+	
+	/* test that both C & X flags are set to the last bit shifted out */
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #0x55555555,%[d1]\n"
+		"\tmove.l #0,%[d2]\n"
+		"\tlsl.l #8,%[d1]\n"
+		"\tscc %[fail]\n"
+		"\taddx.l %[d2],%[d2]\n"
+		"\tmove.l #0,%[result]\n"
+		"\tlsl.l #1,%[d1]\n"
+		"\tscs %[fail2]\n"
+		"\taddx.l %[result],%[result]\n"
+	: [result]"=d"(result), [fail]"=dm"(fail), [fail2]"=dm"(fail2), [d1]"=d"(d1), [d2]"=d"(d2)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	CHECK(fail2);
+	EXPECT(result, 0L);
+	EXPECT(d1, 0xaaaaaa00L);
+	EXPECT(d2, 1L);
+	
+	/* same as above, for word shifts */
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #0x55555555,%[d1]\n"
+		"\tmove.l #0,%[d2]\n"
+		"\tlsl.w #8,%[d1]\n"
+		"\tscc %[fail]\n"
+		"\taddx.l %[d2],%[d2]\n"
+		"\tmove.l #0,%[result]\n"
+		"\tlsl.w #1,%[d1]\n"
+		"\tscs %[fail2]\n"
+		"\taddx.l %[result],%[result]\n"
+	: [result]"=d"(result), [fail]"=dm"(fail), [fail2]"=dm"(fail2), [d1]"=d"(d1), [d2]"=d"(d2)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	CHECK(fail2);
+	EXPECT(result, 0L);
+	EXPECT(d1, 0x5555aa00L);
+	EXPECT(d2, 1L);
+	
+	/* same as above, for byte shifts */
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #0x55555555,%[d1]\n"
+		"\tmove.l #0,%[d2]\n"
+		"\tlsl.b #8,%[d1]\n"
+		"\tscc %[fail]\n"
+		"\taddx.l %[d2],%[d2]\n"
+		"\tmove.l #0,%[result]\n"
+		"\tlsl.b #1,%[d1]\n"
+		"\tscs %[fail2]\n"
+		"\taddx.l %[result],%[result]\n"
+	: [result]"=d"(result), [fail]"=dm"(fail), [fail2]"=dm"(fail2), [d1]"=d"(d1), [d2]"=d"(d2)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	CHECK(fail2);
+	EXPECT(result, 0L);
+	EXPECT(d1, 0x55555500L);
+	EXPECT(d2, 1L);
+	
+	return status;
+}
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/cpu/test_rol_c.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/cpu/test_rol_c.c	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,35 @@
+#include "testdriver.h"
+
+int numtests;
+
+int main(void)
+{
+	char fail, fail2, fail3, fail4;
+	int status;
+	long d0, result;
+	
+	status = 0;
+	
+	/* test that C is set to the last bit shifted out and that X is unaffected */
+	++numtests;
+	__asm__ __volatile__(
+		"\tmove.l #0,%[result]\n"
+		"\tmove.l #0x80000000,%[d0]\n"
+		"\tadd.l %[d0],%[d0]\n" /* should set X, C and V, and clear d0 */
+		"\tscc %[fail]\n"
+		"\tsvc %[fail2]\n"
+	    "\trol #1,%[d0]\n"   /* should clear C and V, and leave X unaffected */
+	    "\tscs %[fail3]\n"
+	    "\tsvs %[fail4]\n"
+		"\taddx.l %[result],%[result]\n"
+	: [result]"=d"(result), [fail]"=dm"(fail), [fail2]"=dm"(fail2), [fail3]"=dm"(fail3), [fail4]"=dm"(fail4), [d0]"=d"(d0)
+	:
+	: "cc", "memory");
+	CHECK(fail);
+	CHECK(fail2);
+	CHECK(fail3);
+	CHECK(fail4);
+	EXPECT(result, 1L);
+	
+	return status;
+}
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/cpu/test_svs_c.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/cpu/test_svs_c.c	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,36 @@
+#include "testdriver.h"
+
+int numtests;
+
+int main(void)
+{
+	int status;
+	long d0, d1, d2, d3, d4, result;
+	
+	status = 0;
+	
+	++numtests;
+	__asm__ __volatile__(
+	"\tmoveq #0x0,%[result]\n"
+	"\tmoveq #0x7f,%[d3]\n"
+"JIT_Test:\n"
+  "\tmoveq #0x11,%[d0]\n"
+  "\tmove.w #0x88,%[d1]\n"
+  "\tmoveq #0x00,%[d2]\n"
+  "\tnot.b %[d2]\n"
+  "\tadd.b %[d2],%[d2]\n"
+  "\tsubx.b %[d1],%[d0]\n"
+  "\tscc %[d4]\n"
+  "\tsvs %[result]\n" /* JIT on ->   d6 zero */
+  "\ttst.b %[result]\n"
+  "\tbeq fail_expected\n"
+  "\tdbf %[d3],JIT_Test\n"
+"fail_expected:\n"
+	: [result]"=d"(result), [d0]"=d"(d0), [d1]"=d"(d1), [d2]"=d"(d2), [d3]"=d"(d3), [d4]"=d"(d4)
+	:
+	: "cc", "memory");
+	EXPECT(result, 0xffL);
+	EXPECT(d3, 0xffffL);
+	
+	return status;
+}
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/cpu/testdriver.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/cpu/testdriver.h	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,28 @@
+#include <stdio.h>
+
+union ld_union {
+	unsigned long v[3];
+	long double d;
+};
+
+#define CHECK(var) \
+	if (var) \
+	{ \
+		fprintf(stderr, "%s:%d: test %d: failed\n", __FILE__, __LINE__, numtests); \
+		status |= 1; \
+	}
+
+#define EXPECT_FP(f, v0, v1, v2) \
+	if (f.v[0] != v0 || f.v[1] != v1 || f.v[2] != v2) \
+	{ \
+		fprintf(stderr, "%s:%d: test %d: expected %08lx:%08lx:%08lx got %08lx:%08lx:%08lx\n", __FILE__, __LINE__, numtests, v0, v1, v2, f.v[0], f.v[1], f.v[2]); \
+		status |= 1; \
+	}
+	
+#define EXPECT(r, v) \
+	if (r != v) \
+	{ \
+		fprintf(stderr, "%s:%d: test %d: expected 0x%08lx, got 0x%08lx\n", __FILE__, __LINE__, numtests, v, r); \
+		status |= 1; \
+	}
+	
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/libcmini/crt0.o
Binary file tests/libcmini/crt0.o has changed
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/libcmini/include/assert.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/libcmini/include/assert.h	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,23 @@
+#ifndef _ASSERT_H_
+#define _ASSERT_H_
+
+#ifndef NDEBUG
+
+#ifndef __STDLIB
+#include <stdlib.h>
+#endif
+
+#ifndef __STDIO
+#include <stdio.h>
+#endif
+
+#define assert(expr)\
+	((void)((expr)||(fprintf(stderr, \
+	"\nAssertion failed: %s, file %s, line %d\n",\
+	 #expr, __FILE__, __LINE__ ),\
+	 ((int (*)(void))abort)())))
+#else
+#define assert(expr)
+#endif /* NDEBUG */
+#endif /* _ASSERT_H_ */
+
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/libcmini/include/ctype.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/libcmini/include/ctype.h	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,20 @@
+/*
+ * ctype.h
+ *
+ *  Created on: 29.05.2013
+ *      Author: mfro
+ */
+
+#ifndef _CTYPE_H_
+#define _CTYPE_H_
+
+#define isdigit(c)	(((c) >= '0') && ((c) <= '9'))
+#define isupper(c)	((c) >= 'A' && ((c) <= 'Z'))
+#define islower(c)	((c) >= 'a' && ((c) <= 'z'))
+#define isalpha(c)	(isupper((c)) || islower(c))
+#define tolower(c)	(isupper(c) ? ((c) + 'a' - 'A') : (c))
+#define toupper(c)	(islower(c) ? ((c) - 'a' - 'A') : (c))
+
+#define isspace(c)  (((c) == ' ') || ((c) == '\t') || ((c == '\n')) || ((c) == '\r') || ((c) == '\v'))
+
+#endif /* CTYPE_H_ */
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/libcmini/include/ext.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/libcmini/include/ext.h	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,133 @@
+#ifndef _EXT_H_
+#define _EXT_H_
+
+#include <time.h>
+#include <stddef.h>
+
+extern int __text, __data, __bss;
+#define _text &__text
+#define _data &__data
+#define _bss  &__bss
+
+#define FA_UPDATE       0x00
+#define FA_RDONLY       0x01
+#define FA_HIDDEN       0x02
+#define FA_SYSTEM       0x04
+#define FA_LABEL        0x08
+#define FA_DIREC        0x10
+#define FA_ARCH         0x20
+
+#define MAXPATH   119
+#define MAXDRIVE  3
+#define MAXDIR    102
+#define MAXFILE   9
+#define MAXEXT    5
+
+#define S_IFCHR   0020000
+#define S_IFDIR   0040000
+#define S_IFREG   0100000
+#define S_IEXEC   0000100
+#define S_IREAD   0000400
+#define S_IWRITE  0000200
+
+typedef unsigned long size_t;
+
+
+struct ffblk
+{
+    char ff_reserved[21];               /* Reserved by TOS */
+    char ff_attrib;                     /* Attribute found */
+    int  ff_ftime;                      /* File time */
+    int  ff_fdate;                      /* File date */
+    long ff_fsize;                      /* File size */
+    char ff_name[13];                   /* File name found */
+};
+
+struct date
+{
+    int    da_year;                     /* Current year */
+    char   da_day;                      /* Day of the month */
+    char   da_mon;                      /* Month ( 1 = Jan ) */
+};
+
+struct time
+{
+    unsigned char   ti_min;             /* Minutes */
+    unsigned char   ti_hour;            /* Hours */
+    unsigned char   ti_hund;            /* Hundredths of seconds */
+    unsigned char   ti_sec;             /* Seconds */
+};
+
+struct ftime
+{
+    unsigned ft_hour:   5;
+    unsigned ft_min:    6;
+    unsigned ft_tsec:   5;
+    unsigned ft_year:   7;
+    unsigned ft_month:  4;
+    unsigned ft_day:    5;
+};
+
+struct stat
+{
+    int    st_dev;
+    int    st_ino;
+    int    st_mode;
+    int    st_nlink;
+    int    st_uid;
+    int    st_gid;
+    int    st_rdev;
+    size_t st_size;
+    long   st_atime;
+    long   st_mtime;
+    long   st_ctime;
+};
+
+struct dfree
+{
+        unsigned df_avail;
+        unsigned df_total;
+        unsigned df_bsec;
+        unsigned df_sclus;
+};
+
+size_t      malloc_size(const void *ptr);
+
+extern int getcurdir(int drive, char *path);
+extern char *getcwd(char *buffer, int bufflen);
+extern int getdisk(void);
+extern void getdfree(unsigned char drive, struct dfree *dtable);
+extern int setdisk(int drive);
+
+extern int findfirst(const char *filename, struct ffblk *ffblk, int attrib);
+extern int findnext(struct ffblk *ffblk);
+
+/* void        getdate( struct date *dateRec ); */
+void        gettime( struct time *timeRec );
+void        setdate( struct date *dateRec );
+void        settime( struct time *timeRec );
+int         getftime( int handle, struct ftime *ftimep );
+int         setftime( int handle, struct ftime *ftimep );
+
+struct tm   *ftimtotm( struct ftime *f );
+
+void        delay( unsigned milliseconds );
+void        sleep( unsigned seconds );
+
+int         kbhit( void );
+int         getch( void );
+int         getche( void );
+int         putch( int c);
+int         chdir( char *filename );
+
+int         fstat( int handle, struct stat *statbuf );
+int         stat( const char *path, struct stat *buff );
+
+int         isatty( int handle );
+long        filelength( int handle );
+
+size_t      coreleft( void );
+
+#endif /* _EXT_H_ */
+
+
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/libcmini/include/features.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/libcmini/include/features.h	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,94 @@
+#ifndef	_FEATURES_H
+#define	_FEATURES_H	1
+
+#undef	__USE_ISOC11
+#undef	__USE_ISOC99
+#undef	__USE_ISOC95
+#undef	__USE_ISOCXX11
+#undef	__USE_POSIX
+#undef	__USE_POSIX2
+#undef	__USE_POSIX199309
+#undef	__USE_POSIX199506
+#undef	__USE_XOPEN
+#undef	__USE_XOPEN_EXTENDED
+#undef	__USE_UNIX98
+#undef	__USE_XOPEN2K
+#undef	__USE_XOPEN2KXSI
+#undef	__USE_XOPEN2K8
+#undef	__USE_XOPEN2K8XSI
+#undef	__USE_LARGEFILE
+#undef	__USE_LARGEFILE64
+#undef	__USE_FILE_OFFSET64
+#undef	__USE_BSD
+#undef	__USE_SVID
+#undef	__USE_MISC
+#undef	__USE_ATFILE
+#undef	__USE_GNU
+#undef	__USE_REENTRANT
+#undef	__USE_FORTIFY_LEVEL
+#undef	__FAVOR_BSD
+#undef	__KERNEL_STRICT_NAMES
+#undef  __USE_MINTLIB
+#undef	__GLIBC_USE_DEPRECATED_GETS
+
+#define	__USE_ANSI	1
+
+/* turn on all the other features.  */
+#undef  _ISOC95_SOURCE
+#define _ISOC95_SOURCE	1
+#undef  _ISOC99_SOURCE
+#define _ISOC99_SOURCE	1
+#undef  _ISOC11_SOURCE
+#define _ISOC11_SOURCE	1
+#undef  _POSIX_SOURCE
+#define _POSIX_SOURCE	1
+#undef  _POSIX_C_SOURCE
+#define _POSIX_C_SOURCE	200809L
+#undef  _XOPEN_SOURCE
+#define _XOPEN_SOURCE	700
+#undef  _XOPEN_SOURCE_EXTENDED
+#define _XOPEN_SOURCE_EXTENDED	1
+#undef  _BSD_SOURCE
+#define _BSD_SOURCE	1
+#undef  _SVID_SOURCE
+#define _SVID_SOURCE	1
+#undef  _DEFAULT_SOURCE
+#define _DEFAULT_SOURCE	1
+
+#define __USE_ISOC11	1
+#define __USE_ISOC99	1
+#define __USE_ISOC95	1
+#define __USE_ISOC11	1
+#if defined(__cplusplus) && __cplusplus >= 201103L
+#  define __USE_ISOCXX11	1
+#endif
+#define __USE_POSIX	1
+#define __USE_POSIX2	1
+#define __USE_POSIX199309	1
+#define __USE_POSIX199506	1
+#define __USE_XOPEN2K		1
+#define __USE_XOPEN	1
+#define __USE_XOPEN_EXTENDED	1
+#define __USE_MISC	1
+#define __USE_BSD	1
+#define __USE_SVID	1
+#define __USE_GNU	1
+
+#include <sys/cdefs.h>
+
+/* Decide whether we can define 'extern inline' functions in headers.  */
+#if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \
+    && !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__
+# define __USE_EXTERN_INLINES	1
+# if (defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__) || \
+     defined __cplusplus || \
+     (defined __clang__ && (defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__))
+#   define _EXTERN_INLINE extern __inline __attribute__((__gnu_inline__))
+# else
+#   define _EXTERN_INLINE extern __inline
+# endif
+#else
+# define _EXTERN_INLINE extern
+#endif
+
+#endif	/* features.h  */
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/libcmini/include/getcookie.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/libcmini/include/getcookie.h	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,6 @@
+#ifndef _GETCOOKIE_H_
+#define _GETCOOKIE_H_
+
+extern int getcookie(long cookie, unsigned long *value);
+#endif
+
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/libcmini/include/getopt.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/libcmini/include/getopt.h	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,11 @@
+#ifndef _GETOPT_H_
+#define _GETOPT_H_
+
+extern int getopt(int argc, char * const argv[], const char *optstring);
+
+extern char *optarg;
+extern int optind;
+extern int opterr;
+extern int optopt;
+
+#endif /* _GETOPT_H_ */
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/libcmini/include/limits.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/libcmini/include/limits.h	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,63 @@
+#ifndef _LIMITS_H_
+#define _LIMITS_H_
+
+
+/* Maximum length of a multibyte character.  */
+#ifndef MB_LEN_MAX
+#define MB_LEN_MAX 1
+#endif
+
+#define CHAR_BIT	8
+#define SCHAR_MAX	0x7f
+#define SCHAR_MIN	(-SCHAR_MAX - 1)
+#define UCHAR_MAX	0xffU
+#ifdef __CHAR_UNSIGNED__
+# define CHAR_MAX	UCHAR_MAX
+# define CHAR_MIN	0
+#else
+# define CHAR_MAX	SCHAR_MAX
+# define CHAR_MIN	SCHAR_MIN
+#endif
+
+#define SHRT_MAX	0x7fff
+#define USHRT_MAX	0xffffU
+#define SHRT_MIN	(-SHRT_MAX - 1)
+
+#define LONG_MAX	0x7fffffffL
+#define ULONG_MAX	0xffffffffUL
+#define LONG_MIN	(-LONG_MAX - 1L)
+
+#ifdef __MSHORT__
+# define INT_MAX	SHRT_MAX
+# define UINT_MAX	USHRT_MAX
+#else
+# define INT_MAX	LONG_MAX
+# define UINT_MAX	ULONG_MAX
+#endif
+#define INT_MIN	(-INT_MAX - 1)
+
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+/* Minimum and maximum values a `signed long long int' can hold.  */
+# undef LLONG_MIN
+# define LLONG_MIN (-LLONG_MAX - 1LL)
+# undef LLONG_MAX
+# define LLONG_MAX __LONG_LONG_MAX__
+
+/* Maximum value an `unsigned long long int' can hold.  (Minimum is 0).  */
+# undef ULLONG_MAX
+# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
+#endif
+
+#if !defined (__STRICT_ANSI__)
+/* Minimum and maximum values a `signed long long int' can hold.  */
+# undef LONG_LONG_MIN
+# define LONG_LONG_MIN (-LONG_LONG_MAX - 1LL)
+# undef LONG_LONG_MAX
+# define LONG_LONG_MAX __LONG_LONG_MAX__
+
+/* Maximum value an `unsigned long long int' can hold.  (Minimum is 0).  */
+# undef ULONG_LONG_MAX
+# define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1ULL)
+#endif
+
+#endif /* _LIMITS_H_ */
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/libcmini/include/mint/basepage.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/libcmini/include/mint/basepage.h	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,36 @@
+/*
+ *	BASEPAGE.H	Definition of the basepage structure
+ */
+
+#ifndef _MINT_BASEPAGE_H
+# define _MINT_BASEPAGE_H 1
+
+#ifndef	_FEATURES_H
+# include <features.h>
+#endif
+
+__BEGIN_DECLS
+
+typedef struct basep {
+    char	*p_lowtpa;	/* pointer to self (bottom of TPA) */
+    char	*p_hitpa;	/* pointer to top of TPA + 1 */
+    char	*p_tbase;	/* base of text segment */
+    long	p_tlen;		/* length of text segment */
+    char	*p_dbase;	/* base of data segment */
+    long	p_dlen;		/* length of data segment */
+    char	*p_bbase;	/* base of BSS segment */
+    long	p_blen;		/* length of BSS segment */
+    char	*p_dta;		/* (UNOFFICIAL, DON'T USE) */
+    struct basep *p_parent;	/* pointer to parent's basepage */
+    char	*p_reserved;	/* reserved for future use */
+    char	*p_env;		/* pointer to environment string */
+    char	p_junk[8];
+    long	p_undef[18];	/* scratch area... don't touch */
+    char	p_cmdlin[128];	/* command line image */
+} BASEPAGE;
+
+extern BASEPAGE *_base;
+
+__END_DECLS
+
+#endif /* _MINT_BASEPAGE_H */
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/libcmini/include/mint/mintbind.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/libcmini/include/mint/mintbind.h	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,618 @@
+
+#ifndef _MINT_MINTBIND_H
+#define _MINT_MINTBIND_H 1
+
+#ifndef _FEATURES_H
+# include <features.h>
+#endif
+
+#ifndef _MINT_OSBIND_H
+# include <mint/osbind.h>
+#endif
+
+__BEGIN_DECLS
+
+/* see compiler.h for __extension__ and AND_MEMORY */
+
+#define trap_1_wllw(n, a, b, c)						\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	long _a = (long)(a);						\
+	long  _b = (long) (b);						\
+	short  _c = (short) (c);					\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movw	%4,%%sp@-\n\t"					\
+		"movl	%3,%%sp@-\n\t"					\
+		"movl	%2,%%sp@-\n\t"					\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#1\n\t"						\
+		"lea	%%sp@(12),%%sp"					\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n), "r"(_a), "r"(_b), "r"(_c)     /* inputs  */		\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc"    /* clobbered regs */	\
+	  AND_MEMORY							\
+	);								\
+	retvalue;							\
+})
+
+#define trap_1_wwlw(n, a, b, c)						\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	short _a = (short)(a);						\
+	long  _b = (long) (b);						\
+	short  _c = (short) (c);					\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movw	%4,%%sp@-\n\t"					\
+		"movl	%3,%%sp@-\n\t"					\
+		"movw	%2,%%sp@-\n\t"					\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#1\n\t"						\
+		"lea	%%sp@(10),%%sp"					\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n), "r"(_a), "r"(_b), "r"(_c)     /* inputs  */		\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc"    /* clobbered regs */	\
+	  AND_MEMORY							\
+	);								\
+	retvalue;							\
+})
+
+#define trap_1_wwww(n, a, b, c)						\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	short _a = (short)(a);						\
+	short  _b = (short)(b);						\
+	short  _c = (short)(c);						\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movw	%4,%%sp@-\n\t"					\
+		"movw	%3,%%sp@-\n\t"					\
+		"movw	%2,%%sp@-\n\t"					\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#1\n\t"						\
+		"addql	#8,%%sp"						\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n), "r"(_a), "r"(_b), "r"(_c)     /* inputs  */		\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc"    /* clobbered regs */	\
+	  AND_MEMORY							\
+	);								\
+	retvalue;							\
+})
+
+#define trap_1_wwwl(n, a, b, c)						\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	short _a = (short)(a);						\
+	short  _b = (short)(b);						\
+	long  _c = (long)(c);						\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movl	%4,%%sp@-\n\t"					\
+		"movw	%3,%%sp@-\n\t"					\
+		"movw	%2,%%sp@-\n\t"					\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#1\n\t"						\
+		"lea	%%sp@(10),%%sp"					\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n), "r"(_a), "r"(_b), "r"(_c)     /* inputs  */		\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc"    /* clobbered regs */	\
+	  AND_MEMORY							\
+	);								\
+	retvalue;							\
+})
+
+#define trap_1_wwl(n, a, b)						\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	short _a = (short)(a);						\
+	long  _b = (long) (b);						\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movl	%3,%%sp@-\n\t"					\
+		"movw	%2,%%sp@-\n\t"					\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#1\n\t"						\
+		"addql	#8,%%sp"						\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n), "r"(_a), "r"(_b)		/* inputs  */		\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc"    /* clobbered regs */	\
+	  AND_MEMORY							\
+	);								\
+	retvalue;							\
+})
+
+#define trap_1_wlllw(n, a, b, c, d)					\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	long _a = (long) (a);						\
+	long _b = (long) (b);						\
+	long _c = (long) (c);						\
+	short _d = (short) (d);						\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movw	%5,%%sp@-\n\t"					\
+		"movl	%4,%%sp@-\n\t"					\
+		"movl	%3,%%sp@-\n\t"					\
+		"movl	%2,%%sp@-\n\t"					\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#1\n\t"						\
+		"lea	%%sp@(16),%%sp"					\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n), "r"(_a), "r"(_b), "r"(_c), "r"(_d) /* inputs  */	\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc"    /* clobbered regs */	\
+	  AND_MEMORY							\
+	);								\
+	retvalue;							\
+})
+
+#define trap_1_wlll(n, a, b, c)						\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	long _a = (long)(a);						\
+	long _b = (long)(b);						\
+	long _c = (long)(c);						\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movl	%4,%%sp@-\n\t"					\
+		"movl	%3,%%sp@-\n\t"					\
+		"movl	%2,%%sp@-\n\t"					\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#1\n\t"						\
+		"lea	%%sp@(14),%%sp"					\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n), "r"(_a), "r"(_b), "r"(_c)	/* inputs  */		\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc"    /* clobbered regs */	\
+	  AND_MEMORY							\
+	);								\
+									\
+	retvalue;							\
+})
+
+#define trap_1_wwllll(n, a, b, c, d, e)					\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	short _a = (short)(a);						\
+	long  _b = (long) (b);						\
+	long  _c = (long) (c);						\
+	long  _d = (long) (d);						\
+	long  _e = (long) (e);						\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movl	%6,%%sp@-\n\t"					\
+		"movl	%5,%%sp@-\n\t"					\
+		"movl	%4,%%sp@-\n\t"					\
+		"movl	%3,%%sp@-\n\t"					\
+		"movw	%2,%%sp@-\n\t"					\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#1\n\t"						\
+		"lea	%%sp@(20),%%sp "					\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n), "r"(_a), "r"(_b), "r"(_c), "r"(_d), "r"(_e) /* inputs  */ \
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc"    /* clobbered regs */	\
+	  AND_MEMORY							\
+	);								\
+	retvalue;							\
+})
+
+#define trap_1_wllll(n, a, b, c, d)					\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	long _a = (long)(a);						\
+	long _b = (long)(b);						\
+	long _c = (long)(c);						\
+	long _d = (long)(d);						\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movl	%5,%%sp@-\n\t"					\
+		"movl	%4,%%sp@-\n\t"					\
+		"movl	%3,%%sp@-\n\t"					\
+		"movl	%2,%%sp@-\n\t"					\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#1\n\t"						\
+		"lea	%%sp@(18),%%sp"					\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n), "r"(_a), "r"(_b), "r"(_c),				\
+	  "r"(_d)				/* inputs  */		\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc"    /* clobbered regs */	\
+	  AND_MEMORY							\
+	);								\
+									\
+	retvalue;							\
+})
+
+#define trap_1_wwlllll(n, a, b, c, d, e, f)					\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	short _a = (short)(a);						\
+	long _b = (long)(b);						\
+	long _c = (long)(c);						\
+	long _d = (long)(d);						\
+	long _e = (long)(e);						\
+	long _f = (long)(f);						\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movl	%7,%%sp@-\n\t"					\
+		"movl	%6,%%sp@-\n\t"					\
+		"movl	%5,%%sp@-\n\t"					\
+		"movl	%4,%%sp@-\n\t"					\
+		"movl	%3,%%sp@-\n\t"					\
+		"movw	%2,%%sp@-\n\t"					\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#1\n\t"						\
+		"lea	%%sp@(24),%%sp"					\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n), "r"(_a), "r"(_b), "r"(_c),				\
+	  "r"(_d), "r"(_e), "r"(_f)		/* inputs  */		\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc"    /* clobbered regs */	\
+	  AND_MEMORY							\
+	);								\
+									\
+	retvalue;							\
+})
+
+#define trap_1_wlllll(n, a, b, c, d, e)					\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	long _a = (long)(a);						\
+	long _b = (long)(b);						\
+	long _c = (long)(c);						\
+	long _d = (long)(d);						\
+	long _e = (long)(e);						\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movl	%6,%%sp@-\n\t"					\
+		"movl	%5,%%sp@-\n\t"					\
+		"movl	%4,%%sp@-\n\t"					\
+		"movl	%3,%%sp@-\n\t"					\
+		"movl	%2,%%sp@-\n\t"					\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#1\n\t"						\
+		"lea	%%sp@(22),%%sp"					\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n), "r"(_a), "r"(_b), "r"(_c),				\
+	  "r"(_d), "r"(_e)			/* inputs  */		\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc"    /* clobbered regs */	\
+	  AND_MEMORY							\
+	);								\
+									\
+	retvalue;							\
+})
+
+#define trap_1_wllllll(n, a, b, c, d, e, f)				\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	long _a = (long)(a);						\
+	long _b = (long)(b);						\
+	long _c = (long)(c);						\
+	long _d = (long)(d);						\
+	long _e = (long)(e);						\
+	long _f = (long)(f);						\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movl	%7,%%sp@-\n\t"					\
+		"movl	%6,%%sp@-\n\t"					\
+		"movl	%5,%%sp@-\n\t"					\
+		"movl	%4,%%sp@-\n\t"					\
+		"movl	%3,%%sp@-\n\t"					\
+		"movl	%2,%%sp@-\n\t"					\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#1\n\t"						\
+		"lea	%%sp@(26),%%sp"					\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n), "r"(_a), "r"(_b), "r"(_c),				\
+	  "r"(_d), "r"(_e), "r"(_f)		/* inputs  */		\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc"    /* clobbered regs */	\
+	  AND_MEMORY							\
+	);								\
+									\
+	retvalue;							\
+})
+
+
+#define Srealloc(newsize)					\
+		trap_1_wl(0x15, (long)(newsize))
+#define Slbopen(name, path, min_ver, sl, fn)			\
+		trap_1_wlllll(0x16, (long)(name), (long)(path), (long)(min_ver), (long)(sl), (long)(fn))
+#define Slbclose(sl)						\
+		trap_1_wl(0x17, (long)(sl))
+#define	Syield()						\
+		(int)trap_1_w(0xff)
+#define Fpipe(ptr)						\
+		(int)trap_1_wl(0x100, (long)(ptr))
+#define Ffchown(f, uid, gid)					\
+		trap_1_wwww(0x101, (short)(f), (short)(uid), (short)(gid))
+#define Ffchmod(f, mode)					\
+		trap_1_www(0x102, (short)(f), (short)(mode))
+#define Fsync(f)						\
+		trap_1_ww(0x103, (short)(f))
+#define Fcntl(f, arg, cmd)					\
+		trap_1_wwlw(0x104, (short)(f), (long)(arg), (short)(cmd))
+#define Finstat(f)						\
+		trap_1_ww(0x105, (short)(f))
+#define Foutstat(f)						\
+		trap_1_ww(0x106, (short)(f))
+#define Fgetchar(f, mode)					\
+		trap_1_www(0x107, (short)(f), (short)(mode))
+#define Fputchar(f, ch, mode)					\
+		trap_1_wwlw(0x108, (short)(f), (long)(ch), (short)(mode))
+
+#define Pwait()							\
+		trap_1_w(0x109)
+#define Pnice(delta)						\
+		(int)trap_1_ww(0x10a, (short)(delta))
+#define Pgetpid()						\
+		(int)trap_1_w(0x10b)
+#define Pgetppid()						\
+		(int)trap_1_w(0x10c)
+#define Pgetpgrp()						\
+		(int)trap_1_w(0x10d)
+#define Psetpgrp(pid, grp)					\
+		(int)trap_1_www(0x10e, (short)(pid), (short)(grp))
+#define Pgetuid()						\
+		(int)trap_1_w(0x10f)
+#define Psetuid(id)						\
+		(int)trap_1_ww(0x110, (short)(id))
+#define Pkill(pid, sig)						\
+		(int)trap_1_www(0x111, (short)(pid), (short)(sig))
+#define Psignal(sig, handler)					\
+		trap_1_wwl(0x112, (short)(sig), (long)(handler))
+#define Pvfork()						\
+		trap_1_w(0x113)
+#define Pgetgid()						\
+		(int)trap_1_w(0x114)
+#define Psetgid(id)						\
+		(int)trap_1_ww(0x115, (short)(id))
+#define Psigblock(mask)						\
+		trap_1_wl(0x116, (unsigned long)(mask))
+#define Psigsetmask(mask)					\
+		trap_1_wl(0x117, (unsigned long)(mask))
+#define Pusrval(arg)						\
+		trap_1_wl(0x118, (long)(arg))
+#define Pdomain(arg)						\
+		(int)trap_1_ww(0x119, (short)(arg))
+#define Psigreturn()						\
+		(void)trap_1_w(0x11a)
+#define Pfork()							\
+		trap_1_w(0x11b)
+#define Pwait3(flag, rusage)					\
+		trap_1_wwl(0x11c, (short)(flag), (long)(rusage))
+#define Fselect(time, rfd, wfd, xfd)				\
+		(int)trap_1_wwlll(0x11d, (unsigned short)(time), (long)(rfd), \
+				(long)(wfd), (long)(xfd))
+#define Prusage(rsp)						\
+		(int)trap_1_wl(0x11e, (long)(rsp))
+#define Psetlimit(i, val)					\
+		trap_1_wwl(0x11f, (short)(i), (long)(val))
+
+#define Talarm(sec)						\
+		trap_1_wl(0x120, (long)(sec))
+#define Pause()							\
+		(void)trap_1_w(0x121)
+#define Sysconf(n)						\
+		trap_1_ww(0x122, (short)(n))
+#define Psigpending()						\
+		trap_1_w(0x123)
+#define Dpathconf(name, which)					\
+		trap_1_wlw(0x124, (long)(name), (short)(which))
+
+#define Pmsg(mode, mbox, msg)					\
+		trap_1_wwll(0x125, (short)(mode), (long)(mbox), (long)(msg))
+#define Fmidipipe(pid, in, out)					\
+		trap_1_wwww(0x126, (short)(pid), (short)(in),(short)(out))
+#define Prenice(pid, delta)					\
+		(int)trap_1_www(0x127, (short)(pid), (short)(delta))
+#define Dopendir(name, flag)					\
+		trap_1_wlw(0x128, (long)(name), (short)(flag))
+#define Dreaddir(len, handle, buf)				\
+		trap_1_wwll(0x129, (short)(len), (long)(handle), (long)(buf))
+#define Drewinddir(handle)					\
+		trap_1_wl(0x12a, (long)(handle))
+#define Dclosedir(handle)					\
+		trap_1_wl(0x12b, (long)(handle))
+#define Fxattr(flag, name, buf)					\
+		trap_1_wwll(0x12c, (short)(flag), (long)(name), (long)(buf))
+#define Flink(old, new)						\
+		trap_1_wll(0x12d, (long)(old), (long)(new))
+#define Fsymlink(old, new)					\
+		trap_1_wll(0x12e, (long)(old), (long)(new))
+#define Freadlink(siz, buf, linknm)				\
+		trap_1_wwll(0x12f, (short)(siz), (long)(buf), (long)(linknm))
+#define Dcntl(cmd, name, arg)					\
+		trap_1_wwll(0x130, (short)(cmd), (long)(name), (long)(arg))
+#define Fchown(name, uid, gid)					\
+		trap_1_wlww(0x131, (long)(name), (short)(uid), (short)(gid))
+#define Fchmod(name, mode)					\
+		trap_1_wlw(0x132, (long)(name), (short)(mode))
+#define Pumask(mask)						\
+		(int)trap_1_ww(0x133, (short)(mask))
+#define Psemaphore(mode, id, tmout)				\
+		trap_1_wwll(0x134, (short)(mode), (long)(id), (long)(tmout))
+#define Dlock(mode, drive)					\
+		(int)trap_1_www(0x135, (short)(mode), (short)(drive))
+#define Psigpause(mask)						\
+		(void)trap_1_wl(0x136, (unsigned long)(mask))
+#define Psigaction(sig, act, oact)					\
+		trap_1_wwll(0x137, (short)(sig), (long)(act), (long)(oact))
+#define Pgeteuid()						\
+		(int)trap_1_w(0x138)
+#define Pgetegid()						\
+		(int)trap_1_w(0x139)
+#define Pwaitpid(pid,flag, rusage)				\
+		trap_1_wwwl(0x13a, (short)(pid), (short)(flag), (long)(rusage))
+#define Dgetcwd(path, drv, size)				\
+		trap_1_wlww(0x13b, (long)(path), (short)(drv), (short)(size))
+#define Salert(msg)						\
+		trap_1_wl(0x13c, (long)(msg))
+/* The following are not yet official... */
+#define Tmalarm(ms)						\
+		trap_1_wl(0x13d, (long)(ms))
+#define Psigintr(vec, sig)					\
+		trap_1_www(0x13e, (short)(vec), (short)(sig))
+#define Suptime(uptime, avenrun)				\
+		trap_1_wll(0x13f, (long)(uptime), (long)(avenrun))
+#define Ptrace(request, pid, addr, data)		\
+		trap_1_wwwll(0x140, (short)(request), (short)(pid), \
+			      (long)(addr), (long)(data))
+#define Mvalidate(pid,addr,size,flags)				\
+		trap_1_wwlll(0x141, (short)(pid), (long)(addr), (long)(size), (long)(flags))
+#define Dxreaddir(len, handle, buf, xattr, xret)		\
+		trap_1_wwllll(0x142, (short)(len), (long)(handle), \
+			      (long)(buf), (long)(xattr), (long)(xret))
+#define Pseteuid(id)						\
+		(int)trap_1_ww(0x143, (short)(id))
+#define Psetegid(id)						\
+		(int)trap_1_ww(0x144, (short)(id))
+#define Pgetauid()						\
+		(int)trap_1_w(0x145)
+#define Psetauid(id)						\
+		(int)trap_1_ww(0x146, (short)(id))
+#define Pgetgroups(gidsetlen, gidset)				\
+		trap_1_wwl(0x147, (short)(gidsetlen), (long)(gidset))
+#define Psetgroups(gidsetlen, gidset)				\
+		trap_1_wwl(0x148, (short)(gidsetlen), (long)(gidset))
+#define Tsetitimer(which, interval, value, ointerval, ovalue)	\
+		trap_1_wwllll(0x149, (short)(which), (long)(interval), \
+			      (long)(value), (long)(ointerval), (long)(ovalue))
+#define Dchroot(dir)						\
+		trap_1_wl(0x14a, (long)(dir))
+#define Fstat64(flag, name, stat)					\
+		trap_1_wwll(0x14b, (short)(flag), (long)(name), (long)(stat))
+#define Fseek64(high, low, fh, how, newpos) \
+		trap_1_wllwwl(0x14c, (long)(high), (long)(low), (short)(fh), \
+		(short)(how), (long)(newpos))
+#define Dsetkey(major, minor, key, cipher)				\
+		trap_1_wlllw(0x14d, (long)(major), (long)(minor), (long)(key), \
+		(short)(cipher))
+#define Psetreuid(rid, eid)   \
+		(int)trap_1_www(0x14e, (short)(rid), (short)(eid))
+#define Psetregid(rid, eid)   \
+		(int)trap_1_www(0x14f, (short)(rid), (short)(eid))
+#define Sync()   \
+		trap_1_w(0x150)
+#define Shutdown(restart)  \
+		trap_1_wl(0x151, (long)(restart))
+#define Dreadlabel(path, label, maxlen)  \
+		trap_1_wllw(0x152, (long)(path), (long)(label), (short)(maxlen))
+#define Dwritelabel(path, label)  \
+		trap_1_wll(0x153, (long)(path), (long)(label))
+#define Ssystem(mode, arg1, arg2) \
+		trap_1_wwll(0x154, (short)(mode), (long)(arg1), (long)(arg2))
+#define Tgettimeofday(tvp, tzp) \
+		trap_1_wll(0x155, (long)(tvp), (long)(tzp))
+#define Tsettimeofday(tvp, tzp) \
+		trap_1_wll(0x156, (long)(tvp), (long)(tzp))
+#define Tadjtime(delta, olddelta) \
+		trap_1_wll(0x157, (long)(delta), (long)(olddelta))
+#define Pgetpriority(which, who) \
+		trap_1_www(0x158, (short)(which), (short)(who))
+#define Psetpriority(which, who, prio) \
+		trap_1_wwww(0x159, (short)(which), (short)(who), (short)(prio))
+#define Fpoll(fds, nfds, timeout) \
+		trap_1_wlll(0x15a,(long)(fds),(long)(nfds),(long)(timeout))
+#define Fwritev(fh, iovp, iovcnt) \
+		trap_1_wwll(0x15b,(short)(fh),(long)(iovp),(long)(iovcnt))
+#define Freadv(fh, iovp, iovcnt) \
+		trap_1_wwll(0x15c,(short)(fh),(long)(iovp),(long)(iovcnt))
+#define Ffstat64(fh, stat) \
+		trap_1_wwl(0x15d,(short)(fh),(long)(stat))
+#define Psysctl(name, namelen, old, oldlenp, new, newlen) \
+		trap_1_wllllll(0x15e,(long)(name),(long)(namelen),(long)(old),(long)(oldlenp),(long)(new),(long)(newlen))
+#define Pemulation(which, op, a1, a2, a3, a4, a5, a6, a7) \
+		trap_1_wwwlllllll(0x15f,(short)(which),(short)(op),(long)(a1),(long)(a2),(long)(a3),(long)(a4),(long)(a5),(long)(a6),(long)(a7))
+#define Fsocket(domain, type, protocol) \
+		trap_1_wlll(0x160,(long)(domain),(long)(type),(long)(protocol))
+#define Fsocketpair(domain, type, protocol, rsv) \
+		trap_1_wllll(0x161,(long)(domain),(long)(type),(long)(protocol),(long)(rsv))
+#define Faccept(fh, name, namelen) \
+		trap_1_wwll(0x162,(short)(fh),(long)(name),(long)(namelen))
+#define Fconnect(fh, name, namelen) \
+		trap_1_wwll(0x163,(short)(fh),(long)(name),(long)(namelen))
+#define Fbind(fh, name, namelen) \
+		trap_1_wwll(0x164,(short)(fh),(long)(name),(long)(namelen))
+#define Flisten(fh, backlog) \
+		trap_1_wwl(0x165,(short)(fh),(long)(backlog))
+#define Frecvmsg(fh, msg, flags) \
+		trap_1_wwll(0x166,(short)(fh),(long)(msg),(long)(flags))
+#define Fsendmsg(fh, msg, flags) \
+		trap_1_wwll(0x167,(short)(fh),(long)(msg),(long)(flags))
+#define Frecvfrom(fh, buf, len, flags, from, fromlen) \
+		trap_1_wwlllll(0x168,(short)(fh),(long)(buf),(long)(len),(long)(flags),(long)(from),(long)(fromlen))
+#define Fsendto(fh, buf, len, flags, to, tolen) \
+		trap_1_wwlllll(0x169,(short)(fh),(long)(buf),(long)(len),(long)(flags),(long)(to),(long)(tolen))
+#define Fsetsockopt(fh, level, name, val, valsize) \
+		trap_1_wwllll(0x16a,(short)(fh),(long)(level),(long)(name),(long)(val),(long)(valsize))
+#define Fgetsockopt(fh, level, name, val, avalsize) \
+		trap_1_wwllll(0x16b,(short)(fh),(long)(level),(long)(name),(long)(val),(long)(avalsize))
+#define Fgetpeername(fh, addr, addrlen) \
+		trap_1_wwll(0x16c,(short)(fh),(long)(addr),(long)(addrlen))
+#define Fgetsockname(fh, addr, addrlen) \
+		trap_1_wwll(0x16d,(short)(fh),(long)(addr),(long)(addrlen))
+#define Fshutdown(fh, how) \
+		trap_1_wwl(0x16e,(short)(fh),(long)(how))
+/* 0x16f */
+#define Pshmget(key, size, shmflg) \
+		trap_1_wlll(0x170,(long)(key),(long)(size),(long)(shmflg))
+#define Pshmctl(shmid, cmd, buf) \
+		trap_1_wlll(0x171,(long)(shmid),(long)(cmd),(long)(buf))
+#define Pshmat(shmid, shmaddr, shmflg) \
+		trap_1_wlll(0x172,(long)(shmid),(long)(shmaddr),(long)(shmflg))
+#define Pshmdt(shmaddr) \
+		trap_1_wl(0x173,(long)(shmaddr))
+#define Psemget(key, nsems, semflg) \
+		trap_1_wlll(0x174,(long)(key),(long)(nsems),(long)(semflg))
+#define Psemctl(semid, semnum, cmd, arg) \
+		trap_1_wllll(0x175,(long)(semid),(long)(semnum),(long)(cmd),(long)(arg))
+#define Psemop(semid, sops, nsops) \
+		trap_1_wlll(0x176,(long)(semid),(long)(sops),(long)(nsops))
+#define Psemconfig(flag) \
+		trap_1_wl(0x177,(long)(flag))
+#define Pmsgget(key, msgflg) \
+		trap_1_wll(0x178,(long)(key),(long)(msgflg))
+#define Pmsgctl(msqid, cmd, buf) \
+		trap_1_wlll(0x179,(long)(msqid),(long)(cmd),(long)(buf))
+#define Pmsgsnd(msqid, msgp, msgsz, msgflg) \
+		trap_1_wllll(0x17a,(long)(msqid),(long)(msgp),(long)(msgsz),(long)(msgflg))
+#define Pmsgrcv(msqid, msgp, msgsz, msgtyp, msgflg) \
+		trap_1_wlllll(0x17b,(long)(msqid),(long)(msgp),(long)(msgsz),(long)(msgtyp),(long)(msgflg))
+/* 0x17c */
+#define Maccess(addr,size,mode) \
+		trap_1_wllw(0x17d, (long)(addr), (long)(size), (short)(mode))
+/* 0x17e */
+/* 0x17f */
+#define Fchown16(name, uid, gid, follow_links) \
+		trap_1_wlwww(0x180, (long)(name), (short)(uid), (short)(gid), (short)follow_links)
+#define Fchdir(fh) \
+		trap_1_ww(0x181, (short)(fh))
+#define Ffdopendir(fh) \
+		trap_1_ww(0x182, (short)(fh))
+#define Fdirfd(handle) \
+		trap_1_wl(0x183, (long)(handle))
+
+__END_DECLS
+
+#endif /* _MINT_MINTBIND_H */
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/libcmini/include/mint/osbind.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/libcmini/include/mint/osbind.h	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,1280 @@
+/*
+ * osbind.h	bindings for OS traps
+ *
+ *		++jrb bammi@xxxxxxxxxxx
+ */
+
+/*
+ * majorly re-hacked for gcc-1.36 and probably beyond
+ * all inlines changed to #defines, beacuse gcc is not
+ * handling clobbered reggies correctly when -mshort.
+ * We now use the Statement Exprs feature of GnuC
+ *
+ * 10/12/89
+ *	changed all "g" constraints to "r" that will force
+ *	all operands to be evaluated (or lea calculated)
+ *	before the __asm__. This is necessary because
+ *	if we had the (looser) "g" constraint, then sometimes
+ *	we are in the situation where stuff is in the stack,
+ *	and we are modifying the stack under Gcc (but eventually
+ *	restoring it before the end of the __asm__), and it does
+ *	not know about it (i believe there is no way to tell it
+ *	this either, but you can hardly expect that). by forcing
+ *	the stricter "r" constraint, we force the eval before using
+ *	the val (or lea as the case may be) and we dont get into
+ *	trouble.
+ *	(thanks to ers for finding this problem!)
+ *	[one side effect of this is that we may(depending on the
+ *	  situation) actually end up with better code when the
+ *	values are already in reggies, or that value is used
+ *	later on (note that Gnu's reggie allocation notices the
+ *	clobbered reggie, and does'nt put the value/or uses
+ *	them from those reggies, nice huh!)
+ *
+ *  28/2/90
+ *	another major re-hack:
+ *	-- the basic reason: there was just no reliable
+ *	way to get the definitions (inline or not does'nt matter) to
+ *	fully evaluate the args before we changed the sp from under it.
+ *	(if -fomit-frame-pointer is *not* used, then most of the time
+ *	 we dont need to do this, as things will just reference off of
+ *	 a6, but this is not true all of the time).
+ *	my solution was to use local vars in the body of the statement
+ *	exprs, and initialize them from the args of the statement expr block.
+ *	to force the evaluation of the args before we change sp from
+ *	under gcc's feet, we make the local vars volatile. we use a
+ *	slight code optimization heuristic: if there are more than 4
+ *	args, only then we make the local volatile, and relax
+ *	the "r" constraint to "g". otherwise, we dont put the volatile
+ *	and force the evaluation by putting the "r" constaint. this
+ *	produces better code in most sitiations (when !__NO_INLINE__
+ *	especially), as either the args are already in a register or
+ *	there is good chance they will soon be reused, and in that
+ *	case it will already be in a register.
+ *      it may (the local vars, especially when no volatile)
+ *	look like overhead, but in 99% of the situations gcc will just
+ *	optimize that assignment right out. besides, this makes
+ *	these defines totally safe (from re-evaluation of the macro args).
+ *
+ *	-- as suggested by andreas schwab (thanks!)
+ *	 (schwab@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx) all the retvalues are now
+ *	 local register vals (see the extentions section in the info file)
+ *	 this really worked out great as all the silly "movl d0,%0" at
+ *	 the end of each def can now be removed, and the value of
+ *	 retvalue ends up in the correct register. it avoids all the
+ *	 silly "mov d0,[d|a]n" type sequences from being generated. a real win.
+ *	 (note in the outputs "=r"(retvalue) still has to be specified,
+ *	 otherwise in certain situations you end up loosing the return
+ *	 value in d0, as gcc sees no output, and correctly assumes that the
+ *	 asm returns no value).
+ *
+ *	-- all the n's (the function #'s for the traps) are now given
+ *	the more relaxed "g". This again results in better code, as
+ *	it is always a constant, and gcc turns the movw %1,sp@- into
+ *	a movw #n,sp@-. we could have given them a "i" constraint too,
+ *	but "g" gives gcc more breathing room, and it does the right
+ *	thing. note: the n's still need to have "r" constraints in the
+ *	non-inline form (function form), as they are no longer constants
+ *	in the function, but a normal arg on the stack frame, and hence
+ *	we need to force evaluation before we change sp. (see osbind.c)
+ *
+ *	-- straps.cpp and traps.c are history. we dont need no stinking
+ *	non-reentrant bindings (straps) or incorrect ones (traps.c :-)
+ *
+ * 03/15/92 ++jrb
+ *	-- another re-hack needed for gcc-2.0: the optimization that we
+ *      used earlier for traps with more than 4 args, making them volatile
+ *	and using "g" constraints no longer works, because gcc has become
+ *	so smart! we now remove the volatile, and give "r" constraints
+ *	(just like traps with <= 4 args). that way the args are evaled
+ *	before we change the stack under gcc, and at appropriate times
+ *	put into reggies and pushed (or as in most cases, they are evaled
+ *	straight into reggies and pushed -- and in even more common cases
+ *	they are already in reggies, and they are just pushed). not doing
+ *	this with -fomit-frame-pointer was causing the temps (from evaluing
+ *	the args) to be created on the stack, but when we changed sp
+ *	from under gccs feet, the offsets  to the temps ended up being wrong.
+ *
+ * 10/28/93 ++jrb
+ *	relax the constraints on the inputs of trap_14_wwwwwww (only
+ *	Rsconf maps to this)  to "g" from "r", as these many "r" 's
+ *	give gcc 2.>3.X heartaches (understandably). note this is ok
+ *	since these args will never be expressions, and we never
+ *	have to constrain hard enough to force eval before we change
+ *	sp from underneath gcc.
+ *
+ */
+
+#ifndef _MINT_OSBIND_H
+#define _MINT_OSBIND_H	1
+
+#ifndef _FEATURES_H
+# include <features.h>
+#endif
+
+#ifndef _MINT_OSTRUCT_H
+# include <mint/ostruct.h>
+#endif
+
+__BEGIN_DECLS
+
+
+/*
+ * GNU C (pseudo inline) Statement Exprs for traps
+ *
+ */
+
+#define trap_1_w(n)							\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#1\n\t"						\
+		"addql	#2,%%sp\n\t"					\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n)				/* inputs  */		\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc"    /* clobbered regs */	\
+	  AND_MEMORY							\
+	);								\
+	retvalue;							\
+})
+
+#define trap_1_ww(n, a)							\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	short _a = (short)(a);						\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movw	%2,%%sp@-\n\t"					\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#1\n\t"						\
+		"addql	#4,%%sp"						\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n), "r"(_a)			/* inputs  */		\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc"    /* clobbered regs */	\
+	  AND_MEMORY							\
+	);								\
+	retvalue;							\
+})
+
+#define trap_1_wl(n, a)							\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	long  _a = (long) (a);						\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movl	%2,%%sp@-\n\t"					\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#1\n\t"						\
+		"addql	#6,%%sp"						\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n), "r"(_a)			/* inputs  */		\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc"    /* clobbered regs */	\
+	  AND_MEMORY							\
+	);								\
+	retvalue;							\
+})
+
+#define trap_1_wlw(n, a, b)						\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	long  _a = (long) (a);						\
+	short _b = (short)(b);						\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movw	%3,%%sp@-\n\t"					\
+		"movl	%2,%%sp@-\n\t"					\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#1\n\t"						\
+		"addql	#8,%%sp"						\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n), "r"(_a), "r"(_b)		/* inputs  */		\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc"    /* clobbered regs */	\
+	  AND_MEMORY							\
+	);								\
+	retvalue;							\
+})
+
+#define trap_1_wwll(n, a, b, c)						\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	short _a = (short)(a);						\
+	long  _b = (long) (b);						\
+	long  _c = (long) (c);						\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movl	%4,%%sp@-\n\t"					\
+		"movl	%3,%%sp@-\n\t"					\
+		"movw	%2,%%sp@-\n\t"					\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#1\n\t"						\
+		"lea	%%sp@(12),%%sp"					\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n), "r"(_a), "r"(_b), "r"(_c)     /* inputs  */		\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc"    /* clobbered regs */	\
+	  AND_MEMORY							\
+	);								\
+	retvalue;							\
+})
+
+#define trap_1_wlww(n, a, b, c)						\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	long  _a = (long) (a);						\
+	short _b = (short)(b);						\
+	short _c = (short)(c);						\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movw	%4,%%sp@-\n\t"					\
+		"movw	%3,%%sp@-\n\t"					\
+		"movl	%2,%%sp@-\n\t"					\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#1\n\t"						\
+		"lea	%%sp@(10),%%sp"					\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n), "r"(_a), "r"(_b), "r"(_c)     /* inputs  */		\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc"    /* clobbered regs */	\
+	  AND_MEMORY							\
+	);								\
+	retvalue;							\
+})
+
+#define trap_1_wlwww(n, a, b, c, d)					\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	short _a = (short)(a);						\
+	short _b = (long)(b);						\
+	long  _c = (short) (c);						\
+	long  _d = (short) (d);						\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movw	%5,%%sp@-\n\t"					\
+		"movw	%4,%%sp@-\n\t"					\
+		"movw	%3,%%sp@-\n\t"					\
+		"movl	%2,%%sp@-\n\t"					\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#1\n\t"						\
+		"lea	%%sp@(12),%%sp"					\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n), "r"(_a), "r"(_b), "r"(_c), "r"(_d) /* inputs  */	\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc", "memory"			\
+	);								\
+	retvalue;							\
+})
+
+#define trap_1_www(n, a, b)						\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	short _a = (short)(a);						\
+	short _b = (short)(b);						\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movw	%3,%%sp@-\n\t"					\
+		"movw	%2,%%sp@-\n\t"					\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#1\n\t"						\
+		"addql	#6,%%sp"						\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n), "r"(_a), "r"(_b)		/* inputs  */		\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc"    /* clobbered regs */	\
+	  AND_MEMORY							\
+	);								\
+	retvalue;							\
+})
+
+#define trap_1_wll(n, a, b)						\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	long  _a = (long) (a);						\
+	long  _b = (long) (b);						\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movl	%3,%%sp@-\n\t"					\
+		"movl	%2,%%sp@-\n\t"					\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#1\n\t"						\
+		"lea	%%sp@(10),%%sp"					\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n), "r"(_a), "r"(_b)		/* inputs  */		\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc"    /* clobbered regs */	\
+	  AND_MEMORY							\
+	);								\
+	retvalue;							\
+})
+
+#define trap_1_wwlll(n, a, b, c, d)					\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	short _a = (short)(a);			\
+	long  _b = (long) (b);			\
+	long  _c = (long) (c);			\
+	long  _d = (long) (d);			\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movl	%5,%%sp@-\n\t"					\
+		"movl	%4,%%sp@-\n\t"					\
+		"movl	%3,%%sp@-\n\t"					\
+		"movw	%2,%%sp@-\n\t"					\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#1\n\t"						\
+		"lea	%%sp@(16),%%sp"					\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n), "r"(_a), "r"(_b), "r"(_c), "r"(_d) /* inputs  */	\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc", "memory"			\
+	);								\
+	retvalue;							\
+})
+
+#define trap_1_wwwll(n, a, b, c, d)					\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	short _a = (short)(a);						\
+	short _b = (short)(b);						\
+	long  _c = (long) (c);						\
+	long  _d = (long) (d);						\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movl	%5,%%sp@-\n\t"					\
+		"movl	%4,%%sp@-\n\t"					\
+		"movw	%3,%%sp@-\n\t"					\
+		"movw	%2,%%sp@-\n\t"					\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#1\n\t"						\
+		"lea	%%sp@(14),%%sp"					\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n), "r"(_a), "r"(_b), "r"(_c), "r"(_d) /* inputs  */	\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc", "memory"			\
+	);								\
+	retvalue;							\
+})
+
+#define trap_13_wl(n, a)						\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	long  _a = (long) (a);						\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movl	%2,%%sp@-\n\t"					\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#13\n\t"					\
+		"addql	#6,%%sp"						\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n), "r"(_a)			/* inputs  */		\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc"    /* clobbered regs */	\
+	  AND_MEMORY							\
+	);								\
+	retvalue;							\
+})
+
+#define trap_13_w(n)							\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#13\n\t"					\
+		"addql	#2,%%sp"						\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n)				/* inputs  */		\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc"    /* clobbered regs */	\
+	  AND_MEMORY							\
+	);								\
+	retvalue;							\
+})
+
+#define trap_13_ww(n, a)						\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	short _a = (short)(a);						\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movw	%2,%%sp@-\n\t"					\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#13\n\t"					\
+		"addql	#4,%%sp"						\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n), "r"(_a)			/* inputs  */		\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc"    /* clobbered regs */	\
+	  AND_MEMORY							\
+	);								\
+	retvalue;							\
+})
+
+#define trap_13_www(n, a, b)						\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	short _a = (short)(a);						\
+	short _b = (short)(b);						\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movw	%3,%%sp@-\n\t"					\
+		"movw	%2,%%sp@-\n\t"					\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#13\n\t"					\
+		"addql	#6,%%sp"						\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n), "r"(_a), "r"(_b)		/* inputs  */		\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc"    /* clobbered regs */	\
+	  AND_MEMORY							\
+	);								\
+	retvalue;							\
+})
+
+#define trap_13_wwlwww(n, a, b, c, d, e)				\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	short _a = (short)(a);			\
+	long  _b = (long) (b);			\
+	short _c = (short)(c);			\
+	short _d = (short)(d);			\
+	short _e = (short)(e);			\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movw	%6,%%sp@-\n\t"					\
+		"movw	%5,%%sp@-\n\t"					\
+		"movw	%4,%%sp@-\n\t"					\
+		"movl	%3,%%sp@-\n\t"					\
+		"movw	%2,%%sp@-\n\t"					\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#13\n\t"					\
+		"lea	%%sp@(14),%%sp"					\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n),							\
+	  "r"(_a), "r"(_b), "r"(_c), "r"(_d), "r"(_e) /* inputs  */	\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc", "memory"			\
+	);								\
+	retvalue;							\
+})
+
+#define trap_13_wwl(n, a, b)						\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	short _a = (short)(a);						\
+	long  _b = (long) (b);						\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movl	%3,%%sp@-\n\t"					\
+		"movw	%2,%%sp@-\n\t"					\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#13\n\t"					\
+		"addql	#8,%%sp"						\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n), "r"(_a), "r"(_b)		/* inputs  */		\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc"    /* clobbered regs */	\
+	  AND_MEMORY							\
+	);								\
+	retvalue;							\
+})
+
+#define trap_14_wwl(n, a, b)						\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	short _a = (short)(a);						\
+	long  _b = (long) (b);						\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movl	%3,%%sp@-\n\t"					\
+		"movw	%2,%%sp@-\n\t"					\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#14\n\t"					\
+		"addql	#8,%%sp"						\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n), "r"(_a), "r"(_b)              /* inputs  */		\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc"    /* clobbered regs */	\
+	  AND_MEMORY							\
+	);								\
+	retvalue;							\
+})
+
+#define trap_14_wwll(n, a, b, c)					\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	short _a = (short)(a);						\
+	long  _b = (long) (b);						\
+	long  _c = (long) (c);						\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movl	%4,%%sp@-\n\t"					\
+		"movl	%3,%%sp@-\n\t"					\
+		"movw	%2,%%sp@-\n\t"					\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#14\n\t"					\
+		"lea	%%sp@(12),%%sp"					\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n), "r"(_a), "r"(_b), "r"(_c)     /* inputs  */		\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc"    /* clobbered regs */	\
+	  AND_MEMORY							\
+	);								\
+	retvalue;							\
+})
+
+#define trap_14_ww(n, a)						\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	short _a = (short)(a);						\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movw	%2,%%sp@-\n\t"					\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#14\n\t"					\
+		"addql	#4,%%sp"						\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n), "r"(_a)			/* inputs  */		\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc"    /* clobbered regs */	\
+	  AND_MEMORY							\
+	);								\
+	retvalue;							\
+})
+
+#define trap_14_w(n)							\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#14\n\t"					\
+		"addql	#2,%%sp"						\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n)				/* inputs  */		\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc"    /* clobbered regs */	\
+	  AND_MEMORY							\
+	);								\
+	retvalue;							\
+})
+
+#define trap_14_wllw(n, a, b, c)					\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	long  _a = (long) (a);						\
+	long  _b = (long) (b);						\
+	short _c = (short)(c);						\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movw	%4,%%sp@-\n\t"					\
+		"movl	%3,%%sp@-\n\t"					\
+		"movl	%2,%%sp@-\n\t"					\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#14\n\t"					\
+		"lea	%%sp@(12),%%sp"					\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n), "r"(_a), "r"(_b), "r"(_c)       /* inputs  */		\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc"    /* clobbered regs */	\
+	  AND_MEMORY							\
+	);								\
+	retvalue;							\
+})
+
+#define trap_14_wl(n, a)						\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	long  _a = (long) (a);						\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movl	%2,%%sp@-\n\t"					\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#14\n\t"					\
+		"addql	#6,%%sp"						\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n), "r"(_a)			/* inputs  */		\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc"    /* clobbered regs */	\
+	  AND_MEMORY							\
+	);								\
+	retvalue;							\
+})
+
+#define trap_14_www(n, a, b)						\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	short _a = (short)(a);						\
+	short _b = (short)(b);						\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movw	%3,%%sp@-\n\t"					\
+		"movw	%2,%%sp@-\n\t"					\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#14\n\t"					\
+		"addql	#6,%%sp"						\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n), "r"(_a), "r"(_b)		/* inputs  */		\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc"    /* clobbered regs */	\
+	  AND_MEMORY							\
+	);								\
+	retvalue;							\
+})
+
+#define trap_14_wllwwwww(n, a, b, c, d, e, f, g)			\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	long  _a = (long) (a);						\
+	long  _b = (long) (b);						\
+	short _c = (short)(c);						\
+	short _d = (short)(d);						\
+	short _e = (short)(e);						\
+	short _f = (short)(f);						\
+	short _g = (short)(g);						\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movw	%8,%%sp@-\n\t"					\
+		"movw	%7,%%sp@-\n\t"					\
+		"movw	%6,%%sp@-\n\t"					\
+		"movw	%5,%%sp@-\n\t"					\
+		"movw	%4,%%sp@-\n\t"					\
+		"movl	%3,%%sp@-\n\t"					\
+		"movl	%2,%%sp@-\n\t"					\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#14\n\t"					\
+		"lea	%%sp@(20),%%sp "					\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n), "r"(_a), "r"(_b),					\
+	  "r"(_c), "r"(_d), "r"(_e), "r"(_f), "r"(_g) /* inputs  */	\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc", "memory"			\
+	);								\
+	retvalue;							\
+})
+
+#define trap_14_wllwwwwlw(n, a, b, c, d, e, f, g, h)			\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	long  _a = (long) (a);						\
+	long  _b = (long) (b);						\
+	short _c = (short)(c);						\
+	short _d = (short)(d);						\
+	short _e = (short)(e);						\
+	short _f = (short)(f);						\
+	long  _g = (long) (g);						\
+	short _h = (short)(h);						\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movw	%9,%%sp@-\n\t"					\
+		"movl	%8,%%sp@-\n\t"					\
+		"movw	%7,%%sp@-\n\t"					\
+		"movw	%6,%%sp@-\n\t"					\
+		"movw	%5,%%sp@-\n\t"					\
+		"movw	%4,%%sp@-\n\t"					\
+		"movl	%3,%%sp@-\n\t"					\
+		"movl	%2,%%sp@-\n\t"					\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#14\n\t"					\
+		"lea	%%sp@(24),%%sp "					\
+	: "=r"(retvalue)			   /* outputs */	\
+	: "g"(n), "r"(_a), "r"(_b), "r"(_c),				\
+	  "r"(_d), "r"(_e), "r"(_f), "r"(_g), "r"(_h) /* inputs  */	\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc", "memory"			\
+	);								\
+	retvalue;							\
+})
+
+#define trap_14_wllwwwwwlw(n, a, b, c, d, e, f, g, h, i)		\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	long  _a = (long) (a);						\
+	long  _b = (long) (b);						\
+	short _c = (short)(c);						\
+	short _d = (short)(d);						\
+	short _e = (short)(e);						\
+	short _f = (short)(f);						\
+	short _g = (short)(g);						\
+	long  _h = (long) (h);						\
+	short _i = (short)(i);						\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movw	%9,%%sp@-\n\t"					\
+		"movl	%8,%%sp@-\n\t"					\
+		"movw	%7,%%sp@-\n\t"					\
+		"movw	%6,%%sp@-\n\t"					\
+		"movw	%5,%%sp@-\n\t"					\
+		"movw	%4,%%sp@-\n\t"					\
+		"movw	%3,%%sp@-\n\t"					\
+		"movl	%2,%%sp@-\n\t"					\
+		"movl	%1,%%sp@-\n\t"					\
+                "movw	%0,%%sp@-"					\
+	:					      /* outputs */	\
+	: "g"(n), "g"(_a), "g"(_b), "g"(_c), "g"(_d),			\
+	  "g"(_e), "g"(_f), "g"(_g), "g"(_h), "g"(_i) /* inputs  */	\
+	);								\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"trap	#14\n\t"					\
+		"lea	%%sp@(26),%%sp"					\
+	: "=r"(retvalue)			/* outputs */		\
+	: 					/* inputs  */		\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc", "memory"			\
+	);								\
+	retvalue;							\
+})
+
+
+#define trap_14_wwwwwww(n, a, b, c, d, e, f)				\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	short _a = (short)(a);						\
+	short _b = (short)(b);						\
+	short _c = (short)(c);						\
+	short _d = (short)(d);						\
+	short _e = (short)(e);						\
+	short _f = (short)(f);						\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movw	%7,%%sp@-\n\t"					\
+		"movw	%6,%%sp@-\n\t"					\
+		"movw	%5,%%sp@-\n\t"					\
+		"movw	%4,%%sp@-\n\t"					\
+		"movw	%3,%%sp@-\n\t"					\
+		"movw	%2,%%sp@-\n\t"					\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#14\n\t"					\
+		"lea	%%sp@(14),%%sp"					\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n), "g"(_a),						\
+	  "g"(_b), "g"(_c), "g"(_d), "g"(_e), "g"(_f)	/* inputs  */	\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc", "memory"			\
+	);								\
+	retvalue;							\
+})
+
+#define trap_14_wlll(n, a, b, c)					\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	long  _a = (long) (a);						\
+	long  _b = (long) (b);						\
+	long  _c = (long) (c);						\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movl	%4,%%sp@-\n\t"					\
+		"movl	%3,%%sp@-\n\t"					\
+		"movl	%2,%%sp@-\n\t"					\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#14\n\t"					\
+		"lea	%%sp@(14),%%sp "					\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n), "r"(_a), "r"(_b), "r"(_c)     /* inputs  */		\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc"    /* clobbered regs */	\
+	  AND_MEMORY							\
+	);								\
+	retvalue;							\
+})
+
+#define trap_14_wllww(n, a, b, c, d)					\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	long  _a = (long) (a);						\
+	long  _b = (long) (b);						\
+	short _c = (short)(c);						\
+	short _d = (short)(d);						\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movw	%5,%%sp@-\n\t"					\
+		"movw	%4,%%sp@-\n\t"					\
+		"movl	%3,%%sp@-\n\t"					\
+		"movl	%2,%%sp@-\n\t"					\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#14\n\t"					\
+		"lea	%%sp@(14),%%sp"					\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n),							\
+	  "r"(_a), "r"(_b), "r"(_c), "r"(_d)    /* inputs  */		\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc", "memory"			\
+	);								\
+	retvalue;							\
+})
+
+#define trap_14_wwwwl(n, a, b, c, d)					\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	short _a = (short)(a);						\
+	short _b = (short)(b);						\
+	short _c = (short)(c);						\
+	long  _d = (long) (d);						\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movl	%5,%%sp@-\n\t"					\
+		"movw	%4,%%sp@-\n\t"					\
+		"movw	%3,%%sp@-\n\t"					\
+		"movw	%2,%%sp@-\n\t"					\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#14\n\t"					\
+		"lea	%%sp@(12),%%sp "					\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n),							\
+	  "r"(_a), "r"(_b), "r"(_c), "r"(_d)        /* inputs  */	\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc", "memory"			\
+	);								\
+	retvalue;							\
+})
+
+#define trap_14_wwwl(n, a, b, c)					\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	short _a = (short)(a);						\
+	short _b = (short)(b);						\
+	long  _c = (long)(c);						\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movl	%4,%%sp@-\n\t"					\
+		"movw	%3,%%sp@-\n\t"					\
+		"movw	%2,%%sp@-\n\t"					\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#14\n\t"					\
+		"lea	%%sp@(10),%%sp"					\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n), "r"(_a), "r"(_b), "r"(_c)	/* inputs  */		\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc"    /* clobbered regs */	\
+	  AND_MEMORY							\
+	);								\
+	retvalue;							\
+})
+
+#define trap_14_wlwlw(n, a, b, c, d)					\
+__extension__								\
+({									\
+	register long retvalue __asm__("d0");				\
+	long  _a = (long) (a);						\
+	short _b = (short)(b);						\
+	long  _c = (long) (c);						\
+	short _d = (short)(d);						\
+	    								\
+	__asm__ volatile						\
+	(								\
+		"movw	%5,%%sp@-\n\t"					\
+		"movl	%4,%%sp@-\n\t"					\
+		"movw	%3,%%sp@-\n\t"					\
+		"movl	%2,%%sp@-\n\t"					\
+		"movw	%1,%%sp@-\n\t"					\
+		"trap	#14\n\t"					\
+		"lea	%%sp@(14),%%sp"					\
+	: "=r"(retvalue)			/* outputs */		\
+	: "g"(n),							\
+	  "r"(_a), "r"(_b), "r"(_c), "r"(_d)    /* inputs  */		\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc", "memory"			\
+	  AND_MEMORY							\
+	);								\
+	retvalue;							\
+})
+
+
+/* DEFINITIONS FOR OS FUNCTIONS */
+
+/*
+ *     GEMDOS  (trap1)
+ */
+#define	       Pterm0()					       	       \
+       (void)trap_1_w((short)(0x00))
+#define	       Cconin()						       \
+       (long)trap_1_w((short)(0x01))
+#define	       Cconout(c)					       \
+       (void)trap_1_ww((short)(0x02),(short)(c))
+#define	       Cauxin()						       \
+       (short)trap_1_w((short)(0x03))
+#define	       Cauxout(c)					       \
+       (void)trap_1_ww((short)(0x04),(short)(c))
+#define	       Cprnout(c)					       \
+       (short)trap_1_ww((short)(0x05),(short)(c))
+#define	       Crawio(data)					       \
+       (long)trap_1_ww((short)(0x06),(short)(data))
+#define	       Crawcin()					       \
+       (long)trap_1_w((short)(0x07))
+#define	       Cnecin()						       \
+       (long)trap_1_w((short)(0x08))
+#define	       Cconws(s)					       \
+       (short)trap_1_wl((short)(0x09),(long)(s))
+#define	       Cconrs(buf)					       \
+       (void)trap_1_wl((short)(0x0A),(long)(buf))
+#define	       Cconis()						       \
+       (short)trap_1_w((short)(0x0B))
+#define	       Dsetdrv(d)					       \
+       (long)trap_1_ww((short)(0x0E),(short)(d))
+#define	       Cconos()						       \
+       (short)trap_1_w((short)(0x10))
+#define	       Cprnos()						       \
+       (short)trap_1_w((short)(0x11))
+#define	       Cauxis()						       \
+       (short)trap_1_w((short)(0x12))
+#define	       Cauxos()						       \
+       (short)trap_1_w((short)(0x13))
+#define	       Dgetdrv()					       \
+       (short)trap_1_w((short)(0x19))
+#define	       Fsetdta(dta)					       \
+       (void)trap_1_wl((short)(0x1A),(long)(dta))
+
+/*
+ * The next binding is not quite right if used in another than the usual ways:
+ *	1. Super(1L) from either user or supervisor mode
+ *	2. ret = Super(0L) from user mode and after this Super(ret) from
+ *	   supervisor mode
+ * We get the following situations (usp, ssp relative to the start of Super):
+ *	Parameter	Userstack	Superstack	Calling Mode	ret
+ *	   1L		   usp		   ssp		    user	 0L
+ *	   1L		   usp		   ssp		 supervisor	-1L
+ *	   0L		  usp-6		   usp		    user	ssp
+ *	   0L		   ssp		  ssp-6		 supervisor   ssp-6
+ *	  ptr		  usp-6		  ptr+6		    user	ssp
+ *	  ptr		  usp+6		   ptr		 supervisor	 sr
+ * The usual C-bindings are safe only because the "unlk a6" is compensating
+ * the errors when you invoke this function. In this binding the "unlk a6" at
+ * the end of the calling function compensates the error made in sequence 2
+ * above (the usp is 6 to low after the first call which is not corrected by
+ * the second call).
+ */
+#define	       Super(ptr)					       \
+       (long)trap_1_wl((short)(0x20),(long)(ptr))
+	/* Tos 1.4: Super(1L) : rets -1L if in super mode, 0L otherwise */
+
+/*
+ * Safe binding to switch back from supervisor to user mode.
+ * On TOS or EmuTOS, if the stack pointer has changed between Super(0)
+ * and Super(oldssp), the resulting user stack pointer is wrong.
+ * This bug does not occur with FreeMiNT.
+ * So the safe way to return from supervisor to user mode is to backup
+ * the stack pointer then restore it after the trap.
+ * Sometimes, GCC optimizes the stack usage, so this matters.
+ */
+#define SuperToUser(ptr)						\
+(void)__extension__							\
+({									\
+	register long retvalue __asm__("d0");				\
+	register long sp_backup;					\
+									\
+	__asm__ volatile						\
+	(								\
+		"movl	%%sp,%1\n\t"					\
+		"movl	%2,%%sp@-\n\t"					\
+		"movw	#0x20,%%sp@-\n\t"					\
+		"trap	#1\n\t"						\
+		"movl	%1,%%sp\n\t"					\
+	: "=r"(retvalue), "=&r"(sp_backup)	/* outputs */		\
+	: "g"((long)(ptr)) 			/* inputs */		\
+	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2", "cc"		\
+	  AND_MEMORY							\
+	);								\
+})
+
+#define	       Tgetdate()					       \
+       (short)trap_1_w((short)(0x2A))
+#define	       Tsetdate(date)					       \
+       (long)trap_1_ww((short)(0x2B),(short)(date))
+#define	       Tgettime()					       \
+       (short)trap_1_w((short)(0x2C))
+#define	       Tsettime(time)					       \
+       (long)trap_1_ww((short)(0x2D),(short)(time))
+#define	       Fgetdta()					       \
+       (_DTA *)trap_1_w((short)(0x2F))
+#define	       Sversion()					       \
+       (short)trap_1_w((short)(0x30))
+#define	       Ptermres(save,rv)				       \
+       (void)trap_1_wlw((short)(0x31),(long)(save),(short)(rv))
+#define	       Dfree(buf,d)					       \
+       (long)trap_1_wlw((short)(0x36),(long)(buf),(short)(d))
+#define	       Dcreate(path)					       \
+       (short)trap_1_wl((short)(0x39),(long)(path))
+#define	       Ddelete(path)					       \
+       (long)trap_1_wl((short)(0x3A),(long)(path))
+#define	       Dsetpath(path)					       \
+       (long)trap_1_wl((short)(0x3B),(long)(path))
+#define	       Fcreate(fn,mode)					       \
+       (long)trap_1_wlw((short)(0x3C),(long)(fn),(short)(mode))
+#define	       Fopen(fn,mode)					       \
+       (long)trap_1_wlw((short)(0x3D),(long)(fn),(short)(mode))
+#define	       Fclose(handle)					       \
+       (long)trap_1_ww((short)(0x3E),(short)(handle))
+#define	       Fread(handle,cnt,buf)				       \
+       (long)trap_1_wwll((short)(0x3F),(short)(handle),	       \
+			 (long)(cnt),(long)(buf))
+#define	       Fwrite(handle,cnt,buf)				       \
+       (long)trap_1_wwll((short)(0x40),(short)(handle),	       \
+			 (long)(cnt),(long)(buf))
+#define	       Fdelete(fn)					       \
+       (long)trap_1_wl((short)(0x41),(long)(fn))
+#define	       Fseek(where,handle,how)				       \
+       (long)trap_1_wlww((short)(0x42),(long)(where),	       \
+			 (short)(handle),(short)(how))
+#define	       Fattrib(fn,rwflag,attr)				       \
+       (short)trap_1_wlww((short)(0x43),(long)(fn),	       \
+			  (short)(rwflag),(short)(attr))
+#define	       Fdup(handle)					       \
+       (long)trap_1_ww((short)(0x45),(short)(handle))
+#define	       Fforce(Hstd,Hnew)				       \
+       (long)trap_1_www((short)(0x46),(short)(Hstd),(short)(Hnew))
+#define	       Dgetpath(buf,d)					       \
+       (long)trap_1_wlw((short)(0x47),(long)(buf),(short)(d))
+#define	       Malloc(size)					       \
+       (long)trap_1_wl((short)(0x48),(long)(size))
+#define	       Mfree(ptr)					       \
+       (long)trap_1_wl((short)(0x49),(long)(ptr))
+#define	       Mshrink(ptr,size)				       \
+       (long)trap_1_wwll((short)(0x4A),(short)0,(long)(ptr),(long)(size))
+#define	       Pexec(mode,prog,tail,env)		       \
+       (long)trap_1_wwlll((short)(0x4B),(short)(mode),(long)(prog),   \
+			   (long)(tail),(long)(env))
+#define	       Pterm(rv)					       \
+       (void)trap_1_ww((short)(0x4C),(short)(rv))
+#define	       Fsfirst(filespec,attr)				       \
+       (long)trap_1_wlw((short)(0x4E),(long)(filespec),(short)(attr))
+#define	       Fsnext()						       \
+       (long)trap_1_w((short)(0x4F))
+#define	       Frename(zero,old,new)				       \
+       (short)trap_1_wwll((short)(0x56),(short)(zero),	       \
+			  (long)(old),(long)(new))
+#define	       Fdatime(timeptr,handle,rwflag)			       \
+       (long)trap_1_wlww((short)(0x57),(long)(timeptr),	       \
+			 (short)(handle),(short)(rwflag))
+#define	       Flock(handle,mode,start,length)			       \
+       (long)trap_1_wwwll((short)(0x5C),(short)(handle),       \
+			  (short)(mode),(long)(start),(long)(length))
+
+/*
+ *     BIOS    (trap13)
+ */
+#define Getmpb(ptr)					       \
+       (void)trap_13_wl((short)(0x00),(long)(ptr))
+#define	       Bconstat(dev)					       \
+       (short)trap_13_ww((short)(0x01),(short)(dev))
+#define	       Bconin(dev)					       \
+       (long)trap_13_ww((short)(0x02),(short)(dev))
+#define	       Bconout(dev,c)					       \
+       (long)trap_13_www((short)(0x03),(short)(dev),(short)((c) & 0xFF))
+/* since AHDI 3.1 there is a new call to Rwabs with one more parameter */
+#define	       Rwabs(rwflag,buf,n,sector,d)			\
+       (long)trap_13_wwlwww((short)(0x04),(short)(rwflag),(long)(buf), \
+			     (short)(n),(short)(sector),(short)(d))
+#define	       Setexc(vnum,vptr) 				      \
+       (void (*) (void))trap_13_wwl((short)(0x05),(short)(vnum),(long)(vptr))
+#define	       Tickcal()					       \
+       (long)trap_13_w((short)(0x06))
+#define	       Getbpb(d)					       \
+       (void *)trap_13_ww((short)(0x07),(short)(d))
+#define	       Bcostat(dev)					       \
+       (short)trap_13_ww((short)(0x08),(short)(dev))
+#define	       Mediach(dev)					       \
+       (short)trap_13_ww((short)(0x09),(short)(dev))
+#define	       Drvmap()						       \
+       (long)trap_13_w((short)(0x0A))
+#define	       Kbshift(data)					       \
+       (long)trap_13_ww((short)(0x0B),(short)(data))
+#define	       Getshift()					       \
+	Kbshift(-1)
+
+
+/*
+ *     XBIOS   (trap14)
+ */
+
+#define	       Initmous(type,param,vptr)			       \
+       (void)trap_14_wwll((short)(0x00),(short)(type),	       \
+			  (long)(param),(long)(vptr))
+#define Ssbrk(size)					       \
+       (void *)trap_14_ww((short)(0x01),(short)(size))
+#define	       Physbase()					       \
+       (void *)trap_14_w((short)(0x02))
+#define	       Logbase()					       \
+       (void *)trap_14_w((short)(0x03))
+#define	       Getrez()						       \
+       (short)trap_14_w((short)(0x04))
+#define	       Setscreen(lscrn,pscrn,rez)			       \
+       (void)trap_14_wllw((short)(0x05),(long)(lscrn),(long)(pscrn), \
+			  (short)(rez))
+#define	       Setpalette(palptr)				       \
+       (void)trap_14_wl((short)(0x06),(long)(palptr))
+#define	       Setcolor(colornum,mixture)			       \
+       (short)trap_14_www((short)(0x07),(short)(colornum),(short)(mixture))
+#define	       Floprd(buf,x,d,sect,trk,side,n)			       \
+       (short)trap_14_wllwwwww((short)(0x08),(long)(buf),(long)(x), \
+	 (short)(d),(short)(sect),(short)(trk),(short)(side),(short)(n))
+#define	       Flopwr(buf,x,d,sect,trk,side,n)			       \
+       (short)trap_14_wllwwwww((short)(0x09),(long)(buf),(long)(x), \
+	       (short)(d),(short)(sect),(short)(trk),(short)(side),(short)(n))
+#define	       Flopfmt(buf,x,d,spt,t,sd,i,m,v)		       \
+       (short)trap_14_wllwwwwwlw((short)(0x0A),(long)(buf),(long)(x), \
+	  (short)(d),(short)(spt),(short)(t),(short)(sd),(short)(i),  \
+	  (long)(m),(short)(v))
+#define	       Midiws(cnt,ptr)					       \
+       (void)trap_14_wwl((short)(0x0C),(short)(cnt),(long)(ptr))
+#define	       Mfpint(vnum,vptr)				       \
+       (void)trap_14_wwl((short)(0x0D),(short)(vnum),(long)(vptr))
+#define	       Iorec(ioDEV)					       \
+       (void *)trap_14_ww((short)(0x0E),(short)(ioDEV))
+#define	       Rsconf(baud,flow,uc,rs,ts,sc)			       \
+       (long)trap_14_wwwwwww((short)(0x0F),(short)(baud),(short)(flow), \
+			  (short)(uc),(short)(rs),(short)(ts),(short)(sc))
+	/* ret old val: MSB -> ucr:8, rsr:8, tsr:8, scr:8 <- LSB */
+#define	       Keytbl(nrml,shft,caps)				       \
+       (void *)trap_14_wlll((short)(0x10),(long)(nrml), \
+			    (long)(shft),(long)(caps))
+#define	       Random()						       \
+       (long)trap_14_w((short)(0x11))
+#define	       Protobt(buf,serial,dsktyp,exec)			       \
+       (void)trap_14_wllww((short)(0x12),(long)(buf),(long)(serial), \
+			   (short)(dsktyp),(short)(exec))
+#define	       Flopver(buf,x,d,sect,trk,sd,n)			       \
+       (short)trap_14_wllwwwww((short)(0x13),(long)(buf),(long)(x),(short)(d),\
+	       (short)(sect),(short)(trk),(short)(sd),(short)(n))
+#define	       Scrdmp()						       \
+       (void)trap_14_w((short)(0x14))
+#define	       Cursconf(rate,attr)				       \
+       (short)trap_14_www((short)(0x15),(short)(rate),(short)(attr))
+#define	       Settime(time)					       \
+       (void)trap_14_wl((short)(0x16),(long)(time))
+#define	       Gettime()					       \
+       (long)trap_14_w((short)(0x17))
+#define	       Bioskeys()					       \
+       (void)trap_14_w((short)(0x18))
+#define	       Ikbdws(len_minus1,ptr)				       \
+       (void)trap_14_wwl((short)(0x19),(short)(len_minus1),(long)(ptr))
+#define	       Jdisint(vnum)					       \
+       (void)trap_14_ww((short)(0x1A),(short)(vnum))
+#define	       Jenabint(vnum)					       \
+       (void)trap_14_ww((short)(0x1B),(short)(vnum))
+#define	       Giaccess(data,reg)				       \
+       (short)trap_14_www((short)(0x1C),(short)(data),(short)(reg))
+#define	       Offgibit(ormask)					       \
+       (void)trap_14_ww((short)(0x1D),(short)(ormask))
+#define	       Ongibit(andmask)					       \
+       (void)trap_14_ww((short)(0x1E),(short)(andmask))
+#define	       Xbtimer(timer,ctrl,data,vptr)			       \
+       (void)trap_14_wwwwl((short)(0x1F),(short)(timer),(short)(ctrl), \
+			   (short)(data),(long)(vptr))
+#define	       Dosound(ptr)					       \
+       (void)trap_14_wl((short)(0x20),(long)(ptr))
+#define	       Setprt(config)					       \
+       (short)trap_14_ww((short)(0x21),(short)(config))
+#define	       Kbdvbase()					       \
+       (_KBDVECS*)trap_14_w((short)(0x22))
+#define	       Kbrate(delay,reprate)				       \
+       (short)trap_14_www((short)(0x23),(short)(delay),(short)(reprate))
+#define	       Prtblk(pblkptr)					       \
+       (void)trap_14_wl((short)(0x24),(long)(pblkptr)) /* obsolete ? */
+#define	       Vsync()						       \
+       (void)trap_14_w((short)(0x25))
+#define	       Supexec(funcptr)					       \
+       (long)trap_14_wl((short)(0x26),(long)(funcptr))
+#define			 Puntaes() \
+		 (void)trap_14_w((short)(0x27))
+#define	       Floprate(drive,rate)				       \
+       (short)trap_14_www((short)(0x29),(short)(drive),(short)(rate))
+#define	       Blitmode(flag)					       \
+       (short)trap_14_ww((short)(0x40),(short)(flag))
+/*
+ * Flag:
+ *  -1: get config
+ * !-1: set config	previous config returned
+ *	bit
+ *	 0	0 blit mode soft	1 blit mode hardware
+ *	 1	0 no blitter		1 blitter present
+ *	2..14   reserved
+ *	 15	must be zero on set/returned as zero
+ * blitmode (bit 0) forced to soft if no blitter(bit 1 == 0).
+ */
+
+/*
+ * extensions for TT TOS
+ */
+
+#define         Mxalloc(amt,flag)					\
+	(long)trap_1_wlw((short)(0x44),(long)(amt),(short)(flag))
+#define		Maddalt(start,size)					\
+	(long)trap_1_wll((short)(0x14),(long)(start),(long)(size))
+
+#define         EsetShift(mode)						\
+	(void)trap_14_ww((short)(80),(short)mode)
+#define         EgetShift()						\
+	(short)trap_14_w((short)(81))
+#define         EsetBank(bank)						\
+	(short)trap_14_ww((short)(82),(short)bank)
+#define         EsetColor(num,val)					\
+	(short)trap_14_www((short)(83),(short)num,(short)val)
+#define         EsetPalette(start,count,ptr)				\
+	(void)trap_14_wwwl((short)(84),(short)start,(short)count,(long)ptr)
+#define         EgetPalette(start,count,ptr)				\
+	(void)trap_14_wwwl((short)(85),(short)start,(short)count,(long)ptr)
+#define         EsetGray(mode)						\
+	(short)trap_14_ww((short)(86),(short)mode)
+#define         EsetSmear(mode)						\
+	(short)trap_14_ww((short)(87),(short)mode)
+
+#define		DMAread(sector,count,buffer,devno)			\
+	(long)trap_14_wlwlw((short)0x2a,(long)sector,(short)count,(long)buffer, \
+			    (short)devno)
+#define		DMAwrite(sector,count,buffer,devno)			\
+	(long)trap_14_wlwlw((short)0x2b,(long)sector,(short)count,(long)buffer, \
+			(short)devno)
+#define		Bconmap(dev)						\
+	(long)trap_14_ww((short)0x2c,(short)(dev))
+#define		NVMaccess(op,start,count,buf)				\
+	(short)trap_14_wwwwl((short)0x2e,(short)op,(short)start,(short)count, \
+			(long)buf)
+
+/*  Wake-up call for ST BOOK -- takes date/time pair in DOS format. */
+
+#define	       Waketime(w_date, w_time)					\
+       (void)trap_14_www((short)(0x2f),(unsigned short)(w_date),	\
+				       (unsigned short)(w_time))
+
+__END_DECLS
+
+
+#endif /* _MINT_OSBIND_H */
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/libcmini/include/mint/ostruct.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/libcmini/include/mint/ostruct.h	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,645 @@
+
+#ifndef _MINT_OSTRUCT_H
+#define _MINT_OSTRUCT_H	1
+
+#ifndef _FEATURES_H
+# include <features.h>
+#endif
+
+#include <mint/basepage.h>
+
+__BEGIN_DECLS
+
+/*
+ * General OS specific codes here
+ *
+ */
+
+/*
+ * GEMDOS defines and structures
+ */
+
+/* Structure used by Dfree() */
+typedef struct {
+    long b_free;	/* number of free clusters */
+    long b_total;	/* total number of clusters */
+    long b_secsiz;	/* number of bytes per sector */
+    long b_clsiz;	/* number of sectors per cluster */
+} _DISKINFO;
+
+/* Structure returned by Fdatime() */
+typedef struct {
+  unsigned short time;
+  unsigned short date;
+} _DOSTIME;
+
+/* Structure used by Cconrs */
+typedef struct
+{
+        unsigned char maxlen;
+        unsigned char actuallen;
+        char    buffer[255];
+} _CCONLINE;
+
+/* Structure used by Fgetdta(), Fsetdta(), Fsfirst(), Fsnext() */
+typedef struct _dta {
+    char 	    dta_buf[21];	/* reserved */
+    char            dta_attribute;	/* file attribute */
+    unsigned short  dta_time;		/* file time stamp */
+    unsigned short  dta_date;		/* file date stamp */
+    long            dta_size;		/* file size */
+    char            dta_name[14];	/* file name */
+} _DTA;
+
+typedef struct
+{
+	unsigned hour   : 5;
+	unsigned minute : 6;
+	unsigned second : 5;
+	unsigned year   : 7;
+	unsigned month  : 4;
+	unsigned day    : 5;
+} _DATETIME;
+
+/* Cconis() return values */
+#define DEV_READY		-1
+#define DEV_BUSY		0
+
+/* Super() constants */
+#define SUP_SET			0L
+#define SUP_INQUIRE		1L
+#define SUP_USER		0L
+#define SUP_SUPER		-1L
+
+/* Fopen() modes */
+#define S_READ			0x00
+#define S_WRITE			0x01
+#define S_READWRITE		0x02
+#define S_COMPAT		0x00
+#define S_DENYREADWRITE	0x10
+#define S_DENYWRITE		0x20
+#define S_DENYREAD		0x30
+#define S_DENYNONE		0x40
+#define S_INHERIT		0x70
+
+#define FO_READ         	S_READ
+#define FO_WRITE        	S_WRITE
+#define FO_RW           	S_READWRITE
+
+/* Fseek() modes */
+#define SEEK_SET		0
+#define SEEK_CUR		1
+#define SEEK_END		2
+
+/* Fattrib() params */
+#define FA_INQUIRE		0
+#define FA_SET			1
+
+/* Modes for Mxalloc() */
+#define MX_STRAM		0x00
+#define MX_TTRAM		0x01
+#define MX_PREFSTRAM		0x02
+#define MX_PREFTTRAM		0x03
+#define MX_MPROT		0x08
+/* if bit #3 is set, then */
+#define MX_HEADER		0x00
+#define MX_PRIVATE		0x10
+#define MX_GLOBAL		0x20
+#define MX_SUPERVISOR		0x30
+#define MX_READABLE		0x40
+
+/* Fforce() params */
+#define GSH_CONIN		0
+#define GSH_CONOUT		1
+#define GSH_AUX			2
+#define GSH_PRN			3
+#define GSH_BIOSCON		-1
+#define GSH_BIOSAUX		-2
+#define GSH_BIOSPRN		-3
+#define GSH_MIDIIN		-4
+#define GSH_MIDIOUT		-5
+
+/* Dgetpath() param */
+#define DEFAULT_DRIVE	0
+
+/* Pterm() modes */
+#define TERM_OK			0
+#define TERM_ERROR		1
+#define TERM_BADPARAMS	2
+#define TERM_CRASH		-1
+#define TERM_CTRLC		-32
+
+/* Return value for i.e. Crawcin() */
+#define MINT_EOF		0xFF1A
+
+/* Codes used with Fsfirst() */
+
+#define        FA_RDONLY           0x01
+#define        FA_HIDDEN           0x02
+#define        FA_SYSTEM           0x04
+#define        FA_LABEL            0x08
+#define        FA_DIR              0x10
+#define        FA_CHANGED          0x20
+
+/* Codes used with Pexec */
+
+#define        PE_LOADGO           0           /* load & go */
+#define        PE_LOAD             3           /* just load */
+#define        PE_GO               4           /* just go */
+#define        PE_CBASEPAGE        5           /* just create basepage */
+/* Tos 1.4: like 4, but memory ownership changed to child, and freed
+   on exit
+ */
+#define        PE_GO_FREE          6           /* just go, then free */
+
+#ifdef __MINT__
+/* ers: what exactly does mode 7 do ??? */
+   #define	PE_ASYNC_LOADGO	   100	       /* load and asynchronously go */
+   #define       PE_ASYNC_GO	   104	       /* asynchronously go	     */
+   #define       PE_ASYNC_GO_FREE   106	       /* asynchronously go and free */
+   #define       PE_OVERLAY	   200	       /* load and overlay	     */
+#endif
+
+/*
+ * BIOS defines and structures
+ */
+
+/* Device codes for Bconin(), Bconout(), Bcostat(), Bconstat() */
+#define _PRT    0
+#define _AUX    1
+#define _CON    2
+#define _MIDI   3
+#define _IKBD   4
+#define _RAWCON 5
+
+#define DEV_PRINTER		_PRT
+#define DEV_AUX			_AUX
+#define DEV_CONSOLE		_CON
+#define DEV_MIDI		_MIDI
+#define DEV_IKBD		_IKBD
+#define DEV_RAW			_RAWCON
+
+/* Mode bitmask used in Rwabs() */
+#define RW_READ			0
+#define RW_WRITE		0
+#define RW_NOMEDIACH	1
+#define RW_NORETRIES	2
+#define RW_NOTRANSLATE	3
+
+/* Vector numbers used in Setexc() */
+#define VEC_BUSERROR	0x02
+#define VEC_ADDRESSERROR	0x03
+#define VEC_ILLEGALINSTRUCTION	0x04
+#define VEC_GEMDOS		0x21
+#define VEC_GEM			0x22
+#define VEC_BIOS		0x2d
+#define VEC_XBIOS		0x2e
+#define VEC_TIMER		0x100
+#define VEC_CRITICALERROR	0x101
+#define VEC_CRITICALERR	VEC_CRITICALERROR
+#define VEC_TERMINATE	0x102
+#define VEC_PROCTERM	VEC_TERMINATE
+#define VEC_INQUIRE		((void*)-1)
+
+/* Values returned by Mediach() */
+#define MED_NOCHANGE	0
+#define MED_UNKNOWN		1
+#define MED_CHANGED		2
+
+/* Mode bitmask for Kbshift() */
+#define K_RSHIFT		0x0001
+#define K_LSHIFT		0x0002
+#define K_CTRL			0x0004
+#define K_ALT			0x0008
+#define K_CAPSLOCK		0x0010
+#define K_CLRHOME		0x0020
+#define K_INSERT		0x0040
+
+
+/* Structure returned by Getbpb() */
+typedef struct {
+  short recsiz;         /* bytes per sector */
+  short clsiz;          /* sectors per cluster */
+  short clsizb;         /* bytes per cluster */
+  short rdlen;          /* root directory size */
+  short fsiz;           /* size of file allocation table */
+  short fatrec;         /* startsector of second FAT */
+  short datrec;         /* first data sector */
+  short numcl;          /* total number of clusters */
+  short bflags;         /* some flags */
+} _BPB;
+
+/* Structures used by Getmpb() */
+
+/* Memory descriptor */
+typedef struct _md {
+    struct _md	*md_next;	/* next descriptor in the chain */
+    long	 md_start;	/* starting address of block */
+    long	 md_length;	/* length of the block */
+    BASEPAGE	*md_owner;	/* owner's process descriptor */
+} _MD;
+
+/* Memory parameter block */
+typedef struct {
+    _MD *mp_free;		/* free memory chunks */
+    _MD *mp_used;		/* used memory descriptors */
+    _MD *mp_rover;		/* rover memory descriptor */
+} _MPB;
+
+
+/*
+ * XBIOS defines and structures
+ */
+
+/* Codes used with Cursconf() */
+#define CURS_HIDE   	0
+#define CURS_SHOW   	1
+#define CURS_BLINK  	2
+#define CURS_NOBLINK    3
+#define CURS_SETRATE    4
+#define CURS_GETRATE    5
+
+/* Modes for Initmous() */
+#define IM_DISABLE		0
+#define IM_RELATIVE		1
+#define IM_ABSOLUTE		2
+#define IM_KEYCODE		4
+
+#define IM_YBOT			0
+#define IM_YTOP			1
+#define IM_PACKETS		2
+#define IM_KEYS			3
+
+/* VsetScreen() modes */
+#define SCR_NOCHANGE	-1
+#define SCR_MODECODE	3
+
+#define COL_INQUIRE		-1
+
+/* Floprd() devices */
+#define FLOP_DRIVEA		0
+#define FLOP_DRIVEB		1
+
+/* Flopfmt() params */
+#define FLOP_NOSKEW		 1
+#define FLOP_SKEW		-1
+
+#define FLOP_MAGIC		0x8754321
+#define FLOP_VIRGIN		0xe5e5
+
+#define FLOPPY_DSDD		0
+#define FLOPPY_DSHD		1
+#define FLOPPY_DSED		2
+
+/* Dbmsg() messages */
+#define DB_NULLSTRING	0xf000
+#define DB_COMMAND		0xf100
+
+/* Mfpint() vector indices */
+#define MFP_PARALLEL	0
+#define	MFP_DCD			1
+#define MFP_CTS			2
+#define MFP_BITBLT		3
+#define MFP_TIMERD		4
+#define MFP_BAUDRATE	MFP_TIMERD
+#define MFP_200HZ		5
+#define MFP_ACIA		6
+#define MFP_DISK		7
+#define MFP_TIMERB		8
+#define MFP_HBLANK		MFP_TIMERB
+#define MFP_TERR		9
+#define MFP_TBE			10
+#define MFP_RERR		11
+#define MFP_RBF			12
+#define MFP_TIMERA		13
+#define MFP_DMASOUND	MFP_TIMERA
+#define MFP_RING		14
+#define MFP_MONODETECT	15
+
+/* Iorec() devices */
+#define IO_SERIAL		0
+#define IO_KEYBOARD		1
+#define IO_MIDI			2
+
+/* Rsconf() speeds */
+#define BAUD_19200		0
+#define BAUD_9600		1
+#define BAUD_4800		2
+#define BAUD_3600		3
+#define BAUD_2400		4
+#define BAUD_2000		5
+#define BAUD_1800		6
+#define BAUD_1200		7
+#define BAUD_600		8
+#define BAUD_300		9
+#define BAUD_200		10
+#define BAUD_150		11
+#define BAUD_134		12
+#define BAUD_110		13
+#define BAUD_75			14
+#define BAUD_50			15
+#define BAUD_INQUIRE	-2
+
+/* Rsconf() params */
+#define FLOW_NONE		0
+#define FLOW_SOFT		1
+#define FLOW_HARD		2
+#define FLOW_BOTH		3
+
+#define RS_RECVENABLE	0x01
+#define RS_SYNCSTRIP	0x02
+#define RS_MATCHBUSY	0x04
+#define RS_BRKDETECT	0x08
+#define RS_FRAMEERR		0x10
+#define RS_PARITYERR	0x20
+#define RS_OVERRUNERR	0x40
+#define RS_BUFFUL		0x80
+
+#define RS_ODDPARITY	0x02
+#define RS_EVENPARITY	0x00
+#define RS_PARITYENABLE	0x04
+
+#define RS_NOSTOP		0x00
+#define RS_1STOP		0x08
+#define RS_15STOP		0x10
+#define RS_2STOP		0x18
+
+#define RS_8BITS		0x00
+#define RS_7BITS		0x20
+#define RS_6BITS		0x40
+#define RS_5BITS		0x60
+
+#define RS_CLK16		0x80
+
+#define RS_INQUIRE		-1
+#define RS_LASTBAUD		2
+
+/* Keytbl() param */
+#define KT_NOCHANGE		((char*)-1)
+
+/* Protobt() params */
+#define SERIAL_NOCHANGE	-1
+#define SERIAL_RANDOM	0x01000001
+
+#define DISK_NOCHANGE	-1
+#define DISK_SSSD		0
+#define DISK_DSSD		1
+#define DISK_SSDD		2
+#define DISK_DSDD		3
+#define DISK_DSHD		4
+#define DISK_DSED		5
+
+#define EXEC_NOCHANGE	-1
+#define EXEC_NO			0
+#define EXEC_YES		1
+
+/* Giaccess() registers */
+#define PSG_APITCHLOW	0
+#define PSG_APITCHHIGH	1
+#define PSG_BPITCHLOW	2
+#define PSG_BPTICHHIGH	3
+#define PSG_CPITCHLOW	4
+#define PSG_CPITCHHIGH	5
+#define PSG_NOISEPITCH	6
+#define PSG_MODE		7
+#define PSG_AVOLUME		8
+#define PSG_BVOLUME		9
+#define PSG_CVOLUME		10
+#define PSG_FREQLOW		11
+#define PSG_FREQHIGH	12
+#define PSG_ENVELOPE	13
+#define PSG_PORTA		14
+#define PSG_PORTB		15
+
+#define PSG_ENABLEA		0x01
+#define PSG_ENABLEB		0x02
+#define PSG_ENABLEC		0x04
+#define PSG_NOISEA		0x08
+#define PSG_NOISEB		0x10
+#define PSG_NOISEC		0x20
+#define PSG_PRTAOUT		0x40
+#define PSG_PRTBOUT		0x80
+
+/* Bitmasks for Offgibit() */
+#define GI_FLOPPYSIDE	0x01
+#define GI_FLOPPYA		0x02
+#define GI_FLOPPYB		0x04
+#define GI_RTS			0x08
+#define GI_DTR			0x10
+#define GI_STROBE		0x20
+#define GI_GPO			0x40
+#define GI_SCCPORT		0x80
+
+/* Xbtimer() values */
+#define XB_TIMERA		0
+#define XB_TIMERB		1
+#define XB_TIMERC		2
+#define XB_TIMERD		3
+
+/* Dosound() param */
+#define DS_INQUIRE		-1
+
+/* Setprt() modes */
+#define PRT_DOTMATRIX	0x01
+#define PRT_MONO		0x02
+#define PRT_ATARI		0x04
+#define PRT_DRAFT		0x08
+#define PRT_PARALLEL	0x10
+#define PRT_CONTINUOUS	0x20
+
+#define PRT_DAISY		0x01
+#define PRT_COLOR		0x02
+#define PRT_EPSON		0x04
+#define PRT_FINAL		0x08
+#define PRT_SERIAL		0x10
+#define PRT_SINGLE		0x20
+
+#define PRT_INQUIRE		-1
+
+/* Kbrate() param */
+#define	KB_INQUIRE		-1
+
+/* Floprate() seek rates */
+#define FRATE_6			0
+#define FRATE_12		1
+#define FRATE_2			2
+#define FRATE_3			3
+#define	FRATE_INQUIRE	-1
+
+/* Bconmap() params */
+#define BMAP_CHECK		0
+#define BMAP_INQUIRE	-1
+#define BMAP_MAPTAB		-2
+
+/* NVMaccess params */
+#define NVM_READ		0
+#define NVM_WRITE		1
+#define NVM_RESET		2
+
+/* Blitmode() modes */
+#define BLIT_SOFT		0
+#define BLIT_HARD		1
+
+/* EsetShift() modes */
+#define ST_LOW			0x0000
+#define ST_MED			0x0100
+#define ST_HIGH			0x0200
+#define TT_MED			0x0300
+#define TT_HIGH			0x0600
+#define TT_LOW			0x0700
+
+#define ES_GRAY			12
+#define ES_SMEAR		15
+
+/* Esetbank() params */
+#define ESB_INQUIRE		-1
+#define EC_INQUIRE		-1
+
+/* EsetGray() modes */
+#define ESG_INQUIRE		-1
+#define ESG_COLOR		0
+#define	ESG_GRAY		1
+
+/* EsetSmear() modes */
+#define ESM_INQUIRE		-1
+#define ESM_NORMAL		0
+#define	ESM_SMEAR		1
+
+/* Structure returned by Iorec() */
+typedef struct {
+    char    *ibuf;
+    short   ibufsiz;
+    volatile short   ibufhd;
+    volatile short   ibuftl;
+    short   ibuflow;
+    short   ibufhi;
+} _IOREC;
+
+/* Structure used by Initmouse() */
+typedef struct {
+	char	topmode;
+	char	buttons;
+	char	xparam;
+	char	yparam;
+	short	xmax;
+	short	ymax;
+	short	xstart;
+	short	ystart;
+} _PARAM;
+
+/* Structure returned by Kbdvbase() */
+typedef struct {
+    void    (*midivec)	(void);
+    void    (*vkbderr)	(void);
+    void    (*vmiderr)	(void);
+    void    (*statvec)	(void *);
+    void    (*mousevec)	(void *);
+    void    (*clockvec)	(void *);
+    void    (*joyvec)	(void *);
+    long    (*midisys)	(void);
+    long    (*ikbdsys)	(void);
+    char    kbstate;
+} _KBDVECS;
+
+/* Structure returned by Keytbl() */
+typedef struct {
+    char *unshift;	/* pointer to unshifted keys */
+    char *shift;	/* pointer to shifted keys */
+    char *caps;		/* pointer to capslock keys */
+
+    /* Entries below available
+     * when _AKP cookie is present.
+     */
+    char *alt;		/* pointers to alt translation tables */
+    char *altshift;
+    char *altcaps;
+
+   /* Entry below is available
+    * on MilanTOS and as of FreeMiNT 1.16.1
+    */
+    char *altgr;
+
+} _KEYTAB;
+
+/* Structure used by Prtblk() */
+typedef struct
+{
+        void    *pb_scrptr;
+        int     pb_offset;
+        int     pb_width;
+        int     pb_height;
+        int     pb_left;
+        int     pb_right;
+        int     pb_screz;
+        int     pb_prrez;
+        void    *pb_colptr;
+        int     pb_prtype;
+        int     pb_prport;
+        void    *pb_mask;
+} _PBDEF;
+
+/* Available from MetaDOS version 2.30 */
+typedef struct
+{
+	unsigned short mi_version;
+	long mi_magic;
+	const char *mi_log2phys;
+} META_INFO_2;
+
+/* Structure used by Metainit() */
+typedef struct
+{
+	unsigned long drivemap;
+	char *version;
+	long reserved[2];
+
+	META_INFO_2 *info;	/* Available from MetaDOS version 2.30 */
+} META_INFO_1;
+
+#ifndef METAINFO
+#define METAINFO META_INFO_1
+#endif
+
+/* Structure used by VgetRGB*/
+typedef struct
+{
+	char reserved;
+	char red;
+	char green;
+	char blue;
+} _RGB;
+
+/* Structure used by Bconmap() */
+typedef struct
+{
+	short (*Bconstat)();
+	long (*Bconin)();
+	long (*Bcostat)();
+	void (*Bconout)();
+	unsigned long (*Rsconf)();
+	_IOREC *iorec;
+} _MAPTAB;
+
+/* Structure used by Bconmap() */
+typedef struct
+{
+	_MAPTAB *maptab;
+	short maptabsize;
+} _BCONMAP;
+
+/* Structure used by Settime */
+typedef struct
+{
+	unsigned year:7;
+	unsigned month:4;
+	unsigned day:5;
+	unsigned hour:5;
+	unsigned minute:6;
+	unsigned second:5;
+} _BIOSTIME;
+
+
+__END_DECLS
+
+
+#endif /* _MINT_OSTRUCT_H */
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/libcmini/include/setjmp.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/libcmini/include/setjmp.h	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,9 @@
+#ifndef _SETJMP_H_
+#define _SETJMP_H_
+
+typedef long jmp_buf[31];
+
+extern int setjmp(jmp_buf buf);
+extern void longjmp(jmp_buf, int);
+
+#endif /* _SETJMP_H_ */
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/libcmini/include/stdarg.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/libcmini/include/stdarg.h	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,127 @@
+/* Copyright (C) 1989-2017 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+<http://www.gnu.org/licenses/>.  */
+
+/*
+ * ISO C Standard:  7.15  Variable arguments  <stdarg.h>
+ */
+
+#ifndef _STDARG_H
+#ifndef _ANSI_STDARG_H_
+#ifndef __need___va_list
+#define _STDARG_H
+#define _ANSI_STDARG_H_
+#endif /* not __need___va_list */
+#undef __need___va_list
+
+/* Define __gnuc_va_list.  */
+
+#ifndef __GNUC_VA_LIST
+#define __GNUC_VA_LIST
+typedef __builtin_va_list __gnuc_va_list;
+#endif
+
+/* Define the standard macros for the user,
+   if this invocation was from the user program.  */
+#ifdef _STDARG_H
+
+#define va_start(v,l)	__builtin_va_start(v,l)
+#define va_end(v)	__builtin_va_end(v)
+#define va_arg(v,l)	__builtin_va_arg(v,l)
+#if !defined(__STRICT_ANSI__) || __STDC_VERSION__ + 0 >= 199900L \
+    || __cplusplus + 0 >= 201103L
+#define va_copy(d,s)	__builtin_va_copy(d,s)
+#endif
+#define __va_copy(d,s)	__builtin_va_copy(d,s)
+
+/* Define va_list, if desired, from __gnuc_va_list. */
+/* We deliberately do not define va_list when called from
+   stdio.h, because ANSI C says that stdio.h is not supposed to define
+   va_list.  stdio.h needs to have access to that data type, 
+   but must not use that name.  It should use the name __gnuc_va_list,
+   which is safe because it is reserved for the implementation.  */
+
+#ifdef _BSD_VA_LIST
+#undef _BSD_VA_LIST
+#endif
+
+#if defined(__svr4__) || (defined(_SCO_DS) && !defined(__VA_LIST))
+/* SVR4.2 uses _VA_LIST for an internal alias for va_list,
+   so we must avoid testing it and setting it here.
+   SVR4 uses _VA_LIST as a flag in stdarg.h, but we should
+   have no conflict with that.  */
+#ifndef _VA_LIST_
+#define _VA_LIST_
+#ifdef __i860__
+#ifndef _VA_LIST
+#define _VA_LIST va_list
+#endif
+#endif /* __i860__ */
+typedef __gnuc_va_list va_list;
+#ifdef _SCO_DS
+#define __VA_LIST
+#endif
+#endif /* _VA_LIST_ */
+#else /* not __svr4__ || _SCO_DS */
+
+/* The macro _VA_LIST_ is the same thing used by this file in Ultrix.
+   But on BSD NET2 we must not test or define or undef it.
+   (Note that the comments in NET 2's ansi.h
+   are incorrect for _VA_LIST_--see stdio.h!)  */
+#if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(WINNT)
+/* The macro _VA_LIST_DEFINED is used in Windows NT 3.5  */
+#ifndef _VA_LIST_DEFINED
+/* The macro _VA_LIST is used in SCO Unix 3.2.  */
+#ifndef _VA_LIST
+/* The macro _VA_LIST_T_H is used in the Bull dpx2  */
+#ifndef _VA_LIST_T_H
+/* The macro __va_list__ is used by BeOS.  */
+#ifndef __va_list__
+typedef __gnuc_va_list va_list;
+#endif /* not __va_list__ */
+#endif /* not _VA_LIST_T_H */
+#endif /* not _VA_LIST */
+#endif /* not _VA_LIST_DEFINED */
+#if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__))
+#define _VA_LIST_
+#endif
+#ifndef _VA_LIST
+#define _VA_LIST
+#endif
+#ifndef _VA_LIST_DEFINED
+#define _VA_LIST_DEFINED
+#endif
+#ifndef _VA_LIST_T_H
+#define _VA_LIST_T_H
+#endif
+#ifndef __va_list__
+#define __va_list__
+#endif
+
+#endif /* not _VA_LIST_, except on certain systems */
+
+#endif /* not __svr4__ */
+
+#endif /* _STDARG_H */
+
+#endif /* not _ANSI_STDARG_H_ */
+#endif /* not _STDARG_H */
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/libcmini/include/stddef.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/libcmini/include/stddef.h	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,19 @@
+/*
+ * stddef.h
+ *
+ *  Created on: 31.05.2013
+ *      Author: mfro
+ */
+
+#ifndef STDDEF_H_
+#define STDDEF_H_
+
+typedef unsigned long size_t;
+typedef signed long ptrdiff_t;
+
+#define __NULL (0L)
+
+/* Offset of member MEMBER in a struct of type TYPE.  */
+#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
+
+#endif /* STDDEF_H_ */
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/libcmini/include/stdio.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/libcmini/include/stdio.h	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,109 @@
+/*
+ * stdio.h
+ *
+ *  Created on: 29.05.2013
+ *      Author: mfro
+ */
+
+#ifndef _STDIO_H_
+#define _STDIO_H_
+
+#include <stdlib.h>
+#include <stdarg.h>
+#include <mint/osbind.h>
+
+typedef struct __stdio_file FILE;
+typedef struct __stdio_file
+{
+    long __magic;
+#define	_IOMAGIC (0xfedabeebL)	/* Magic number to fill `__magic'.  */
+
+#if 0
+    void *BufPtr;     /* next byte write */
+    void *BufLvl;     /* next byte read */
+    void *BufStart;   /* first byte of buffer */
+    void *BufEnd;     /* first byte after buffer */
+#endif
+    long Handle;      /* GEMDOS handle */
+#if 0
+    char Flags;
+    char resv;
+    char ChrBuf;
+    char ungetFlag;
+#endif
+    FILE *__next;     /* Next FILE in the linked list.  */
+
+} FILE;
+
+extern FILE *stdout;
+extern FILE *stdin;
+extern FILE *stderr;
+
+#define _IONBF	2
+
+#ifndef NULL
+#define NULL        ((void *)0)
+#endif /* NULL */
+
+#define OPEN_MAX        32
+#define FOPEN_MAX       32
+#define FILENAME_MAX    128
+#define PATH_MAX        128
+#define BUFSIZ          1024
+#define EOF             (-1)
+
+/*
+ * access modes for open()
+ */
+#define O_RDONLY        0x00    /* open read-only */
+#define O_WRONLY        0x01    /* open write-only (this doesn't work apparently on _all_ TOS versions */
+#define O_RDWR          0x02    /* open for reading and writing */
+#define O_APPEND        0x08    /* position file pointer to end of file before each write */
+#define O_CREAT         0x20    /* create file if it doesn't exist */
+#define O_TRUNC         0x40    /* truncate to zero size */
+#define O_EXCL          0x80    /* ? */
+
+#define SEEK_SET    0   /* Seek from beginning of file.  */
+#define SEEK_CUR    1   /* Seek from current position.  */
+#define SEEK_END    2   /* Seek from end of file.  */
+
+extern int errno;
+
+extern FILE *fopen(const char *path, const char *mode);
+extern int fclose(FILE *fp);
+extern size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream);
+extern size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
+extern int fseek(FILE *fp, long offset, int origin);
+extern long ftell(FILE *stream);
+
+
+
+
+extern int fputs(const char *s, FILE *stream);
+extern int puts(const char *s);
+extern int fputc(int c, FILE *stream);
+extern int putc(int c, FILE *stream);
+
+extern int scanf(const char *format, ...);
+extern int fscanf(FILE *stream, const char *format, ...);
+extern int fgetc(FILE *stream);
+extern int putchar(int c);
+extern int fprintf(FILE *stream, const char *format, ...);
+extern int vfprintf(FILE *stream, const char *format, va_list ap);
+
+extern int printf(const char *fmt, ...);
+extern int snprintf(char *s, size_t size, const char *fmt, ...);
+extern int vsnprintf(char *str, size_t size, const char *fmt, va_list va);
+extern int sprintf(char *s, const char *format, ...);
+extern int vsprintf(char *s, const char *format, va_list va);
+
+extern int puts(const char *s);
+
+extern int open(const char *filename, int access, ...);
+extern int close(int fd);
+extern int unlink(const char *filename);
+
+static inline int fileno(FILE *stream) { return stream->Handle; }
+static inline int getc(FILE *stream) { return fgetc(stream); }
+
+#endif /* STDIO_H_ */
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/libcmini/include/stdlib.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/libcmini/include/stdlib.h	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,47 @@
+/*
+ * stdlib.h
+ *
+ *  Created on: 31.05.2013
+ *      Author: mfro
+ */
+
+#ifndef _STDLIB_H_
+#define _STDLIB_H_
+
+typedef unsigned long size_t;
+
+extern int atoi(const char *c);
+extern long atol(const char *c);
+extern void *malloc(size_t size);
+extern void *calloc(size_t nmemb, size_t size);
+extern void *realloc(void *ptr, size_t size);
+extern void free(void *ptr);
+
+extern char *ltoa(long value, char *buffer, int radix);
+#define _ltoa(a, b, c) ltoa((a), (b), (c))
+
+extern char *getenv(const char *name);
+
+int atexit(void (*func)(void));
+extern void exit(int status);
+extern void abort(void);
+
+#ifdef __MSHORT__
+#define	RAND_MAX (0x7FFF)
+#else
+#define	RAND_MAX (0x7FFFFFFFL)
+#endif
+
+extern int rand(void);
+extern long lrand(void);
+extern void srand48(long int seed);
+
+extern long strtol(const char*, char**, int);
+extern unsigned long strtoul(const char*, char**, int);
+extern long long strtoll(const char*, char**, int);
+extern unsigned long long strtoull(const char*, char**, int);
+
+#define abs(j)  ((j) > 0 ? (j) : -(j))
+
+#define NULL	((void *) 0)
+#endif /* _STDLIB_H_ */
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/libcmini/include/string.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/libcmini/include/string.h	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,47 @@
+/*
+ * string.h
+ *
+ *  Created on: 29.05.2013
+ *      Author: mfro
+ */
+
+#ifndef _STRING_H_
+#define _STRING_H_
+
+#include <stdlib.h>
+
+extern char *strcat(char *dst, const char *src);
+extern char *strcpy(char *dst, const char *src);
+extern size_t strlen(const char *s);
+extern char *strncat(char *dst, const char *src, size_t max);
+extern int strcmp(const char *s1, const char *s2);
+extern int stricmp(const char *s1, const char *s2);
+extern int strcasecmp(const char *s1, const char *s2);
+extern int strncmp(const char *s1, const char *s2, size_t max);
+extern int strnicmp(const char *s1, const char *s2, size_t max);
+extern int strncasecmp(const char *s1, const char *s2, size_t max);
+extern char *strncpy(char *dst, const char *src, size_t max);
+extern char *strdup(const char *s1);
+extern char *strndup(const char *s1, size_t n);
+extern char *strchr(const char *s, int c);
+extern char *strstr(const char *s, const char *wanted);
+extern size_t strspn(const char *s, const char *accept);
+extern size_t strcspn(const char *s, const char *reject);
+extern char *strpbrk(const char *s, const char *breakat);
+extern char *index(const char *s, int c);
+extern char *strrchr(const char *s, int c);
+extern char *rindex(const char *s, int c);
+
+extern void bzero(void *s, size_t n);
+extern void bcopy(const void *src, void *dst, size_t n);
+extern void *memset(void *b, int c, size_t len);
+extern void *memcpy(void *dest, const void *src, size_t n);
+extern void *memmove(void *dest, const void *src, size_t n);
+extern int memcmp(const void *s1, const void *s2, size_t n);
+
+extern char *strerror(int errnum);
+extern char* strerror_r(int errnum, char *buf, size_t bufsize);
+
+extern char *strrev(char *);
+extern char *strlwr(char *);
+#endif /* _STRING_H_ */
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/libcmini/include/sys/cdefs.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/libcmini/include/sys/cdefs.h	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,126 @@
+#ifndef	_SYS_CDEFS_H
+# define _SYS_CDEFS_H 1
+
+#ifdef __GNUC__
+
+#if defined __GNUC__ && defined __GNUC_MINOR__
+# define __GNUC_PREREQ(maj, min) \
+	((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
+#else
+# define __GNUC_PREREQ(maj, min) 0
+#endif
+
+/* All functions, except those with callbacks or those that
+   synchronize memory, are leaf functions.  */
+# if __GNUC_PREREQ (4, 6) && !defined _LIBC
+#  define __LEAF , __leaf__
+#  define __LEAF_ATTR __attribute__ ((__leaf__))
+# else
+#  define __LEAF
+#  define __LEAF_ATTR
+# endif
+
+# if !defined __cplusplus && __GNUC_PREREQ (3, 3)
+#  define __THROW	__attribute__ ((__nothrow__))
+#  define __THROWNL	__attribute__ ((__nothrow__))
+#  define __NTH(fct)	__attribute__ ((__nothrow__)) fct
+# else
+#  if defined __cplusplus && __GNUC_PREREQ (2,8)
+#   define __THROW	throw ()
+#   define __THROWNL	throw ()
+#   define __NTH(fct)	fct throw ()
+#  else
+#   define __THROW
+#   define __THROWNL
+#   define __NTH(fct)	fct
+#  endif
+# endif
+
+#if __GNUC_PREREQ(3, 3)
+# define __CLOBBER_RETURN(a) 
+#else
+# define __CLOBBER_RETURN(a) a,
+#endif
+
+#if __GNUC_PREREQ(2, 6)
+#define AND_MEMORY , "memory"
+#else
+#define AND_MEMORY
+#endif
+
+#else	/* Not GCC.  */
+
+# define __GNUC_PREREQ(maj, min) 0
+
+# define __inline		/* No inline functions.  */
+
+# define __THROW
+# define __THROWNL
+# define __NTH(fct)	fct
+
+# define __const	const
+# define __signed	signed
+# define __volatile	volatile
+
+#endif	/* GCC.  */
+
+#define __CONCAT(x,y)	x ## y
+#define __STRING(x)	#x
+#define __STRINGIFY(x)	__STRING(x)
+
+#ifdef	__cplusplus
+# define __BEGIN_DECLS	extern "C" {
+# define __END_DECLS	}
+#else
+# define __BEGIN_DECLS
+# define __END_DECLS
+#endif
+
+#if __GNUC_PREREQ (2,96)
+# define __attribute_malloc__ __attribute__ ((__malloc__))
+#else
+# define __attribute_malloc__ /* Ignore */
+#endif
+
+#if __GNUC_PREREQ (2,96)
+# define __attribute_pure__ __attribute__ ((__pure__))
+#else
+# define __attribute_pure__ /* Ignore */
+#endif
+
+#if __GNUC_PREREQ (3,1)
+# define __attribute_used__ __attribute__ ((__used__))
+# define __attribute_noinline__ __attribute__ ((__noinline__))
+#else
+# define __attribute_used__ __attribute__ ((__unused__))
+# define __attribute_noinline__ /* Ignore */
+#endif
+
+#if __GNUC_PREREQ (2,8)
+# define __attribute_format_arg__(x) __attribute__ ((__format_arg__ (x)))
+#else
+# define __attribute_format_arg__(x) /* Ignore */
+#endif
+
+#if __GNUC_PREREQ (2,97)
+# define __attribute_format_strfmon__(a,b) \
+  __attribute__ ((__format__ (__strfmon__, a, b)))
+#else
+# define __attribute_format_strfmon__(a,b) /* Ignore */
+#endif
+
+#if __GNUC_PREREQ (3,3)
+# define __nonnull(params) __attribute__ ((__nonnull__ params))
+#else
+# define __nonnull(params)
+#endif
+
+#if !__GNUC_PREREQ (2,8)
+# define __extension__		/* Ignore */
+#endif
+
+#if !__GNUC_PREREQ (2,92)
+# define __restrict	/* Ignore */
+#endif
+
+#endif	 /* sys/cdefs.h */
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/libcmini/include/sys/stat.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/libcmini/include/sys/stat.h	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,5 @@
+#ifdef __MINTLIB_COMPATIBLE
+#include_next <sys/stat.h>
+#else
+#include <ext.h>
+#endif
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/libcmini/include/sys/types.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/libcmini/include/sys/types.h	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,77 @@
+#ifndef _SYS_TYPES_H
+#define _SYS_TYPES_H 1
+
+#ifndef _FEATURES_H
+# include <features.h>
+#endif
+
+typedef signed char __int8_t;
+typedef unsigned char __uint8_t;
+typedef signed short int __int16_t;
+typedef unsigned short int __uint16_t;
+#ifndef __MSHORT__
+typedef signed int __int32_t;
+typedef unsigned int __uint32_t;
+#else
+typedef signed long int __int32_t;
+typedef unsigned long int __uint32_t;
+#endif /* __MSHORT__ */
+#ifdef __GNUC__
+typedef signed long long int __int64_t;
+typedef unsigned long long int __uint64_t;
+#endif  /* GNUC */
+
+typedef __uint32_t __uid_t;	/* Type of user identifications.  */
+typedef __uint32_t __gid_t;	/* Type of group identifications.  */
+typedef __uint32_t __ino_t;	/* Type of file serial numbers.  */
+typedef __uint32_t __mode_t;	/* Type of file attribute bitmasks.  */
+typedef signed long int __ssize_t;	/* Type of a byte count, or error.  */
+typedef __int32_t __off_t;	/* Type of file sizes and offsets.  */
+typedef __int32_t __clock_t;	/* Type of CPU usage counts.  */
+typedef __int32_t __time_t;
+typedef long int __suseconds_t;
+typedef int __pid_t;		/* Type of process identifications.  */
+
+typedef long loff_t;
+
+#ifndef __gid_t_defined
+typedef __gid_t gid_t;
+# define __gid_t_defined 1
+#endif
+
+#ifndef __mode_t_defined
+typedef __mode_t mode_t;
+# define __mode_t_defined 1
+#endif
+
+#ifndef __uid_t_defined
+typedef __uid_t uid_t;
+# define __uid_t_defined 1
+#endif
+
+#ifndef __off_t_defined
+typedef __off_t off_t;
+# define __off_t_defined 1
+#endif
+
+#ifndef __pid_t_defined
+typedef __pid_t pid_t;
+# define __pid_t_defined 1
+#endif
+
+#ifndef __ssize_t_defined
+typedef __ssize_t ssize_t;
+# define __ssize_t_defined 1
+#endif
+
+#ifndef __time_t_defined
+typedef __time_t time_t;
+#define __time_t_defined 1
+#endif
+
+#ifndef __clock_t_defined
+typedef __clock_t clock_t;
+#define __clock_t_defined 1
+#endif
+
+#endif /* _TYPES_H */
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/libcmini/include/time.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/libcmini/include/time.h	Thu Apr 26 14:56:01 2018 +0200
@@ -0,0 +1,53 @@
+#ifndef _TIME_H_
+#define _TIME_H_
+
+#include <stdio.h>
+#include <sys/types.h>
+
+#define CLOCKS_PER_SEC 200
+#define CLK_TCK	       200
+
+#ifndef __time_t_defined
+typedef __time_t time_t;
+#define __time_t_defined 1
+#endif
+#ifndef __clock_t_defined
+typedef __clock_t clock_t;
+#define __clock_t_defined 1
+#endif
+#ifndef __suseconds_t_defined
+typedef __suseconds_t suseconds_t;
+#define __suseconds_t_defined 1
+#endif
+
+
+struct tm 
+{
+	int tm_sec;         /* seconds */
+	int tm_min;         /* minutes */
+	int tm_hour;        /* hours */
+	int tm_mday;        /* day of the month */
+	int tm_mon;         /* month */
+	int tm_year;        /* year */
+	int tm_wday;        /* day of the week */
+	int tm_yday;        /* day in the year */
+	int tm_isdst;       /* daylight saving time */
+};
+
+struct timeval
+{
+	time_t tv_sec;			/* seconds */
+	suseconds_t tv_usec;	/* microseconds */
+};
+
+struct timezone
+{
+	int tz_minuteswest;		/* minutes west of Greenwich */
+	int tz_dsttime;			/* type of DST correction */
+};
+
+extern time_t time(time_t *tloc);
+extern clock_t clock(void);
+extern time_t mktime(struct tm *tm);
+
+#endif /* _TIME_H_ */
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/libcmini/libcmini.a
Binary file tests/libcmini/libcmini.a has changed
diff -r 3d5c93e19e03 -r 41f2e8a1ac81 tests/libcmini/startup.o
Binary file tests/libcmini/startup.o has changed

Attachment: cpu-testsuite.tar.xz
Description: application/xz-compressed-tar



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/