cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync; $Id$
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync;; @file
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync; Bootsector that benchmarks I/O and MMIO roundtrip time.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync; VBoxManage setextradata bs-test1 VBoxInternal/Devices/VMMDev/0/Config/TestingEnabled 1
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync; VBoxManage setextradata bs-test1 VBoxInternal/Devices/VMMDev/0/Config/TestingMMIO 1
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync; Copyright (C) 2007-2014 Oracle Corporation
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync; This file is part of VirtualBox Open Source Edition (OSE), as
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync; available from http://www.virtualbox.org. This file is free software;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync; you can redistribute it and/or modify it under the terms of the GNU
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync; General Public License (GPL) as published by the Free Software
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync; Foundation, in version 2 as it comes in the "COPYING" file of the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync; The contents of this file may alternatively be used under the terms
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync; of the Common Development and Distribution License Version 1.0
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync; VirtualBox OSE distribution, in which case the provisions of the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync; CDDL are applicable instead of those of the GPL.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync; You may elect to license modified versions of this file under the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync; terms and conditions of either the GPL or the CDDL or both.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync%include "iprt/asmdefs.mac"
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync%include "iprt/x86.mac"
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync%include "VBox/VMMDevTesting.mac"
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync;; The number of instructions to test.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync%define TEST_INSTRUCTION_COUNT_IO 2000000
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
2b41f73e305b2cd1a4dadff538705a7a8fb63f02vboxsync;; The number of RDTSC instructions to test.
2b41f73e305b2cd1a4dadff538705a7a8fb63f02vboxsync%define TEST_INSTRUCTION_COUNT_RDTSC 4000000
2b41f73e305b2cd1a4dadff538705a7a8fb63f02vboxsync
3cb585d34a2e3df35c60e45e7182dde65f3a6c22vboxsync;; The number of RDTSC instructions to test.
3cb585d34a2e3df35c60e45e7182dde65f3a6c22vboxsync%define TEST_INSTRUCTION_COUNT_READCR4 1000000
3cb585d34a2e3df35c60e45e7182dde65f3a6c22vboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync;; The number of instructions to test.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync%define TEST_INSTRUCTION_COUNT_MMIO 750000
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync;; Define this to drop unnecessary test variations.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync%define QUICK_TEST
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync; Include and execute the init code.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync %define BS2_INIT_RM
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync %define BS2_INC_PE16
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync %define BS2_INC_PE32
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync %define BS2_INC_PP32
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync %define BS2_INC_PAE32
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync %define BS2_INC_LM64
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync %include "bootsector2-common-init-code.mac"
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync; The benchmark driver
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncBEGINPROC main
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ; Test prologue.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync mov ax, .s_szTstName
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync call TestInit_r86
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync call Bs2EnableA20_r86
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync call Bs2PanicIfVMMDevTestingIsMissing_r86
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ; CPUID.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync mov ax, .s_szTstCpuId
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync call TestSub_r86
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync call BenchmarkCpuId_rm_pp32
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync call BenchmarkCpuId_rm_pae32
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync call BenchmarkCpuId_rm_lm64
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync call BenchmarkCpuId_rm_pe16
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync call BenchmarkCpuId_rm_pe32
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync call BenchmarkCpuId_rm_rm
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
2b41f73e305b2cd1a4dadff538705a7a8fb63f02vboxsync ;
2b41f73e305b2cd1a4dadff538705a7a8fb63f02vboxsync ; RDTSC.
2b41f73e305b2cd1a4dadff538705a7a8fb63f02vboxsync ;
2b41f73e305b2cd1a4dadff538705a7a8fb63f02vboxsync mov ax, .s_szTstRdTsc
2b41f73e305b2cd1a4dadff538705a7a8fb63f02vboxsync call TestSub_r86
2b41f73e305b2cd1a4dadff538705a7a8fb63f02vboxsync call BenchmarkRdTsc_rm_pp32
2b41f73e305b2cd1a4dadff538705a7a8fb63f02vboxsync call BenchmarkRdTsc_rm_pae32
2b41f73e305b2cd1a4dadff538705a7a8fb63f02vboxsync call BenchmarkRdTsc_rm_lm64
2b41f73e305b2cd1a4dadff538705a7a8fb63f02vboxsync call BenchmarkRdTsc_rm_pe16
2b41f73e305b2cd1a4dadff538705a7a8fb63f02vboxsync call BenchmarkRdTsc_rm_pe32
2b41f73e305b2cd1a4dadff538705a7a8fb63f02vboxsync call BenchmarkRdTsc_rm_rm
2b41f73e305b2cd1a4dadff538705a7a8fb63f02vboxsync
3cb585d34a2e3df35c60e45e7182dde65f3a6c22vboxsync ;
3cb585d34a2e3df35c60e45e7182dde65f3a6c22vboxsync ; Read CR4
3cb585d34a2e3df35c60e45e7182dde65f3a6c22vboxsync ;
3cb585d34a2e3df35c60e45e7182dde65f3a6c22vboxsync mov ax, .s_szTstRdCr4
3cb585d34a2e3df35c60e45e7182dde65f3a6c22vboxsync call TestSub_r86
3cb585d34a2e3df35c60e45e7182dde65f3a6c22vboxsync call BenchmarkRdCr4_rm_pp32
3cb585d34a2e3df35c60e45e7182dde65f3a6c22vboxsync call BenchmarkRdCr4_rm_pae32
3cb585d34a2e3df35c60e45e7182dde65f3a6c22vboxsync call BenchmarkRdCr4_rm_lm64
3cb585d34a2e3df35c60e45e7182dde65f3a6c22vboxsync call BenchmarkRdCr4_rm_pe16
3cb585d34a2e3df35c60e45e7182dde65f3a6c22vboxsync call BenchmarkRdCr4_rm_pe32
3cb585d34a2e3df35c60e45e7182dde65f3a6c22vboxsync call BenchmarkRdCr4_rm_rm
3cb585d34a2e3df35c60e45e7182dde65f3a6c22vboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ; I/O port access.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync mov ax, .s_szTstNopIoPort
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync call TestSub_r86
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync call BenchmarkIoPortNop_rm_rm
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync call BenchmarkIoPortNop_rm_pe16
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync call BenchmarkIoPortNop_rm_pe32
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync call BenchmarkIoPortNop_rm_pp32
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync call BenchmarkIoPortNop_rm_pae32
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync call BenchmarkIoPortNop_rm_lm64
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ; MMIO access.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync mov ax, .s_szTstNopMmio
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync call TestSub_r86
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync call BenchmarkMmioNop_rm_pp32
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync call BenchmarkMmioNop_rm_pae32
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync call BenchmarkMmioNop_rm_lm64
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync call BenchmarkMmioNop_rm_pe16
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync call BenchmarkMmioNop_rm_pe32
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync call BenchmarkMmioNop_rm_rm
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ; We're done.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync call TestTerm_r86
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync call Bs2Panic
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync.s_szTstName:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync db 'tstIOIntr', 0
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync.s_szTstCpuId:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync db 'CPUID EAX=1', 0
2b41f73e305b2cd1a4dadff538705a7a8fb63f02vboxsync.s_szTstRdTsc:
2b41f73e305b2cd1a4dadff538705a7a8fb63f02vboxsync db 'RDTSC', 0
3cb585d34a2e3df35c60e45e7182dde65f3a6c22vboxsync.s_szTstRdCr4:
3cb585d34a2e3df35c60e45e7182dde65f3a6c22vboxsync db 'Read CR4', 0
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync.s_szTstNopIoPort:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync db 'NOP I/O Port Access', 0
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync.s_szTstNopMmio:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync db 'NOP MMIO Access', 0
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncENDPROC main
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync; Instantiate the template code.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync%include "bootsector2-template-footer.mac" ; reset the initial environemnt.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync%define TMPL_RM
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync%include "bootsector2-test1-template.mac"
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync;%define TMPL_CMN_V86
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync;%include "bootsector2-test1-template.mac"
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync%define TMPL_PE16
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync%include "bootsector2-test1-template.mac"
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync%define TMPL_PE32
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync%include "bootsector2-test1-template.mac"
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync;%define TMPL_PP16
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync;%include "bootsector2-test1-template.mac"
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync%define TMPL_PP32
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync%include "bootsector2-test1-template.mac"
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync;%define TMPL_PAE16
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync;%include "bootsector2-test1-template.mac"
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync%define TMPL_PAE32
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync%include "bootsector2-test1-template.mac"
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync;%define TMPL_LM16
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync;%include "bootsector2-test1-template.mac"
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync;%define TMPL_LM32
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync;%include "bootsector2-test1-template.mac"
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync%define TMPL_LM64
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync%include "bootsector2-test1-template.mac"
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync; End sections and image.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync%include "bootsector2-common-end.mac"
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync