-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.cc
3431 lines (3191 loc) · 113 KB
/
config.cc
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
/////////////////////////////////////////////////////////////////////////
// $Id: config.cc 14067 2021-01-05 21:57:13Z vruppert $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002-2021 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "bochs.h"
#include "bxversion.h"
#include "iodev/iodev.h"
#include "iodev/hdimage/hdimage.h"
#include "param_names.h"
#include <assert.h>
#ifdef HAVE_LOCALE_H
#include <locale.h>
#endif
#if defined(macintosh)
// Work around a bug in SDL 1.2.4 on MacOS X, which redefines getenv to
// SDL_getenv, but then neglects to provide SDL_getenv. It happens
// because we are defining -Dmacintosh.
#undef getenv
#endif
int bochsrc_include_level = 0;
#if BX_PLUGINS
Bit8u bx_user_plugin_count = 0;
#endif
#define LOG_THIS genlog->
extern bx_debug_t bx_dbg;
static int parse_line_unformatted(const char *context, char *line);
static int parse_line_formatted(const char *context, int num_params, char *params[]);
static int parse_bochsrc(const char *rcfile);
static int get_floppy_type_from_image(const char *filename);
static Bit64s bx_param_handler(bx_param_c *param, int set, Bit64s val)
{
char pname[BX_PATHNAME_LEN];
Bit8u device;
//Bit8u channel;
bx_list_c *base = (bx_list_c*) param->get_parent();
base->get_param_path(pname, BX_PATHNAME_LEN);
if (!strncmp(pname, "ata.", 4)) {
// channel = pname[4] - '0';
if (!strcmp(base->get_name(), "master")) {
device = 0;
} else {
device = 1;
}
if (!strcmp(param->get_name(), "type")) {
if (set) {
switch (val) {
case BX_ATA_DEVICE_DISK:
((bx_param_filename_c*)SIM->get_param("path", base))->set_extension("img");
break;
case BX_ATA_DEVICE_CDROM:
((bx_param_filename_c*)SIM->get_param("path", base))->set_extension("iso");
break;
}
}
} else {
BX_PANIC(("bx_param_handler called with unknown parameter '%s.%s'", pname, param->get_name()));
return -1;
}
} else {
param->get_param_path(pname, BX_PATHNAME_LEN);
if ((!strcmp(pname, BXPN_FLOPPYA_TYPE)) ||
(!strcmp(pname, BXPN_FLOPPYB_TYPE))) {
if (set) {
if (val == BX_FLOPPY_AUTO) {
val = get_floppy_type_from_image(SIM->get_param_string("path", base)->getptr());
SIM->get_param_enum("type", base)->set(val);
} else if (!SIM->get_init_done() && (val != BX_FLOPPY_NONE)) {
switch (val) {
case BX_FLOPPY_2_88:
device = BX_FDD_350ED;
break;
case BX_FLOPPY_720K:
case BX_FLOPPY_1_44:
device = BX_FDD_350HD;
break;
default:
device = BX_FDD_525HD;
}
SIM->get_param_enum("devtype", base)->set(device);
}
}
} else {
BX_PANIC(("bx_param_handler called with unknown parameter '%s'", pname));
return -1;
}
}
return val;
}
const char *bx_param_string_handler(bx_param_string_c *param, int set,
const char *oldval, const char *val, int maxlen)
{
char pname[BX_PATHNAME_LEN];
param->get_param_path(pname, BX_PATHNAME_LEN);
if (!strcmp(pname, BXPN_SCREENMODE)) {
if (set == 1) {
BX_INFO(("Screen mode changed to %s", val));
}
} else if (!strcmp(pname, BXPN_USER_SHORTCUT)) {
if ((set == 1) && (SIM->get_init_done())) {
if (!bx_gui->parse_user_shortcut(val)) {
val = oldval;
}
}
#if BX_PLUGINS
} else if (!strncmp(pname, "misc.user_plugin", 16)) {
if ((strlen(oldval) > 0) && (strcmp(oldval, "none"))) {
PLUG_unload_user_plugin(oldval);
}
if ((strlen(val) > 0) && (strcmp(val, "none"))) {
PLUG_load_user_plugin(val);
}
#endif
} else {
BX_PANIC(("bx_param_string_handler called with unknown parameter '%s'", pname));
}
return val;
}
void bx_init_std_nic_options(const char *name, bx_list_c *menu)
{
// networking module choices
static const char *eth_module_list[] = {
"null",
#if BX_NETMOD_LINUX
"linux",
#endif
#if BX_NETMOD_TAP
"tap",
#endif
#if BX_NETMOD_TUNTAP
"tuntap",
#endif
#if BX_NETMOD_WIN32
"win32",
#endif
#if BX_NETMOD_FBSD
"fbsd",
#endif
#if BX_NETMOD_VDE
"vde",
#endif
#if BX_NETMOD_SLIRP
"slirp",
#endif
#if BX_NETMOD_SOCKET
"socket",
#endif
"vnet",
NULL
};
bx_param_enum_c *ethmod;
bx_param_bytestring_c *macaddr;
bx_param_filename_c *path, *bootrom;
char descr[120];
sprintf(descr, "MAC address of the %s device. Don't use an address of a machine on your net.", name);
macaddr = new bx_param_bytestring_c(menu,
"mac",
"MAC Address",
descr,
"", 6);
macaddr->set_initial_val("\xfe\xfd\xde\xad\xbe\xef");
macaddr->set_separator(':');
ethmod = new bx_param_enum_c(menu,
"ethmod",
"Ethernet module",
"Module used for the connection to the real net.",
eth_module_list,
0,
0);
ethmod->set_by_name("null");
ethmod->set_ask_format("Choose ethernet module for the device [%s] ");
new bx_param_string_c(menu,
"ethdev",
"Ethernet device",
"Device used for the connection to the real net. This is only valid if an ethernet module other than 'null' is used.",
"xl0", BX_PATHNAME_LEN);
path = new bx_param_filename_c(menu,
"script",
"Device configuration script",
"Name of the script that is executed after Bochs initializes the network interface (optional).",
"none", BX_PATHNAME_LEN);
path->set_ask_format("Enter new script name, or 'none': [%s] ");
bootrom = new bx_param_filename_c(menu,
"bootrom",
"Boot ROM image",
"Pathname of network boot ROM image to load",
"", BX_PATHNAME_LEN);
bootrom->set_format("Name of boot ROM image: %s");
}
void bx_init_usb_options(const char *usb_name, const char *pname, int maxports)
{
char group[16], name[8], descr[512], label[512];
bx_param_c *usb = SIM->get_param("ports.usb");
sprintf(group, "USB %s", usb_name);
sprintf(label, "%s Configuration", usb_name);
bx_list_c *menu = new bx_list_c(usb, pname, label);
menu->set_options(menu->SHOW_PARENT);
sprintf(label, "Enable %s emulation", usb_name);
sprintf(descr, "Enables the %s emulation", usb_name);
bx_param_bool_c *enabled = new bx_param_bool_c(menu, "enabled", label, descr, 1);
bx_list_c *deplist = new bx_list_c(NULL);
for (Bit8u i = 0; i < maxports; i++) {
sprintf(name, "port%u", i+1);
sprintf(label, "Port #%u Configuration", i+1);
sprintf(descr, "Device connected to %s port #%u and it's options", usb_name, i+1);
bx_list_c *port = new bx_list_c(menu, name, label);
port->set_options(port->SERIES_ASK | port->USE_BOX_TITLE);
sprintf(descr, "Device connected to %s port #%d", usb_name, i+1);
bx_param_string_c *device = new bx_param_string_c(port, "device", "Device",
descr, "", BX_PATHNAME_LEN);
sprintf(descr, "Options for device connected to %s port #%u", usb_name, i+1);
bx_param_string_c *options = new bx_param_string_c(port, "options", "Options",
descr, "", BX_PATHNAME_LEN);
port->set_group(group);
deplist->add(port);
deplist->add(device);
deplist->add(options);
}
enabled->set_dependent_list(deplist);
}
void bx_plugin_ctrl_reset(bx_bool init_done)
{
bx_list_c *base = (bx_list_c*) SIM->get_param(BXPN_PLUGIN_CTRL);
if (init_done) {
for (int i = 0; i < base->get_size(); i++) {
((bx_param_bool_c*)base->get(i))->set(0);
}
SIM->opt_plugin_ctrl("*", 0);
}
// add the default set of plugins to the list
new bx_param_bool_c(base, "unmapped", "", "", 1);
new bx_param_bool_c(base, "biosdev", "", "", 1);
new bx_param_bool_c(base, "speaker", "", "", 1);
new bx_param_bool_c(base, "extfpuirq", "", "", 1);
new bx_param_bool_c(base, "parallel", "", "", 1);
new bx_param_bool_c(base, "serial", "", "", 1);
#if BX_SUPPORT_GAMEPORT
new bx_param_bool_c(base, "gameport", "", "", 1);
#endif
#if BX_SUPPORT_IODEBUG && BX_DEBUGGER
new bx_param_bool_c(base, "iodebug", "", "", 1);
#endif
SIM->opt_plugin_ctrl("*", 1);
}
void bx_init_options()
{
int i;
bx_list_c *menu;
bx_list_c *deplist;
bx_param_num_c *ioaddr, *ioaddr2, *irq;
bx_param_bool_c *enabled, *readonly;
bx_param_enum_c *mode, *type, *toggle, *status;
bx_param_filename_c *path;
char name[BX_PATHNAME_LEN], descr[512], label[512];
bx_param_c *root_param = SIM->get_param(".");
// general options subtree
menu = new bx_list_c(root_param, "general", "");
// config interface option, set in bochsrc or command line
static const char *config_interface_list[] = {
#if BX_USE_WIN32CONFIG
"win32config",
#endif
#if BX_USE_TEXTCONFIG
"textconfig",
#endif
#if BX_WITH_WX
"wx",
#endif
NULL
};
bx_param_enum_c *sel_config = new bx_param_enum_c(menu,
"config_interface", "Configuration interface",
"Select configuration interface",
config_interface_list,
0,
0);
sel_config->set_by_name(BX_DEFAULT_CONFIG_INTERFACE);
static const char *bochs_start_names[] = { "quick", "load", "edit", "run" };
// quick start option, set by command line arg
new bx_param_enum_c(menu,
"start_mode",
"Bochs start types",
"Bochs start types",
bochs_start_names,
BX_RUN_START,
BX_QUICK_START);
new bx_param_bool_c(menu,
"restore",
"Restore Bochs session",
"Restore Bochs session",
0);
new bx_param_string_c(menu,
"restore_path",
"Path to data for restore",
"Path to data for restore",
"",
BX_PATHNAME_LEN);
// benchmarking mode, set by command line arg
new bx_param_num_c(menu,
"benchmark",
"benchmark mode",
"set benchmark mode",
0, BX_MAX_BIT32U, 0);
// dump statistics, set by command line arg
new bx_param_num_c(menu,
"dumpstats",
"dumpstats mode",
"dump statistics period",
0, BX_MAX_BIT32U, 0);
// unlock disk images
new bx_param_bool_c(menu,
"unlock_images",
"Unlock disk images",
"Unlock disk images leftover previous from Bochs session",
0);
// subtree for setting up log actions by device in bochsrc
bx_list_c *logfn = new bx_list_c(menu, "logfn", "Logfunctions");
new bx_list_c(logfn, "debug", "");
new bx_list_c(logfn, "info", "");
new bx_list_c(logfn, "error", "");
new bx_list_c(logfn, "panic", "");
// optional plugin control
new bx_list_c(menu, "plugin_ctrl", "Optional Plugin Control");
// subtree for special menus
bx_list_c *special_menus = new bx_list_c(root_param, "menu", "");
#if BX_SUPPORT_SMP
#define BX_CPU_PROCESSORS_LIMIT 255
#define BX_CPU_CORES_LIMIT 8
#define BX_CPU_HT_THREADS_LIMIT 4
#else
#define BX_CPU_PROCESSORS_LIMIT 1
#define BX_CPU_CORES_LIMIT 1
#define BX_CPU_HT_THREADS_LIMIT 1
#endif
// cpu subtree
bx_list_c *cpu_param = new bx_list_c(root_param, "cpu", "CPU Options");
static const char *cpu_names[] = {
#define bx_define_cpudb(model) #model,
#include "cpudb.h"
NULL
};
#undef bx_define_cpudb
new bx_param_enum_c(cpu_param,
"model", "CPU configuration",
"Choose pre-defined CPU configuration",
cpu_names, 0, 0);
// cpu options
bx_param_num_c *nprocessors = new bx_param_num_c(cpu_param,
"n_processors", "Number of processors in SMP mode",
"Sets the number of processors for multiprocessor emulation",
1, BX_CPU_PROCESSORS_LIMIT,
1);
nprocessors->set_enabled(BX_CPU_PROCESSORS_LIMIT > 1);
nprocessors->set_options(bx_param_c::CI_ONLY);
bx_param_num_c *ncores = new bx_param_num_c(cpu_param,
"n_cores", "Number of cores in each processor in SMP mode",
"Sets the number of cores per processor for multiprocessor emulation",
1, BX_CPU_CORES_LIMIT,
1);
ncores->set_enabled(BX_CPU_CORES_LIMIT > 1);
ncores->set_options(bx_param_c::CI_ONLY);
bx_param_num_c *nthreads = new bx_param_num_c(cpu_param,
"n_threads", "Number of HT threads per each core in SMP mode",
"Sets the number of HT (Intel(R) HyperThreading Technology) threads per core for multiprocessor emulation",
1, BX_CPU_HT_THREADS_LIMIT,
1);
nthreads->set_enabled(BX_CPU_HT_THREADS_LIMIT > 1);
nthreads->set_options(bx_param_c::CI_ONLY);
new bx_param_num_c(cpu_param,
"ips", "Emulated instructions per second (IPS)",
"Emulated instructions per second, used to calibrate bochs emulated time with wall clock time.",
BX_MIN_IPS, BX_MAX_BIT32U,
4000000);
#if BX_SUPPORT_SMP
new bx_param_num_c(cpu_param,
"quantum", "Quantum ticks in SMP simulation",
"Maximum amount of instructions allowed to execute before returning control to another CPU.",
BX_SMP_QUANTUM_MIN, BX_SMP_QUANTUM_MAX,
16);
#endif
new bx_param_bool_c(cpu_param,
"reset_on_triple_fault", "Enable CPU reset on triple fault",
"Enable CPU reset if triple fault occurred (highly recommended)",
1);
#if BX_CPU_LEVEL >= 5
new bx_param_bool_c(cpu_param,
"ignore_bad_msrs", "Ignore RDMSR / WRMSR to unknown MSR register",
"Ignore RDMSR/WRMSR to unknown MSR register",
1);
#endif
new bx_param_bool_c(cpu_param,
"cpuid_limit_winnt", "Limit max CPUID function to 3",
"Limit max CPUID function reported to 3 to workaround WinNT issue",
0);
#if BX_SUPPORT_MONITOR_MWAIT
new bx_param_bool_c(cpu_param,
"mwait_is_nop", "Don't put CPU to sleep state by MWAIT",
"Don't put CPU to sleep state by MWAIT",
0);
#endif
#if BX_CONFIGURE_MSRS
new bx_param_filename_c(cpu_param,
"msrs",
"Configurable MSR definition file",
"Set path to the configurable MSR definition file",
"", BX_PATHNAME_LEN);
#endif
cpu_param->set_options(menu->SHOW_PARENT);
// cpuid subtree
#if BX_CPU_LEVEL >= 4
bx_list_c *cpuid_param = new bx_list_c(root_param, "cpuid", "CPUID Options");
new bx_param_num_c(cpuid_param,
"level", "CPU Level",
"CPU level",
(BX_CPU_LEVEL < 5) ? BX_CPU_LEVEL : 5, BX_CPU_LEVEL,
BX_CPU_LEVEL);
new bx_param_num_c(cpuid_param,
"stepping", "Stepping ID",
"Processor 4-bits stepping ID",
0, 15,
3);
new bx_param_num_c(cpuid_param,
"model", "Model ID",
"Processor model ID, extended model ID",
0, 255,
3);
new bx_param_num_c(cpuid_param,
"family", "Family ID",
"Processor family ID, extended family ID",
BX_CPU_LEVEL, (BX_CPU_LEVEL >= 6) ? 4095 : BX_CPU_LEVEL,
BX_CPU_LEVEL);
new bx_param_string_c(cpuid_param,
"vendor_string",
"CPUID vendor string",
"Set the CPUID vendor string",
#if BX_CPU_VENDOR_INTEL
"GenuineIntel",
#else
"AuthenticAMD",
#endif
BX_CPUID_VENDOR_LEN+1);
new bx_param_string_c(cpuid_param,
"brand_string",
"CPUID brand string",
"Set the CPUID brand string",
#if BX_CPU_VENDOR_INTEL
" Intel(R) Pentium(R) 4 CPU ",
#else
"AMD Athlon(tm) processor",
#endif
BX_CPUID_BRAND_LEN+1);
#if BX_CPU_LEVEL >= 5
new bx_param_bool_c(cpuid_param,
"mmx", "Support for MMX instruction set",
"Support for MMX instruction set",
1);
// configure defaults to XAPIC enabled
static const char *apic_names[] = {
"legacy",
"xapic",
#if BX_CPU_LEVEL >= 6
"xapic_ext",
"x2apic",
#endif
NULL
};
new bx_param_enum_c(cpuid_param,
"apic", "APIC configuration",
"Select APIC configuration (Legacy APIC/XAPIC/XAPIC_EXT/X2APIC)",
apic_names,
BX_CPUID_SUPPORT_XAPIC,
BX_CPUID_SUPPORT_LEGACY_APIC);
#endif
#if BX_CPU_LEVEL >= 6
// configure defaults to CPU_LEVEL = 6 with SSE2 enabled
static const char *simd_names[] = {
"none",
"sse",
"sse2",
"sse3",
"ssse3",
"sse4_1",
"sse4_2",
#if BX_SUPPORT_AVX
"avx",
"avx2",
#if BX_SUPPORT_EVEX
"avx512",
#endif
#endif
NULL };
new bx_param_enum_c(cpuid_param,
"simd", "Support for SIMD instruction set",
"Support for SIMD (SSE/SSE2/SSE3/SSSE3/SSE4_1/SSE4_2/AVX/AVX2/AVX512) instruction set",
simd_names,
BX_CPUID_SUPPORT_SSE2,
BX_CPUID_SUPPORT_NOSSE);
new bx_param_bool_c(cpuid_param,
"sse4a", "Support for AMD SSE4A instructions",
"Support for AMD SSE4A instructions",
0);
new bx_param_bool_c(cpuid_param,
"misaligned_sse", "Support for AMD Misaligned SSE mode",
"Support for AMD Misaligned SSE mode",
0);
new bx_param_bool_c(cpuid_param,
"sep", "Support for SYSENTER/SYSEXIT instructions",
"Support for SYSENTER/SYSEXIT instructions",
1);
new bx_param_bool_c(cpuid_param,
"movbe", "Support for MOVBE instruction",
"Support for MOVBE instruction",
0);
new bx_param_bool_c(cpuid_param,
"adx", "Support for ADX instructions",
"Support for ADCX/ADOX instructions",
0);
new bx_param_bool_c(cpuid_param,
"aes", "Support for AES instruction set",
"Support for AES instruction set",
0);
new bx_param_bool_c(cpuid_param,
"sha", "Support for SHA instruction set",
"Support for SHA instruction set",
0);
new bx_param_bool_c(cpuid_param,
"xsave", "Support for XSAVE extensions",
"Support for XSAVE extensions",
0);
new bx_param_bool_c(cpuid_param,
"xsaveopt", "Support for XSAVEOPT instruction",
"Support for XSAVEOPT instruction",
0);
#if BX_SUPPORT_AVX
new bx_param_bool_c(cpuid_param,
"avx_f16c", "Support for AVX F16 convert instructions",
"Support for AVX F16 convert instructions",
0);
new bx_param_bool_c(cpuid_param,
"avx_fma", "Support for AVX FMA instructions",
"Support for AVX FMA instructions",
0);
new bx_param_num_c(cpuid_param,
"bmi", "Support for BMI instructions",
"Support for Bit Manipulation Instructions (BMI)",
0, 2,
0);
new bx_param_bool_c(cpuid_param,
"xop", "Support for AMD XOP instructions",
"Support for AMD XOP instructions",
0);
new bx_param_bool_c(cpuid_param,
"fma4", "Support for AMD four operand FMA instructions",
"Support for AMD FMA4 instructions",
0);
new bx_param_bool_c(cpuid_param,
"tbm", "Support for AMD TBM instructions",
"Support for AMD Trailing Bit Manipulation (TBM) instructions",
0);
#endif
#if BX_SUPPORT_X86_64
new bx_param_bool_c(cpuid_param,
"x86_64", "x86-64 and long mode",
"Support for x86-64 and long mode",
1);
new bx_param_bool_c(cpuid_param,
"1g_pages", "1G pages support in long mode",
"Support for 1G pages in long mode",
0);
new bx_param_bool_c(cpuid_param,
"pcid", "PCID support in long mode",
"Support for process context ID (PCID) in long mode",
0);
new bx_param_bool_c(cpuid_param,
"fsgsbase", "FS/GS BASE access instructions support",
"FS/GS BASE access instructions support in long mode",
0);
#endif
new bx_param_bool_c(cpuid_param,
"smep", "Supervisor Mode Execution Protection support",
"Supervisor Mode Execution Protection support",
0);
new bx_param_bool_c(cpuid_param,
"smap", "Supervisor Mode Access Prevention support",
"Supervisor Mode Access Prevention support",
0);
#if BX_SUPPORT_MONITOR_MWAIT
new bx_param_bool_c(cpuid_param,
"mwait", "MONITOR/MWAIT instructions support",
"MONITOR/MWAIT instructions support",
BX_SUPPORT_MONITOR_MWAIT);
#endif
#if BX_SUPPORT_VMX
new bx_param_num_c(cpuid_param,
"vmx", "Support for Intel VMX extensions emulation",
"Support for Intel VMX extensions emulation",
0, BX_SUPPORT_VMX,
1);
#endif
#if BX_SUPPORT_SVM
new bx_param_bool_c(cpuid_param,
"svm", "Secure Virtual Machine (SVM) emulation support",
"Secure Virtual Machine (SVM) emulation support",
0);
#endif
#endif // CPU_LEVEL >= 6
cpuid_param->set_options(menu->SHOW_PARENT | menu->USE_SCROLL_WINDOW);
// CPUID subtree depends on CPU model
SIM->get_param_enum(BXPN_CPU_MODEL)->set_dependent_list(cpuid_param->clone(), 0);
// enable CPUID subtree only for CPU model choice #0
SIM->get_param_enum(BXPN_CPU_MODEL)->set_dependent_bitmap(0, BX_MAX_BIT64U);
#endif // CPU_LEVEL >= 4
// memory subtree
bx_list_c *memory = new bx_list_c(root_param, "memory", "Memory Options");
bx_list_c *stdmem = new bx_list_c(memory, "standard", "Standard Options");
bx_list_c *optrom = new bx_list_c(memory, "optrom", "Optional ROM Images");
bx_list_c *optram = new bx_list_c(memory, "optram", "Optional RAM Images");
bx_list_c *ram = new bx_list_c(stdmem, "ram", "RAM size options");
bx_list_c *rom = new bx_list_c(stdmem, "rom", "BIOS ROM options");
bx_list_c *vgarom = new bx_list_c(stdmem, "vgarom", "VGABIOS ROM options");
// memory options (ram & rom)
bx_param_num_c *ramsize = new bx_param_num_c(ram,
"size",
"Memory size (megabytes)",
"Amount of RAM in megabytes",
1, ((Bit64u)(1) << BX_PHY_ADDRESS_WIDTH) / (1024*1024),
BX_DEFAULT_MEM_MEGS);
ramsize->set_ask_format("Enter memory size (MB): [%d] ");
bx_param_num_c *host_ramsize = new bx_param_num_c(ram,
"host_size",
"Host allocated memory size (megabytes)",
"Amount of host allocated memory in megabytes",
1, 2048,
BX_DEFAULT_MEM_MEGS);
host_ramsize->set_ask_format("Enter host memory size (MB): [%d] ");
ram->set_options(ram->SERIES_ASK);
path = new bx_param_filename_c(rom,
"file",
"ROM BIOS image",
"Pathname of ROM image to load",
"", BX_PATHNAME_LEN);
path->set_format("Name of ROM BIOS image: %s");
sprintf(name, "%s/BIOS-bochs-latest", (char *)get_builtin_variable("BXSHARE"));
path->set_initial_val(name);
bx_param_num_c *romaddr = new bx_param_num_c(rom,
"address",
"ROM BIOS address",
"The address at which the ROM image should be loaded",
0, BX_MAX_BIT32U,
0);
romaddr->set_base(16);
romaddr->set_format("0x%08x");
romaddr->set_long_format("ROM BIOS address: 0x%08x");
new bx_param_string_c(rom,
"options",
"BIOS options",
"Options for the Bochs BIOS",
"", BX_PATHNAME_LEN);
rom->set_options(rom->SERIES_ASK);
path = new bx_param_filename_c(vgarom,
"file",
"VGA BIOS image",
"Pathname of VGA ROM image to load",
"", BX_PATHNAME_LEN);
path->set_format("Name of VGA BIOS image: %s");
sprintf(name, "%s/VGABIOS-lgpl-latest", get_builtin_variable("BXSHARE"));
path->set_initial_val(name);
vgarom->set_options(vgarom->SERIES_ASK);
bx_list_c *optnum;
bx_param_num_c *optaddr;
for (i=0; i<BX_N_OPTROM_IMAGES; i++) {
sprintf(name, "%d", i+1);
sprintf(descr, "Pathname of optional ROM image #%d to load", i+1);
sprintf(label, "Optional ROM image #%d", i+1);
optnum = new bx_list_c(optrom, name, label);
path = new bx_param_filename_c(optnum,
"file",
"Path",
descr,
"", BX_PATHNAME_LEN);
sprintf(label, "Name of optional ROM image #%d", i+1);
strcat(label, " : %s");
path->set_format(strdup(label));
sprintf(descr, "The address at which the optional ROM image #%d should be loaded", i+1);
optaddr = new bx_param_num_c(optnum,
"address",
"Address",
descr,
0, BX_MAX_BIT32U,
0);
optaddr->set_base(16);
optaddr->set_format("0x%05x");
sprintf(label, "Optional ROM #%d address:", i+1);
strcat(label, " 0x%05x");
optaddr->set_long_format(strdup(label));
deplist = new bx_list_c(NULL);
deplist->add(optaddr);
path->set_dependent_list(deplist);
optnum->set_options(optnum->SERIES_ASK | optnum->USE_BOX_TITLE);
}
optrom->set_options(optrom->SHOW_PARENT);
for (i=0; i<BX_N_OPTRAM_IMAGES; i++) {
sprintf(name, "%d", i+1);
sprintf(descr, "Pathname of optional RAM image #%d to load", i+1);
sprintf(label, "Optional RAM image #%d", i+1);
optnum = new bx_list_c(optram, name, label);
path = new bx_param_filename_c(optnum,
"file",
"Path",
descr,
"", BX_PATHNAME_LEN);
sprintf(label, "Name of optional RAM image #%d", i+1);
strcat(label, " : %s");
path->set_format(strdup(label));
sprintf(descr, "The address at which the optional RAM image #%d should be loaded", i+1);
optaddr = new bx_param_num_c(optnum,
"address",
"Address",
descr,
0, BX_MAX_BIT32U,
0);
optaddr->set_base(16);
optaddr->set_format("0x%05x");
sprintf(label, "Optional RAM #%d address:", i+1);
strcat(label, " 0x%05x");
optaddr->set_long_format(strdup(label));
deplist = new bx_list_c(NULL);
deplist->add(optaddr);
path->set_dependent_list(deplist);
optnum->set_options(optnum->SERIES_ASK | optnum->USE_BOX_TITLE);
}
optram->set_options(optram->SHOW_PARENT);
memory->set_options(memory->SHOW_PARENT | memory->USE_TAB_WINDOW);
// clock & cmos subtree
bx_list_c *clock_cmos = new bx_list_c(root_param, "clock_cmos", "Clock & CMOS Options");
// clock & cmos options
static const char *clock_sync_names[] = { "none", "realtime", "slowdown", "both", NULL };
bx_param_enum_c *clock_sync = new bx_param_enum_c(clock_cmos,
"clock_sync", "Synchronisation method",
"Host to guest time synchronization method",
clock_sync_names,
BX_CLOCK_SYNC_NONE,
BX_CLOCK_SYNC_NONE);
bx_param_num_c *time0 = new bx_param_num_c(clock_cmos,
"time0",
"Initial CMOS time for Bochs\n(1:localtime, 2:utc, other:time in seconds)",
"Initial time for Bochs CMOS clock, used if you really want two runs to be identical",
0, BX_MAX_BIT32U,
BX_CLOCK_TIME0_LOCAL);
bx_param_bool_c *rtc_sync = new bx_param_bool_c(clock_cmos,
"rtc_sync", "Sync RTC speed with realtime",
"If enabled, the RTC runs at realtime speed",
0);
deplist = new bx_list_c(NULL);
deplist->add(rtc_sync);
clock_sync->set_dependent_list(deplist, 0);
clock_sync->set_dependent_bitmap(BX_CLOCK_SYNC_REALTIME, 1);
clock_sync->set_dependent_bitmap(BX_CLOCK_SYNC_BOTH, 1);
bx_list_c *cmosimage = new bx_list_c(clock_cmos, "cmosimage", "CMOS Image Options");
bx_param_bool_c *use_cmosimage = new bx_param_bool_c(cmosimage,
"enabled", "Use a CMOS image",
"Controls the usage of a CMOS image",
0);
path = new bx_param_filename_c(cmosimage,
"path", "Pathname of CMOS image",
"Pathname of CMOS image",
"", BX_PATHNAME_LEN);
bx_param_bool_c *rtc_init = new bx_param_bool_c(cmosimage,
"rtc_init", "Initialize RTC from image",
"Controls whether to initialize the RTC with values stored in the image",
0);
deplist = new bx_list_c(NULL);
deplist->add(path);
deplist->add(rtc_init);
use_cmosimage->set_dependent_list(deplist);
time0->set_ask_format("Enter Initial CMOS time (1:localtime, 2:utc, other:time in seconds): [%d] ");
clock_sync->set_ask_format("Enter Synchronisation method: [%s] ");
clock_cmos->set_options(clock_cmos->SHOW_PARENT);
cmosimage->set_options(cmosimage->SHOW_PARENT);
// pci subtree
bx_list_c *pci = new bx_list_c(root_param, "pci", "PCI Options");
// pci options
static const char *pci_chipset_names[] = { "i430fx", "i440fx", "i440bx", NULL };
deplist = new bx_list_c(NULL);
enabled = new bx_param_bool_c(pci,
"enabled",
"Enable PCI Support",
"Controls whether to emulate a PCI chipset",
BX_SUPPORT_PCI);
bx_param_enum_c *pci_chipset = new bx_param_enum_c(pci,
"chipset", "PCI chipset",
"Select PCI chipset to emulate",
pci_chipset_names,
BX_PCI_CHIPSET_I440FX,
BX_PCI_CHIPSET_I430FX);
deplist->add(pci_chipset);
// pci slots
bx_list_c *slot = new bx_list_c(pci, "slot", "PCI Slots");
deplist->add(slot);
for (i=0; i<BX_N_PCI_SLOTS; i++) {
sprintf(name, "%d", i+1);
sprintf (descr, "Name of the device connected to PCI slot #%d", i+1);
sprintf (label, "PCI slot #%d device", i+1);
bx_param_string_c *devname = new bx_param_string_c(slot,
name,
label,
descr,
"", BX_PATHNAME_LEN);
deplist->add(devname);
}
bx_param_string_c *advopts = new bx_param_string_c(pci, "advopts", "Advanced PCI Options",
"Set advanced PCI options",
"", BX_PATHNAME_LEN);
deplist->add(advopts);
enabled->set_dependent_list(deplist);
pci->set_options(pci->SHOW_PARENT);
slot->set_options(slot->SHOW_PARENT);
// display subtree
bx_list_c *display = new bx_list_c(root_param, "display", "Bochs Display & Interface Options");
// this is a list of gui libraries that are known to be available at
// compile time. The one that is listed first will be the default,
// which is used unless the user overrides it on the command line or
// in a configuration file.
static const char *display_library_list[] = {
#if BX_WITH_X11
"x",
#endif
#if BX_WITH_WIN32
"win32",
#endif
#if BX_WITH_CARBON
"carbon",
#endif
#if BX_WITH_MACOS
"macos",
#endif
#if BX_WITH_AMIGAOS
"amigaos",
#endif
#if BX_WITH_SDL
"sdl",
#endif
#if BX_WITH_SDL2
"sdl2",
#endif
#if BX_WITH_TERM
"term",
#endif
#if BX_WITH_RFB
"rfb",
#endif
#if BX_WITH_VNCSRV
"vncsrv",
#endif
#if BX_WITH_WX
"wx",
#endif
#if BX_WITH_NOGUI
"nogui",
#endif
NULL
};
bx_param_enum_c *sel_displaylib = new bx_param_enum_c(display,
"display_library", "VGA Display Library",
"Select VGA Display Library",
display_library_list,
0,
0);
sel_displaylib->set_by_name(BX_DEFAULT_DISPLAY_LIBRARY);
sel_displaylib->set_ask_format("Choose which library to use for the Bochs display: [%s] ");
new bx_param_string_c(display,
"displaylib_options", "Display Library options",
"Options passed to Display Library",
"",
BX_PATHNAME_LEN);
new bx_param_bool_c(display,
"private_colormap", "Use a private colormap",
"Request that the GUI create and use it's own non-shared colormap. This colormap will be used when in the bochs window. If not enabled, a shared colormap scheme may be used. Not implemented on all GUI's.",
0);
#if BX_WITH_AMIGAOS
bx_param_bool_c *fullscreen = new bx_param_bool_c(display,
"fullscreen", "Use full screen mode",
"When enabled, bochs occupies the whole screen instead of just a window.",
0);
bx_param_string_c *screenmode = new bx_param_string_c(display,
"screenmode",
"Screen mode name",
"Screen mode name",
"", BX_PATHNAME_LEN);
screenmode->set_handler(bx_param_string_handler);
#endif
new bx_param_bool_c(display,
"vga_realtime",
"VGA timer realtime",
"If enabled, the VGA timer is based on realtime",
1);
bx_param_num_c *vga_update_freq = new bx_param_num_c(display,
"vga_update_frequency",
"VGA Update Frequency",
"Number of VGA updates per emulated second",
1, 60,
5);
vga_update_freq->set_ask_format ("Type a new value for VGA update frequency: [%d] ");
bx_param_string_c *vga_extension = new bx_param_string_c(display,
"vga_extension",
"VGA Extension",
"Name of the VGA extension",
"none", BX_PATHNAME_LEN);
vga_extension->set_initial_val("vbe");
display->set_options(display->SHOW_PARENT);