ia64/xen-unstable

annotate tools/firmware/hvmloader/hvmloader.c @ 8708:f1b361b05bf3

Big merge the HVM full-virtualisation abstractions.

This changeset contains all differences between
xen-unstable.hg and xen-unstable-hvm.hg.

All information and comments for changesets unique to
xen-unstable-hvm.hg are included below.

Signed-off-by: Leendert van Doorn <leendert@watson.ibm.com>
Signed-off-by: Keir Fraser <keir@xensource.com>

> user: leendert@eserver2.watson.ibm.com
> date: Tue Jan 31 04:29:51 2006 -0400
> files: xen/include/asm-ia64/mm.h
> description:
> Fix ia64 compile.
>
> Signed-off-by: Leendert van Doorn <leendert@watson.ibm.com>
>
>
> user: leendert@eserver2.watson.ibm.com
> date: Tue Jan 31 02:21:49 2006 -0400
> files: xen/include/xen/domain_page.h
> description:
> Eliminate unused fields (pfn,va) warnings.
>
> Signed-Off-By: Leendert van Doorn <leendert@watson.ibm.com>
>
>
> user: leendert@eserver2.watson.ibm.com
> date: Fri Jan 27 04:31:44 2006 -0400
> files: tools/python/xen/xend/image.py
> description:
> Name cleanup. vmx refers to VT-x specific code, HVM is used for all others.
>
> Signed-off-by: Leendert van Doorn <leendert@watson.ibm.com>
>
>
> user: root@xen-trw1.amd.com
> date: Sun Jan 22 18:39:58 2006 -0500
> files: xen/arch/x86/hvm/platform.c
> description:
> support prefix 0x67 in hvm decode logic, gfxboot patch causes 0x67 prefix.
>
>
> user: twoller@xen-trw1.amd.com
> date: Sun Jan 22 18:35:59 2006 -0500
> files: xen/arch/x86/hvm/svm/svm.c xen/arch/x86/hvm/svm/vmcb.c xen/include/asm-x86/hvm/svm/svm.h
> description:
> check for valid shared_page_va/vmcb before deallocating in SVM.
>
>
> user: leendert@eserver2.watson.ibm.com
> date: Sun Jan 22 02:56:20 2006 -0400
> files: xen/include/asm-x86/hvm/svm/svm.h xen/include/asm-x86/hvm/svm/vmmcall.h
> description:
> Some SVM header file cleanups.
>
> Signed-off-by: Leendert van Doorn <leendert@watson.ibm.com>
>
>
> user: leendert@eserver2.watson.ibm.com
> date: Fri Jan 20 11:50:23 2006 -0400
> files: xen/arch/x86/domain.c
> description:
> Need to be more diligent about when to call into the HVM abstraction layer
> and when not.
>
> Signed-Off-By: Leendert van Doorn <leendert@watson.ibm.com>
>
>
> user: leendert@eserver2.watson.ibm.com
> date: Wed Jan 18 15:14:56 2006 -0400
> files: xen/arch/x86/hvm/svm/svm.c xen/arch/x86/hvm/svm/x86_32/exits.S xen/arch/x86/hvm/svm/x86_64/exits.S xen/arch/x86/hvm/vmx/x86_32/exits.S xen/arch/x86/hvm/vmx/x86_64/exits.S
> description:
> Added missing copyright statements and updated svm.c's copyright to properly
> reflect that it was derived from vmx.c.
>
> Signed-Off-By: Leendert van Doorn <leendert@watson.ibm.com>
>
>
> user: leendert@eserver2.watson.ibm.com
> date: Tue Jan 17 09:42:11 2006 -0400
> files: xen/arch/ia64/Makefile xen/arch/ia64/vmx/vlsapic.c xen/arch/ia64/vmx/vmx_init.c xen/include/asm-ia64/vmx_platform.h
> description:
> Make sure ia64 builds again with the new directory structure.
>
> Signed-off-by: Leendert van Doorn <leendert@watson.ibm.com>
>
>
> user: leendert@localhost.localdomain
> date: Tue Jan 17 08:28:51 2006 -0400
> files: xen/arch/x86/Makefile xen/arch/x86/hvm/i8259.c xen/arch/x86/hvm/vioapic.c
> description:
> The device models now belong in hvm.
>
> Signed-ff-by: Leendert van Doorn <leendert@watson.ibm.com>
>
>
> user: leendert@eserver2.watson.ibm.com
> date: Sun Jan 15 16:40:58 2006 -0400
> files: xen/arch/x86/Makefile xen/arch/x86/cpu/amd.c xen/arch/x86/cpu/intel.c xen/arch/x86/dm/hvm_vioapic.c xen/arch/x86/dm/i8259.c xen/arch/x86/dom0_ops.c xen/arch/x86/domain.c xen/arch/x86/hvm/hvm.c xen/arch/x86/hvm/intercept.c xen/arch/x86/hvm/io.c xen/arch/x86/hvm/platform.c xen/arch/x86/hvm/svm/emulate.c xen/arch/x86/hvm/svm/instrlen.c xen/arch/x86/hvm/svm/intr.c xen/arch/x86/hvm/svm/svm.c xen/arch/x86/hvm/svm/vmcb.c xen/arch/x86/hvm/svm/x86_32/exits.S xen/arch/x86/hvm/svm/x86_64/exits.S xen/arch/x86/hvm/vlapic.c xen/arch/x86/hvm/vmx/io.c xen/arch/x86/hvm/vmx/vmcs.c xen/arch/x86/hvm/vmx/vmx.c xen/arch/x86/hvm/vmx/x86_32/exits.S xen/arch/x86/hvm/vmx/x86_64/exits.S xen/arch/x86/i387.c xen/arch/x86/x86_32/entry.S xen/arch/x86/x86_32/traps.c xen/arch/x86/x86_64/entry.S xen/arch/x86/x86_64/traps.c xen/include/asm-x86/domain.h xen/include/asm-x86/hvm/domain.h xen/include/asm-x86/hvm/hvm.h xen/include/asm-x86/hvm/io.h xen/include/asm-x86/hvm/support.h xen/include/asm-x86/hvm/svm/emulate.h xen/include/asm-x86/hvm/svm/intr.h xen/include/asm-x86/hvm/svm/svm.h xen/include/asm-x86/hvm/svm/vmcb.h xen/include/asm-x86/hvm/svm/vmmcall.h xen/include/asm-x86/hvm/vcpu.h xen/include/asm-x86/hvm/vioapic.h xen/include/asm-x86/hvm/vlapic.h xen/include/asm-x86/hvm/vmx/cpu.h xen/include/asm-x86/hvm/vmx/vmcs.h xen/include/asm-x86/hvm/vmx/vmx.h xen/include/asm-x86/hvm/vpic.h xen/include/asm-x86/hvm/vpit.h xen/include/asm-x86/shadow.h
> description:
> As suggested by Keir, I restructured the hvm/vmx/svm tree. The new
> directory structure looks like:
>
> xen/arch/hvm/
> xen/arch/hvm/vmx
> xen/arch/hvm/vmx/x86_32
> xen/arch/hvm/vmx/x86_64
> xen/arch/hvm/svm
> xen/arch/hvm/svm/x86_32
> xen/arch/hvm/svm/x86_64
>
> xen/include/hvm/
> xen/include/hvm/vmx
> xen/include/hvm/svm
>
> Many files have been renamed and had their hvm_/vmx_/svm_ suffix removed
> because this is now clear from the directory where the file resides.
>
> Signed-off-by: Leendert van Doorn <leendert@watson.ibm.com>
>
>
> user: leendert@eserver2.watson.ibm.com
> date: Sat Jan 14 17:03:28 2006 -0400
> files: xen/arch/ia64/vmx/vlsapic.c xen/include/asm-ia64/vmx_platform.h
> description:
> Name change fix for ia64.
>
> Signed-off-by: Leendert van Doorn <leendert@watson.ibm.com>
>
>
> user: leendert@eserver2.watson.ibm.com
> date: Sat Jan 14 15:12:59 2006 -0400
> files: xen/arch/x86/dm/hvm_vioapic.c xen/arch/x86/dm/i8259.c xen/arch/x86/hvm.c xen/arch/x86/hvm_intercept.c xen/arch/x86/svm.c xen/arch/x86/svm_intr.c xen/arch/x86/svm_vmcb.c xen/arch/x86/vmx.c xen/arch/x86/vmx_io.c xen/arch/x86/vmx_vmcs.c xen/include/asm-x86/hvm_domain.h xen/include/asm-x86/hvm_vcpu.h
> description:
> Move VMX/SVM print buffer to hvm_domain.
>
> Cleanup variable names. The suffix hvm_ is redundant in hvm_domain.
>
> Signed-off-by: Leendert van Doorn <leendert@watson.ibm.com>
>
>
> user: twoller@xen-trw1.site
> date: Fri Jan 13 17:03:18 2006 -0500
> files: xen/arch/x86/svm.c
> description:
> remove unnecessary spin_unlock in asid_fetch code for svm.
>
>
> user: twoller@xen-trw1.site
> date: Wed Jan 11 20:00:36 2006 -0500
> files: xen/arch/x86/svm.c
> description:
> remove unneeded update_pagetables() during svm PF handling (resolved with ASID code rework).
>
>
> user: leendert@eserver2.watson.ibm.com
> date: Tue Jan 10 02:45:32 2006 -0400
> files: xen/arch/x86/hvm.c xen/arch/x86/vmx_io.c
> description:
> Factor out cpu_get_interrupt(). It is used by VMX and SVM.
>
> Signed-Off-By: Leendert van Doorn <leendert@watson.ibm.com>
>
>
> user: leendert@eserver2.watson.ibm.com
> date: Mon Jan 9 00:03:30 2006 -0400
> files: xen/arch/x86/hvm.c xen/arch/x86/svm.c xen/arch/x86/vmx.c xen/include/asm-x86/hvm_support.h xen/include/asm-x86/hvm_vcpu.h
> description:
> Introduce small print buffer per domain rather than a single global one.
>
> Signed-off-by: Leendert van Doorn <leendert@watson.ibm.com>
>
>
> user: leendert@eserver2.watson.ibm.com
> date: Sun Jan 8 23:07:12 2006 -0400
> files: xen/arch/x86/dom0_ops.c xen/include/asm-x86/hvm_support.h xen/include/public/arch-x86_32.h xen/include/public/arch-x86_64.h
> description:
> More cleanup. There is no point in distinguishing between SVM and VMX,
> a single HVM flag bit suffices.
>
> Signed-Off-By: Leendert van Doorn <leendert@watson.ibm.com>
>
>
> user: leendert@eserver2.watson.ibm.com
> date: Sun Jan 8 12:05:59 2006 -0400
> files: xen/arch/x86/svm.c xen/arch/x86/vmx.c
> description:
> Both VMX & SVM now print writes to the debug port (0xE9) on the console.
>
> Signed-off-by: Leendert van Doorn <leendert@watson.ibm.com>
>
>
> user: leendert@eserver2.watson.ibm.com
> date: Sat Jan 7 13:55:27 2006 -0400
> files: xen/arch/x86/svm.c xen/arch/x86/svm_intr.c xen/arch/x86/svm_vmcb.c xen/arch/x86/vmx.c xen/arch/x86/vmx_io.c xen/arch/x86/vmx_vmcs.c xen/arch/x86/x86_32/asm-offsets.c xen/arch/x86/x86_64/asm-offsets.c xen/include/asm-x86/domain.h xen/include/asm-x86/vmx.h
> description:
> Introduce shorthands to improve code legibility.
>
> Signed-Off-By: Leendert van Doorn <leendert@watson.ibm.com>
>
>
> user: leendert@eserver2.watson.ibm.com
> date: Wed Jan 4 06:12:10 2006 -0400
> files: tools/examples/xmexample.hvm
> description:
> Minor spelling mistakes.
>
> Signed-off-by: Leendert van Doorn <leendert@watson.ibm.com>
>
>
> user: leendert@eserver2.watson.ibm.com
> date: Wed Jan 4 03:37:55 2006 -0400
> files: xen/include/public/hvm/hvm_info_table.h xen/include/public/hvm/ioreq.h xen/include/public/hvm/vmx_assist.h
> description:
> Missed adding new files.
>
> Signed-off-by: Leendert van Doorn <leendert@watson.ibm.com>
>
>
> user: leendert@eserver2.watson.ibm.com
> date: Mon Jan 2 01:23:54 2006 -0400
> files: tools/debugger/libxendebug/xendebug.c tools/libxc/xc_hvm_build.c
> description:
> Finalize Xin Li's patch: vmx/svm_identify is no longer necessary.
> Xen debug should test for HVM instead of VMX.
>
> Signed-off-by: Leendert van Doorn <leendert@watson.ibm.com>
>
>
> user: twoller@xen-trw1.site
> date: Sun Jan 1 03:22:39 2006 -0500
> files: tools/ioemu/vl.c
> description:
> change hardcoded VTXEN to HVMXEN.
>
>
> user: leendert@eserver2.watson.ibm.com
> date: Sun Jan 1 02:22:47 2006 -0400
> files: tools/libxc/xc_hvm_build.c tools/python/xen/xend/image.py xen/arch/x86/domain.c
> description:
> Avoid xen crash if there is no VMX support. If a platform
> doesn't support VMX, creating VMX domain will crash xen
> HV.
>
> Signed-off-by: Xin Li <xin.b.li@intel.com>
> Signed-off-by: Leendert van Doorn <leendert@watson.ibm.com>
> [ vmx/svm_identify are still needed in hvm builder, but this may not
> really be necessary. I need to check this. - lvd ]
>
>
> user: twoller@xen-trw1.site
> date: Fri Dec 30 21:38:56 2005 -0500
> files: xen/arch/x86/svm.c xen/arch/x86/svm_vmcb.c xen/arch/x86/x86_32/entry.S xen/include/asm-x86/svm.h xen/include/asm-x86/svm_vmcb.h
> description:
> add multi-core support for guest ASIDs for SVM partitions.
>
>
> user: leendert@eserver2.watson.ibm.com
> date: Sun Dec 25 20:44:43 2005 -0400
> files: tools/firmware/vmxassist/head.S
> description:
> Make sure vmxassist still works in its debug environment.
>
> Signed-Off-By: Leendert van Doorn <leendert@watson.ibm.com>
>
>
> user: leendert@eserver2.watson.ibm.com
> date: Fri Dec 23 18:27:57 2005 -0400
> files: tools/libxc/xc_ia64_stubs.c
> description:
> Fixed libxc ia64, xend uses xc_hvm_build instead of xc_vmx_build.
>
> Signed-off-by: Leendert van Doorn <leendert@watson.ibm.com>
>
>
> user: twoller@xen-trw1.site
> date: Wed Dec 21 21:39:17 2005 -0500
> files: xen/arch/x86/svm_intr.c xen/arch/x86/svm_vmcb.c
> description:
> cleanup of svm specific code.
>
>
> user: leendert@eserver2.watson.ibm.com
> date: Wed Dec 21 17:18:25 2005 -0400
> files: tools/python/xen/xm/tests/test_create.py tools/xm-test/README
> description:
> Minor name cleanups. xm-test isn't VMX specific. Instead use HVM.
>
>
> user: twoller@xen-trw1.site
> date: Tue Dec 20 20:01:38 2005 -0500
> files: xen/arch/x86/svm_vmcb.c
> description:
> reword comments.
>
>
> user: twoller@xen-trw1.site
> date: Tue Dec 20 20:01:07 2005 -0500
> files: xen/arch/x86/svm_intr.c
> description:
> add additional VLAPIC delivery modes.
>
>
> user: twoller@xen-trw1.site
> date: Tue Dec 20 20:00:22 2005 -0500
> files: xen/arch/x86/svm.c
> description:
> reformat misaligned code.
>
>
> user: twoller@xen-trw1.site
> date: Tue Dec 20 19:59:37 2005 -0500
> files: xen/arch/x86/svm.c
> description:
> Add additional AMD SVM specific CPUID logic.
>
>
> user: leendert@eserver2.watson.ibm.com
> date: Thu Dec 15 03:06:15 2005 -0400
> files: tools/xm-test/tests/block-create/01_block_attach_device_pos.py tools/xm-test/tests/block-create/02_block_attach_file_device_pos.py tools/xm-test/tests/block-create/04_block_attach_device_repeatedly_pos.py tools/xm-test/tests/block-create/05_block_attach_and_dettach_device_repeatedly_pos.py tools/xm-test/tests/block-create/06_block_attach_baddomain_neg.py tools/xm-test/tests/block-create/07_block_attach_baddevice_neg.py tools/xm-test/tests/block-create/08_block_attach_bad_filedevice_neg.py tools/xm-test/tests/block-create/09_block_attach_and_dettach_device_check_data_pos.py tools/xm-test/tests/block-create/10_block_attach_dettach_multiple_devices.py tools/xm-test/tests/block-create/11_block_attach_shared_dom0.py tools/xm-test/tests/block-create/12_block_attach_shared_domU.py tools/xm-test/tests/block-destroy/01_block-destroy_btblock_pos.py tools/xm-test/tests/block-destroy/02_block-destroy_rtblock_pos.py tools/xm-test/tests/block-destroy/04_block-destroy_nonattached_neg.py tools/xm-test/tests/block-destroy/05_block-destroy_byname_pos.py tools/xm-test/tests/block-destroy/06_block-destroy_check_list_pos.py tools/xm-test/tests/block-list/01_block-list_pos.py tools/xm-test/tests/block-list/02_block-list_attachbd_pos.py tools/xm-test/tests/block-list/03_block-list_anotherbd_pos.py tools/xm-test/tests/block-list/04_block-list_nodb_pos.py tools/xm-test/tests/block-list/06_block-list_checkremove_pos.py tools/xm-test/tests/memmax/01_memmax_badparm_neg.py tools/xm-test/tests/memset/01_memset_basic_pos.py tools/xm-test/tests/memset/02_memset_badparm_neg.py tools/xm-test/tests/memset/03_memset_random_pos.py tools/xm-test/tests/memset/04_memset_smallmem_pos.py tools/xm-test/tests/migrate/01_migrate_localhost_pos.py tools/xm-test/tests/network-attach/01_network_attach_pos.py tools/xm-test/tests/network-attach/02_network_attach_detach_pos.py tools/xm-test/tests/network-attach/03_network_attach_detach_multiple_pos.py tools/xm-test/tests/restore/01_restore_basic_pos.py tools/xm-test/tests/restore/02_restore_badparm_neg.py tools/xm-test/tests/restore/03_restore_badfilename_neg.py tools/xm-test/tests/restore/04_restore_withdevices_pos.py tools/xm-test/tests/save/01_save_basic_pos.py tools/xm-test/tests/save/02_save_badparm_neg.py tools/xm-test/tests/save/03_save_bogusfile_neg.py tools/xm-test/tests/sysrq/01_sysrq_basic_neg.py tools/xm-test/tests/sysrq/02_sysrq_sync_pos.py tools/xm-test/tests/sysrq/03_sysrq_withreboot_pos.py
> description:
> Adding SKIP() to tests that aren't supported for VMX domains.
>
> Signed-off-by: Dan Stekloff <dsteklof@us.ibm.com>
> Signed-off-by: Leendert van Doorn <leendert@watson.ibm.com>
>
>
> user: leendert@eserver2.watson.ibm.com
> date: Tue Dec 13 22:43:47 2005 -0400
> files: xen/arch/x86/svm.c xen/arch/x86/vmx.c xen/arch/x86/vmx_io.c xen/include/asm-x86/hvm_vpit.h xen/include/asm-x86/msr.h
> description:
> Support VMX guest accesses to IA32_TIME_STAMP_COUNTER MSR.
>
> Signed-off-by: Haifeng Xue <haifeng.xue@intel.com>
> Signed-off-by: Leendert van Doorn <leendert@us.ibm.com>
>
>
> user: twoller@xen-trw1.site
> date: Tue Dec 13 19:49:53 2005 -0500
> files: xen/arch/x86/svm.c xen/arch/x86/svm_emulate.c xen/arch/x86/svm_instrlen.c xen/arch/x86/svm_intr.c xen/arch/x86/svm_vmcb.c xen/include/asm-x86/svm.h xen/include/asm-x86/svm_emulate.h xen/include/asm-x86/svm_intr.h xen/include/asm-x86/svm_vmcb.h xen/include/asm-x86/svm_vmmcall.h
> description:
> Add SVM base files to repository.
>
>
> user: twoller@xen-trw1.site
> date: Tue Dec 13 19:49:02 2005 -0500
> files: xen/arch/x86/x86_32/entry.S xen/arch/x86/x86_64/entry.S
> description:
> Add SVM entry points for launch/resume.
>
>
> user: twoller@xen-trw1.site
> date: Tue Dec 13 19:47:38 2005 -0500
> files: .hgignore
> description:
> Add hvmloader files to ignore list.
>
>
> user: leendert@eserver2.watson.ibm.com
> date: Mon Dec 12 22:58:54 2005 -0400
> files: docs/src/user.tex tools/firmware/README xen/include/asm-x86/hvm.h
> description:
> Removed dirty words (by request).
>
>
> user: leendert@eserver2.watson.ibm.com
> date: Mon Dec 12 05:48:22 2005 -0400
> files: tools/firmware/hvmloader/mkhex
> description:
> Fix file mode.
>
> Signed-off-by: Leendert van Doorn <leendert@watson.ibm.com>
>
>
> user: leendert@eserver2.watson.ibm.com
> date: Mon Dec 12 04:50:42 2005 -0400
> files: xen/Rules.mk xen/arch/x86/cpu/amd.c xen/arch/x86/cpu/intel.c xen/arch/x86/dm/hvm_vioapic.c xen/arch/x86/dm/i8259.c xen/arch/x86/dom0_ops.c xen/arch/x86/domain.c xen/arch/x86/hvm.c xen/arch/x86/hvm_intercept.c xen/arch/x86/hvm_io.c xen/arch/x86/hvm_platform.c xen/arch/x86/hvm_vlapic.c xen/arch/x86/mpparse.c xen/arch/x86/shadow.c xen/arch/x86/vmx.c xen/arch/x86/vmx_io.c xen/arch/x86/vmx_vmcs.c xen/arch/x86/x86_32/asm-offsets.c xen/arch/x86/x86_32/entry.S xen/arch/x86/x86_64/asm-offsets.c xen/arch/x86/x86_64/entry.S xen/arch/x86/x86_64/mm.c xen/include/asm-x86/config.h xen/include/asm-x86/cpufeature.h xen/include/asm-x86/domain.h xen/include/asm-x86/hvm_domain.h xen/include/asm-x86/hvm_io.h xen/include/asm-x86/hvm_support.h xen/include/asm-x86/hvm_vcpu.h xen/include/asm-x86/hvm_vioapic.h xen/include/asm-x86/hvm_vlapic.h xen/include/asm-x86/hvm_vpic.h xen/include/asm-x86/hvm_vpit.h xen/include/asm-x86/mpspec.h xen/include/asm-x86/msr.h xen/include/asm-x86/processor.h xen/include/asm-x86/vmx.h xen/include/asm-x86/vmx_cpu.h xen/include/asm-x86/vmx_vmcs.h
> description:
> Phase 3 of HVM integration: This patchset introduces the refactoring of
> virtualization architecture independent functions from specific ones.
>
>
> user: leendert@eserver2.watson.ibm.com
> date: Sun Dec 11 07:02:51 2005 -0400
> files: xen/arch/x86/dom0_ops.c xen/arch/x86/domain.c xen/arch/x86/i387.c xen/arch/x86/shadow.c xen/arch/x86/vmx.c xen/arch/x86/x86_32/traps.c xen/arch/x86/x86_64/traps.c xen/include/asm-x86/hvm.h xen/include/asm-x86/hvm_support.h xen/include/asm-x86/regs.h xen/include/asm-x86/shadow.h xen/include/asm-x86/vmx_vmcs.h
> description:
> Phase 2 of HVM integration: This patchset introduces the hvm interface
> to the hypervisor and modifies all the non-vmx specific files to use it.
>
>
> user: leendert@eserver2.watson.ibm.com
> date: Sun Dec 11 01:10:00 2005 -0400
> files: tools/examples/Makefile tools/examples/README tools/examples/xmexample.hvm tools/ioemu/exec-all.h tools/ioemu/hw/i8254.c tools/ioemu/hw/i8259.c tools/ioemu/monitor.c tools/ioemu/target-i386-dm/helper2.c tools/ioemu/vl.c tools/libxc/Makefile tools/libxc/xc_hvm_build.c tools/libxc/xc_ptrace.c tools/libxc/xc_ptrace_core.c tools/libxc/xenguest.h tools/python/xen/lowlevel/xc/xc.c tools/python/xen/xend/image.py tools/python/xen/xm/create.py tools/xm-test/configure.ac tools/xm-test/lib/XmTestLib/XenDomain.py tools/xm-test/lib/XmTestLib/config.py.in tools/xm-test/ramdisk/Makefile.am tools/xm-test/ramdisk/bin/create_disk_image tools/xm-test/tests/block-list/04_block-list_nodb_pos.py xen/include/public/arch-x86_32.h xen/include/public/arch-x86_64.h
> description:
> Phase 1 of HVM integration: This patchset updates the tools. Most of the
> tools are machine independent except for some detection code in the hvm
> domain builder.
author kaf24@firebug.cl.cam.ac.uk
date Tue Jan 31 11:49:51 2006 +0100 (2006-01-31)
parents
children ae245d35457b
rev   line source
kaf24@8708 1 /*
kaf24@8708 2 * hvmloader.c: HVM ROMBIOS/VGABIOS/ACPI/VMXAssist image loader.
kaf24@8708 3 *
kaf24@8708 4 * A quicky so that we can boot rom images as if they were a Linux kernel.
kaf24@8708 5 * This code will copy the rom images (ROMBIOS/VGABIOS/VM86) into their
kaf24@8708 6 * respective spaces and transfer control to VM86 to execute the BIOSes.
kaf24@8708 7 *
kaf24@8708 8 * Leendert van Doorn, leendert@watson.ibm.com
kaf24@8708 9 * Copyright (c) 2005, International Business Machines Corporation.
kaf24@8708 10 *
kaf24@8708 11 * This program is free software; you can redistribute it and/or modify it
kaf24@8708 12 * under the terms and conditions of the GNU General Public License,
kaf24@8708 13 * version 2, as published by the Free Software Foundation.
kaf24@8708 14 *
kaf24@8708 15 * This program is distributed in the hope it will be useful, but WITHOUT
kaf24@8708 16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
kaf24@8708 17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
kaf24@8708 18 * more details.
kaf24@8708 19 *
kaf24@8708 20 * You should have received a copy of the GNU General Public License along with
kaf24@8708 21 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
kaf24@8708 22 * Place - Suite 330, Boston, MA 02111-1307 USA.
kaf24@8708 23 */
kaf24@8708 24 #include "roms.h"
kaf24@8708 25 #include "../acpi/acpi2_0.h" /* for ACPI_PHYSICAL_ADDRESS */
kaf24@8708 26
kaf24@8708 27 /* memory map */
kaf24@8708 28 #define VGABIOS_PHYSICAL_ADDRESS 0x000C0000
kaf24@8708 29 #define VMXASSIST_PHYSICAL_ADDRESS 0x000D0000
kaf24@8708 30 #define ROMBIOS_PHYSICAL_ADDRESS 0x000F0000
kaf24@8708 31
kaf24@8708 32 /* invoke SVM's paged realmode support */
kaf24@8708 33 #define SVM_VMMCALL_RESET_TO_REALMODE 0x00000001
kaf24@8708 34
kaf24@8708 35 /*
kaf24@8708 36 * C runtime start off
kaf24@8708 37 */
kaf24@8708 38 asm(
kaf24@8708 39 " .text \n"
kaf24@8708 40 " .globl _start \n"
kaf24@8708 41 "_start: \n"
kaf24@8708 42 " cld \n"
kaf24@8708 43 " cli \n"
kaf24@8708 44 " lgdt gdt_desr \n"
kaf24@8708 45 " movl $stack_top, %esp \n"
kaf24@8708 46 " movl %esp, %ebp \n"
kaf24@8708 47 " call main \n"
kaf24@8708 48 " jmp halt \n"
kaf24@8708 49 " \n"
kaf24@8708 50 "gdt_desr: \n"
kaf24@8708 51 " .word gdt_end - gdt - 1 \n"
kaf24@8708 52 " .long gdt \n"
kaf24@8708 53 " \n"
kaf24@8708 54 " .align 8 \n"
kaf24@8708 55 "gdt: \n"
kaf24@8708 56 " .quad 0x0000000000000000 \n"
kaf24@8708 57 " .quad 0x00CF92000000FFFF \n"
kaf24@8708 58 " .quad 0x00CF9A000000FFFF \n"
kaf24@8708 59 "gdt_end: \n"
kaf24@8708 60 " \n"
kaf24@8708 61 "halt: \n"
kaf24@8708 62 " sti \n"
kaf24@8708 63 " jmp . \n"
kaf24@8708 64 " \n"
kaf24@8708 65 " .bss \n"
kaf24@8708 66 " .align 8 \n"
kaf24@8708 67 "stack: \n"
kaf24@8708 68 " .skip 0x4000 \n"
kaf24@8708 69 "stack_top: \n"
kaf24@8708 70 );
kaf24@8708 71
kaf24@8708 72 extern int get_acpi_enabled(void);
kaf24@8708 73 extern int acpi_madt_update(unsigned char* acpi_start);
kaf24@8708 74
kaf24@8708 75 static inline void
kaf24@8708 76 outw(unsigned short addr, unsigned short val)
kaf24@8708 77 {
kaf24@8708 78 __asm__ __volatile__ ("outw %%ax, %%dx" :: "d"(addr), "a"(val));
kaf24@8708 79 }
kaf24@8708 80
kaf24@8708 81 static inline void
kaf24@8708 82 outb(unsigned short addr, unsigned char val)
kaf24@8708 83 {
kaf24@8708 84 __asm__ __volatile__ ("outb %%al, %%dx" :: "d"(addr), "a"(val));
kaf24@8708 85 }
kaf24@8708 86
kaf24@8708 87 static inline unsigned char
kaf24@8708 88 inb(unsigned short addr)
kaf24@8708 89 {
kaf24@8708 90 unsigned char val;
kaf24@8708 91
kaf24@8708 92 __asm__ __volatile__ ("inb %w1,%0" : "=a" (val) : "Nd" (addr));
kaf24@8708 93 return val;
kaf24@8708 94 }
kaf24@8708 95
kaf24@8708 96 void *
kaf24@8708 97 memcpy(void *dest, const void *src, unsigned n)
kaf24@8708 98 {
kaf24@8708 99 int t0, t1, t2;
kaf24@8708 100
kaf24@8708 101 __asm__ __volatile__(
kaf24@8708 102 "cld\n"
kaf24@8708 103 "rep; movsl\n"
kaf24@8708 104 "testb $2,%b4\n"
kaf24@8708 105 "je 1f\n"
kaf24@8708 106 "movsw\n"
kaf24@8708 107 "1: testb $1,%b4\n"
kaf24@8708 108 "je 2f\n"
kaf24@8708 109 "movsb\n"
kaf24@8708 110 "2:"
kaf24@8708 111 : "=&c" (t0), "=&D" (t1), "=&S" (t2)
kaf24@8708 112 : "0" (n/4), "q" (n), "1" ((long) dest), "2" ((long) src)
kaf24@8708 113 : "memory"
kaf24@8708 114 );
kaf24@8708 115 return dest;
kaf24@8708 116 }
kaf24@8708 117
kaf24@8708 118 int
kaf24@8708 119 puts(const char *s)
kaf24@8708 120 {
kaf24@8708 121 while (*s)
kaf24@8708 122 outb(0xE9, *s++);
kaf24@8708 123 return 0;
kaf24@8708 124 }
kaf24@8708 125
kaf24@8708 126 int
kaf24@8708 127 cirrus_check(void)
kaf24@8708 128 {
kaf24@8708 129 outw(0x3C4, 0x9206);
kaf24@8708 130 return inb(0x3C5) == 0x12;
kaf24@8708 131 }
kaf24@8708 132
kaf24@8708 133 int
kaf24@8708 134 vmmcall(int edi, int esi, int edx, int ecx, int ebx)
kaf24@8708 135 {
kaf24@8708 136 int eax;
kaf24@8708 137
kaf24@8708 138 __asm__ __volatile__(
kaf24@8708 139 ".byte 0x0F,0x01,0xD9"
kaf24@8708 140 : "=a" (eax)
kaf24@8708 141 : "a"(0x58454E00), /* XEN\0 key */
kaf24@8708 142 "b"(ebx), "c"(ecx), "d"(edx), "D"(edi), "S"(esi)
kaf24@8708 143 );
kaf24@8708 144 return eax;
kaf24@8708 145 }
kaf24@8708 146
kaf24@8708 147 int
kaf24@8708 148 check_amd(void)
kaf24@8708 149 {
kaf24@8708 150 char id[12];
kaf24@8708 151
kaf24@8708 152 __asm__ __volatile__(
kaf24@8708 153 "cpuid"
kaf24@8708 154 : "=b" (*(int *)(&id[0])),
kaf24@8708 155 "=c" (*(int *)(&id[8])),
kaf24@8708 156 "=d" (*(int *)(&id[4]))
kaf24@8708 157 : "a" (0)
kaf24@8708 158 );
kaf24@8708 159 return __builtin_memcmp(id, "AuthenticAMD", 12) == 0;
kaf24@8708 160 }
kaf24@8708 161
kaf24@8708 162 int
kaf24@8708 163 main(void)
kaf24@8708 164 {
kaf24@8708 165 puts("HVM Loader\n");
kaf24@8708 166
kaf24@8708 167 puts("Loading ROMBIOS ...\n");
kaf24@8708 168 memcpy((void *)ROMBIOS_PHYSICAL_ADDRESS, rombios, sizeof(rombios));
kaf24@8708 169 if (cirrus_check()) {
kaf24@8708 170 puts("Loading Cirrus VGABIOS ...\n");
kaf24@8708 171 memcpy((void *)VGABIOS_PHYSICAL_ADDRESS,
kaf24@8708 172 vgabios_cirrusvga, sizeof(vgabios_cirrusvga));
kaf24@8708 173 } else {
kaf24@8708 174 puts("Loading Standard VGABIOS ...\n");
kaf24@8708 175 memcpy((void *)VGABIOS_PHYSICAL_ADDRESS,
kaf24@8708 176 vgabios_stdvga, sizeof(vgabios_stdvga));
kaf24@8708 177 }
kaf24@8708 178
kaf24@8708 179 if (get_acpi_enabled() != 0) {
kaf24@8708 180 puts("Loading ACPI ...\n");
kaf24@8708 181 acpi_madt_update((unsigned char *) acpi);
kaf24@8708 182 if (ACPI_PHYSICAL_ADDRESS+sizeof(acpi) <= 0xF0000) {
kaf24@8708 183 /*
kaf24@8708 184 * Make sure acpi table does not overlap rombios
kaf24@8708 185 * currently acpi less than 8K will be OK.
kaf24@8708 186 */
kaf24@8708 187 memcpy((void *)ACPI_PHYSICAL_ADDRESS, acpi,
kaf24@8708 188 sizeof(acpi));
kaf24@8708 189 }
kaf24@8708 190 }
kaf24@8708 191
kaf24@8708 192 if (check_amd()) {
kaf24@8708 193 /* AMD implies this is SVM */
kaf24@8708 194 puts("SVM go ...\n");
kaf24@8708 195 vmmcall(SVM_VMMCALL_RESET_TO_REALMODE, 0, 0, 0, 0);
kaf24@8708 196 } else {
kaf24@8708 197 puts("Loading VMXAssist ...\n");
kaf24@8708 198 memcpy((void *)VMXASSIST_PHYSICAL_ADDRESS,
kaf24@8708 199 vmxassist, sizeof(vmxassist));
kaf24@8708 200
kaf24@8708 201 puts("VMX go ...\n");
kaf24@8708 202 __asm__ __volatile__(
kaf24@8708 203 "jmp *%%eax"
kaf24@8708 204 : : "a" (VMXASSIST_PHYSICAL_ADDRESS), "d" (0)
kaf24@8708 205 );
kaf24@8708 206 }
kaf24@8708 207
kaf24@8708 208 puts("Failed to invoke ROMBIOS\n");
kaf24@8708 209 return 0;
kaf24@8708 210 }
kaf24@8708 211