読者です 読者をやめる 読者になる 読者になる

BHyVeビルドめも7

BHyVe DragonFlyBSD

φ(.. )メモシテオコウ vmcs.cからvmcs.o作成キタ━(゜∀゜)━! ということで、vmcs.cのコンパイルが通った訳です。diffはこちら

done:
まずは無いって言われたsys/pcpu.hですが、これは特に使う必要なかったのでサクッと削除。

次にFreeBSDだとcurcpuが今動いているcpuの番号だと思うんですが、dbsdでこれに該当するmycpuidを使うためにmachine/thread.hをインクルード。
そういえば、machine/foo.hのmachineって、/usr/src/sys/platform//includeだけじゃなくて、/usr/src/sys/cpu//includeも見るんですね。

そして、r_idtの代わりにr_idt_arr。これはdbsdだと配列になっているのでr_idt_arr[mycpuid].rd_baseする感じになってます。
最後にddb用のコマンド(db_show_vmcs)ですが、これはコンパイルエラーがとれなかったので諦めてifdefで消しましたorz まあ、デバッグ用のものなのでとりあえずは良いかなと。

todo:
次はvmx.cですねぇ。最初のほうのエラーはヘッダが読めてないようなのでそれを直すのですかね。printfとかmallocはたんにkprintfとかkmallocに置き換えるだけで良いはずだけど他のはどうすかね(´ε`;)ウーン…

--------------------------------------------------------------
>>> Kernel build for BHYVE started on Tue Jul  3 21:15:47 JST 2012
--------------------------------------------------------------
===> BHYVE
cd /usr/src/sys/config;  PATH=/usr/obj/usr/src/ctools_x86_64_x86_64/usr/sbin:/usr/obj/usr/src/ctools_x86_64_x86_64/usr/bin:/usr/obj/usr/src/ctools_x86_64_x86_64/bin:/usr/obj/usr/src/ctools_x86_64_x86_64/usr/games:/usr/obj/usr/src/btools_x86_64/usr/sbin:/usr/obj/usr/src/btools_x86_64/usr/bin:/usr/obj/usr/src/btools_x86_64/bin:/usr/obj/usr/src/btools_x86_64/usr/games:/usr/pkg/bin  config  -d /usr/obj/usr/src/sys/BHYVE  /usr/src/sys/config/BHYVE
Kernel build directory is /usr/obj/usr/src/sys/BHYVE
cd /usr/obj/usr/src/sys/BHYVE;  MAKEOBJDIRPREFIX=/usr/obj/usr/src/world_x86_64  OBJTREE=/usr/obj  MACHINE_ARCH=x86_64  MACHINE=x86_64  MACHINE_PLATFORM=pc64  OBJFORMAT_PATH=/usr/obj/usr/src/ctools_x86_64_x86_64  HOST_CCVER=gcc44  CCVER=gcc44  BINUTILSVER=binutils221  DESTDIR=/usr/obj/usr/src/world_x86_64  INSTALL="sh /usr/src/tools/install.sh"  PATH=/usr/obj/usr/src/ctools_x86_64_x86_64/usr/sbin:/usr/obj/usr/src/ctools_x86_64_x86_64/usr/bin:/usr/obj/usr/src/ctools_x86_64_x86_64/bin:/usr/obj/usr/src/ctools_x86_64_x86_64/usr/games:/usr/obj/usr/src/btools_x86_64/usr/sbin:/usr/obj/usr/src/btools_x86_64/usr/bin:/usr/obj/usr/src/btools_x86_64/bin:/usr/obj/usr/src/btools_x86_64/usr/games:/usr/pkg/bin make KERNEL=kernel all
cc -c -O -pipe  -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes  -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -Wold-style-definition -std=c99 -Wold-style-declaration -g -nostdinc -I. -Iinclude -I/usr/src/sys -I/usr/src/sys/../include -I/usr/obj/usr/src/sys/BHYVE -I"/usr/src/sys/dev/acpica5" -I"/usr/src/sys/contrib/dev/acpica-unix/include" -I/usr/src/sys/dev/netif/ath/hal -I/usr/src/sys/dev/netif/ath/hal/ath_hal  -D_KERNEL -include opt_global.h  -finline-limit=8000 --param inline-unit-growth=100 --param large-function-growth=1000 -fno-common -ffreestanding -mpreferred-stack-boundary=4 -fno-stack-protector -mcmodel=kernel -mno-red-zone -mfpmath=387 -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -mno-sse4 -mno-sse4a  -mno-sse5 -mno-abm -mno-aes -mno-avx -mno-pclmul -mno-popcnt -msoft-float -fno-asynchronous-unwind-tables -fno-omit-frame-pointer  /usr/src/sys/platform/pc64/vmm/intel/vmcs.c -Werror
cc -c -O -pipe  -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes  -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -Wold-style-definition -std=c99 -Wold-style-declaration -g -nostdinc -I. -Iinclude -I/usr/src/sys -I/usr/src/sys/../include -I/usr/obj/usr/src/sys/BHYVE -I"/usr/src/sys/dev/acpica5" -I"/usr/src/sys/contrib/dev/acpica-unix/include" -I/usr/src/sys/dev/netif/ath/hal -I/usr/src/sys/dev/netif/ath/hal/ath_hal  -D_KERNEL -include opt_global.h  -finline-limit=8000 --param inline-unit-growth=100 --param large-function-growth=1000 -fno-common -ffreestanding -mpreferred-stack-boundary=4 -fno-stack-protector -mcmodel=kernel -mno-red-zone -mfpmath=387 -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -mno-sse4 -mno-sse4a  -mno-sse5 -mno-abm -mno-aes -mno-avx -mno-pclmul -mno-popcnt -msoft-float -fno-asynchronous-unwind-tables -fno-omit-frame-pointer  /usr/src/sys/platform/pc64/vmm/intel/vmx.c -Werror
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:36:22: error: sys/pcpu.h: No such file or directory
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:53:23: error: vmm_lapic.h: No such file or directory
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:54:21: error: vmm_msr.h: No such file or directory
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:55:21: error: vmm_ktr.h: No such file or directory
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:56:22: error: vmm_stat.h: No such file or directory
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:62:17: error: x86.h: No such file or directory
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:119: error: array type has incomplete element type
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:158: error: expected ')' before string constant
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:159: error: expected ')' before string constant
/usr/src/sys/platform/pc64/vmm/intel/vmx.c: In function 'vmx_disable':
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:390: error: 'curcpu' undeclared (first use in this function)
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:390: error: (Each undeclared identifier is reported only once
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:390: error: for each function it appears in.)
/usr/src/sys/platform/pc64/vmm/intel/vmx.c: In function 'vmx_enable':
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:421: error: 'curcpu' undeclared (first use in this function)
cc1: warnings being treated as errors
/usr/src/sys/platform/pc64/vmm/intel/vmx.c: In function 'vmx_init':
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:436: error: implicit declaration of function 'printf'
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:436: error: nested extern declaration of 'printf'
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:501: error: implicit declaration of function 'guest_msr_valid'
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:501: error: nested extern declaration of 'guest_msr_valid'
/usr/src/sys/platform/pc64/vmm/intel/vmx.c: In function 'vmx_vminit':
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:646: error: implicit declaration of function 'malloc'
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:646: error: nested extern declaration of 'malloc'
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:646: error: assignment makes pointer from integer without a cast
/usr/src/sys/platform/pc64/vmm/intel/vmx.c: In function 'vmx_handle_cpuid':
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:750: error: implicit declaration of function 'x86_emulate_cpuid'
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:750: error: nested extern declaration of 'x86_emulate_cpuid'
/usr/src/sys/platform/pc64/vmm/intel/vmx.c: In function 'vmx_set_pcpu_defaults':
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:793: error: 'curcpu' undeclared (first use in this function)
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:800: error: implicit declaration of function 'vmm_stat_incr'
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:800: error: nested extern declaration of 'vmm_stat_incr'
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:800: error: 'VCPU_MIGRATIONS' undeclared (first use in this function)
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:802: error: implicit declaration of function 'PCPU_GET'
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:802: error: nested extern declaration of 'PCPU_GET'
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:802: error: 'tssp' undeclared (first use in this function)
/usr/src/sys/platform/pc64/vmm/intel/vmx.c: In function 'vmx_inject_nmi':
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:929: error: implicit declaration of function 'VMM_CTR0'
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:929: error: nested extern declaration of 'VMM_CTR0'
/usr/src/sys/platform/pc64/vmm/intel/vmx.c: In function 'vmx_inject_interrupts':
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:975: error: implicit declaration of function 'lapic_pending_intr'
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:975: error: nested extern declaration of 'lapic_pending_intr'
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:1006: error: implicit declaration of function 'lapic_intr_accepted'
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:1006: error: nested extern declaration of 'lapic_intr_accepted'
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:1008: error: implicit declaration of function 'VMM_CTR1'
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:1008: error: nested extern declaration of 'VMM_CTR1'
/usr/src/sys/platform/pc64/vmm/intel/vmx.c: In function 'vmx_exit_process':
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:1124: error: implicit declaration of function 'emulate_rdmsr'
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:1124: error: nested extern declaration of 'emulate_rdmsr'
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:1134: error: implicit declaration of function 'emulate_wrmsr'
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:1134: error: nested extern declaration of 'emulate_wrmsr'
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:1170: error: 'VMEXIT_EXTINT' undeclared (first use in this function)
/usr/src/sys/platform/pc64/vmm/intel/vmx.c: In function 'vmx_run':
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:1266: error: implicit declaration of function 'lapic_timer_tick'
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:1266: error: nested extern declaration of 'lapic_timer_tick'
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:1312: error: 'TDF_ASTPENDING' undeclared (first use in this function)
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:1315: error: implicit declaration of function 'enable_intr'
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:1315: error: nested extern declaration of 'enable_intr'
/usr/src/sys/platform/pc64/vmm/intel/vmx.c: In function 'vmx_vmcleanup':
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:1375: error: implicit declaration of function 'free'
/usr/src/sys/platform/pc64/vmm/intel/vmx.c:1375: error: nested extern declaration of 'free'
*** Error code 1

Stop in /usr/obj/usr/src/sys/BHYVE.
*** Error code 1

Stop in /usr/src.
*** Error code 1

Stop in /usr/src.