-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathchiptool.cs
More file actions
775 lines (707 loc) · 36.2 KB
/
chiptool.cs
File metadata and controls
775 lines (707 loc) · 36.2 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
using System;
using System.Globalization;
using System.IO;
using System.IO.Pipes;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
namespace chiptool
{
internal class Program
{
static string HandleCommand(string[] args)
{
chiplib chipLib = new chiplib();
try
{
if (args.Length == 0) return "No command";
string cmd = args[0].ToLowerInvariant();
string Hex(string s) => s.StartsWith("0x", StringComparison.OrdinalIgnoreCase) ? s.Substring(2) : s;
switch (cmd)
{
case "rdmsr":
if (args.Length >= 2 && uint.TryParse(Hex(args[1]), NumberStyles.HexNumber, null, out uint rdmsrAddr))
{
if (chipLib.ReadMsr(rdmsrAddr, out ulong val))
return $"0x{rdmsrAddr:X8} 0x{(uint)(val >> 32):X8} 0x{(uint)(val & 0xFFFFFFFF):X8}";
return "Failed to read MSR";
}
break;
case "wrmsr":
if (args.Length >= 4 &&
uint.TryParse(Hex(args[1]), NumberStyles.HexNumber, null, out uint wrAddr) &&
uint.TryParse(Hex(args[2]), NumberStyles.HexNumber, null, out uint wrEdx) &&
uint.TryParse(Hex(args[3]), NumberStyles.HexNumber, null, out uint wrEax))
{
ulong value = ((ulong)wrEdx << 32) | wrEax;
return chipLib.WriteMsr(wrAddr, value) ? $"0x{wrAddr:X8} 0x{wrEdx:X8} 0x{wrEax:X8}" : "Failed to write MSR";
}
break;
case "rdmsrb":
if (args.Length >= 3 && uint.TryParse(Hex(args[1]), NumberStyles.HexNumber, null, out uint rdmsrbAddr))
{
if (chipLib.ReadMsrBit(rdmsrbAddr, args[2], out ulong bitVal))
return $"0x{rdmsrbAddr:X8} {args[2]} 0x{bitVal:X}";
return "Failed to read MSR Bit";
}
break;
case "wrmsrb":
if (args.Length >= 4 &&
uint.TryParse(Hex(args[1]), NumberStyles.HexNumber, null, out uint wrmsrbAddr) &&
int.TryParse(Hex(args[3]), NumberStyles.HexNumber, null, out int bitValSet))
{
return chipLib.WriteMsrBit(wrmsrbAddr, args[2], bitValSet) ? $"0x{wrmsrbAddr:X8} {args[2]} 0x{bitValSet:X}" : "Failed to write MSR Bit";
}
break;
case "rdpci":
case "wrpci":
case "rdpcib":
case "wrpcib":
if (args.Length >= 4)
{
int size = int.Parse(args[1]);
TryParseBDF(args[2], out uint b, out uint d, out uint f);
int offset = int.Parse(Hex(args[3]), NumberStyles.HexNumber);
if (cmd.StartsWith("rd"))
{
if (cmd.EndsWith("b"))
{
if (chipLib.ReadPciBit(b, d, f, (byte)offset, args[4], size, out ulong val))
return $"{args[2]} 0x{offset:X2} {args[4]} 0x{val:X}";
return "Failed to read PCI Bit";
}
else
{
if (chipLib.ReadPci(b, d, f, (byte)offset, size, out uint val))
return $"{args[2]} 0x{offset:X2} 0x{val:X}";
return "Failed to read PCI";
}
}
else
{
uint val = uint.Parse(Hex(args[cmd.EndsWith("b") ? 5 : 4]), NumberStyles.HexNumber);
string bits = cmd.EndsWith("b") ? args[4] : null;
return cmd.EndsWith("b")
? chipLib.WritePciBit(b, d, f, (byte)offset, bits, val, size) ? $"{args[2]} 0x{offset:X2} {bits} 0x{val:X}" : "Failed to write PCI Bit"
: chipLib.WritePci(b, d, f, (byte)offset, val, size) ? $"{args[2]} 0x{offset:X2} 0x{val:X}" : "Failed to write PCI";
}
}
break;
case "rdio":
case "wrio":
case "rdiob":
case "wriob":
if (args.Length >= 3)
{
int size = int.Parse(args[1]);
ushort port = ushort.Parse(Hex(args[2]), NumberStyles.HexNumber);
if (cmd.StartsWith("rd"))
{
if (cmd.EndsWith("b"))
{
if (chipLib.ReadIoBit(port, size, args[3], out uint val))
return $"0x{port:X4} {args[3]} 0x{val:X}";
return "Failed to read IO Bit";
}
else
{
if (chipLib.ReadIo(port, size, out uint val))
return $"0x{port:X4} 0x{val:X8}";
return "Failed to read IO";
}
}
else
{
uint val = cmd.EndsWith("b") ? (args[4] == "1" || args[4].ToLower() == "true" ? 1u : 0u) : uint.Parse(Hex(args[3]), NumberStyles.HexNumber);
return cmd.EndsWith("b")
? chipLib.WriteIoBit(port, size, args[3], val) ? $"0x{port:X4} {args[3]} 0x{val:X}" : "Failed to write IO Bit"
: chipLib.WriteIo(port, size, val) ? $"0x{port:X4} 0x{val:X}" : "Failed to write IO";
}
}
break;
case "rdmem":
case "wrmem":
case "rdmemb":
case "wrmemb":
if (args.Length >= 3)
{
int size = int.Parse(args[1]);
ulong addr = ulong.Parse(Hex(args[2]), NumberStyles.HexNumber);
if (cmd.StartsWith("rd"))
{
if (cmd.EndsWith("b"))
{
ulong val;
if (chipLib.ReadMemBit(addr, size, args[3], out val))
return $"0x{addr:X8} {args[3]} 0x{val:X}";
return "Failed to read MEM Bit";
}
else
{
ulong val;
if (chipLib.ReadMem(addr, size, out val))
return $"0x{addr:X8} 0x{val:X}";
return "Failed to read MEM";
}
}
else
{
ulong val = cmd.EndsWith("b") ? ulong.Parse(Hex(args[4]), NumberStyles.HexNumber) : ulong.Parse(Hex(args[3]), NumberStyles.HexNumber);
return cmd.EndsWith("b")
? chipLib.WriteMemBit(addr, size, args[3], val) ? $"0x{addr:X8} {args[3]} 0x{val:X}" : "Failed to write MEM Bit"
: chipLib.WriteMem(addr, size, val) ? $"0x{addr:X8} 0x{val:X}" : "Failed to write MEM";
}
}
break;
default:
return "Unknown command";
}
}
catch (Exception ex) { return $"Error: {ex.Message}"; }
return "Invalid arguments";
}
static bool TryParseBDF(string input, out uint bus, out uint dev, out uint func)
{
var parts = input.Split(':');
if (parts.Length == 3 &&
uint.TryParse(parts[0], NumberStyles.HexNumber, null, out bus) &&
uint.TryParse(parts[1], NumberStyles.HexNumber, null, out dev) &&
uint.TryParse(parts[2], NumberStyles.HexNumber, null, out func))
return true;
bus = dev = func = 0;
return false;
}
static void RunAsDaemon()
{
var pipeName = "chiptool";
Console.WriteLine("[DAEMON] Chiptool daemon running...");
Task.Run(() =>
{
while (true)
{
NamedPipeServerStream server = null;
try
{
server = new NamedPipeServerStream(pipeName, PipeDirection.InOut, 1, PipeTransmissionMode.Message, PipeOptions.None);
server.WaitForConnection();
using (var reader = new StreamReader(server))
using (var writer = new StreamWriter(server) { AutoFlush = true })
{
string line = reader.ReadLine();
if (string.IsNullOrWhiteSpace(line)) return;
string[] split = line.Trim().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
string output = HandleCommand(split);
writer.WriteLine(output);
}
}
catch (IOException ex)
{
Console.WriteLine("[DAEMON] Pipe error: " + ex.Message);
}
catch (Exception ex)
{
Console.WriteLine("[DAEMON] Unexpected error: " + ex.Message);
}
finally
{
if (server != null)
{
try { server.Dispose(); } catch { }
}
}
}
});
while (true)
{
string input = Console.ReadLine();
if (string.IsNullOrWhiteSpace(input))
continue;
if (input.ToLower() == "exit")
{
Console.WriteLine("[DAEMON] Shutting down...");
break;
}
string[] split = input.Trim().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
string output = HandleCommand(split);
Console.WriteLine(output);
}
}
static void Main(string[] args)
{
if (args.Length == 0 || args.Contains("--help") || args.Contains("--h") || args.Contains("/?"))
{
PrintHelp();
return;
}
chiplib chipLib = new chiplib();
try
{
if (args.Length == 0)
{
Console.WriteLine("No command provided");
return;
}
string cmd = args[0].ToLowerInvariant();
string Hex(string s) => s.StartsWith("0x", StringComparison.OrdinalIgnoreCase) ? s.Substring(2) : s;
switch (cmd)
{
case "--daemon":
RunAsDaemon();
break;
case "--rdmsr":
{
if (args.Length >= 2 && uint.TryParse(Hex(args[1]), NumberStyles.HexNumber, null, out uint rdmsrAddr))
{
if (chipLib.ReadMsr(rdmsrAddr, out ulong val))
{
uint eax = (uint)(val & 0xFFFFFFFF);
uint edx = (uint)(val >> 32);
Console.WriteLine($"0x{rdmsrAddr:X8} 0x{edx:X8} 0x{eax:X8}");
}
else
{
Console.WriteLine("Failed to read MSR.");
}
}
}
break;
case "--wrmsr":
{
if (args.Length >= 4 &&
uint.TryParse(Hex(args[1]), NumberStyles.HexNumber, null, out uint wrAddr) &&
uint.TryParse(Hex(args[2]), NumberStyles.HexNumber, null, out uint wrEdx) &&
uint.TryParse(Hex(args[3]), NumberStyles.HexNumber, null, out uint wrEax))
{
ulong value = ((ulong)wrEdx << 32) | wrEax;
if (chipLib.WriteMsr(wrAddr, value))
{
Console.WriteLine($"0x{wrAddr:X8} 0x{wrEdx:X8} 0x{wrEax:X8}");
}
else
{
Console.WriteLine("Failed to write MSR.");
}
}
}
break;
case "--rdpci":
{
if (args.Length >= 4)
{
int size = int.Parse(args[1]);
TryParseBDF(args[2], out uint b, out uint d, out uint f);
int offset = int.Parse(Hex(args[3]), NumberStyles.HexNumber);
if (chipLib.ReadPci(b, d, f, (byte)offset, size, out uint val))
{
Console.WriteLine($"{args[2]} 0x{offset:X2} 0x{val:X}");
}
else
{
Console.WriteLine("Failed to read PCI.");
}
}
}
break;
case "--wrpci":
{
if (args.Length >= 5)
{
int size = int.Parse(args[1]);
TryParseBDF(args[2], out uint b, out uint d, out uint f);
int offset = int.Parse(Hex(args[3]), NumberStyles.HexNumber);
uint val = uint.Parse(Hex(args[4]), NumberStyles.HexNumber);
if (chipLib.WritePci(b, d, f, (byte)offset, val, size))
{
Console.WriteLine($"{args[2]} 0x{offset:X2} 0x{val:X}");
}
else
{
Console.WriteLine("Failed to write PCI.");
}
}
}
break;
case "--rdio":
{
if (args.Length >= 3)
{
int size = int.Parse(args[1]);
ushort port = ushort.Parse(Hex(args[2]), NumberStyles.HexNumber);
if (chipLib.ReadIo(port, size, out uint val))
{
Console.WriteLine($"0x{port:X4} 0x{val:X8}");
}
else
{
Console.WriteLine("Failed to read IO.");
}
}
}
break;
case "--wrio":
{
if (args.Length >= 4)
{
int size = int.Parse(args[1]);
ushort port = ushort.Parse(Hex(args[2]), NumberStyles.HexNumber);
uint val = uint.Parse(Hex(args[3]), NumberStyles.HexNumber);
if (chipLib.WriteIo(port, size, val))
{
Console.WriteLine($"0x{port:X4} 0x{val:X}");
}
else
{
Console.WriteLine("Failed to write IO.");
}
}
}
break;
case "--rdmsrb":
{
if (args.Length >= 3)
{
var address = args[1];
var bitRange = args[2];
if (chipLib.ReadMsrBit(Convert.ToUInt32(address, 16), bitRange, out ulong value))
{
Console.WriteLine($"0x{address:X8} {bitRange} 0x{value:X}");
}
else
{
Console.WriteLine("Failed to read MSR bit.");
}
}
}
break;
case "--wrmsrb":
{
if (args.Length >= 4)
{
var address = args[1];
var bitRange = args[2];
var value = uint.Parse(Hex(args[3]), NumberStyles.HexNumber);
if (chipLib.WriteMsrBit(Convert.ToUInt32(address, 16), bitRange, Convert.ToInt32(value)))
{
Console.WriteLine($"0x{address:X8} {bitRange} 0x{value}");
}
else
{
Console.WriteLine("Failed to write MSR bit.");
}
}
}
break;
case "--rdpcib":
{
if (args.Length >= 5)
{
int size = int.Parse(args[1]);
TryParseBDF(args[2], out uint b, out uint d, out uint f);
int offset = int.Parse(Hex(args[3]), NumberStyles.HexNumber);
var bitRange = args[4];
if (chipLib.ReadPciBit(b, d, f, (byte)offset, bitRange, size, out ulong value))
{
Console.WriteLine($"{args[2]} 0x{offset:X2} {bitRange} 0x{value:X}");
}
else
{
Console.WriteLine("Failed to read PCI bit.");
}
}
}
break;
case "--wrpcib":
{
if (args.Length >= 6)
{
int size = int.Parse(args[1]);
TryParseBDF(args[2], out uint b, out uint d, out uint f);
int offset = int.Parse(Hex(args[3]), NumberStyles.HexNumber);
var bitRange = args[4];
uint val = uint.Parse(Hex(args[5]), NumberStyles.HexNumber);
if (chipLib.WritePciBit(b, d, f, (byte)offset, bitRange, val, size))
{
Console.WriteLine($"{args[2]} 0x{offset:X2} 0x{val:X}");
}
else
{
Console.WriteLine("Failed to write PCI bit.");
}
}
}
break;
case "--rdiob":
{
if (args.Length >= 4)
{
int size = int.Parse(args[1]);
ushort port = ushort.Parse(Hex(args[2]), NumberStyles.HexNumber);
var bitRange = args[3];
if (chipLib.ReadIoBit(port, size, bitRange, out uint val))
{
Console.WriteLine($"0x{port:X4} {bitRange} 0x{val:X}");
}
else
{
Console.WriteLine("Failed to read IO bit.");
}
}
}
break;
case "--wriob":
{
if (args.Length >= 5)
{
int size = int.Parse(args[1]);
ushort port = ushort.Parse(Hex(args[2]), NumberStyles.HexNumber);
var bitRange = args[3];
uint val = uint.Parse(Hex(args[4]), NumberStyles.HexNumber);
if (chipLib.WriteIoBit(port, size, bitRange, val))
{
Console.WriteLine($"0x{port:X4} {bitRange} 0x{val:X}");
}
else
{
Console.WriteLine("Failed to write IO bit.");
}
}
}
break;
case "--rdmem":
{
if (args.Length >= 3)
{
int size = int.Parse(args[1]);
ulong address = Convert.ToUInt64(args[2], 16);
if (chipLib.ReadMem(address, size, out ulong val))
{
Console.WriteLine($"0x{address:X8} 0x{val:X}");
}
else
{
Console.WriteLine("Failed to read memory.");
}
}
}
break;
case "--wrmem":
{
if (args.Length >= 4)
{
int size = int.Parse(args[1]);
ulong address = Convert.ToUInt64(args[2], 16);
ulong val = Convert.ToUInt64(args[3], 16);
if (chipLib.WriteMem(address, size, val))
{
Console.WriteLine($"0x{address:X8} 0x{val:X}");
}
else
{
Console.WriteLine("Failed to write memory.");
}
}
}
break;
case "--rdmemb":
{
if (args.Length >= 4)
{
int size = int.Parse(args[1]);
ulong address = Convert.ToUInt64(args[2], 16);
var bitRange = args[3];
if (chipLib.ReadMemBit(address, size, bitRange, out ulong value))
{
Console.WriteLine($"0x{address:X8} {bitRange} 0x{value:X}");
}
else
{
Console.WriteLine("Failed to read memory bit.");
}
}
}
break;
case "--wrmemb":
{
if (args.Length >= 5)
{
int size = int.Parse(args[1]);
ulong address = Convert.ToUInt64(args[2], 16);
var bitRange = args[3];
ulong value = Convert.ToUInt64(args[4], 16);
if (chipLib.WriteMemBit(address, size, bitRange, value))
{
Console.WriteLine($"0x{address:X8} {bitRange} 0x{value:X}");
}
else
{
Console.WriteLine("Failed to write memory bit.");
}
}
}
break;
case "--rdpmc":
{
if (args.Length >= 2)
{
var index = args[1];
if (chipLib.ReadPmc(uint.Parse(index, NumberStyles.HexNumber), out ulong value))
{
Console.WriteLine($"0x{index.PadLeft(10, '0')} 0x{value:X8}");
}
else
{
Console.WriteLine("Failed to read PMC.");
}
}
}
break;
case "--rdmemblk":
{
if (args.Length >= 2)
{
var index = args[1];
if (chipLib.ReadPmc(uint.Parse(index, NumberStyles.HexNumber), out ulong value))
{
Console.WriteLine($"0x{index.PadLeft(10, '0')} 0x{value:X8}");
}
else
{
Console.WriteLine("Failed to read PMC.");
}
}
}
break;
case "--wrmemblk":
{
if (args.Length >= 2)
{
int paramIndex = 1; // 👈 Declaras aquí
paramIndex++;
var byteCountStr = args.ElementAtOrDefault(paramIndex++);
var address = args.ElementAtOrDefault(paramIndex++);
if (byteCountStr != null && address != null)
{
if (!uint.TryParse(byteCountStr, out uint byteCount))
{
Console.WriteLine("Invalid byte count.");
return;
}
if (args.Length - paramIndex != (int)byteCount)
{
Console.WriteLine("Incorrect number of bytes provided.");
return;
}
byte[] buffer = new byte[byteCount];
for (int i = 0; i < (int)byteCount; i++)
{
var byteStr = args[paramIndex + i];
if (byteStr.StartsWith("0x", StringComparison.OrdinalIgnoreCase))
{
byteStr = byteStr.Substring(2);
}
if (!byte.TryParse(byteStr, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out buffer[i]))
{
Console.WriteLine($"Invalid byte value: {args[paramIndex + i]}");
return;
}
}
ulong addressConverted = Convert.ToUInt64(address, 16);
if (!chipLib.WriteMemBlock(addressConverted, buffer))
{
Console.WriteLine("Failed to write MEM block.");
return;
}
if (chipLib.ReadMemBlock(addressConverted, byteCount, out byte[] readBuffer))
{
HexDump(readBuffer, byteCount, addressConverted);
}
else
{
Console.WriteLine("Failed to read back MEM block for verification.");
}
}
}
}
break;
default:
Console.WriteLine("Invalid command. Use --help or /? for help.");
break;
}
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
}
private static void HexDump(byte[] data, uint size, ulong prefixAddr)
{
char[] ascii = new char[17];
ascii[16] = '\0';
for (uint i = 0; i < size; ++i)
{
if (i % 16 == 0)
Console.Write($"{prefixAddr + i:X16} | ");
Console.Write($"{data[i]:X2} ");
if (data[i] >= ' ' && data[i] <= '~')
{
ascii[i % 16] = (char)data[i];
}
else
{
ascii[i % 16] = '.';
}
if ((i + 1) % 8 == 0 || i + 1 == size)
{
Console.Write(" ");
if ((i + 1) % 16 == 0)
{
Console.WriteLine($"| {new string(ascii)}");
}
else if (i + 1 == size)
{
ascii[(i + 1) % 16] = '\0';
if ((i + 1) % 16 <= 8)
{
Console.Write(" ");
}
for (uint j = (i + 1) % 16; j < 16; ++j)
{
Console.Write(" ");
}
Console.WriteLine($"| {new string(ascii)}");
}
}
}
}
static void PrintHelp()
{
Console.WriteLine("Usage:");
Console.WriteLine("\nMSR Commands");
Console.WriteLine(" --rdmsr <address> | Read MSR");
Console.WriteLine(" --wrmsr <address> <edx> <eax> | Write MSR");
Console.WriteLine(" --rdmsrb <address> <bit> | Read MSR Bit");
Console.WriteLine(" --wrmsrb <address> <bit> <value> | Write MSR Bit");
Console.WriteLine("\nPCI Commands");
Console.WriteLine(" --rdpci <size> <bus:dev:func> <offset> | Read PCI configuration");
Console.WriteLine(" --wrpci <size> <bus:dev:func> <offset> <value> | Write PCI configuration");
Console.WriteLine(" --rdpcib <size> <bus:dev:func> <offset> <bit> | Read PCI Bit");
Console.WriteLine(" --wrpcib <size> <bus:dev:func> <offset> <bit> <value> | Write PCI Bit");
Console.WriteLine("\nI/O Commands");
Console.WriteLine(" --rdio <size> <port> | Read I/O port");
Console.WriteLine(" --wrio <size> <port> <value> | Write I/O port");
Console.WriteLine(" --rdiob <size> <port> <bit> | Read I/O Port Bit");
Console.WriteLine(" --wriob <size> <port> <bit> <value> | Write I/O Port Bit");
Console.WriteLine("\nMemory Commands");
Console.WriteLine(" --rdmem <size> <address> | Read Memory");
Console.WriteLine(" --wrmem <size> <address> <value> | Write Memory");
Console.WriteLine(" --rdmemb <size> <address> <bit> | Read Memory Bit");
Console.WriteLine(" --wrmemb <size> <address> <bit> <value> | Write Memory Bit");
Console.WriteLine(" --rdmemblk <bytes> <address> | Read Memory Block (hexdump max 3584)");
Console.WriteLine(" --wrmemblk <bytes> <address> <byte0> <byte1> ... | Write Memory Block (hexdump verify)");
Console.WriteLine("\nPMC Commands");
Console.WriteLine(" --rdpmc <index> | Read PMC Counter");
Console.WriteLine("\nHelp");
Console.WriteLine(" --help or /? | Show this help menu");
}
}
}