static void _add_particle(struct p3d_emitter* et, float* mat, struct p3d_symbol* sym) { struct p3d_particle* p; PS_ARRAY_ALLOC(PARTICLE_ARRAY, p); if (!p) { return; } if (mat) { memcpy(p->mat, mat, sizeof(p->mat)); } else { memset(p->mat, 0, sizeof(p->mat)); p->mat[0] = p->mat[3] = 1024; } _init_particle(et, p, sym); p->ud = NULL; if (ADD_FUNC) { ADD_FUNC(p, et->ud); } p->next = NULL; if (!et->head) { assert(!et->tail); et->head = et->tail = p; } else { assert(et->tail); et->tail->next = p; et->tail = p; } }
int main(int argc, char const* argv[]) { ADD_FUNC(func); if (argc!=2) { std::cout << "Usage: " << std::endl; std::cout << argv[0] << " functionname" << std::endl; return -1; } std::string func_name = argv[1]; auto val = func_map.getCallBack(func_name); if (NULL == val) { std::cout << func_name << " not found" << std::endl; } else { val(); } return 0; }
/** * Populates an empty "patches" (hDbgModPatchMem) module with patch symbols. * * @param pVM The cross context VM structure. * @param hDbgMod The debug module handle. */ static void patmR3DbgAddPatches(PVM pVM, RTDBGMOD hDbgMod) { /* * Global functions and a start marker. */ ADD_FUNC(hDbgMod, pVM->patm.s.pPatchMemGC, pVM->patm.s.pfnHelperCallGC, g_patmLookupAndCallRecord.cbFunction, "PATMLookupAndCall"); ADD_FUNC(hDbgMod, pVM->patm.s.pPatchMemGC, pVM->patm.s.pfnHelperRetGC, g_patmRetFunctionRecord.cbFunction, "PATMRetFunction"); ADD_FUNC(hDbgMod, pVM->patm.s.pPatchMemGC, pVM->patm.s.pfnHelperJumpGC, g_patmLookupAndJumpRecord.cbFunction, "PATMLookupAndJump"); ADD_FUNC(hDbgMod, pVM->patm.s.pPatchMemGC, pVM->patm.s.pfnHelperIretGC, g_patmIretFunctionRecord.cbFunction, "PATMIretFunction"); ADD_FUNC(hDbgMod, pVM->patm.s.pPatchMemGC, pVM->patm.s.pPatchMemGC, 0, "PatchMemStart"); ADD_FUNC(hDbgMod, pVM->patm.s.pPatchMemGC, pVM->patm.s.pGCStackGC, PATM_STACK_TOTAL_SIZE, "PATMStack"); /* * The patches. */ RTAvloU32DoWithAll(&pVM->patm.s.PatchLookupTreeHC->PatchTree, true /*fFromLeft*/, patmR3DbgAddPatchCallback, pVM); }
int main(int argc, char **argv) { std::map<std::string, std::function<int ()>> M = {ADD_FUNC(lambda_1), ADD_FUNC(lambda_7), ADD_FUNC(lambda_6), ADD_FUNC(bind_1), ADD_FUNC(bind_4), ADD_FUNC(trans_1), ADD_FUNC(trans_2), ADD_FUNC(trans_3), ADD_FUNC(trans_4), ADD_FUNC(trans_5), ADD_FUNC(trans_6), ADD_FUNC(m_1), ADD_FUNC(functor_1), ADD_FUNC(functor_3), ADD_FUNC(m_2)}; auto show_all = [=] (const std::string& ps) { size_t count = 1; std::cout << ps; for (auto& p : M) { std::cout << p.first << ","; if (count++ % 5 == 0) std::cout << std::endl << ps; } std::cout << std::endl; std::cout << ps << "h : history" << std::endl; std::cout << ps << "! : last command" << std::endl; std::cout << ps << "!n : command at position n" << std::endl; }; auto is_number = [] (const std::string& s) { return !s.empty() && std::find_if(s.begin(), s.end(), [](char c) { return !std::isdigit(c); }) == s.end(); }; auto bail = [=] (const std::string& ps) { std::cout << ps << "goodbye...." << std::endl; exit(0); }; auto exec = [=] (const std::string& ps, const std::string& in) { auto it = M.find(in); if(it != M.end()) { std::cout << ps << "executing " << it->first << std::endl; it->second(); std::cout << " *** " << std::endl; } else { std::cout << ps << "action " << in << " not found" << std::endl; show_all(ps); } }; std::deque<std::string> H; auto show_hist = [&] (const std::string& ps){ size_t index = 0; for (auto& el : H) { std::cout << ps << index << ") " << el << std::endl; index++; if (index > 10) break; } }; const std::string ps = "-> "; auto run_cmd = [&] (const std::string& in) { if (in == "q" or in == "Q") bail(ps); if (in == "?") { show_all(ps); return; } if (in == "h") { show_hist(ps); return; } exec(ps, in); return; }; bool keep = true; while (keep) { std::cout << ps ; std::string in; std::getline(std::cin, in); if (in != "?" && in != "h" && in != "!" && !is_number(in)) H.push_front(in); std::string cmd(in); if (in == "!") { cmd = H.front(); H.pop_front(); } if (is_number(in)) { int index = std::stoi(in); if (index > -1 && index < H.size()) { cmd = H[index];; } } run_cmd(cmd); } return 0; }
* Support code for running tests of GLX_OML_sync_control. */ #include "piglit-util-gl-common.h" #include "piglit-glx-util.h" #include "common.h" PFNGLXGETSYNCVALUESOMLPROC __piglit_glXGetSyncValuesOML; PFNGLXGETMSCRATEOMLPROC __piglit_glXGetMscRateOML; PFNGLXSWAPBUFFERSMSCOMLPROC __piglit_glXSwapBuffersMscOML; PFNGLXWAITFORMSCOMLPROC __piglit_glXWaitForMscOML; PFNGLXWAITFORSBCOMLPROC __piglit_glXWaitForSbcOML; #define ADD_FUNC(name) PIGLIT_GLX_PROC(__piglit_##name, name) static const struct piglit_glx_proc_reference procs[] = { ADD_FUNC(glXGetSyncValuesOML), ADD_FUNC(glXGetMscRateOML), ADD_FUNC(glXSwapBuffersMscOML), ADD_FUNC(glXWaitForMscOML), ADD_FUNC(glXWaitForSbcOML), }; Window win; XVisualInfo *visinfo; void piglit_oml_sync_control_test_run(bool fullscreen, enum piglit_result (*draw)(Display *dpy)) { Display *dpy; GLXContext ctx;
/** * Populate DBGF_AS_RC with PATM symbols. * * Called by dbgfR3AsLazyPopulate when DBGF_AS_RC or DBGF_AS_RC_AND_GC_GLOBAL is * accessed for the first time. * * @param pVM The cross context VM structure. * @param hDbgAs The DBGF_AS_RC address space handle. */ VMMR3_INT_DECL(void) PATMR3DbgPopulateAddrSpace(PVM pVM, RTDBGAS hDbgAs) { AssertReturnVoid(VM_IS_RAW_MODE_ENABLED(pVM)); /* * Add a fake debug module for the PATMGCSTATE structure. */ RTDBGMOD hDbgMod; int rc = RTDbgModCreate(&hDbgMod, "patmgcstate", sizeof(PATMGCSTATE), 0 /*fFlags*/); if (RT_SUCCESS(rc)) { ADD_MEMBER(hDbgMod, PATMGCSTATE, uVMFlags, "uVMFlags"); ADD_MEMBER(hDbgMod, PATMGCSTATE, uPendingAction, "uPendingAction"); ADD_MEMBER(hDbgMod, PATMGCSTATE, uPatchCalls, "uPatchCalls"); ADD_MEMBER(hDbgMod, PATMGCSTATE, uScratch, "uScratch"); ADD_MEMBER(hDbgMod, PATMGCSTATE, uIretEFlags, "uIretEFlags"); ADD_MEMBER(hDbgMod, PATMGCSTATE, uIretCS, "uIretCS"); ADD_MEMBER(hDbgMod, PATMGCSTATE, uIretEIP, "uIretEIP"); ADD_MEMBER(hDbgMod, PATMGCSTATE, Psp, "Psp"); ADD_MEMBER(hDbgMod, PATMGCSTATE, fPIF, "fPIF"); ADD_MEMBER(hDbgMod, PATMGCSTATE, GCPtrInhibitInterrupts, "GCPtrInhibitInterrupts"); ADD_MEMBER(hDbgMod, PATMGCSTATE, GCCallPatchTargetAddr, "GCCallPatchTargetAddr"); ADD_MEMBER(hDbgMod, PATMGCSTATE, GCCallReturnAddr, "GCCallReturnAddr"); ADD_MEMBER(hDbgMod, PATMGCSTATE, Restore.uEAX, "Restore.uEAX"); ADD_MEMBER(hDbgMod, PATMGCSTATE, Restore.uECX, "Restore.uECX"); ADD_MEMBER(hDbgMod, PATMGCSTATE, Restore.uEDI, "Restore.uEDI"); ADD_MEMBER(hDbgMod, PATMGCSTATE, Restore.eFlags, "Restore.eFlags"); ADD_MEMBER(hDbgMod, PATMGCSTATE, Restore.uFlags, "Restore.uFlags"); rc = RTDbgAsModuleLink(hDbgAs, hDbgMod, pVM->patm.s.pGCStateGC, 0 /*fFlags*/); AssertLogRelRC(rc); RTDbgModRelease(hDbgMod); } /* * Add something for the stats so we get some kind of symbols for * references to them while disassembling patches. */ rc = RTDbgModCreate(&hDbgMod, "patmstats", PATM_STAT_MEMSIZE, 0 /*fFlags*/); if (RT_SUCCESS(rc)) { ADD_FUNC(hDbgMod, pVM->patm.s.pStatsGC, pVM->patm.s.pStatsGC, PATM_STAT_MEMSIZE, "PATMMemStatsStart"); rc = RTDbgAsModuleLink(hDbgAs, hDbgMod, pVM->patm.s.pStatsGC, 0 /*fFlags*/); AssertLogRelRC(rc); RTDbgModRelease(hDbgMod); } /* * Add a fake debug module for the patches and stack. */ rc = RTDbgModCreate(&hDbgMod, "patches", pVM->patm.s.cbPatchMem + PATM_STACK_TOTAL_SIZE + PAGE_SIZE, 0 /*fFlags*/); if (RT_SUCCESS(rc)) { pVM->patm.s.hDbgModPatchMem = hDbgMod; patmR3DbgAddPatches(pVM, hDbgMod); rc = RTDbgAsModuleLink(hDbgAs, hDbgMod, pVM->patm.s.pPatchMemGC, 0 /*fFlags*/); AssertLogRelRC(rc); } }
int __aeabi_idiv(int, int); int __aeabi_idivmod(int, int); unsigned int __aeabi_uidiv(unsigned int, unsigned int); unsigned int __aeabi_uidivmod(unsigned int, unsigned int); long long __aeabi_ldivmod(long long, long long); unsigned long long __aeabi_uldivmod(unsigned long long, unsigned long long); #define ADD_FUNC(FUNC) {{(word_t)#FUNC}, {(word_t)FUNC}} #define ADD_FUNC_ALIAS(FUNC, NAME) {{(word_t)#NAME}, {(word_t)FUNC}} #define arm7_func_count (sizeof(arm7_funcs) / sizeof(fxe2_export_t)) static const fxe2_export_t arm7_funcs[] = { ADD_FUNC(swiWaitForVBlank), ADD_FUNC(irqSet), ADD_FUNC(irqClear), ADD_FUNC(irqEnable), ADD_FUNC(irqDisable), ADD_FUNC(writePowerManagement), ADD_FUNC(timerStart), ADD_FUNC(timerPause), ADD_FUNC(timerStop), ADD_FUNC(timerElapsed), ADD_FUNC(fifoSendAddress), ADD_FUNC(fifoSendValue32), ADD_FUNC(fifoSendDatamsg), ADD_FUNC(fifoSetAddressHandler), ADD_FUNC(fifoSetValue32Handler), ADD_FUNC(fifoSetDatamsgHandler),