diff options
author | 2021-05-21 09:21:42 -0400 | |
---|---|---|
committer | 2021-05-21 09:21:42 -0400 | |
commit | f06784df5a44c2aeb450ff88346a96f0bc9eb732 (patch) | |
tree | 49e9923a65f7cf572a6f0833737b72848299b1c8 /bootstrap_cmds/migcom.tproj | |
parent | 0e3bb24ea8cde1573760b88ad56c1cc00be15cc8 (diff) | |
parent | 8d788054a62508f8d1b93067be16fb73f987ca8e (diff) | |
download | apple_cmds-f06784df5a44c2aeb450ff88346a96f0bc9eb732.tar.gz apple_cmds-f06784df5a44c2aeb450ff88346a96f0bc9eb732.tar.zst apple_cmds-f06784df5a44c2aeb450ff88346a96f0bc9eb732.zip |
Merge branch 'apple'
Diffstat (limited to 'bootstrap_cmds/migcom.tproj')
-rw-r--r-- | bootstrap_cmds/migcom.tproj/server.c | 8 | ||||
-rw-r--r-- | bootstrap_cmds/migcom.tproj/user.c | 54 |
2 files changed, 17 insertions, 45 deletions
diff --git a/bootstrap_cmds/migcom.tproj/server.c b/bootstrap_cmds/migcom.tproj/server.c index 7bbed53..5b22b46 100644 --- a/bootstrap_cmds/migcom.tproj/server.c +++ b/bootstrap_cmds/migcom.tproj/server.c @@ -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... */ diff --git a/bootstrap_cmds/migcom.tproj/user.c b/bootstrap_cmds/migcom.tproj/user.c index 839732d..6e9d27c 100644 --- a/bootstrap_cmds/migcom.tproj/user.c +++ b/bootstrap_cmds/migcom.tproj/user.c @@ -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); @@ -1967,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 @@ -1981,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... */ @@ -2010,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... */ |