From 5404dace3af559ea508315905f19209e1eebf25d Mon Sep 17 00:00:00 2001 From: George Koehler Date: Sun, 10 Jun 2018 16:00:23 -0400 Subject: [PATCH 1/4] Stop using from x86emu. The code included only for _X_ATTRIBUTE_PRINTF, which tells some compilers to check the printf format string. Remove so ACK doesn't need any X11 headers. Some machines don't have the X11 headers, or they need a flag like -I/usr/X11R[67]/include to find them. --- plat/pc86/emu/README.md | 7 +++---- plat/pc86/emu/x86emu/x86emu/debug.h | 2 +- plat/pc86/emu/x86emu/x86emu/regs.h | 5 +---- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/plat/pc86/emu/README.md b/plat/pc86/emu/README.md index d63cb0275..7c12ca68b 100644 --- a/plat/pc86/emu/README.md +++ b/plat/pc86/emu/README.md @@ -1,4 +1,3 @@ -The x86emu directory contains a copy of the xorg 8086 emulation library from -the X server. It's distributable under the MIT/X11 license, and so is -compatible with the ACK. - +The x86emu directory contains a modified copy of the xorg 8086 emulation +library from the X server. It's distributable under the MIT/X11 license, +and so is compatible with the ACK. diff --git a/plat/pc86/emu/x86emu/x86emu/debug.h b/plat/pc86/emu/x86emu/x86emu/debug.h index 1f04b7b65..1158c2c90 100644 --- a/plat/pc86/emu/x86emu/x86emu/debug.h +++ b/plat/pc86/emu/x86emu/x86emu/debug.h @@ -189,7 +189,7 @@ extern "C" { /* Use "C" linkage when in C++ mode */ #endif extern void x86emu_inc_decoded_inst_len(int x); - extern void x86emu_decode_printf(const char *x, ...) _X_ATTRIBUTE_PRINTF(1,2); + extern void x86emu_decode_printf(const char *x, ...); extern void x86emu_just_disassemble(void); extern void x86emu_single_step(void); extern void x86emu_end_instr(void); diff --git a/plat/pc86/emu/x86emu/x86emu/regs.h b/plat/pc86/emu/x86emu/x86emu/regs.h index 3c9469f52..057f38cb7 100644 --- a/plat/pc86/emu/x86emu/x86emu/regs.h +++ b/plat/pc86/emu/x86emu/x86emu/regs.h @@ -39,8 +39,6 @@ #ifndef __X86EMU_REGS_H #define __X86EMU_REGS_H -#include - /*---------------------- Macros and type definitions ----------------------*/ #ifdef PACK @@ -331,8 +329,7 @@ extern "C" { /* Use "C" linkage when in C++ mode */ /* Function to log information at runtime */ - void printk(const char *fmt, ...) - _X_ATTRIBUTE_PRINTF(1, 2); + void printk(const char *fmt, ...); #ifdef __cplusplus } /* End of "C" linkage for C++ */ From 6f9e418f94cfd719b9197563d39adbb2f6805d51 Mon Sep 17 00:00:00 2001 From: George Koehler Date: Sun, 10 Jun 2018 16:24:35 -0400 Subject: [PATCH 2/4] Remove extra `#include ` to fix `uint` From my request at https://github.com/kstenerud/Musashi/pull/31 There was a conflict between Musahi's uint and OpenBSD's uint: $ cc -o m68kmake m68kmake.c $ ./m68kmake $ cc -DM68K_COMPILE_FOR_MAME=0 -c m68kcpu.c In file included from m68kcpu.c:565: In file included from /usr/include/stdio.h:46: /usr/include/sys/types.h:58:22: error: cannot combine with previous 'int' declaration specifier typedef unsigned int uint; /* Sys V compatibility */ ^ ./m68kcpu.h:75:25: note: expanded from macro 'uint' #define uint unsigned int ^ 1 error generated. --- plat/linux68k/emu/musashi/README.ACK.md | 6 +++--- plat/linux68k/emu/musashi/m68kcpu.c | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/plat/linux68k/emu/musashi/README.ACK.md b/plat/linux68k/emu/musashi/README.ACK.md index 9e2e4c2e8..a04695129 100644 --- a/plat/linux68k/emu/musashi/README.ACK.md +++ b/plat/linux68k/emu/musashi/README.ACK.md @@ -1,3 +1,3 @@ -This is a copy of the Karl Stenerud's Musashi m68k emulator, available from -https://github.com/kstenerud/Musashi. It's MIT licensed and so is compatible -with the ACK. +This is a modified copy of the Karl Stenerud's Musashi m68k emulator, +available from https://github.com/kstenerud/Musashi. It's MIT licensed +and so is compatible with the ACK. diff --git a/plat/linux68k/emu/musashi/m68kcpu.c b/plat/linux68k/emu/musashi/m68kcpu.c index 45e20aa65..89820c0f0 100755 --- a/plat/linux68k/emu/musashi/m68kcpu.c +++ b/plat/linux68k/emu/musashi/m68kcpu.c @@ -562,7 +562,6 @@ void m68k_set_instr_hook_callback(void (*callback)(void)) CALLBACK_INSTR_HOOK = callback ? callback : default_instr_hook_callback; } -#include /* Set the CPU type. */ void m68k_set_cpu_type(unsigned int cpu_type) { From 250777d1ca3c28564e68c4808306bbbc2b04c499 Mon Sep 17 00:00:00 2001 From: George Koehler Date: Sun, 10 Jun 2018 16:26:54 -0400 Subject: [PATCH 3/4] Rename setmode() to set_mode() to avoid BSD prototype. 4.4BSD added a non-standard function setmode() to ; its prototype is not compatible. --- util/ass/ass00.c | 2 +- util/ass/ass80.c | 8 ++++---- util/ass/assci.c | 28 ++++++++++++++-------------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/util/ass/ass00.c b/util/ass/ass00.c index 82651b595..b6c9dc519 100644 --- a/util/ass/ass00.c +++ b/util/ass/ass00.c @@ -369,7 +369,7 @@ end_module() { */ align(wordsize) ; - setmode(DATA_NUL); + set_mode(DATA_NUL); dump(100); enmd_pro(); enmd_glo(); diff --git a/util/ass/ass80.c b/util/ass/ass80.c index 614dbaf47..514c8dbc0 100644 --- a/util/ass/ass80.c +++ b/util/ass/ass80.c @@ -280,7 +280,7 @@ int icount(size) { return amount ; } -setmode(mode) { +set_mode(mode) { if (datamode==mode) { /* in right mode already */ switch ( datamode ) { @@ -302,8 +302,8 @@ setmode(mode) { default: return ; } - setmode(DATA_NUL) ; /* flush current descriptor */ - setmode(mode) ; + set_mode(DATA_NUL) ; /* flush current descriptor */ + set_mode(mode) ; return; } switch(datamode) { /* terminate current mode */ @@ -376,7 +376,7 @@ setmode(mode) { ext8(HEADBSS) ; break; default: - fatal("Unknown mode in setmode") ; + fatal("Unknown mode in set_mode") ; } } diff --git a/util/ass/assci.c b/util/ass/assci.c index 3b9761eac..5c5b1795e 100644 --- a/util/ass/assci.c +++ b/util/ass/assci.c @@ -699,10 +699,10 @@ chkstart() { if ( absout ) return ; if ( !oksizes ) fatal("missing size specification") ; - setmode(DATA_CONST) ; + set_mode(DATA_CONST) ; extconst((cons_t)0) ; databytes= wordsize ; - setmode(DATA_REP) ; + set_mode(DATA_REP) ; if ( wordsize1 ) { - setmode(DATA_REP); + set_mode(DATA_REP); extadr(amount-1) ; } } else { n = (n + wordsize - 1) / wordsize; while (n > MAXBYTE) { - setmode(DATA_BSS); + set_mode(DATA_BSS); ext8(MAXBYTE); n -= MAXBYTE; } - setmode(DATA_BSS); + set_mode(DATA_BSS); ext8((int) n); } } @@ -787,7 +787,7 @@ extloc(lbp) register locl_t *lbp; { * assemble a pointer constant from a local label. * For example con *1 */ - setmode(DATA_IPTR); + set_mode(DATA_IPTR); data_reloc( chp_cast lbp,dataoff,RELLOC); extadr((cons_t)0); } @@ -800,7 +800,7 @@ extglob(agbp,off) glob_t *agbp; cons_t off; { * Various relocation has to be prepared here in some cases */ gbp=agbp; - setmode(DATA_DPTR); + set_mode(DATA_DPTR); if ( gbp->g_status&DEF ) { extadr(gbp->g_val.g_addr+off); } else { @@ -813,7 +813,7 @@ extpro(aprp) proc_t *aprp; { /* * generate a addres that is defined by a procedure descriptor. */ - consiz= ptrsize ; setmode(DATA_UCON); + consiz= ptrsize ; set_mode(DATA_UCON); extarb((int)ptrsize,(long)(aprp->p_num)); } @@ -825,7 +825,7 @@ extstring() { * generate data for a string. */ for(n=strlngth,s=string ; n--; ) { - setmode(DATA_BYTES) ; + set_mode(DATA_BYTES) ; ext8(*s++); } return ; @@ -839,7 +839,7 @@ extxcon(header) { * generate data for a floating constant initialized by a string. */ - setmode(header); + set_mode(header); s = string ; for (n=strlngth ; n-- ;) { if ( *s==0 ) error("Zero byte in initializer") ; @@ -875,7 +875,7 @@ extvcon(header) { * generate data for a constant initialized by a string. */ - setmode(header); + set_mode(header); if ( consiz>4 ) { error("Size of initializer exceeds loader capability") ; } From a000c628081eff68ac82b5b935f496b160cfad0a Mon Sep 17 00:00:00 2001 From: George Koehler Date: Sun, 10 Jun 2018 16:29:52 -0400 Subject: [PATCH 4/4] Get moncalls.c to compile on OpenBSD. Remove some declarations (not all correct) and #include , , and to get the correct declarations. Disable mount(2), umount(2), and stime(2) because BSD (around 4.3BSD-Reno) lost compatibility with these Unix v7 functions. --- util/int/moncalls.c | 22 +++++++--------------- util/int/sysidf.h | 5 +++++ 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/util/int/moncalls.c b/util/int/moncalls.c index 4b30b0bb9..9e7b954ea 100644 --- a/util/int/moncalls.c +++ b/util/int/moncalls.c @@ -11,12 +11,10 @@ #include #include -#if __STDC__ -#include -#endif #include - -extern int errno; /* UNIX error number */ +#include +#include +#include extern int running; /* from main.c */ extern int fd_limit; /* from io.c */ @@ -39,10 +37,7 @@ struct timeb { /* non-existing; we use an ad-hoc definition */ #endif /* BSD4_2 */ #ifdef SYS_V -#include -#undef ERANGE /* collision with trap.h */ #include -#include #endif /* SYS_V */ #include @@ -57,13 +52,6 @@ struct timeb { /* non-existing; we use an ad-hoc definition */ #define DUPMASK 0x40 -extern long lseek(); -#ifdef SYS_V -extern unsigned int alarm(); -extern long time(); -extern void sync(); -#endif /* SYS_V */ - #define INT2SIZE max(wsize, 2L) #define INT4SIZE max(wsize, 4L) @@ -548,6 +536,7 @@ moncall() LOG(("@m9 Getpid: succeeded, pid = %d", pid)); break; +#ifdef WANT_MOUNT_UMOUNT case 21: /* Mount */ dsp1 = pop_ptr(); @@ -587,6 +576,7 @@ moncall() LOG(("@m9 Mount: succeeded, dsp1 = %lu", dsp1)); } break; +#endif case 23: /* Setuid */ @@ -612,6 +602,7 @@ moncall() LOG(("@m9 Getuid(part 2): eff uid = %d", userid)); break; +#ifdef WANT_STIME case 25: /* Stime */ tm = pop_int4(); @@ -632,6 +623,7 @@ moncall() LOG(("@m9 Stime: succeeded, tm = %ld", tm)); } break; +#endif case 26: /* Ptrace */ diff --git a/util/int/sysidf.h b/util/int/sysidf.h index 8297f12ac..ed385b189 100644 --- a/util/int/sysidf.h +++ b/util/int/sysidf.h @@ -25,3 +25,8 @@ * seems to be the standard that won. --- dtrg */ //#define WANT_SGTTY + +/* FIXME: Uncomment to enable these calls in moncalls.c */ + +//#define WANT_MOUNT_UMOUNT +//#define WANT_STIME