TInt DMemModelProcess::MapUserRamCode(DMemModelCodeSegMemory* aMemory) { __KTRACE_OPT(KPROC,Kern::Printf("DMemModelProcess %O MapUserRamCode %C %d %d", this, aMemory->iCodeSeg, iOsAsid, aMemory->iPagedCodeInfo!=0)); __ASSERT_MUTEX(DCodeSeg::CodeSegLock); TMappingCreateFlags createFlags = EMappingCreateExactVirtual; if(!(aMemory->iCodeSeg->iAttr&ECodeSegAttAddrNotUnique)) { // codeseg memory address is globally unique, (common address across all processes)... FlagSet(createFlags,EMappingCreateCommonVirtual); } if(aMemory->iCodeSeg->IsExe()) { // EXE codesegs have already had their virtual address allocated so we must adopt that... __NK_ASSERT_DEBUG(iCodeVirtualAllocSize); __NK_ASSERT_DEBUG(iCodeVirtualAllocAddress==aMemory->iRamInfo.iCodeRunAddr); iCodeVirtualAllocSize = 0; iCodeVirtualAllocAddress = 0; FlagSet(createFlags,EMappingCreateAdoptVirtual); } DMemoryMapping* mapping; return MM::MappingNew(mapping,aMemory->iCodeMemoryObject,EUserExecute,iOsAsid,createFlags,aMemory->iRamInfo.iCodeRunAddr); }
TInt DMemModelAlignedShPool::MappingNew(DShBufMapping*& aMapping, DMemModelProcess* aProcess) { // Must be in critical section so we don't leak os asid references. __ASSERT_CRITICAL; TMappingCreateFlags flags=EMappingCreateDefault; FlagSet(flags, EMappingCreateReserveAllResources); // Open a reference to aProcess's os so it isn't freed and reused while // we're creating this mapping. TInt osAsid = aProcess->TryOpenOsAsid(); if (osAsid < 0) {// The process has freed its os asid so can't create a new mapping. return KErrDied; } DMemoryMapping* mapping = NULL; DShBufMapping* m = NULL; TInt r = MM::MappingNew(mapping, MM::RoundToPageCount(iBufGap), osAsid, flags); if (r == KErrNone) { m = new DShBufMapping; if (m) { m->iMapping = mapping; m->iOsAsid = osAsid; } else { MM::MappingDestroy(mapping); r = KErrNoMemory; } } // Close the reference on the os asid as while aMapping is valid then the // os asid must be also. aProcess->CloseOsAsid(); aMapping = m; __KTRACE_OPT(KMMU2, Kern::Printf("DMemModelAlignedShPool::MappingNew returns 0x%08x,%d",aMapping,r)); return r; }
FlagSet operator ~ () { return FlagSet(~m_flags); }
FlagSet operator ^ (EnumClass const &arg) { return FlagSet(m_flags ^ static_cast<IntegralType>(arg)); }
void SetTrainerFlag(u16 flag) { FlagSet(TRAINER_FLAG_START + flag); }
void unref_sub_8082590(void) { FlagSet(CurrentOpponentTrainerFlag()); // duplicate function }
void SetCurrentTrainerBattledFlag(void) { FlagSet(CurrentOpponentTrainerFlag()); }
void SetSafariZoneFlag(void) { FlagSet(SYS_SAFARI_MODE); }
void MakeNonNetworkable(sPropertyDesc* pDesc) { FlagSet(pDesc->netFlags, PROP_NONETWORK); }
/** Set the privileges for a client. * @param[in] client Client who has become an operator. * @param[in] oper Configuration item describing oper's privileges. */ void client_set_privs(struct Client *client, struct ConfItem *oper) { struct Privs *source, *defaults; enum Priv priv; if (!MyConnect(client)) return; /* Clear out client's privileges. */ memset(cli_privs(client), 0, sizeof(struct Privs)); if (!IsAnOper(client) || !oper) return; if (!privs_defaults_set) { memset(&privs_global, -1, sizeof(privs_global)); FlagClr(&privs_global, PRIV_WALK_LCHAN); FlagClr(&privs_global, PRIV_UNLIMIT_QUERY); FlagClr(&privs_global, PRIV_SET); FlagClr(&privs_global, PRIV_BADCHAN); FlagClr(&privs_global, PRIV_LOCAL_BADCHAN); #if defined(UNDERNET) FlagClr(&privs_global, PRIV_APASS_OPMODE); #endif memset(&privs_local, 0, sizeof(privs_local)); FlagSet(&privs_local, PRIV_CHAN_LIMIT); FlagSet(&privs_local, PRIV_MODE_LCHAN); FlagSet(&privs_local, PRIV_SHOW_INVIS); FlagSet(&privs_local, PRIV_SHOW_ALL_INVIS); FlagSet(&privs_local, PRIV_LOCAL_KILL); FlagSet(&privs_local, PRIV_REHASH); FlagSet(&privs_local, PRIV_LOCAL_GLINE); FlagSet(&privs_local, PRIV_LOCAL_JUPE); FlagSet(&privs_local, PRIV_LOCAL_OPMODE); FlagSet(&privs_local, PRIV_WHOX); FlagSet(&privs_local, PRIV_DISPLAY); FlagSet(&privs_local, PRIV_FORCE_LOCAL_OPMODE); privs_defaults_set = 1; } /* Decide whether to use global or local oper defaults. */ if (FlagHas(&oper->privs_dirty, PRIV_PROPAGATE)) defaults = FlagHas(&oper->privs, PRIV_PROPAGATE) ? &privs_global : &privs_local; else if (FlagHas(&oper->conn_class->privs_dirty, PRIV_PROPAGATE)) defaults = FlagHas(&oper->conn_class->privs, PRIV_PROPAGATE) ? &privs_global : &privs_local; else { assert(0 && "Oper has no propagation and neither does connection class"); return; } /* For each feature, figure out whether it comes from the operator * conf, the connection class conf, or the defaults, then apply it. */ for (priv = 0; priv < PRIV_LAST_PRIV; ++priv) { /* Figure out most applicable definition for the privilege. */ if (FlagHas(&oper->privs_dirty, priv)) source = &oper->privs; else if (FlagHas(&oper->conn_class->privs_dirty, priv)) source = &oper->conn_class->privs; else source = defaults; /* Set it if necessary (privileges were already cleared). */ if (FlagHas(source, priv)) SetPriv(client, priv); } /* This should be handled in the config, but lets be sure... */ if (HasPriv(client, PRIV_PROPAGATE)) { /* force propagating opers to display */ SetPriv(client, PRIV_DISPLAY); } else { /* if they don't propagate oper status, prevent desyncs */ ClrPriv(client, PRIV_KILL); ClrPriv(client, PRIV_GLINE); ClrPriv(client, PRIV_JUPE); ClrPriv(client, PRIV_OPMODE); ClrPriv(client, PRIV_BADCHAN); } }
static void sub_810CC34(void) { PlaySE(SE_W115); FlagSet(FLAG_SYS_USE_FLASH); ScriptContext1_SetupScript(gUnknown_081B694A); }
bool8 ScrCmd_setflag(struct ScriptContext *ctx) { FlagSet(ScriptReadHalfword(ctx)); return FALSE; }