这是我第一次尝试使用任何语言的脚本。我知道我想做什么,但可以使用一些帮助找到我要找的东西。这是我自己的学习和乐趣:)PowerShell数据类型和散列表MCA_Decode
- 需要1个参数(两个字节十六进制或二进制)
- 比较反对错误方项目掩盖
- 写主机与解释
当前数据类型都可能是字符串。我需要这些是int
? int32
? int64
?
错误口罩简单的赋值给变量
$IO_Error = 0000111000001011
会是更有效的将这些存储为“哈希表”
$ErrorList = @{IO_Error, 0000111000001011; so, on; so, on;}
然后能的foreach检查是否匹配?
这适用于简单的错误,但进入复合错误代码和掩码我需要能够引用和检查某些偏移量以查看设置了哪些位以确保精确解码。
<#
# =====================
# Simple Error Codes # Table 15-8. IA32_MCi_Status [15:0] Simple Error Code Encoding
# ===================== # 64-ia-32-architectures-software-developer-manual-325462. Volume 3B
#
#
# Error Desc Error Mask Error Code Binary Encoding Meaning
# No Error 0000 0000 0000 0000 No error has been reported to this bank of error-reporting registers.
# Unclassified 0000 0000 0000 0001 This error has not been classified into the MCA error classes.
# Microcode ROM Parity Error 0000 0000 0000 0010 Parity error in internal microcode ROM
# External Error 0000 0000 0000 0011 The BINIT# from another processor caused this processor to enter machine check.*1
# FRC Error 0000 0000 0000 0100 FRC (functional redundancy check) master/slave error
# Internal Parity Error 0000 0000 0000 0101 Internal parity error.
# SMM Handler Code Access Violation 0000 0000 0000 0110 An attempt was made by the SMM Handler to execute outside the ranges specified by SMRR.
# Internal Timer Error 0000 0100 0000 0000 Internal timer error.
# I/O Error 0000 1110 0000 1011 generic I/O error.
# Internal Unclassified 0000 01xx xxxx xxxx Internal unclassified errors. *2
#
#
# =====================
# Compound Error Codes # Table 15-9 IA32_MCi_Status [15:0] Compound Error Code Encounding
# ===================== # 64-ia-32-architectures-software-developer-manual-325462. Volume 3B
#
#
# Error Desc Error Mask Error Code Binary Encoding Meaning
# Generic Cache Hierarchy 000F 0000 0000 11LL Generic cache hierarchy error
# TLB Errors 000F 0000 0001 TTLL {TT}TLB{LL}_ERR
# Memory Controller Errors 000F 0000 1MMM CCCC {MMM}_CHANNEL{CCCC}_ERR
# Cache Hierarchy Errors 000F 0001 RRRR TTLL {TT}CACHE{LL}_{RRRR}_ERR
# Bus and Interconnect Errors 000F 1PPT RRRR IILL BUS{LL}_{PP}_{RRRR}_{II}_{T}_ERR
#
#----------------------------------------------------------------------------------------------------------------------------------------------
#>
Function MCA_Decode
{
$No_Error = 0000000000000000
$Unclassified = 0000000000000001
$Microcode_ROM_Parity_Error = 0000000000000010
$External_Error = 0000000000000011
$FRC_Error = 0000000000000100
$Internal_Parity_Error = 0000000000000101
$SMM_Handler_Code_Access_Violation = 0000000000000110
$Internal_Timer_Error = 0000010000000000
$IO_Error = 0000111000001011
#$Internal_Unclassified = 000001xx xxxx xxxx
#
#
$input = $args[0]
if($input -eq $No_Error){
Write-Host "Error Type: No Error`nError Desc: No error has been reported to this bank of error-reporting registers." -ForegroundColor Green
}
if($input -eq $Unclassified){
Write-Host "Error Type: Unclassified`nError Desc: This error has not been classified into the MCA error classes." -ForegroundColor Green
}
if($input -eq $Microcode_ROM_Parity_Error){
Write-Host "Error Type: Microcode ROM Parity Error`nError Desc: Parity error in internal microcode ROM" -ForegroundColor Green
}
if($input -eq $External_Error){
Write-Host "Error Type: External Error`nError Desc: The BINIT# from another processor caused this processor to enter machine check." -ForegroundColor Green
}
if($input -eq $FRC_Error){
Write-Host "Error Type: FRC Error`nError Desc: FRC (functional redundancy check) master/slave error" -ForegroundColor Green
}
if($input -eq $Internal_Parity_Error){
Write-Host "Error Type: Internal Parity Error`nError Desc: Internal parity error." -ForegroundColor Green
}
if($input -eq $SMM_Handler_Code_Access_Violation){
Write-Host "Error Type: SMM Handler Code Access Violation`nError Desc: An attempt was made by the SMM Handler to execute outside the ranges specified by SMRR." -ForegroundColor Green
}
if($input -eq $Internal_Timer_Error){
Write-Host "Error Type: Internal Timer Error`Error Desc: Internal timer error." -ForegroundColor Green
}
if($input -eq $IO_Error){
Write-Host "Error Type: I/O Error`Error Desc: generic I/O error." -ForegroundColor Green
}
}
MCA_Decode $args[0]
得到的一切使用帮助工作只是为了澄清,该变量其实都是“字符串” $ IO_Error.GetTypeCode() 字符串 – genperf
只是为了澄清,该变量在事实上所有的“字符串” $ IO_Error.GetTypeCode() 字符串 所以我可以很容易地发送我的变量| gm然而,对于从来没有玩过这个定义是不容易解释的人,例如这个很容易 长度属性int长度{获得;} if($ input.Length -le 4){[convert ] :: ToString(“$ input”,2)} ..... 我知道两个字节的十六进制输入将是4个字符长,所以这可以测试,如果十六进制我可以转换为二进制。 什么是不明确的是我需要这些值是Ints和什么样的 – genperf