/*! * \brief Initializes speculation registers before the start of a job. */ int Speculation_Init() { int slice; uint64_t scrub_rate; L2C_SPECID_t specid; if(TI_isDD1() || ((GetPersonality()->Kernel_Config.NodeConfig & PERS_ENABLE_DD1_Workarounds) != 0)) { } else { SPEC_SetNumberOfDomains(1); SPEC_SetPrivMap( L2C_PRIVMAP_DISABLEWRITEFNC(L2C_PRIVMAP_FUNC_NUMDOM) | L2C_PRIVMAP_DISABLEWRITEFNC(L2C_PRIVMAP_FUNC_PRIVMAP) ); ppc_msync(); for(specid=0; specid<128; specid++) { SPEC_TryChangeState_priv(specid, L2C_IDSTATE_PRED_SPEC | L2C_IDSTATE_INVAL); SPEC_SetConflict_priv(specid, 0); } ppc_msync(); } App_GetEnvValue("BG_SIMPLEROLLBACK", &SIMPLE_ROLLBACK); L2_AtomicStore(&SpecDomainsAllocated, 0); domainsConfigured = 0; // Reset the L2 scrub rate scrub_rate = 64; for(slice=0; slice<L2_DCR_num; slice++) { // Set the L2 scrub rate uint64_t l2_dcr_refctrl = DCRReadPriv(L2_DCR(slice, REFCTRL)); if(default_l2_first_init) default_l2_scrub_rate[slice] = L2_DCR__REFCTRL__SCB_INTERVAL_get(l2_dcr_refctrl); L2_DCR__REFCTRL__SCB_INTERVAL_insert(l2_dcr_refctrl, default_l2_scrub_rate[slice]); DCRWritePriv(L2_DCR(slice, REFCTRL), l2_dcr_refctrl); } default_l2_first_init = 1; Speculation_ExitJailMode(); return 0; }
VOID CPokemonCodec::SetPersonality(BYTE bType) { if(m_pPokemon == NULL || m_bEncoded) return; BYTE bShiny = GetIsShiny(); DWORD dwDiff; if(bType >= 25) bType %= 25; dwDiff = bType + 25 - GetPersonality(); if(dwDiff >= 25) dwDiff %= 25; if(dwDiff == 0) return; // note: 0x00100000 % 25 = 1 // it is an ideal number for preserving the low word dwDiff <<= 20; DWORD dwChar = m_pPokemon->Header.dwChar; if(0xFFFFFFFF - dwChar < dwDiff) // must not overflow !!! dwChar -= 0x01900000 - dwDiff; else dwChar += dwDiff; SetChar(dwChar); if(bShiny) { SetID(GenShinyID()); } else { while(GetIsShiny()) { SetID(m_pPokemon->Header.dwID + 0x00010000); } } }
VOID CPokemonCodec::SetSexByte(BYTE bSexByte) { if(m_pPokemon == NULL || m_bEncoded) return; BYTE bShiny = GetIsShiny(); BYTE bPersonality = GetPersonality(); // the code is a bit slow, but it is easy to write SetChar((m_pPokemon->Header.dwChar & 0xFFFFFF00) + bSexByte); // the least significant byte indicates sex SetPersonality(bPersonality); if(bShiny) { SetID(GenShinyID()); } else { while(GetIsShiny()) { SetID(m_pPokemon->Header.dwID + 0x00010000); } } }
int network_init(void) { int rc; configureBlockGIBarrier(); // Generate an IPv4 address for the torus device. The address is saved in the first interface section of the personality. // This has the side effect of overwriting an address that was put there by the control system but CNK does not // support configuring an IP address through the database. Personality_t *pers = GetPersonality(); memset(NodeState.torusIpAddress.octet, 0x00, sizeof(IP_Addr_t)); struct TorusIPAddress generatedAddr; generatedAddr.octet0 = 10; generatedAddr.type = 2; // Special value for a compute node if ((pers->Network_Config.NetFlags2 & ND_CN_BRIDGE_PORT_6) != 0) { generatedAddr.port = 1; } else if ((pers->Network_Config.NetFlags2 & ND_CN_BRIDGE_PORT_7) !=0) { generatedAddr.port = 2; } else { generatedAddr.port = 0; } generatedAddr.aCoord = pers->Network_Config.Acoord; generatedAddr.bCoord = pers->Network_Config.Bcoord; generatedAddr.cCoord = pers->Network_Config.Ccoord; generatedAddr.dCoord = pers->Network_Config.Dcoord; generatedAddr.eCoord = pers->Network_Config.Ecoord; memcpy(NodeState.torusIpAddress.octet, &generatedAddr, sizeof(generatedAddr)); TRACE( TRACE_Verbs, ("(I) network_init(): generated torus IPv4 address is %u.%u.%u.%u\n", NodeState.torusIpAddress.octet[0], NodeState.torusIpAddress.octet[1], NodeState.torusIpAddress.octet[2], NodeState.torusIpAddress.octet[3]) ); // flightlog generated IPv4 address #if 0 printf("(I) network_init(): generated torus IPv4 address is %u.%u.%u.%u from %u %u %u %u %u\n", NodeState.torusIpAddress.octet[0], NodeState.torusIpAddress.octet[1], NodeState.torusIpAddress.octet[2], NodeState.torusIpAddress.octet[3], pers->Network_Config.Acoord, pers->Network_Config.Bcoord, pers->Network_Config.Ccoord, pers->Network_Config.Dcoord, pers->Network_Config.Ecoord); #endif struct mudm_init_info mudminit; memset(&mudminit, 0, sizeof(mudminit)); mudminit.callers_version = MUDM_VERSION; mudminit.req_inbound_connections = 5; mudminit.req_inj_fifos = 1; mudminit.req_rec_fifos = 1; mudminit.req_num_pollers = 1; mudminit.recv = cnverbs_recv; mudminit.recv_conn = cnverbs_recv_conn; mudminit.status = cnverbs_status; mudminit.allocate = cnkmudm_allocate; mudminit.free = cnkmudm_free; mudminit.personality = GetPersonality(); mudminit.callback_context = NULL; mudminit.wakeupActive = CNK_ENABLE_MUDM_WAKEUP_POLL; NodeState.MUDM = NULL; rc = mudm_init(&mudminit, &mudmconfig, &NodeState.MUDM); if(rc != 0) { printf("(E) network_init(): mudm_init failed with rc=%d\n", rc); return rc; } addFlightRecorder(&mudmconfig.mudm_hi_wrap_flight_recorder); addFlightRecorder(&mudmconfig.mudm_lo_wrap_flight_recorder); rc = cnverbs_init(); if(rc != 0) { printf("(E) network_init(): cnv_init failed with rc=%d\n", rc); return rc; } TRACE( TRACE_Verbs, ("(I) network_init(): networks are initialized\n") ); return 0; }