File: GENMEM

package info (click to toggle)
mcelog 147%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 876 kB
  • ctags: 979
  • sloc: ansic: 7,634; sh: 482; makefile: 110; python: 60
file content (28 lines) | stat: -rwxr-xr-x 889 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
# GENMEM socketid channel dimm corr-err-cnt uc-flag
# generate a memory error. All fields are optional.
# suitable to be fed into mce-inject or mcelog --ascii
# Note: DIMMs only work when mcelog is in Nehalem mode
# this cannot be forced through mce-inject, but only on the command line
# setting ucflag and injecting can panic your system
socketid=${1:-0}
channel=${2:-0}
dimm=${3:-0}
corr_err_cnt=${4:-0}

if [ ! -z "$5" ] ; then
	ucflag=$[(1 << (61-32)) | (1 << (60-32)) | (1 << (56-32))]
else
	ucflag=0
fi

echo "# memory error on socket $socketid ch $channel dimm $dimm"
echo "CPU 0 2" # XXX use cpu in socket
echo "# nehalem"
echo "PROCESSOR 0:0x106a0"
printf "MCGCAP 0x%x\n" $[1 << 10]
echo "SOCKETID $socketid"
printf "STATUS 0x%08x%08x\n" \
	$[0x88000000 + ($corr_err_cnt << 6) + $ucflag] $[0xb0 + $channel]
printf "MISC 0x%08x\n" $[($channel << 18) + ($dimm << 16)]