Update Source To bootstrap_cmds-121.100.1

This commit is contained in:
Thomas A 2023-01-28 17:05:49 -08:00
parent 8621ac3801
commit 0e07a921c1
10 changed files with 34 additions and 2160 deletions

View File

@ -110,9 +110,6 @@ string_t DefinesHeaderFileName = strNULL;
string_t UserFileName = strNULL;
string_t ServerFileName = strNULL;
string_t GenerationDate = strNULL;
#ifdef DARLING
string_t XtraceMigFileName = strNULL;
#endif
void
more_global()
@ -135,13 +132,6 @@ more_global()
else if (streql(ServerFileName, "/dev/null"))
ServerFileName = strNULL;
#ifdef DARLING
if (XtraceMigFileName == strNULL)
XtraceMigFileName = strconcat(SubsystemName, "XtraceMig.c");
else if (streql(XtraceMigFileName, "/dev/null"))
XtraceMigFileName = strNULL;
#endif
if (ServerDemux == strNULL)
ServerDemux = strconcat(SubsystemName, "_server");

View File

@ -104,9 +104,6 @@ extern string_t InternalHeaderFileName;
extern string_t DefinesHeaderFileName;
extern string_t UserFileName;
extern string_t ServerFileName;
#ifdef DARLING
extern string_t XtraceMigFileName;
#endif
extern void more_global(void);

View File

@ -71,7 +71,7 @@ FileName ({QString}|{AString})
#include <mach/std_types.h>
#include "statement.h"
#include "global.h"
#include "parser.h"
#include "y.tab.h" // was parser.h
#include "lexxer.h"
#include "mig_machine.h"

View File

@ -1,5 +0,0 @@
# Inserts tool locations into the mig script
NR == 2 { print "MIGCOM=\"" migcom "\"\nMIGCC=\"" migcc "\"" }
{ print }

View File

@ -275,17 +275,6 @@ parseArgs(int argc,char *argv[])
break;
case 'x':
#ifdef DARLING
if (streql(argv[0], "-xtracemig")) {
--argc;
++argv;
if (argc == 0)
fatal("missing name for -xtracemig option");
XtraceMigFileName = strmake(argv[0]);
break;
}
else
#endif
ShortCircuit = TRUE;
/* fall thru - no longer supported */
@ -299,9 +288,6 @@ parseArgs(int argc,char *argv[])
}
FILE *uheader, *server, *user;
#ifdef DARLING
FILE *xtracemig;
#endif
int
main(int argc, char *argv[])
@ -343,10 +329,6 @@ main(int argc, char *argv[])
}
if (DefinesHeaderFileName)
dheader = myfopen(DefinesHeaderFileName, "w");
#ifdef DARLING
if (XtraceMigFileName && !IsKernelServer && !IsKernelUser)
xtracemig = myfopen(XtraceMigFileName, "w");
#endif
if (BeVerbose) {
printf("Writing %s ... ", UserHeaderFileName);
fflush(stdout);
@ -397,15 +379,6 @@ main(int argc, char *argv[])
fflush(stdout);
}
WriteServer(server, stats);
#ifdef DARLING
if (XtraceMigFileName && !IsKernelServer && !IsKernelUser) {
if (BeVerbose) {
printf("done.\nWriting %s ... ", XtraceMigFileName);
fflush(stdout);
}
WriteXtraceMig(xtracemig, stats);
}
#endif
fclose(server);
if (BeVerbose)
printf("done.\n");

View File

@ -91,9 +91,9 @@ fi
cppflags="-D__MACH30__"
files=
arch=`uname -m`
arch=`/usr/bin/arch`
WORKTMP=`mktemp -d "${TMPDIR:-/tmp}/mig.XXXXXX"`
WORKTMP=`/usr/bin/mktemp -d "${TMPDIR:-/tmp}/mig.XXXXXX"`
if [ $? -ne 0 ]; then
echo "Failure creating temporary work directory: ${WORKTMP}"
echo "Exiting..."
@ -113,7 +113,6 @@ do
-sheader ) sheader="$2"; migflags=( "${migflags[@]}" "$1" "$2"); shift; shift;;
-iheader ) iheader="$2"; migflags=( "${migflags[@]}" "$1" "$2"); shift; shift;;
-dheader ) dheader="$2"; migflags=( "${migflags[@]}" "$1" "$2"); shift; shift;;
-xtracemig ) xtracemig="$2"; migflags=( "${migflags[@]}" "$1" "$2"); shift; shift;;
-arch ) arch="$2"; shift; shift;;
-target ) target=( "$1" "$2"); shift; shift;;
-maxonstack ) migflags=( "${migflags[@]}" "$1" "$2"); shift; shift;;

View File

@ -921,6 +921,8 @@ static void
WriteCheckMsgSize(FILE *file, argument_t *arg)
{
routine_t *rt = arg->argRoutine;
ipc_type_t *it = arg->argType;
ipc_type_t *btype = it->itElement;
if (arg->argCount && !arg->argSameCount)
WriteRequestNDRConvertIntRepOneArgUse(file, arg->argCount);
@ -928,7 +930,8 @@ WriteCheckMsgSize(FILE *file, argument_t *arg)
fprintf(file, "#if\t__MigTypeCheck\n");
/* verify that the user-code-provided count does not exceed the maximum count allowed by the type. */
fprintf(file, "\t" "if ( In%dP->%s > %d )\n", arg->argCount->argRequestPos, arg->argCount->argMsgField, arg->argType->itNumber);
fprintf(file, "\t" "if ( In%dP->%s > %d )\n", arg->argCount->argRequestPos,
arg->argCount->argMsgField, it->itNumber/btype->itNumber);
fputs("\t\t" "return MIG_BAD_ARGUMENTS;\n", file);
/* ...end... */
@ -955,7 +958,8 @@ WriteCheckMsgSize(FILE *file, argument_t *arg)
fprintf(file, "#if\t__MigTypeCheck\n");
/* verify that the user-code-provided count does not exceed the maximum count allowed by the type. */
fprintf(file, "\t" "if ( In%dP->%s > %d )\n", arg->argCount->argRequestPos, arg->argCount->argMsgField, arg->argType->itNumber);
fprintf(file, "\t" "if ( In%dP->%s > %d )\n", arg->argCount->argRequestPos,
arg->argCount->argMsgField, it->itNumber/btype->itNumber);
fputs("\t\t" "return MIG_BAD_ARGUMENTS;\n", file);
/* ...end... */
@ -1994,6 +1998,8 @@ WritePackArgValueNormal(FILE *file, argument_t *arg)
fprintf(file, "#ifdef USING_MIG_STRNCPY_ZEROFILL\n");
fprintf(file, "\t}\n");
fprintf(file, "#endif /* USING_MIG_STRNCPY_ZEROFILL */\n");
fprintf(file, "\tOutP->%sOffset = 0;\n", arg->argMsgField);
}
else if (it->itNoOptArray)
fprintf(file, "\t(void)memcpy((char *) OutP->%s, (const char *) %s, %d);\n", arg->argMsgField, arg->argVarName, it->itTypeSize);
@ -2019,6 +2025,11 @@ WritePackArgValueNormal(FILE *file, argument_t *arg)
WriteCopyType(file, it, TRUE, "OutP->%s", "/* %s */ %s(%s)", arg->argMsgField, it->itOutTrans, arg->argVarName);
else
WriteCopyType(file, it, TRUE, "OutP->%s", "/* %s */ %s", arg->argMsgField, arg->argVarName);
if (arg->argPadName != NULL && it->itPadSize != 0) {
fprintf(file, "\t for (int i = 0; i < %d; i++)\n", it->itPadSize);
fprintf(file, "\t\t OutP->%s[i] = 0;\n", arg->argPadName);
}
}
static void

View File

@ -55,14 +55,6 @@
#include "utils.h"
#include "global.h"
#ifndef DISABLE_SPECIAL_REPLY_PORT_IN_CHROOT
#define DISABLE_SPECIAL_REPLY_PORT_IN_CHROOT 1
#endif
#ifndef DISABLE_SPECIAL_REPLY_PORT_IN_SIMULATOR
#define DISABLE_SPECIAL_REPLY_PORT_IN_SIMULATOR 1
#endif
#ifndef USE_IMMEDIATE_SEND_TIMEOUT
#define USE_IMMEDIATE_SEND_TIMEOUT 0
#endif
@ -196,29 +188,9 @@ WriteMyIncludes(FILE *file, statement_t *stats)
fprintf(file, "\n");
fprintf(file, "#include <TargetConditionals.h>\n");
fprintf(file, "#include <mach/mach_sync_ipc.h>\n");
#if DISABLE_SPECIAL_REPLY_PORT_IN_SIMULATOR
fprintf(file, "#ifndef __MigCanUseSpecialReplyPort\n");
fprintf(file, "#if TARGET_OS_SIMULATOR\n");
fprintf(file, "#define __MigCanUseSpecialReplyPort 0\n");
fprintf(file, "#define mig_get_special_reply_port() MACH_PORT_DEAD\n");
fprintf(file, "#define mig_dealloc_special_reply_port(port) __builtin_trap()\n");
fprintf(file, "#endif\n");
fprintf(file, "#endif /* __MigCanUseSpecialReplyPort */\n");
#endif
#if DISABLE_SPECIAL_REPLY_PORT_IN_CHROOT
fprintf(file, "#ifndef __MigCanUseSpecialReplyPort\n");
fprintf(file, "#if TARGET_OS_OSX\n");
fprintf(file, "extern _Bool _os_xbs_chrooted;\n");
fprintf(file, "#define __MigCanUseSpecialReplyPort (!_os_xbs_chrooted)\n");
fprintf(file, "#endif\n");
fprintf(file, "#endif /* __MigCanUseSpecialReplyPort */\n");
#endif
fprintf(file, "#ifndef __MigCanUseSpecialReplyPort\n");
fprintf(file, "#define __MigCanUseSpecialReplyPort 1\n");
fprintf(file, "#endif /* __MigCanUseSpecialReplyPort */\n");
fprintf(file, "#ifndef __MigSpecialReplyPortMsgOption\n");
fprintf(file, "#define __MigSpecialReplyPortMsgOption (__MigCanUseSpecialReplyPort ? "
"(MACH_SEND_SYNC_OVERRIDE|MACH_SEND_SYNC_USE_THRPRI|MACH_RCV_SYNC_WAIT) : MACH_MSG_OPTION_NONE)\n");
fprintf(file, "#define __MigSpecialReplyPortMsgOption "
"(MACH_SEND_SYNC_OVERRIDE|MACH_SEND_SYNC_USE_THRPRI|MACH_RCV_SYNC_WAIT)\n");
fprintf(file, "#endif /* __MigSpecialReplyPortMsgOption */\n");
}
/*
@ -256,11 +228,7 @@ WriteOneMachErrorDefine(FILE *file, char *name, boolean_t timeout, boolean_t Spe
fprintf(file, "\tcase MACH_SEND_INVALID_DATA: \\\n");
fprintf(file, "\tcase MACH_SEND_INVALID_DEST: \\\n");
fprintf(file, "\tcase MACH_SEND_INVALID_HEADER: \\\n");
if (SpecialReplyPort) {
fprintf(file, "\t\tif (!__MigCanUseSpecialReplyPort) { \\\n");
fprintf(file, "\t\t\tmig_put_reply_port(InP->Head.msgh_reply_port); \\\n");
fprintf(file, "\t\t} \\\n");
} else {
if (!SpecialReplyPort) {
fprintf(file, "\t\tmig_put_reply_port(InP->Head.msgh_reply_port); \\\n");
}
fprintf(file, "\t\tbreak; \\\n");
@ -270,11 +238,7 @@ WriteOneMachErrorDefine(FILE *file, char *name, boolean_t timeout, boolean_t Spe
}
fprintf(file, "\tdefault: \\\n");
if (SpecialReplyPort) {
fprintf(file, "\t\tif (__MigCanUseSpecialReplyPort) { \\\n");
fprintf(file, "\t\t\tmig_dealloc_special_reply_port(InP->Head.msgh_reply_port); \\\n");
fprintf(file, "\t\t} else { \\\n");
fprintf(file, "\t\t\tmig_dealloc_reply_port(InP->Head.msgh_reply_port); \\\n");
fprintf(file, "\t\t} \\\n");
fprintf(file, "\t\tmig_dealloc_special_reply_port(InP->Head.msgh_reply_port); \\\n");
} else {
fprintf(file, "\t\tmig_dealloc_reply_port(InP->Head.msgh_reply_port); \\\n");
}
@ -392,7 +356,7 @@ WriteRequestHead(FILE *file, routine_t *rt)
else if (rt->rtOneWay)
fprintf(file, "\tInP->%s = MACH_PORT_NULL;\n", rt->rtReplyPort->argMsgField);
else if (rt->rtUseSpecialReplyPort)
fprintf(file, "\tInP->%s = __MigCanUseSpecialReplyPort ? mig_get_special_reply_port() : mig_get_reply_port();\n", rt->rtReplyPort->argMsgField);
fprintf(file, "\tInP->%s = mig_get_special_reply_port();\n", rt->rtReplyPort->argMsgField);
else
fprintf(file, "\tInP->%s = mig_get_reply_port();\n", rt->rtReplyPort->argMsgField);
@ -1176,6 +1140,8 @@ WritePackArgValueNormal(FILE *file, argument_t *arg)
fprintf(file, "#ifdef USING_MIG_STRNCPY_ZEROFILL\n");
fprintf(file, "\t}\n");
fprintf(file, "#endif /* USING_MIG_STRNCPY_ZEROFILL */\n");
fprintf(file, "\tInP->%sOffset = 0;\n", arg->argMsgField);
}
else if (it->itNoOptArray)
fprintf(file, "\t(void)memcpy((char *) InP->%s, (const char *) %s%s, %d);\n", arg->argMsgField, ref, arg->argVarName, it->itTypeSize);
@ -1212,6 +1178,11 @@ WritePackArgValueNormal(FILE *file, argument_t *arg)
}
else
WriteCopyType(file, it, TRUE, "InP->%s", "/* %s */ %s%s", arg->argMsgField, ref, arg->argVarName);
if (arg->argPadName != NULL && it->itPadSize != 0) {
fprintf(file, "\t for (int i = 0; i < %d; i++)\n", it->itPadSize);
fprintf(file, "\t\t InP->%s[i] = 0;\n", arg->argPadName);
}
fprintf(file, "\n");
}
@ -1960,6 +1931,8 @@ static void
WriteCheckMsgSize(FILE *file, argument_t *arg)
{
routine_t *rt = arg->argRoutine;
ipc_type_t *it = arg->argType;
ipc_type_t *btype = it->itElement;
/* If there aren't any more Out args after this, then
we can use the msgh_size_delta value directly in
@ -1974,7 +1947,8 @@ WriteCheckMsgSize(FILE *file, argument_t *arg)
/*
* emit code to verify that the server-code-provided count does not exceed the maximum count allowed by the type.
*/
fprintf(file, "\t" "if ( Out%dP->%s > %d )\n", arg->argCount->argReplyPos, arg->argCount->argMsgField, arg->argType->itNumber);
fprintf(file, "\t" "if ( Out%dP->%s > %d )\n", arg->argCount->argReplyPos,
arg->argCount->argMsgField, it->itNumber/btype->itNumber);
fputs("\t\t" "return MIG_TYPE_ERROR;\n", file);
/* ...end... */
@ -2003,7 +1977,8 @@ WriteCheckMsgSize(FILE *file, argument_t *arg)
/*
* emit code to verify that the server-code-provided count does not exceed the maximum count allowed by the type.
*/
fprintf(file, "\t" "if ( Out%dP->%s > %d )\n", arg->argCount->argReplyPos, arg->argCount->argMsgField, arg->argType->itNumber);
fprintf(file, "\t" "if ( Out%dP->%s > %d )\n", arg->argCount->argReplyPos,
arg->argCount->argMsgField, it->itNumber/btype->itNumber);
fputs("\t\t" "return MIG_TYPE_ERROR;\n", file);
/* ...end... */

View File

@ -75,8 +75,4 @@ extern void WriteApplDefaults( FILE *file, char *dir );
extern void WriteApplMacro( FILE *file, char *dir, char *when, routine_t *rt );
extern void WriteBogusServerRoutineAnnotationDefine( FILE *file );
#ifdef DARLING
extern void WriteXtraceMig( FILE *file, statement_t *stats );
#endif
#endif /* _WRITE_H */

File diff suppressed because it is too large Load Diff