Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial Pull Request for xmhf-64 #35

Draft
wants to merge 560 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
560 commits
Select commit Hold shift + click to select a range
d06cbc4
Fix word size problems in xmhf_baseplatform_arch_x86_64vmx_wakeupAPs()
lxylxy123456 Feb 23, 2022
3ae6989
Fix x86_64 alignment problem for sinit_mle_data_t
lxylxy123456 Mar 3, 2022
774b9dc
Fix missed change in 8da04f576860a7afbba6370aadb2ed024431c4cc
lxylxy123456 Mar 3, 2022
4d6217b
Use sparse file to save build disk space
lxylxy123456 Mar 3, 2022
a08f148
Fix x86_64 alignment problem for other fields in _txt_heap.h
lxylxy123456 Mar 3, 2022
2e3af77
Define debug section in ld scripts, remove linker warnings
lxylxy123456 Mar 4, 2022
3b40aa1
Fix 2 compile warnings
lxylxy123456 Mar 4, 2022
486583a
Add todo
lxylxy123456 Mar 8, 2022
e7d5a66
Split definition of xmhf_sl_arch_x86_setup_runtime_paging in xmhf-sl.h
lxylxy123456 Mar 13, 2022
215bff8
Make peh-x86svm-entry.S similar to peh-x86_64svm-entry.S
lxylxy123456 Mar 13, 2022
0240f2b
Try to add DMAP support to XMHF
superymk Mar 13, 2022
5aa8357
Phase 1 of merging x86 and x64: rename functions from *x86_64* to *x86*
lxylxy123456 Mar 13, 2022
ee49c59
Modify sl-x86.c
lxylxy123456 Mar 13, 2022
8e0fbd0
Run phase 2 on sl-x86.c
lxylxy123456 Mar 13, 2022
357568f
Merge _svm_getvcpu and _vmx_getvcpu in x86
lxylxy123456 Mar 13, 2022
63e942c
expand -t 4 xcph-x86.c
lxylxy123456 Mar 13, 2022
c455729
Change types in xcph-x86.c
lxylxy123456 Mar 14, 2022
87a4978
Add ifdef to xcph-x86.c
lxylxy123456 Mar 14, 2022
521339f
Simplify ifdefs in xcph-x86.c
lxylxy123456 Mar 14, 2022
dd266a9
Fix compile errors in xcph-x86.c
lxylxy123456 Mar 14, 2022
cf6ff75
Merge rntm-x86-data.c
lxylxy123456 Mar 14, 2022
016af4a
Add ifdef to smpg-x86vmx.c
lxylxy123456 Mar 14, 2022
2178594
Add ifdef to part-x86vmx.c
lxylxy123456 Mar 14, 2022
643b4fe
Add ifdef to memp-x86vmx.c
lxylxy123456 Mar 14, 2022
699eed0
Make memp-x86vmx-data.c the same
lxylxy123456 Mar 14, 2022
6e52a00
Update some of peh-x86vmx-main.c
lxylxy123456 Mar 14, 2022
bf7bd77
Change some of peh-x86vmx-main.c
lxylxy123456 Mar 14, 2022
6b4de45
Add ifdef to peh-x86vmx-main.c
lxylxy123456 Mar 14, 2022
1d05a81
Add ifdefs to peh-x86-safemsr.c
lxylxy123456 Mar 14, 2022
7545c2f
Make bplt-x86vmx.c the same
lxylxy123456 Mar 14, 2022
fa9e447
Use DECLARE_FIELD in x86
lxylxy123456 Mar 14, 2022
99022eb
Add ifdef to bplt-x86vmx-data.c
lxylxy123456 Mar 14, 2022
c2d899d
Update bplt-x86vmx-vmcs.c
lxylxy123456 Mar 14, 2022
6a4b079
Add ifdef to bplt-x86vmx-vmcs.c
lxylxy123456 Mar 14, 2022
28e42ce
Fix compile error
lxylxy123456 Mar 14, 2022
c51de41
Fix EPT misconfiguration error
lxylxy123456 Mar 14, 2022
a6d27db
Remove STATIC_ASSERT
lxylxy123456 Mar 14, 2022
a4fa44c
Add ifdef to bplt-x86vmx-smp.c
lxylxy123456 Mar 14, 2022
71aa129
Add ifdef to bplt-x86svm-smp.c
lxylxy123456 Mar 14, 2022
7797778
Add ifdef to bplt-x86-smp.c
lxylxy123456 Mar 14, 2022
937c8fd
Change bplt-x86-addressing.c
lxylxy123456 Mar 14, 2022
85d100b
Add ifdefs to bplt-x86-addressing.c
lxylxy123456 Mar 14, 2022
f1051aa
Add ifdef to xmhf-tpm-arch-x86.h
lxylxy123456 Mar 14, 2022
31d3852
Misc change in xmhf-baseplatform-arch-x86_64.h
lxylxy123456 Mar 14, 2022
a0c6902
Add ifdef to _configx86.h
lxylxy123456 Mar 14, 2022
17f6c6e
Add ifdef to xmhf-baseplatform-arch-x86.h
lxylxy123456 Mar 14, 2022
9d00a42
Make _vmx.h the same
lxylxy123456 Mar 14, 2022
4fa4ded
Move x86_64/_configx86_64.h to x86_64/_configx86.h to make xmhf-basep…
lxylxy123456 Mar 14, 2022
5876db5
Add ifdefs to _txt_config_regs.h
lxylxy123456 Mar 14, 2022
11cd3f2
Add ifdef to _processor.h
lxylxy123456 Mar 14, 2022
b36174b
Rename isrHigh to isrHigh16 for x86
lxylxy123456 Mar 14, 2022
6550815
Change x86/_paging.h
lxylxy123456 Mar 14, 2022
f3e72dd
Add ifdefs to _paging.h
lxylxy123456 Mar 14, 2022
f57ce30
Add ifdefs to _msr.h
lxylxy123456 Mar 14, 2022
ff3d34c
Add ifdefs to _div64.h
lxylxy123456 Mar 14, 2022
354e7a2
Fix typo in _cmdline.h
lxylxy123456 Mar 14, 2022
f384105
Fix compile bug in _div64.h
lxylxy123456 Mar 14, 2022
de8ddcb
Fix compile bug in _div64.h
lxylxy123456 Mar 14, 2022
95253b2
Remove trailing white spaces for all files
lxylxy123456 Mar 14, 2022
15401fa
Wrap up phase 2
lxylxy123456 Mar 14, 2022
896edaf
Update Makefiles
lxylxy123456 Mar 15, 2022
6039c04
Phase 3: remove x86_64 files
lxylxy123456 Mar 15, 2022
f943694
Moved .S files (Makefiles not changed yet)
lxylxy123456 Mar 15, 2022
2dc631f
Change Makefiles to follow moved .S files
lxylxy123456 Mar 15, 2022
3d13800
Add i386/amd64 to artifacts
lxylxy123456 Mar 15, 2022
9afa215
Change build.yml
lxylxy123456 Mar 15, 2022
c33a79c
Rename ia64 to amd64
lxylxy123456 Mar 15, 2022
049e089
Change to FreeBSD's amd64 version, not ia64
lxylxy123456 Mar 15, 2022
03ce415
Replace all `__X86_64__` to `__AMD64__`, and `__X86__` to `__I386__`
lxylxy123456 Mar 15, 2022
046be44
Replace remaining files
lxylxy123456 Mar 15, 2022
7585a54
__XMHF_X86_64__ -> __XMHF_AMD64__, __XMHF_X86__ -> __XMHF_I386__
lxylxy123456 Mar 15, 2022
099b123
Update comments
lxylxy123456 Mar 15, 2022
88226b5
Update .gitignore
lxylxy123456 Mar 15, 2022
ac4a81a
Manually change x86_64 to amd64
lxylxy123456 Mar 15, 2022
e4ff5ad
Manually remove useless __AMD64__
lxylxy123456 Mar 15, 2022
f8f0a50
Manually replace "x86-64"
lxylxy123456 Mar 15, 2022
65a3f5e
Complete merging 32-bit and 64-bit XMHF code
lxylxy123456 Mar 15, 2022
4cc64d2
Add assertions about maskable interrupts in scode.c
lxylxy123456 Mar 15, 2022
fbabf20
Block NMI when running PALs
lxylxy123456 Mar 15, 2022
f0baec0
Halt if dropping NMI
lxylxy123456 Mar 15, 2022
966a267
Add amd64 / i386 to banner
lxylxy123456 Mar 15, 2022
921e1e1
Miao xmhf64 (#2)
superymk Mar 17, 2022
0bb1b2b
Rename TARGET_WORDSIZE to TARGET_SUBARCH
lxylxy123456 Mar 17, 2022
f14b795
Support configuring AMD64_MAX_PHYS_ADDR
lxylxy123456 Mar 17, 2022
e82b0f5
Fix bug in configure.ac
lxylxy123456 Mar 17, 2022
24eafa6
Fix bug in displaying subarch in init.c
lxylxy123456 Mar 17, 2022
549eb68
Make xmhf-mm.o sparse
lxylxy123456 Mar 18, 2022
a1fdf7b
Solve regression that PALs cannot run with DMAP (assertion error)
lxylxy123456 Mar 20, 2022
516e618
Rearrange x64 GDT: make code32 + 8 = data32
lxylxy123456 Mar 20, 2022
763ac41
Fix problem in types when calling hash_memory_multi() (variadic funct…
lxylxy123456 Mar 20, 2022
1e456c1
Move ifdefs in a1fdf7b2c into hypapp
lxylxy123456 Mar 21, 2022
fafe5fe
Add PA_PAGE* macros in _paging.h for physical addresses
lxylxy123456 Mar 22, 2022
3401132
Combine _vmx_setupEPT() between i386 and amd64
lxylxy123456 Mar 22, 2022
8336bbd
Disallow guest to modify IA32_MTRR_DEF_TYPE
lxylxy123456 Mar 22, 2022
c9bb82a
Implement inefficient MTRR change handling
lxylxy123456 Mar 22, 2022
70e58b6
Support notifying hypapp about MTRR change
lxylxy123456 Mar 22, 2022
f068c90
Implement MTRR read / write failure handling
lxylxy123456 Mar 23, 2022
0234312
Skip EPT update when modifying MTRR for simple cases
lxylxy123456 Mar 23, 2022
ec78a94
For Intel, unblock NMI when runtime starts
lxylxy123456 Mar 24, 2022
2dfada5
Skip compiling xmhf-dmaprot when DMAP=n
lxylxy123456 Mar 25, 2022
0fc1584
Allow parallel build of runtimecomponents
lxylxy123456 Mar 25, 2022
8af91ba
Move .palign_data to .bss.palign_data to save space in .o files
lxylxy123456 Mar 25, 2022
1fc057b
Move .stack to .bss.stack to save more space
lxylxy123456 Mar 25, 2022
87eb884
No need to compile bplt-x86vmx-mtrrs.c when DRT=n
lxylxy123456 Mar 25, 2022
82bf154
Do not compile txt_acmod.c if DRT=n
lxylxy123456 Mar 25, 2022
b25354f
Remove unneeded header files when DRT=n
lxylxy123456 Mar 25, 2022
74ea1e2
Fix compile error in amd64
lxylxy123456 Mar 25, 2022
e2a866a
Remove libtommath.a from bootloader in amd64, because it is not used
lxylxy123456 Mar 25, 2022
023c78f
Rename ADDL_LIBS32 to ADDL_LIBS_BOOTLOADER
lxylxy123456 Mar 26, 2022
31425b9
Create ADDL_INCLUDES_BOOTLOADER to reduce bootloader's includes
lxylxy123456 Mar 26, 2022
9e1aa4b
Split the subdir build target to more targets (to increase parallelism)
lxylxy123456 Mar 26, 2022
84886fc
Replace .a file names with variables
lxylxy123456 Mar 26, 2022
cc879ed
Fix problem caused by 1fc057b46: force objcopy to include .bss-like s…
lxylxy123456 Mar 26, 2022
6fa884f
Update .github/build.sh
lxylxy123456 Mar 26, 2022
cd81de2
Move vmx_eap_zap() to runtime.c (solves compile regression)
lxylxy123456 Mar 26, 2022
8867950
Fix a bug when running DMAP on 32-bit XMHF on HP 2540p
superymk Mar 27, 2022
04b9121
Remove invalid Makefile targets
lxylxy123456 Mar 27, 2022
d9bed08
Define runtime.mk to capture common logic in runtime component Makefiles
lxylxy123456 Mar 27, 2022
a65ddfa
Rename *.x86.o to *.i386.o
lxylxy123456 Mar 27, 2022
70636de
Update runtime.mk docs
lxylxy123456 Mar 27, 2022
be9cba7
Generate dependency files
lxylxy123456 Mar 27, 2022
f0e16b8
Write Setting up XMHF64 documentation
lxylxy123456 Mar 27, 2022
23f92f8
Remove -mno-sse5 from CFLAGS, as this argument disappears as of gcc v…
lxylxy123456 Mar 27, 2022
548d2a9
Fix compile error in tpm_extra.c: cannot use uninitialized stack as r…
lxylxy123456 Mar 28, 2022
5fffd8d
Fix compile error in rijndael.c
lxylxy123456 Mar 28, 2022
5d8dfb8
Fix compile error in sha2.c
lxylxy123456 Mar 28, 2022
16f6c8b
Fix compile warning in part-x86vmx.c
lxylxy123456 Mar 28, 2022
2bd0b98
Fix linker script for compiling on Fedora
lxylxy123456 Mar 28, 2022
10a91e4
Add instructions to compile XMHF on Fedora
lxylxy123456 Mar 28, 2022
a3b624e
Update build.sh to detect Fedora platform
lxylxy123456 Mar 28, 2022
c072968
Update docs
lxylxy123456 Mar 28, 2022
3de5159
Support setting optimization level
lxylxy123456 Mar 28, 2022
13ff967
Change HALT() implementation to fix compile errors in -O3
lxylxy123456 Mar 28, 2022
2a50e96
Fix incorrect use of HALT_ON_ERRORCOND()
lxylxy123456 Mar 28, 2022
67bfb18
Use shifts in _vmx_setupEPT() instead of * and /
lxylxy123456 Mar 28, 2022
fc54fa5
In all occurrences of __AMD64__, require __I386__ || __AMD64__ to be …
lxylxy123456 Mar 28, 2022
0a7127e
Fix bug caused by fc54fa5d2db3f0616ddc98caaa628c964d2e76e3
lxylxy123456 Mar 28, 2022
74026e5
Miao xmhf64 (#4)
superymk Mar 29, 2022
430f688
Add documentation about PA_* macros
lxylxy123456 Mar 29, 2022
7ccb2e7
Fix compiler error in -O1 (make sure compiler knows assert() never re…
lxylxy123456 Mar 29, 2022
8230fe8
Fix compile error in hpt.c: not checked else condition
lxylxy123456 Mar 29, 2022
f947b36
Fix -O1 compile error in part-x86vmx.c: remove inline asm of CPUID
lxylxy123456 Mar 29, 2022
8ff33cb
Fix -O1 compile error in part-x86{vmx,svm}.c: use volatile to prevent…
lxylxy123456 Mar 29, 2022
9ce9ef6
Add sections in *.lds.S to support -O3 compile
lxylxy123456 Mar 29, 2022
7263d84
Add sections in *.lds.S to support -O3 compile for debug info
lxylxy123456 Mar 29, 2022
08fcdb5
Add sections in *.lds.S to support -O3 compile for debug info
lxylxy123456 Mar 29, 2022
98b48c6
Fix Debian -O3 compile error: hint to compiler that EU_CHK functions …
lxylxy123456 Mar 29, 2022
1f972ec
Support -O3 compile in build.sh
lxylxy123456 Mar 29, 2022
b94f3aa
Fix build.yml
lxylxy123456 Mar 29, 2022
054820a
Fix runtime error in -O3: make some global variables volatile
lxylxy123456 Mar 29, 2022
5818265
Fix runtime error in -O3: make quiesce signal global variables volatile
lxylxy123456 Mar 29, 2022
7a41602
Make sipireceived volatile
lxylxy123456 Mar 30, 2022
822842a
Make g_appmain_success_counter volatile
lxylxy123456 Mar 30, 2022
092ec73
Refactor _paging.h macros
lxylxy123456 Mar 31, 2022
2d1aa5f
Export <xmhf_get_machine_paddr_range>, because hypapps may need to us…
superymk Mar 31, 2022
ddb8857
Use PA_PAGE_ALIGN_UP macros in macros like P4L_NPLM4T
lxylxy123456 Mar 31, 2022
6ff794a
Add checking in _paging.h macros
lxylxy123456 Apr 1, 2022
bcdafac
Add _ in PAGE_ALIGN_UP (fix typo)
lxylxy123456 Apr 1, 2022
85141ca
Fix incorrect use of PAGE_ALIGN_* in dmap code
lxylxy123456 Apr 1, 2022
030a30f
Make macro __TARGET_BASE depend on __TARGET_BASE_SL
lxylxy123456 Apr 3, 2022
50ca007
Run preprocessor on runtime lds files
lxylxy123456 Apr 3, 2022
f715338
Fix error in preprocessing runtime-x86-i386.lds.S
lxylxy123456 Apr 3, 2022
eb842cc
Merge runtime LD scripts
lxylxy123456 Apr 3, 2022
efb5f45
Run preprocessor on sl LD script
lxylxy123456 Apr 3, 2022
69ff2c1
Rename runtime and sl ld scripts
lxylxy123456 Apr 3, 2022
813a64e
Make TSS access rights the same for i386 and amd64
lxylxy123456 Apr 3, 2022
3bd65ee
In QEMU, print warning if running amd64 guest in i386 XMHF
lxylxy123456 Apr 3, 2022
61f4e88
First try of Jenkins
lxylxy123456 Apr 7, 2022
23f0498
Debug Jenkinsfile
lxylxy123456 Apr 7, 2022
595da9d
Use git clean
lxylxy123456 Apr 7, 2022
28d01db
Update Jenkins CI
lxylxy123456 Apr 7, 2022
1ca738d
Debug test2.py for Jenkins
lxylxy123456 Apr 7, 2022
53b2c91
Add lock to println
lxylxy123456 Apr 7, 2022
f1a66b0
Circleci project setup (#6)
lxylxy123456 Apr 7, 2022
05943b8
Update Circle CI config.yml
lxylxy123456 Apr 7, 2022
36879f1
Implement _optimize_x86vmx_intercept_handler to run common intercepts…
lxylxy123456 Apr 7, 2022
8f4d34b
Enable Circle CI testing using 1 CPU
lxylxy123456 Apr 7, 2022
247b937
Optimize EPT and #DB for handling LAPIC EOI
lxylxy123456 Apr 8, 2022
b5c4c40
Fix compile error caused by 247b937c0
lxylxy123456 Apr 8, 2022
afb602b
Remove TODO
lxylxy123456 Apr 8, 2022
7abab5b
Change to SMP = 2 for Circle CI
lxylxy123456 Apr 8, 2022
f3b723e
Update setup-xmhf64.md docs
lxylxy123456 Apr 8, 2022
19f71b9
Update docs for XMHF64 support status
lxylxy123456 Apr 8, 2022
6628105
Prevent running hypapp's autogen.sh every time remaking XMHF
lxylxy123456 Apr 13, 2022
40581d2
Fix typo in sha1 computation
lxylxy123456 Apr 13, 2022
016013a
Specify CircleCI resource class
lxylxy123456 Apr 13, 2022
5c29efd
Fix bug in xmhf/src/xmhf-core/Makefile to correctly parallel remake
lxylxy123456 Apr 21, 2022
617b027
Update xmhf_smpguest_arch_x86vmx_eventhandler_nmiexception() to allow…
lxylxy123456 Apr 21, 2022
f5c27d8
Replace #DB exception with monitor trap
lxylxy123456 Apr 21, 2022
ed05407
Disable NMI during LAPIC interception
lxylxy123456 Apr 21, 2022
ae0d0ff
Intercept exceptions during LAPIC interception
lxylxy123456 Apr 21, 2022
9a15c9c
Fix OPTIMIZE_NESTED_VIRT for LAPIC logic change
lxylxy123456 Apr 21, 2022
ac146f4
Fix typo
lxylxy123456 Apr 21, 2022
876b859
Modify .jenkins/test2.py to test faster locally
lxylxy123456 Apr 21, 2022
a13c6bf
Support x2APIC
lxylxy123456 Apr 21, 2022
64b4570
Revert "Replace #DB exception with monitor trap"
lxylxy123456 Apr 22, 2022
d6d3cea
Clean up for reverting monitor trap
lxylxy123456 Apr 22, 2022
611d3dd
Update for Circle CI
lxylxy123456 Apr 22, 2022
8331010
Store artifacts
lxylxy123456 Apr 22, 2022
02ab74d
Clean up code
lxylxy123456 Apr 22, 2022
3d1952a
Fix i386 Circle CI
lxylxy123456 Apr 22, 2022
7349014
Indentation
lxylxy123456 Apr 22, 2022
1a3f267
Update automated testing time
lxylxy123456 Apr 22, 2022
1e4548f
Add comments for hpt.c
lxylxy123456 Apr 24, 2022
0bd3d8c
Comment hpto.c and hpt.h
lxylxy123456 Apr 24, 2022
e8ed559
Add documentation for hptw.c
lxylxy123456 Apr 24, 2022
cb825af
Add a little bit documentation for hptw_emhf.c
lxylxy123456 Apr 24, 2022
cc6206e
Move all files to xmhf-64 folder
lxylxy123456 Apr 27, 2022
f89556b
Restore uberXMHF code (reverts 669ffe4253f6f6389c8217f64e8bdddde36ee394)
lxylxy123456 Apr 27, 2022
cdaa491
Convert markdown documentation to rST
lxylxy123456 Apr 27, 2022
80d7d9b
Remove docs in source code directory (reverts 9bea8ffeef5b86f38430727…
lxylxy123456 Apr 27, 2022
53e6adb
Add .gitignore for docs/
lxylxy123456 Apr 28, 2022
d9eca96
Remove lockdown (not supported in xmhf-64)
lxylxy123456 Apr 28, 2022
6d778e0
Copy documentation from pc-legacy-x86_32
lxylxy123456 Apr 28, 2022
2ee7793
Update documentation
lxylxy123456 Apr 28, 2022
eb08025
Rename rst file
lxylxy123456 Apr 28, 2022
3457c99
Remove lockdown documentation
lxylxy123456 Apr 28, 2022
007ab17
Remove nmm_*_gpaddr() functions
lxylxy123456 Apr 29, 2022
73bd018
Use debugfs to install XMHF in CI testing
lxylxy123456 Apr 29, 2022
2915cb7
Force add ignored files
lxylxy123456 Apr 29, 2022
3c79344
Update Circle CI test script
lxylxy123456 Apr 29, 2022
a830c3a
Remove unnecessary files
lxylxy123456 Apr 29, 2022
e61506a
Use debugfs -f
lxylxy123456 Apr 29, 2022
18ecd86
Prevent commands containing paths in debugfs
lxylxy123456 Apr 29, 2022
85f436e
Merge branch 'xmhf64' into HEAD
lxylxy123456 Apr 29, 2022
dac5ff8
Add a list of features and bugs
lxylxy123456 Apr 30, 2022
e995b81
Implement microcode update
lxylxy123456 Apr 30, 2022
d0f2be0
Enable ucode in CI
lxylxy123456 Apr 30, 2022
b9c1f1d
Merge branch 'xmhf64' into uberxmhf-merge
lxylxy123456 Apr 30, 2022
19eff80
Update docs for microcode update
lxylxy123456 Apr 30, 2022
ee71c12
Fix typo in lds file
lxylxy123456 Apr 30, 2022
7bccee1
Merge branch 'xmhf64' into uberxmhf-merge
lxylxy123456 Apr 30, 2022
a3ab249
Fix bug in build.sh
lxylxy123456 May 1, 2022
560c74c
Remove UNIX execute bit for non-executable files
lxylxy123456 May 2, 2022
829ca01
Merge branch 'xmhf64' into uberxmhf-merge
lxylxy123456 May 2, 2022
d2bd1d0
Bug in 32-bit XMHF secureloader: gdt_base not converted to sla
lxylxy123456 May 2, 2022
453a15c
Merge branch 'xmhf64' into uberxmhf-merge
lxylxy123456 May 2, 2022
ca07e6b
Ignore .sha1 files
lxylxy123456 May 3, 2022
83e0d44
Merge branch 'xmhf64' into uberxmhf-merge
lxylxy123456 May 3, 2022
15eab16
Move list of features and bugs in CHANGELOG.md
lxylxy123456 May 3, 2022
f844baf
Add execution bit back to lockdown files (to make sure the PR does no…
lxylxy123456 May 3, 2022
dcc7462
Remove xmhf-64/hypapps/verify
lxylxy123456 May 6, 2022
b44b19f
Update docs for supported OS, QEMU install and debug
lxylxy123456 May 6, 2022
2133e36
Remove the verification folder
lxylxy123456 May 6, 2022
30bc098
Move hidden CI folders to xmhf-64/tools
lxylxy123456 May 6, 2022
2634f09
Remove binary files
lxylxy123456 May 6, 2022
52036eb
Add sample QEMU commands
lxylxy123456 May 7, 2022
7a9cb2f
Documentation changes
lxylxy123456 May 23, 2022
da0f721
More documentation changes
lxylxy123456 May 23, 2022
aee91e0
Add sudo to update-grub
lxylxy123456 May 26, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
57 changes: 56 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,61 @@

## Changelog

* Version 6.2.0

* Features
* xmhf-64: initial commit, copied from xmhf
* xmhf-64: fix compile errors found in high GCC version
* xmhf-64: support running XMHF in 64-bit mode
* xmhf-64: support continuous integration testing
* xmhf-64: support running XMHF in QEMU
* xmhf-64: support running XMHF with modern guest operating systems
* xmhf-64: support running guests that use PAE paging
* xmhf-64: provide ``pal_demo``, which compiles TrustVisor PALs in
Windows and Linux, without using linker scripts
* xmhf-64: decrease compilation artifact size (e.g. object files)
* xmhf-64: support optimized compile (e.g. ``-O3``)
* xmhf-64: support DMAP in Intel
* xmhf-64: allow the guest OS to change MTRR
* xmhf-64: support x2APIC
* xmhf-64: support Intel microcode update

* Bug fixes
* xmhf-64: check `grube820list_numentries` in `dealwithE820()` to
prevent possible buffer overflow
* xmhf-64: fix Makefile dependencies problems
* xmhf-64: fix unsigned overflow in `udelay()`. This bug causes sleep
to be shorter than expected
* xmhf-64: fix the CR0 intercept handler
* xmhf-64: fix WRMSR intercept handler when MSR comes from
`vmx_msr_area_msrs`. This bug leads to unexpected values read by the
guest
* xmhf-64: block guests' access to x2APIC. This bug may allow guests to
to send INIT to a CPU
* xmhf-64: fix incorrect assert in hpt.c for long mode paging. This bug
is on a code path that is likely unused by 32-bit guests
* xmhf-64: fix logic in NMI quiesce handling. This bug can cause
deadlock and lose of guest NMIs
* xmhf-64: fix the problem that `HALT()` does not halt forever. This
bug can cause troubles during debugging
* xmhf-64: fix the problem that the last entry of E820 is dropped
* xmhf-64: unset CR4.VMXE, which is incorrectly set
* xmhf-64: fix logic in booting, which causes problems for single CPU
machines
* xmhf-64: fix guest initial state (e.g. DX, CR0, ...)
* xmhf-64: truncate RSP in `_vmx_int15_handleintercept()`
* xmhf-64: fix incorrect assumption about default MTRR type. This bug
causes strange cache errors in Windows 10
* xmhf-64: block guests' change to MTRRs. This bug allows guests to
change host's memory cache settings
* xmhf-64: block guest microcode update. This bug allows guests to
update microcode arbitrarily
* xmhf-64: fix NULL pointer reference in the VGA driver. This bug is on
a code path that only happens when debugging
* xmhf-64: fix incorrect use of .fill in `xmhf_xcphandler_idt_start()`.
This bug leads to less area allocated for IDT than expected
* xmhf-64: remove two unused nmm functions that may contain bugs

* Version 6.1.0

* Features
Expand Down Expand Up @@ -153,4 +208,4 @@

* Version 0.1
* Initial Release


3 changes: 3 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/_build
/_temp
/_themes
13 changes: 13 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,19 @@ framework and associated components.
rpi3-cortex_a53-armv8_32/debugging


.. toctree::
:maxdepth: 2
:caption: PC Intel x86 64-bit:

pc-intel-x86_64/introduction
pc-intel-x86_64/hw-requirements
pc-intel-x86_64/supported-os
pc-intel-x86_64/build
pc-intel-x86_64/installing
pc-intel-x86_64/debugging
pc-intel-x86_64/uberapp-trustvisor


.. toctree::
:maxdepth: 2
:caption: Legacy PC AMD/Intel x86 32-bit:
Expand Down
241 changes: 241 additions & 0 deletions docs/pc-intel-x86_64/build.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,241 @@
.. include:: /macros.rst

.. _pc-intel-x86_64-building:

Building
========

uberXMHF (pc-intel-x86_64) and uberapps (e.g., :doc:`TrustVisor </pc-intel-x86_64/uberapp-trustvisor>`\ ) get built
in a Linux environment with
a recent version of gcc. uberXMHF (pc-intel-x86_64) has been verified to
build on Debian 11 and Fedora 35, both 32 and 64 bit.

It is also possible to build uberXMHF in docker. The ``debian:11`` Docker tag is known to work.

Build tools
-----------

A (partial) list of packages to install on Ubuntu / Debian:

.. code-block:: bash

aptitude install pbuilder texinfo ruby build-essential autoconf libtool

A (partial) list of packages to install on Fedora:

.. code-block:: bash

dnf install autoconf automake make gcc
# The next line installs fallocate, which is recommended
dnf install util-linux

On 64-bit Debian, you will also need to install 32-bit libraries:

.. code-block:: bash

aptitude install build-essential crossbuild-essential-i386

On 32-bit Debian, to compile XMHF in 64-bit, install 64-bit cross compiler:

.. code-block:: bash

apt-get install build-essential crossbuild-essential-amd64

High-level Build Summary
------------------------

One "drives" the build from the root directory of uberXMHF (pc-intel-x86_64):

The interesting high-level build commands include:

.. code-block:: bash

./autogen.sh # creates ./configure
./configure # creates Makefile from Makefile.in
make # builds the selected hypapp and the XMHF core
make install # installs binaries
make install-dev # (hypapp specific) installs dev headers and libs
make test # (hypapp specific) runs various automated tests
make clean # cleanup
make htmldoc # generates the HTML documentation you are reading in the `./doc` sub-folder


The functioning of ``make install-dev`` and ``make test`` are
uberapp-specific. For example, in the TrustVisor uberapp, the primary prerequisite
for tee-sdk and PAL development is having successfully run
``make install-dev``.

How do I build a uberXMHF (pc-intel-x86_64) uberapp?
-----------------------------------------------------

The method for building different uberapps (e.g., TrustVisor) is by specifying
which uberapp to build using ``./configure``.
The following describes the sequence of steps for building a
uberXMHF (pc-intel-x86_64) uberapp using the helloworld
uberapp as a running example.

Change working directory to the uberXMHF (pc-intel-x86_64) root directory.

.. code-block:: bash

cd ./xmhf-64


Generate the ``./configure`` script.

.. code-block:: bash

./autogen.sh


Configure the uberXMHF (pc-intel-x86_64) uberapp (see below for the
``--with-target-subarch=`` configuration option).

.. code-block:: bash

./configure --with-approot=hypapps/helloworld --with-target-subarch=...


Generate and install the binaries:

.. code-block:: bash

make
make install
make install-dev # optional (hypapp-specific)
make test # optional (hypapp-specific)


To use multiple processors on the compiling machine, try ``make -j $(nproc)``.

Note that ``make install`` is only useful if the development system and
the target system (on which uberXMHF (pc-intel-x86_64) is installed) are
the same. If not,
you will need to manually copy the files ``./xmhf/init-x86.bin``
and ``./xmhf/hypervisor-x86.bin.gz`` to the ``/boot`` folder of the
target system (see :doc:`Installing uberXMHF (pc-intel-x86_64) </pc-intel-x86_64/installing>` ).

Build configuration options
---------------------------

Mandatory arguments
^^^^^^^^^^^^^^^^^^^

*
--with-approot=[UBERAPP_PATH], specifies the uberapp source root; must be provided

*
--with-target-subarch=[TARGET_SUBARCH], specify which subarch of uberXMHF to
build (32-bit or 64-bit); must be provided

*
When building 32-bit uberXMHF on 32-bit Debian or Fedora:
``--with-target-subarch=i386``
*
When building 64-bit uberXMHF on 32-bit Debian:
``--with-target-subarch=amd64 CC=x86_64-linux-gnu-gcc LD=x86_64-linux-gnu-ld``
*
When building 64-bit uberXMHF on 32-bit Fedora:
``--with-target-subarch=amd64``
*
When building 32-bit uberXMHF on 64-bit Debian:
``--with-target-subarch=i386 CC=i686-linux-gnu-gcc LD=i686-linux-gnu-ld``
*
When building 32-bit uberXMHF on 64-bit Fedora:
``--with-target-subarch=i386``
*
When building 64-bit uberXMHF on 64-bit Debian or Fedora:
``--with-target-subarch=amd64``
*
If these argument is not added correctly, an error message like
``ld: cannot find -lgcc`` may appear when building.

*
--with-target-platform=[PLATFORM], specifies the target platform for the build;
optional, current options are: x86pc (x86 hardware virtualized platforms, default)

*
--with-target-arch=[ARCH], specifies the target CPU architecture;
optional, current options are: x86vmx (Intel, default)

Recommended arguments
^^^^^^^^^^^^^^^^^^^^^

*
--enable-debug-symbols, adds debug info to generated ELF files. With this
configuration, GDB can print symbols in ``*.exe`` files.

*
--disable-drt, disables Dynamic Root-of-Trust (DRT); optional, useful for builds
targeting platforms without support for DRT and/or TPM

*
--disable-dmap, disables DMA protection; optional, useful for builds targeting
platforms without DMA protection capabilities

*
--with-amd64-max-phys-addr=[MAX_PHYS_ADDR], configures maximum physical
address (in bytes) supported by 64-bit uberXMHF

*
For example, ``--with-amd64-max-phys-addr=0x140000000`` sets physical
address to 5 GiB. The default is 16 GiB. When XMHF runs on a machine that
has more physical memory than this value, XMHF will halt. This
configuration is ignored in i386 XMHF

*
--enable-update-intel-ucode, allows the guest to perform microcode update

Other arguments
^^^^^^^^^^^^^^^

*
--disable-debug-serial --enable-debug-vga, print debug messages on VGA, not
serial port. This is useful for builds targeting platforms without serial
ports

*
--with-opt=[COMPILER_FLAGS], compiles XMHF with optimization. For example,
``--with-opt='-O3 -Wno-stringop-overflow'`` adds ``-O3`` and
``-Wno-stringop-overflow`` to GCC's arguments to compile in optimization
``-O3``. As of writing of this documentation, ``-Wno-stringop-overflow`` is
needed due to a `bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105100>`_
in GCC:

*
--enable-optimize-nested-virt, enables some risky optimizations in intercept
handling

*
When running XMHF under many levels of nested virtualization, VMREAD and
VMWRITE instructions become expensive. This configuration enables
manually optimized intercept handling for some cases to prevent XMHF from
running too slow to boot the guest OS. However, these optimizations need
to be manually maintained and may be incorrect.

Configuration examples
^^^^^^^^^^^^^^^^^^^^^^

``xmhf-64/.github/build.sh`` can be used to generate configuration options. It
automatically detects the compiling machine's bit size and can be especially
helpful to figure out cross-compile options. See comments at the start of this
file. The following will print sample configuration commands:

.. code-block:: bash

./.github/build.sh i386 release -n
./.github/build.sh amd64 release -n

Other examples:

.. code-block:: bash

# Build i386 XMHF on i386 Ubuntu, without DRT and DMAP
./configure --with-approot=hypapps/trustvisor --disable-dmap --disable-drt

# Build i386 on amd64 Debian
./configure --with-approot=hypapps/trustvisor --enable-debug-symbols --enable-debug-qemu CC=i686-linux-gnu-gcc LD=i686-linux-gnu-ld

# Build amd64 on amd64 Debian, with 8 GiB memory, and use VGA instead of serial
./configure --with-approot=hypapps/trustvisor --with-target-subarch=amd64 --enable-debug-symbols --enable-debug-qemu --with-amd64-max-phys-addr=0x200000000 --disable-debug-serial --enable-debug-vga

Loading