int xenpdptpin(ulong va) { struct mmuext_op op; ulong mfn; mfn = MFN(PADDR(va)); LOG(dprint("pdptpin %lux %lux\n", va, mfn);)
bool ReadTag(const musik::Core::String& fn, musik::Core::SongInfo& target) { bool ret = true; musik::Core::Filename mfn(fn); target.SetFilename(fn); target.SetFormat("Ogg Vorbis"); try { #if defined (WIN32) TagLib::FileRef tag_file(fn.c_str()); #else TagLib::FileRef tag_file(utf16to8(fn, true).c_str()); #endif if (!tag_file.isNull()) { if (tag_file.tag()) { TagLib::Tag *tag = tag_file.tag(); target.SetArtist(musik::Core::utf8to16(tag->artist().to8Bit(true))); target.SetAlbum(musik::Core::utf8to16(tag->album().to8Bit(true))); target.SetTitle(musik::Core::utf8to16(tag->title().to8Bit(true))); target.SetGenre(musik::Core::utf8to16(tag->genre().to8Bit(true))); target.SetNotes(musik::Core::utf8to16(tag->comment().to8Bit(true))); target.SetYear(musik::Core::IntToString(tag->year())); target.SetTrackNum(musik::Core::IntToString(tag->track())); } if (tag_file.audioProperties()) { TagLib::AudioProperties *properties = tag_file.audioProperties(); int duration = properties->length() * 1000; target.SetBitrate(musik::Core::IntToString(properties->bitrate())); target.SetDuration(musik::Core::IntToString(duration)); } } // if the title is empty, then use the // filename... if (target.GetTitle().IsEmpty()) { musik::Core::Filename MFN(fn); target.SetTitle(MFN.GetJustFilename()); } } catch (...) { ret = false; cout << "taglib crashed reading: " << fn.c_str() << endl; } return ret; }
/** * Fudges the MSRs that guest are known to access in some odd cases. * * A typical example is a VM that has been moved between different hosts where * for instance the cpu vendor differs. * * @returns VBox status code. * @param pVM The cross context VM structure. */ int cpumR3MsrApplyFudge(PVM pVM) { /* * Basic. */ static CPUMMSRRANGE const s_aFudgeMsrs[] = { MFO(0x00000000, "IA32_P5_MC_ADDR", Ia32P5McAddr), MFX(0x00000001, "IA32_P5_MC_TYPE", Ia32P5McType, Ia32P5McType, 0, 0, UINT64_MAX), MVO(0x00000017, "IA32_PLATFORM_ID", 0), MFN(0x0000001b, "IA32_APIC_BASE", Ia32ApicBase, Ia32ApicBase), MVI(0x0000008b, "BIOS_SIGN", 0), MFX(0x000000fe, "IA32_MTRRCAP", Ia32MtrrCap, ReadOnly, 0x508, 0, 0), MFX(0x00000179, "IA32_MCG_CAP", Ia32McgCap, ReadOnly, 0x005, 0, 0), MFX(0x0000017a, "IA32_MCG_STATUS", Ia32McgStatus, Ia32McgStatus, 0, ~(uint64_t)UINT32_MAX, 0), MFN(0x000001a0, "IA32_MISC_ENABLE", Ia32MiscEnable, Ia32MiscEnable), MFN(0x000001d9, "IA32_DEBUGCTL", Ia32DebugCtl, Ia32DebugCtl), MFO(0x000001db, "P6_LAST_BRANCH_FROM_IP", P6LastBranchFromIp), MFO(0x000001dc, "P6_LAST_BRANCH_TO_IP", P6LastBranchToIp), MFO(0x000001dd, "P6_LAST_INT_FROM_IP", P6LastIntFromIp), MFO(0x000001de, "P6_LAST_INT_TO_IP", P6LastIntToIp), MFS(0x00000277, "IA32_PAT", Ia32Pat, Ia32Pat, Guest.msrPAT), MFZ(0x000002ff, "IA32_MTRR_DEF_TYPE", Ia32MtrrDefType, Ia32MtrrDefType, GuestMsrs.msr.MtrrDefType, 0, ~(uint64_t)0xc07), MFN(0x00000400, "IA32_MCi_CTL_STATUS_ADDR_MISC", Ia32McCtlStatusAddrMiscN, Ia32McCtlStatusAddrMiscN), }; int rc = cpumR3MsrApplyFudgeTable(pVM, &s_aFudgeMsrs[0], RT_ELEMENTS(s_aFudgeMsrs)); AssertLogRelRCReturn(rc, rc); /* * XP might mistake opterons and other newer CPUs for P4s. */ if (pVM->cpum.s.GuestFeatures.uFamily >= 0xf) { static CPUMMSRRANGE const s_aP4FudgeMsrs[] = { MFX(0x0000002c, "P4_EBC_FREQUENCY_ID", IntelP4EbcFrequencyId, IntelP4EbcFrequencyId, 0xf12010f, UINT64_MAX, 0), }; rc = cpumR3MsrApplyFudgeTable(pVM, &s_aP4FudgeMsrs[0], RT_ELEMENTS(s_aP4FudgeMsrs)); AssertLogRelRCReturn(rc, rc); } return rc; }
bool CanPlay(const musik::Core::String& filename) { musik::Core::Filename MFN(filename); if (MFN.GetExtension() == _T("ogg")) { return true; } return false; }
static Page* mmupdballoc(ulong va, void *mpdb) { int s; Page *page; Page *badpages, *pg; s = splhi(); /* * All page tables must be read-only. We will mark them * readwrite later when we free them and they are no * longer used as page tables. */ if(m->pdbpool == 0){ spllo(); badpages = 0; for (;;) { page = newpage(0, 0, 0); page->va = VA(kmap(page)); if(mpdb) memmove((void*)page->va, mpdb, BY2PG); else memset((void*)page->va, 0, BY2PG); if (xenpgdpin(page->va)) break; /* * XXX Plan 9 is a bit lax about putting pages on the free list when they are * still mapped (r/w) by some process's page table. From Plan 9's point * of view this is safe because the any such process will have up->newtlb set, * so the mapping will be cleared before the process is dispatched. But the Xen * hypervisor has no way of knowing this, so it refuses to pin the page for use * as a pagetable. */ if(0) print("bad pgdpin %lux va %lux copy %lux %s\n", MFN(PADDR(page->va)), va, (ulong)mpdb, up? up->text: ""); page->next = badpages; badpages = page; } while (badpages != 0) { pg = badpages; badpages = badpages->next; putpage(pg); } } else{ page = m->pdbpool; m->pdbpool = page->next; m->pdbcnt--; if (!xenpgdpin(page->va)) panic("xenpgdpin"); } splx(s); page->next = 0; return page; }
/* * Calculate PLL output frequency */ static uint32_t calc_pll(uint32_t pllreg, uint32_t base_freq) { int32_t mfn = MFN(pllreg); /* Numerator */ uint32_t mfi = MFI(pllreg); /* Integer part */ uint32_t mfd = 1 + MFD(pllreg); /* Denominator */ uint32_t pd = 1 + PD(pllreg); /* Pre-divider */ if (mfi < 5) { mfi = 5; } /* mfn is 10-bit signed twos-complement */ mfn <<= 32 - 10; mfn >>= 32 - 10; return ((2 * (base_freq >> 10) * (mfi * mfd + mfn)) / (mfd * pd)) << 10; }
bool ReadTag(const musik::Core::String& fn, musik::Core::SongInfo& target) { WmaMetadataEditor editor(fn.c_str()); if (editor.IsValid()) { try { target.SetArtist(editor.GetStrAttribute(g_wszWMAlbumArtist)); if (target.GetArtist() == L"") { target.SetArtist(editor.GetStrAttribute(g_wszWMAuthor)); } target.SetAlbum(editor.GetStrAttribute(g_wszWMAlbumTitle)); target.SetTitle(editor.GetStrAttribute(g_wszWMTitle)); target.SetGenre(editor.GetStrAttribute(g_wszWMGenre)); target.SetYear(editor.GetStrAttribute(g_wszWMYear)); target.SetNotes(editor.GetStrAttribute(g_wszWMDescription)); // track number can be stored as an int OR a string! // // also: it appears track numbers are stored 0 based if they // are stored as strings? // std::wstring strTrackNum = editor.GetStrAttribute(g_wszWMTrackNumber); int trackNum = musik::Core::StringToInt(strTrackNum); // if (trackNum <= 0) { target.SetTrackNum(musik::Core::IntToString( editor.GetDWORDAttribute(g_wszWMTrackNumber) + 1)); } else { target.SetTrackNum(musik::Core::IntToString(trackNum)); } target.SetBitrate(musik::Core::IntToString( editor.GetDWORDAttribute(g_wszWMBitrate) / 1000)); // target.SetDuration(musik::Core::IntToString( editor.GetDWORDAttribute(g_wszWMDuration) / 10000)); // if the title is empty, then use the // filename... if (target.GetTitle().IsEmpty()) { musik::Core::Filename MFN(fn); target.SetTitle(MFN.GetJustFilename()); } target.SetFormat("Windows Media Audio"); return true; } catch(...) { std::wstring error = L"Caught unhandled exception while reading WMA file: " + fn; ::OutputDebugString(error.c_str()); } } return false; }