예제 #1
0
파일: machine_check.c 프로젝트: Prajna/xnu
static void
mca_save_state(mca_state_t *mca_state)
{
	mca_mci_bank_t  *bank;
	unsigned int	i;

	assert(!ml_get_interrupts_enabled() || get_preemption_level() > 0);

	if  (mca_state == NULL)
		return;

	mca_state->mca_mcg_ctl = mca_control_MSR_present ?
					rdmsr64(IA32_MCG_CTL) : 0ULL;	
	mca_state->mca_mcg_status.u64 = rdmsr64(IA32_MCG_STATUS);

 	bank = (mca_mci_bank_t *) &mca_state->mca_error_bank[0];
	for (i = 0; i < mca_error_bank_count; i++, bank++) {
		bank->mca_mci_ctl        = rdmsr64(IA32_MCi_CTL(i));	
		bank->mca_mci_status.u64 = rdmsr64(IA32_MCi_STATUS(i));	
		if (!bank->mca_mci_status.bits.val)
			continue;
		bank->mca_mci_misc = (bank->mca_mci_status.bits.miscv)?
					rdmsr64(IA32_MCi_MISC(i)) : 0ULL;	
		bank->mca_mci_addr = (bank->mca_mci_status.bits.addrv)?
					rdmsr64(IA32_MCi_ADDR(i)) : 0ULL;	
	} 

	/*
	 * If we're the first thread with MCA state, point our package to it
	 * and don't care about races
	 */
	if (x86_package()->mca_state == NULL)
		x86_package()->mca_state = mca_state;
}
예제 #2
0
파일: machine_check.c 프로젝트: Prajna/xnu
static void
mca_dump_error_banks(mca_state_t *state)
{
	unsigned int 		i;

	kdb_printf("MCA error-reporting registers:\n");
	for (i = 0; i < mca_error_bank_count; i++ ) {
		if (i == 8) {
			/*
			 * Fatal Memory Error
			 */

			/* Dump MC8 for local package */
			kdb_printf(" Package %d logged:\n",
				   x86_package()->ppkg_num);
			mca_dump_bank_mc8(state, 8);

			/* If there's other packages, report their MC8s */
			x86_pkg_t	*pkg;
			uint64_t	deadline;
			for (pkg = x86_pkgs; pkg != NULL; pkg = pkg->next) {
				if (pkg == x86_package())
					continue;
				deadline = mach_absolute_time() + LockTimeOut;
				while  (pkg->mca_state == NULL &&
					mach_absolute_time() < deadline)
					cpu_pause();
				if (pkg->mca_state) {
					kdb_printf(" Package %d logged:\n",
						   pkg->ppkg_num);
					mca_dump_bank_mc8(pkg->mca_state, 8);
				} else {
					kdb_printf(" Package %d timed out!\n",
						   pkg->ppkg_num);
				}
			}
			continue;
		}
		mca_dump_bank(state, i);
	}
}
예제 #3
0
파일: machine_check.c 프로젝트: DiogoPC/xnu
static void
mca_cpu_dump_error_banks(mca_state_t *state)
{
	unsigned int 		i;

	if (!state->mca_is_valid)
		return;

	kdb_printf("MCA error-reporting registers:\n");
	for (i = 0; i < mca_error_bank_count; i++ ) {
		if (i == 8 && state == x86_package()->mca_state) {
			/*
			 * Fatal Memory Error
			 */

			/* Dump MC8 for this package */
			kdb_printf(" Package %d logged:\n",
				   x86_package()->ppkg_num);
			mca_dump_bank_mc8(state, 8);
			continue;
		}
		mca_dump_bank(state, i);
	}
}