-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathcommand.c
1083 lines (875 loc) · 30.5 KB
/
command.c
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
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/***************************************************************************
*
* Copyright (c) 1997, 1998 Timpanogas Research Group, Inc. All Rights
* Reserved.
*
* AUTHOR : Jeff V. Merkey
* FILE : COMMAND.C
* DESCRIP : System Console Command Executive for MANOS v1.0
* DATE : January 10, 1998
*
***************************************************************************/
#include "stdarg.h"
#include "stdio.h"
#include "stdlib.h"
#include "ctype.h"
#include "string.h"
#include "kernel.h"
#include "keyboard.h"
#include "screen.h"
#include "types.h"
#include "emit.h"
#include "dos.h"
#include "tss.h"
#include "os.h"
#include "mps.h"
#include "hal.h"
#include "window.h"
#include "dosfile.h"
#include "timer.h"
#include "line.h"
#include "loader.h"
#include "cmd.h"
#include "xcall.h"
void CommandProcess(void);
BYTE ServerName[100] = { "MANOS_PRIME" };
BYTE ServerNetworkNumber[100] = { "" };
LONG ServerNetworkAddress = 0;
LONG ConnectionsAllowed = 10000;
LONG ConnectionsOpen = 0;
LONG endTest = 0;
void ThreadTest(void)
{
while (!endTest)
{
thread_switch();
}
ConsolePrintf("test thread %08X has been killed\n", get_running_process());
return;
}
LONG displayThreadTestHelp(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
if (screen) {}
if (commandLine) {}
if (parser) {}
printfScreen(screen, "create a test thread\n");
return TRUE;
}
LONG createTestThread(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
register PROCESS *process;
if (screen) {};
if (commandLine) {};
if (parser) {};
endTest = 0;
process = createThread("test thread", (LONG (*)())ThreadTest, 8192, 0, -1);
if (process)
ConsolePrintf("test thread %08X has been started\n", process);
return TRUE;
}
LONG displayKillThreadTestHelp(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
if (screen) {}
if (commandLine) {}
if (parser) {}
printfScreen(screen, "kill all test threads\n");
return TRUE;
}
LONG killTestThreads(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
if (screen) {};
if (commandLine) {};
if (parser) {};
endTest = TRUE;
return TRUE;
}
void CreateConsoleProcess(void)
{
insert_process(&idle_p[0]);
commandP = createThread("system console process",
(LONG (*)()) CommandProcess,
8192 * 2, 0, 0);
}
void GetServerInfo(void)
{
register LONG retCode;
LONG valid;
while (1)
{
register BYTE *p = ServerName;
register LONG nameInvalid = 0;
printfScreen(consoleScreen, "\nEnter File Server Name: ");
ScreenInputFromKeyboard(consoleScreen, &ServerName[0], 0, 80, 7);
strupr(ServerName);
if (ServerName[0])
{
while (*p)
{
switch (*p)
{
case '>': case '<': case ',': case '+':
case '|': case ']': case '[': case '=':
case ' ': case '.': case '*': case '?':
printfScreen(consoleScreen, "\nInvalid Name \n");
nameInvalid = TRUE;
break;
default:
p++;
break;
}
if (nameInvalid)
break;
}
if (!nameInvalid)
break;
}
}
while (1)
{
BYTE *p = ServerNetworkNumber;
printfScreen(consoleScreen, "\nEnter Internal Network Address: ");
ScreenInputFromKeyboard(consoleScreen, &ServerNetworkNumber[0], 0, 80, 7);
ServerNetworkAddress = EvaluateExpression(0, &p, (LONG *) &valid);
if (valid)
{
strupr(ServerNetworkNumber);
break;
}
}
}
LONG displayMemoryHelp(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
if (screen) {}
if (commandLine) {}
if (parser) {}
printfScreen(screen, "displays the memory configuration for this system\n");
return TRUE;
}
LONG displayMemoryInfo(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
BYTE displayBuffer[100] = { "" };
extern LONG TotalSystemMemory;
extern LONG HighMemoryLength;
extern LONG LowMemoryLength;
if (commandLine) {};
if (parser) {};
sprintf_comma(displayBuffer, "%d", TotalSystemMemory);
printfScreen(screen, "Total System Memory : %s bytes\n", displayBuffer);
sprintf_comma(displayBuffer, "%d", HighMemoryLength);
printfScreen(screen, "Available Memory Above 1MB : %s bytes\n", displayBuffer);
sprintf_comma(displayBuffer, "%d", LowMemoryLength);
printfScreen(screen, "Available Memory Below 1MB : %s bytes\n", displayBuffer);
return TRUE;
}
LONG displaySpeedHelp(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
if (screen) {}
if (commandLine) {}
if (parser) {}
printfScreen(screen, "displays the current processor speed rating for this system\n");
return TRUE;
}
LONG displaySpeedInfo(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
extern LONG SystemSpeedRating;
if (commandLine) {};
if (parser) {};
printfScreenWithAttribute(screen, WHITE,
"Processor Speed Rating: %d\n", SystemSpeedRating);
printfScreenWithAttribute(screen, WHITE,
"\nTypical Speed Ratings are:\n");
printfScreenWithAttribute(screen, WHITE,
"Intel 80386SX-16 Mhz ......... rating is 466\n");
printfScreenWithAttribute(screen, WHITE,
"Intel 80386DX-33 Mhz ......... rating is 1250\n");
printfScreenWithAttribute(screen, WHITE,
"Intel 80486DX2-66 Mhz ........ rating is 5058\n");
printfScreenWithAttribute(screen, WHITE,
"Intel Pentium(R)-133 Mhz ..... rating is 24346\n");
printfScreenWithAttribute(screen, WHITE,
"Intel Pentium(R)-166 Mhz ..... rating is 35556\n");
printfScreenWithAttribute(screen, WHITE,
"Intel PentiumPro-200 Mhz ..... rating is 51126\n");
printfScreenWithAttribute(screen, WHITE,
"Intel PentiumII-266 Mhz ...... rating is 69709\n");
return TRUE;
}
LONG displayVersionHelp(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
if (screen) {}
if (commandLine) {}
if (parser) {}
printfScreen(screen, "displays the current operating system version\n");
return TRUE;
}
LONG displayVersionInfo(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
extern LONG MajorVersion;
extern LONG MinorVersion;
extern LONG BuildVersion;
if (commandLine) {};
if (parser) {};
printfScreen(screen, "Metropolitan Area Network Operating System\n");
printfScreen(screen, "v%02d.%02d.%02d\n", MajorVersion, MinorVersion, BuildVersion);
printfScreen(screen, "Copyright (C) 1997, 1998 Timpanogas Research Group, Inc.\n");
printfScreen(screen, "All Rights Reserved.\n");
return TRUE;
}
LONG displayMonitorHelp(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
if (screen) {}
if (commandLine) {}
if (parser) {}
printfScreen(screen, "activates the system monitor console\n");
return TRUE;
}
LONG activateSystemMonitor(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
register PROCESS *process;
extern LONG MonitorActive;
extern void MonitorProcess(void);
if (commandLine) {};
if (parser) {};
if (MonitorActive)
{
printfScreen(screen, "MONITOR is already active\n");
return TRUE;
}
process = createThread("System Monitor",
(LONG (*)()) MonitorProcess,
8192 * 2,
0,
-1);
if (!process)
printfScreen(screen, "could not exec monitor process\n");
return TRUE;
}
LONG displayExportsHelp(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
if (screen) {}
if (commandLine) {}
if (parser) {}
printfScreen(screen, "displays all application module exported functions\n");
return TRUE;
}
LONG displayExports(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
extern void DisplayExportsMatch(SCREEN *, LONG, BYTE *);
extern void DisplayExports(SCREEN *, LONG);
if (parser) {};
commandLine = &commandLine[parser->commandNameLength];
while (*commandLine && *commandLine == ' ') commandLine++;
if (*commandLine)
DisplayExportsMatch(screen, WHITE, commandLine);
else
DisplayExports(screen, WHITE);
return TRUE;
}
LONG displayModulesHelp(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
if (screen) {}
if (commandLine) {}
if (parser) {}
printfScreen(screen, "displays all loaded application modules\n");
return TRUE;
}
LONG displayModules(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
extern void DisplayModuleMap(SCREEN *, LONG, LONG);
if (commandLine) {};
if (parser) {};
DisplayModuleMap(screen, WHITE, 0);
return TRUE;
}
LONG loadFileModuleHelp(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
if (screen) {}
if (commandLine) {}
if (parser) {}
printfScreen(screen, "loads and activates an application module\n");
printfScreen(screen, "i.e. LOAD \\path\\filename\n");
return TRUE;
}
LONG loadFileModule(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
register LONG retCode;
MODULE_HANDLE *newModule;
extern LONG LoadFile(BYTE *, MODULE_HANDLE **);
if (parser) {};
commandLine = &commandLine[parser->commandNameLength];
while (*commandLine && *commandLine == ' ') commandLine++;
strupr(commandLine);
retCode = LoadFile(commandLine, &newModule);
switch(retCode)
{
case 0:
printfScreen(screen, "%s Loaded\n", newModule->ModuleShortName);
break;
case FILE_NOT_FOUND:
printfScreen(screen, "File %s not found\n", commandLine);
break;
case FILE_INCOMPAT:
printfScreen(screen, "File %s is not a Microsoft(R) PE32 Format. Load Failed\n", commandLine);
break;
case FILE_SEEK_ERROR:
printfScreen(screen, "Seek Error for File %s. Load Failed\n", commandLine);
break;
case FILE_READ_ERROR:
printfScreen(screen, "Read Error for File %s. Load Failed\n", commandLine);
break;
case FILE_MODULO_ERROR:
printfScreen(screen, "File %s had a MODULO 512 Segment Error. Load Failed\n", commandLine);
break;
case FILE_MEMORY_ERROR:
printfScreen(screen, "System Out of Memory. File %s not Loaded\n", commandLine);
break;
case FILE_CORRUPT_ERROR:
printfScreen(screen, "File %s is corrupted. Load Failed\n", commandLine);
break;
case FILE_DUP_ERROR:
printfScreen(screen, "File %s is already loaded\n", commandLine);
break;
case FILE_UNRESOLVED:
printfScreen(screen, "File %s had Unresolved Exernals. Load Failed\n", commandLine);
break;
case FILE_PROCESS_ERROR:
printfScreen(screen, "Default Process not created. File %s Load Failed\n", commandLine);
break;
case FILE_LINK_ERROR:
printfScreen(screen, "File %s had multiple data/code segments or bad relocation table.\n", commandLine);
break;
default:
printfScreen(screen, "Error Loading File (%d)\n", retCode);
break;
}
return TRUE;
}
LONG unloadFileModuleHelp(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
if (screen) {}
if (commandLine) {}
if (parser) {}
printfScreen(screen, "unloads an active application module\n");
printfScreen(screen, "i.e. UNLOAD module\n");
return TRUE;
}
LONG unloadFileModule(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
register LONG retCode;
extern LONG UnloadFile(BYTE *);
if (parser) {};
commandLine = &commandLine[parser->commandNameLength];
while (*commandLine && *commandLine == ' ') commandLine++;
retCode = UnloadFile(commandLine);
switch (retCode)
{
case 0:
printfScreen(screen, "Module %s Unloaded\n", strupr(commandLine));
break;
case -1:
printfScreen(screen, "Module %s not Loaded\n", strupr(commandLine));
break;
case -2:
break;
case -3:
printfScreen(screen, "Module %s unload cancelled by user\n", strupr(commandLine));
break;
default:
printfScreen(screen, "Module not Unloaded\n");
break;
}
return TRUE;
}
LONG dumpModuleHelp(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
if (screen) {}
if (commandLine) {}
if (parser) {}
printfScreen(screen, "dumps a file in binary mode\n");
printfScreen(screen, "i.e. pedump \\path\\filename\n");
return TRUE;
}
LONG dumpModule(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
register LONG retCode;
extern LONG DumpFile(SCREEN *screen, BYTE *);
if (parser) {};
commandLine = &commandLine[parser->commandNameLength];
while (*commandLine && *commandLine == ' ') commandLine++;
retCode = DumpFile(screen, commandLine);
switch (retCode)
{
case 0:
break;
case -1:
default:
printfScreen(screen, "file not found\n");
break;
}
return TRUE;
}
LONG pedumpModuleHelp(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
if (screen) {}
if (commandLine) {}
if (parser) {}
printfScreen(screen, "dumps a Microsoft Portable Executable (PE) module\n");
printfScreen(screen, "i.e. pedump \\path\\filename\n");
return TRUE;
}
LONG pedumpModule(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
register LONG retCode;
extern LONG DumpPEFile(SCREEN *screen, BYTE *);
if (parser) {};
commandLine = &commandLine[parser->commandNameLength];
while (*commandLine && *commandLine == ' ') commandLine++;
SetPauseMode(screen, screen->nLines - 4);
retCode = DumpPEFile(screen, commandLine);
switch (retCode)
{
case 0:
break;
case -1:
default:
printfScreen(screen, "file not found\n");
break;
}
ClearPauseMode(screen);
return TRUE;
}
LONG exitSystemHelp(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
if (screen) {}
if (commandLine) {}
if (parser) {}
printfScreen(screen, "exits the system and returns to MS-DOS\n");
return TRUE;
}
LONG exitSystem(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
register LONG key;
if (commandLine) {};
if (parser) {};
printfScreen(screen, "Exit To MS-DOS? <y/n> ");
key = ReadKeyboard(screen);
printfScreen(screen, "%c\n", (BYTE) key & 0xFF);
if (toupper(key & 0xFF) == 'Y')
{
printfScreen(screen, "Exiting ... \n");
ExitOS(); // this call does not return
}
return TRUE;
}
LONG clearConsoleScreenHelp(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
if (screen) {}
if (commandLine) {}
if (parser) {}
printfScreen(screen, "clears the system console screen\n");
return TRUE;
}
LONG clearConsoleScreen(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
if (commandLine) {};
if (parser) {};
ClearScreen(screen);
return TRUE;
}
LONG displayUtilizationHelp(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
if (screen) {}
if (commandLine) {}
if (parser) {}
printfScreen(screen, "displays active SMP utilization per processor, and for the system\n");
return TRUE;
}
LONG displayUtilization(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
register LONG i;
if (commandLine) {};
if (parser) {};
printfScreen(screen, "system utilization is : %d%%\n", systemUtilization);
for (i=0; i < active_processors; i++)
{
printfScreen(screen, "processor (%02i) utilization is : %03d%%\n",
i, processorUtilization[i]);
}
return TRUE;
}
LONG onlineProcessorHelp(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
if (screen) {}
if (commandLine) {}
if (parser) {}
printfScreen(screen, "activates a specified processor\n");
printfScreen(screen, "i.e. online [p#]\n");
return TRUE;
}
LONG onlineProcessor(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
register LONG value;
LONG valid;
if (parser) {};
commandLine = &commandLine[parser->commandNameLength];
while (*commandLine && *commandLine == ' ') commandLine++;
value = EvaluateExpression(0, &commandLine, &valid);
if (valid && value < num_procs)
{
activate_processor(value)
? printfScreen(screen, "Processor (%i) has been activated\n", value)
: printfScreen(screen, "Processor (%i) did not activate\n", value);
return TRUE;
}
printfScreen(screen, "invalid processor specified\n");
return TRUE;
}
LONG offlineProcessorHelp(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
if (screen) {}
if (commandLine) {}
if (parser) {}
printfScreen(screen, "deactivates a specified processor\n");
printfScreen(screen, "i.e. offline [p#]\n");
return TRUE;
}
LONG offlineProcessor(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
register LONG value;
LONG valid;
if (parser) {};
commandLine = &commandLine[parser->commandNameLength];
while (*commandLine && *commandLine == ' ') commandLine++;
value = EvaluateExpression(0, &commandLine, &valid);
if (valid && value < num_procs)
{
close_processor(value)
? printfScreen(screen, "Processor (%i) could not be halted\n", value)
: printfScreen(screen, "Processor (%i) has been shutdown\n", value);
return TRUE;
}
printfScreen(screen, "invalid processor specified\n");
return TRUE;
}
LONG displayProcessorStatusHelp(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
if (screen) {}
if (commandLine) {}
if (parser) {}
printfScreen(screen, "displays active SMP processors and their current state\n");
return TRUE;
}
LONG displayProcessorStatus(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
register LONG i;
extern BYTE *procState[];
if (commandLine) {};
if (parser) {};
for (i=0; i < num_procs; i++)
{
printfScreenWithAttribute(screen, WHITE, "Processor: (%i) State: %s\n",
i, procState[processor_table[i].ProcessorState & 0xF]);
}
return TRUE;
}
LONG displayHelpHelp(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
if (screen) {}
if (commandLine) {}
if (parser) {}
printfScreen(screen, "displays general help for all commands, or help for a specific command\n");
printfScreen(screen, "HELP <enter> - list all commands\n");
printfScreen(screen, "HELP command <enter> - help for a specific command\n");
return TRUE;
}
LONG displayHelp(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
register LONG count;
BYTE verbBuffer[100];
register BYTE *verb, *pp, *vp;
commandLine = &commandLine[parser->commandNameLength];
while (*commandLine && *commandLine == ' ') commandLine++;
count = 0;
pp = commandLine;
vp = verb = &verbBuffer[0];
while (*pp && *pp == ' ' && count++ < 80)
pp++;
while (*pp && *pp != ' ' && count++ < 80)
*vp++ = *pp++;
*vp = '\0';
while (*pp && *pp == ' ' && count++ < 80)
pp++;
ConsoleParserHelpRoutine(screen, verb, commandLine);
return TRUE;
}
LONG displayProcessHelp(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
if (screen) {}
if (commandLine) {}
if (parser) {}
printfScreen(screen, "displays active SMP processes and threads\n");
return TRUE;
}
LONG displayProcessInfo(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
register PROCESS *p;
register LONG flags, i;
extern BYTE *processState[];
if (commandLine) {};
if (parser) {};
flags = get_flags();
spin_lock(&systemThreadmutex);
p = systemThreadHead;
while (p)
{
i = p->lastProcessor;
printfScreenWithAttribute(screen, WHITE,
"%08X:%08X | %s | p%02i | %s | %s\n",
p,
p->stackPointer,
processState[p->threadState & 0xF],
p->lastProcessor,
(p == processorSet[i].running_process) ? "RUN " : "IDLE",
p->processName);
p = p->kernelNext;
}
spin_unlock(&systemThreadmutex);
set_flags(flags);
return TRUE;
}
LONG changeScreenSizeHelp(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
if (screen) {}
if (commandLine) {}
if (parser) {}
printfScreen(screen, "changes the line settings for the system screen\n");
printfScreen(screen, "LINES 25 - set to 25 line mode\n");
printfScreen(screen, "LINES 43 - set to 43 line mode\n");
printfScreen(screen, "LINES 50 - set to 50 line mode\n");
return TRUE;
}
LONG changeScreenSize(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
register LONG value;
extern LONG ChangeSystemScreenSize(LONG);
if (parser) {};
commandLine = &commandLine[parser->commandNameLength];
while (*commandLine && *commandLine == ' ') commandLine++;
value = atol(commandLine);
switch (value)
{
case 25:
ChangeSystemScreenSize(25);
return TRUE;
case 43:
ChangeSystemScreenSize(43);
return TRUE;
case 50:
ChangeSystemScreenSize(50);
return TRUE;
default:
printfScreen(screen, "invalid line mode specified\n");
return TRUE;
}
}
LONG nmiDebugEntryHelp(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
if (screen) {}
if (commandLine) {}
if (parser) {}
printfScreen(screen, "send a directed nmi to debug a specified processor\n");
printfScreen(screen, "i.e. nmidebug [p#]\n");
return TRUE;
}
LONG nmiDebugEntry(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
register LONG value;
LONG valid;
if (parser) {};
commandLine = &commandLine[parser->commandNameLength];
while (*commandLine && *commandLine == ' ') commandLine++;
value = EvaluateExpression(0, &commandLine, &valid);
if (valid &&
value < num_procs &&
processor_table[value].ProcessorState != PROCESSOR_INACTIVE)
{
extern LONG xcall_processor(LONG, LONG, LONG, LONG, LONG);
xcall_processor(value, XCALL_DIRECTED, 0, 0, 0);
return TRUE;
}
printfScreen(screen, "invalid processor specified\n");
return TRUE;
}
LONG debugEntryHelp(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
if (screen) {}
if (commandLine) {}
if (parser) {}
printfScreen(screen, "signal an INT3 to debug a specified processor\n");
printfScreen(screen, "i.e. debug [p#]\n");
return TRUE;
}
LONG debugEntry(SCREEN *screen, BYTE *commandLine, CONSOLE_PARSER *parser)
{
register LONG value;
LONG valid;
if (parser) {};
commandLine = &commandLine[parser->commandNameLength];
while (*commandLine && *commandLine == ' ') commandLine++;
value = EvaluateExpression(0, &commandLine, &valid);
if (valid &&
value < num_procs &&
processor_table[value].ProcessorState != PROCESSOR_INACTIVE)
{
processor_table[value].DebugSignal = TRUE;
close_processor(value);
return TRUE;
}
printfScreen(screen, "invalid processor specified\n");
return TRUE;
}
CONSOLE_PARSER createTestThreadParser = {
0, 0, killTestThreads, displayKillThreadTestHelp, 0, "STOP", 0, 0,
"kill all SMP test threads", &serverModuleHandle };
CONSOLE_PARSER killTestThreadsParser = {
0, 0, createTestThread, displayThreadTestHelp, 0, "TEST", 0, 0,
"create an SMP test thread", &serverModuleHandle };
CONSOLE_PARSER displayMemoryInfoParser = {
0, 0, displayMemoryInfo, displayMemoryHelp, 0, "MEMORY", 0, 0,
"display current system memory totals", &serverModuleHandle };
CONSOLE_PARSER displaySpeedInfoParser = {
0, 0, displaySpeedInfo, displaySpeedHelp, 0, "SPEED", 0, 0,
"display processor speed ratings", &serverModuleHandle };
CONSOLE_PARSER displayVersionInfoParser = {
0, 0, displayVersionInfo, displayVersionHelp, 0, "VERSION", 0, 0,
"display current version", &serverModuleHandle };
CONSOLE_PARSER activateSystemMonitorParser = {
0, 0, activateSystemMonitor, displayMonitorHelp, 0, "MONITOR", 0, 0,
"activate system monitor", &serverModuleHandle };
CONSOLE_PARSER displayExportsParser = {
0, 0, displayExports, displayExportsHelp, 0, "EXPORTS", 0, 0,
"display exported functions", &serverModuleHandle };
CONSOLE_PARSER displayModulesParser = {
0, 0, displayModules, displayModulesHelp, 0, "MODULES", 0, 0,
"display loaded modules", &serverModuleHandle };
CONSOLE_PARSER loadFileModuleParser = {
0, 0, loadFileModule, loadFileModuleHelp, 0, "LOAD", 0, 0,
"load a module", &serverModuleHandle };
CONSOLE_PARSER unloadFileModuleParser = {
0, 0, unloadFileModule, unloadFileModuleHelp, 0, "UNLOAD", 0, 0,
"unload a module", &serverModuleHandle };
CONSOLE_PARSER displayProcessInfoParser = {
0, 0, displayProcessInfo, displayProcessHelp, 0, "PROCESS", 0, 0,
"display all active kernel processes", &serverModuleHandle };
CONSOLE_PARSER exitSystemParser = {
0, 0, exitSystem, exitSystemHelp, 0, "EXIT", 0, 0,
"shutdown and exit the operating system", &serverModuleHandle };
CONSOLE_PARSER quitSystemParser = {
0, 0, exitSystem, exitSystemHelp, 0, "Q", 0, 0,
"shutdown and exit the operating system", &serverModuleHandle };
CONSOLE_PARSER clearConsoleScreenParser = {
0, 0, clearConsoleScreen, clearConsoleScreenHelp, 0, "CLS", 0, 0,
"clear the console screen", &serverModuleHandle };
CONSOLE_PARSER displayUtilizationParser = {
0, 0, displayUtilization, displayUtilizationHelp, 0, "UTIL", 0, 0,
"display processor and system utilization", &serverModuleHandle };
CONSOLE_PARSER onlineProcessorParser = {
0, 0, onlineProcessor, onlineProcessorHelp, 0, "ONLINE", 0, 0,
"activate a processor", &serverModuleHandle };
CONSOLE_PARSER offlineProcessorParser = {
0, 0, offlineProcessor, offlineProcessorHelp, 0, "OFFLINE", 0, 0,
"deactivate a processor", &serverModuleHandle };
CONSOLE_PARSER displayProcessorStatusParser = {
0, 0, displayProcessorStatus, displayProcessorStatusHelp, 0, "PROCESSORS", 0, 0,
"display status of all processors", &serverModuleHandle };
CONSOLE_PARSER displayHelpParser = {
0, 0, displayHelp, displayHelpHelp, 0, "HELP", 0, 0,
"this help screen (HELP <command> for specific help)", &serverModuleHandle };
CONSOLE_PARSER displayQuestionMarkParser = {
0, 0, displayHelp, displayHelpHelp, 0, "?", 0, 0,
"this help screen", &serverModuleHandle };
CONSOLE_PARSER dumpModuleParser = {
0, 0, dumpModule, dumpModuleHelp, 0, "DUMP", 0, 0,
"dumps a file in binary mode", &serverModuleHandle };
CONSOLE_PARSER pedumpModuleParser = {
0, 0, pedumpModule, pedumpModuleHelp, 0, "PEDUMP", 0, 0,
"dumps a Microsoft Portable Executable (PE) file module", &serverModuleHandle };
CONSOLE_PARSER changeScreenSizeParser = {
0, 0, changeScreenSize,
changeScreenSizeHelp, 0, "LINES", 0, 0,
"changes the number of screen lines", &serverModuleHandle };
CONSOLE_PARSER nmiDebugEntryParser = {
0, 0, nmiDebugEntry, nmiDebugEntryHelp, 0, "NMIDEBUG", 0, 0,
"signal a processor (w/NMI) to enter the debugger", &serverModuleHandle };
CONSOLE_PARSER debugEntryParser = {