diff --git a/etc/mtree/BSD.usr.dist b/etc/mtree/BSD.usr.dist index 46a975178595..fcaf5c72cef8 100644 --- a/etc/mtree/BSD.usr.dist +++ b/etc/mtree/BSD.usr.dist @@ -1,1286 +1,1290 @@ # $FreeBSD$ # # Please see the file src/etc/mtree/README before making changes to this file. # /set type=dir uname=root gname=wheel mode=0755 . bin .. include private bsdstat .. event1 .. gmock internal custom .. .. .. gtest internal custom .. .. .. sqlite3 .. ucl .. zstd .. .. .. lib clang 14.0.5 include cuda_wrappers .. fuzzer .. openmp_wrappers .. ppc_wrappers .. profile .. sanitizer .. xray .. .. lib freebsd .. .. share .. .. .. compat .. dtrace .. engines .. flua .. i18n .. libxo encoder .. .. .. libdata gcc .. ldscripts .. pkgconfig .. .. libexec bsdconfig 020.docsinstall include .. .. 030.packages include .. .. 040.password include .. .. 050.diskmgmt include .. .. 070.usermgmt include .. .. 080.console include .. .. 090.timezone include .. .. 110.mouse include .. .. 120.networking include .. .. 130.security include .. .. 140.startup include .. .. 150.ttys include .. .. dot include .. .. include .. includes include .. .. .. bsdinstall .. dwatch .. hyperv .. lpr ru .. .. sendmail .. sm.bin .. zfs .. .. local .. obj nochange .. sbin .. share atf tags=package=tests .. + bhyve + kbdlayout + .. + .. bsdconfig media .. networking .. packages .. password .. startup .. timezone .. usermgmt .. .. calendar de_AT.ISO_8859-15 .. de_DE.ISO8859-1 .. fr_FR.ISO8859-1 .. hr_HR.ISO8859-2 .. hu_HU.ISO8859-2 .. pt_BR.ISO8859-1 .. pt_BR.UTF-8 .. ru_RU.KOI8-R .. ru_RU.UTF-8 .. uk_UA.KOI8-U .. .. certs blacklisted tags=package=caroot .. trusted tags=package=caroot .. .. dict .. doc IPv6 .. atf tags=package=tests .. kyua tags=package=tests .. legal .. llvm clang .. .. ncurses .. ntp drivers icons .. scripts .. .. hints .. icons .. pic .. scripts .. .. pjdfstest .. .. dtrace .. examples BSD_daemon .. FreeBSD_version .. IPv6 .. bhyve .. bootforth .. bsdconfig .. csh .. diskless .. dma .. drivers .. dwatch .. etc defaults .. .. find_interface .. flua .. hast .. hostapd .. indent .. ipfilter .. ipfw .. jails .. kld cdev module .. test .. .. dyn_sysctl .. firmware fwconsumer .. fwimage .. .. khelp .. syscall module .. test .. .. .. kyua tags=package=tests .. libusb20 .. libvgl .. mdoc .. netgraph .. perfmon .. pf .. ppi .. ppp .. printing .. scsi_target .. ses getencstat .. sesd .. setencstat .. setobjstat .. srcs .. .. smbfs print .. .. sunrpc dir .. msg .. sort .. .. tcsh .. uefisign .. ypldap .. .. firmware .. flua .. games fortune .. .. i18n csmapper APPLE .. AST .. BIG5 .. CNS .. CP .. EBCDIC .. GB .. GEORGIAN .. ISO-8859 .. ISO646 .. JIS .. KAZAKH .. KOI .. KS .. MISC .. TCVN .. .. esdb APPLE .. AST .. BIG5 .. CP .. DEC .. EBCDIC .. EUC .. GB .. GEORGIAN .. ISO-2022 .. ISO-8859 .. ISO646 .. KAZAKH .. KOI .. MISC .. TCVN .. UTF .. .. .. keys pkg revoked tags=package=runtime .. trusted tags=package=runtime .. .. .. kyua tags=package=tests misc tags=package=tests .. store tags=package=tests .. .. locale af_ZA.ISO8859-1 .. af_ZA.ISO8859-15 .. af_ZA.UTF-8 .. ar_AE.UTF-8 .. ar_EG.UTF-8 .. ar_JO.UTF-8 .. ar_MA.UTF-8 .. ar_QA.UTF-8 .. ar_SA.UTF-8 .. am_ET.UTF-8 .. be_BY.CP1131 .. be_BY.CP1251 .. be_BY.ISO8859-5 .. be_BY.UTF-8 .. bg_BG.CP1251 .. bg_BG.UTF-8 .. ca_AD.ISO8859-1 .. ca_AD.ISO8859-15 .. ca_ES.ISO8859-1 .. ca_ES.ISO8859-15 .. ca_FR.ISO8859-1 .. ca_FR.ISO8859-15 .. ca_IT.ISO8859-1 .. ca_IT.ISO8859-15 .. ca_AD.UTF-8 .. ca_ES.UTF-8 .. ca_FR.UTF-8 .. ca_IT.UTF-8 .. cs_CZ.ISO8859-2 .. cs_CZ.UTF-8 .. da_DK.ISO8859-1 .. da_DK.ISO8859-15 .. da_DK.UTF-8 .. de_AT.ISO8859-1 .. de_AT.ISO8859-15 .. de_AT.UTF-8 .. de_CH.ISO8859-1 .. de_CH.ISO8859-15 .. de_CH.UTF-8 .. de_DE.ISO8859-1 .. de_DE.ISO8859-15 .. de_DE.UTF-8 .. el_GR.ISO8859-7 .. el_GR.UTF-8 .. en_AU.ISO8859-1 .. en_AU.ISO8859-15 .. en_AU.US-ASCII .. en_AU.UTF-8 .. en_CA.ISO8859-1 .. en_CA.ISO8859-15 .. en_CA.US-ASCII .. en_CA.UTF-8 .. en_GB.ISO8859-1 .. en_GB.ISO8859-15 .. en_GB.US-ASCII .. en_GB.UTF-8 .. en_HK.ISO8859-1 .. en_HK.UTF-8 .. en_IE.ISO8859-1 .. en_IE.ISO8859-15 .. en_IE.UTF-8 .. en_NZ.ISO8859-1 .. en_NZ.ISO8859-15 .. en_NZ.US-ASCII .. en_NZ.UTF-8 .. en_PH.UTF-8 .. en_SG.ISO8859-1 .. en_SG.UTF-8 .. en_US.ISO8859-1 .. en_US.ISO8859-15 .. en_US.US-ASCII .. en_US.UTF-8 .. en_ZA.ISO8859-1 .. en_ZA.ISO8859-15 .. en_ZA.US-ASCII .. en_ZA.UTF-8 .. es_AR.ISO8859-1 .. es_AR.UTF-8 .. es_CR.UTF-8 .. es_ES.ISO8859-1 .. es_ES.ISO8859-15 .. es_ES.UTF-8 .. es_MX.ISO8859-1 .. es_MX.UTF-8 .. et_EE.ISO8859-1 .. et_EE.ISO8859-15 .. et_EE.UTF-8 .. eu_ES.ISO8859-1 .. eu_ES.ISO8859-15 .. eu_ES.UTF-8 .. fi_FI.ISO8859-1 .. fi_FI.ISO8859-15 .. fi_FI.UTF-8 .. fr_BE.ISO8859-1 .. fr_BE.ISO8859-15 .. fr_BE.UTF-8 .. fr_CA.ISO8859-1 .. fr_CA.ISO8859-15 .. fr_CA.UTF-8 .. fr_CH.ISO8859-1 .. fr_CH.ISO8859-15 .. fr_CH.UTF-8 .. fr_FR.ISO8859-1 .. fr_FR.ISO8859-15 .. fr_FR.UTF-8 .. ga_IE.UTF-8 .. he_IL.UTF-8 .. hi_IN.ISCII-DEV .. hi_IN.UTF-8 .. hr_HR.ISO8859-2 .. hr_HR.UTF-8 .. hu_HU.ISO8859-2 .. hu_HU.UTF-8 .. hy_AM.ARMSCII-8 .. hy_AM.UTF-8 .. is_IS.ISO8859-1 .. is_IS.ISO8859-15 .. is_IS.UTF-8 .. it_CH.ISO8859-1 .. it_CH.ISO8859-15 .. it_CH.UTF-8 .. it_IT.ISO8859-1 .. it_IT.ISO8859-15 .. it_IT.UTF-8 .. ja_JP.SJIS .. ja_JP.UTF-8 .. ja_JP.eucJP .. kk_KZ.UTF-8 .. ko_KR.CP949 .. ko_KR.UTF-8 .. ko_KR.eucKR .. lt_LT.ISO8859-13 .. lt_LT.UTF-8 .. lv_LV.ISO8859-13 .. lv_LV.UTF-8 .. mn_MN.UTF-8 .. nb_NO.ISO8859-1 .. nb_NO.ISO8859-15 .. nb_NO.UTF-8 .. nl_BE.ISO8859-1 .. nl_BE.ISO8859-15 .. nl_BE.UTF-8 .. nl_NL.ISO8859-1 .. nl_NL.ISO8859-15 .. nl_NL.UTF-8 .. nn_NO.ISO8859-1 .. nn_NO.ISO8859-15 .. nn_NO.UTF-8 .. pl_PL.ISO8859-2 .. pl_PL.UTF-8 .. pt_BR.ISO8859-1 .. pt_BR.UTF-8 .. pt_PT.ISO8859-1 .. pt_PT.ISO8859-15 .. pt_PT.UTF-8 .. ro_RO.ISO8859-2 .. ro_RO.UTF-8 .. ru_RU.CP1251 .. ru_RU.CP866 .. ru_RU.ISO8859-5 .. ru_RU.KOI8-R .. ru_RU.UTF-8 .. se_FI.UTF-8 .. se_NO.UTF-8 .. sk_SK.ISO8859-2 .. sk_SK.UTF-8 .. sl_SI.ISO8859-2 .. sl_SI.UTF-8 .. sr_RS.ISO8859-5 .. sr_RS.UTF-8 .. sr_RS.ISO8859-2 .. sr_RS.UTF-8@latin .. sv_FI.ISO8859-1 .. sv_FI.ISO8859-15 .. sv_FI.UTF-8 .. sv_SE.ISO8859-1 .. sv_SE.ISO8859-15 .. sv_SE.UTF-8 .. tr_TR.ISO8859-9 .. tr_TR.UTF-8 .. uk_UA.CP1251 .. uk_UA.ISO8859-5 .. uk_UA.KOI8-U .. uk_UA.UTF-8 .. zh_CN.GB18030 .. zh_CN.GB2312 .. zh_CN.GBK .. zh_CN.eucCN .. zh_CN.UTF-8 .. zh_HK.UTF-8 .. zh_TW.Big5 .. zh_TW.UTF-8 .. .. man man1 .. man2 .. man3 .. man3lua .. man4 aarch64 .. amd64 .. arm .. i386 .. powerpc .. .. man5 .. man6 .. man7 .. man8 amd64 .. i386 .. powerpc .. .. man9 .. .. misc fonts .. .. mk .. nls C .. af_ZA.ISO8859-1 .. af_ZA.ISO8859-15 .. af_ZA.UTF-8 .. am_ET.UTF-8 .. be_BY.CP1131 .. be_BY.CP1251 .. be_BY.ISO8859-5 .. be_BY.UTF-8 .. bg_BG.CP1251 .. bg_BG.UTF-8 .. ca_ES.ISO8859-1 .. ca_ES.ISO8859-15 .. ca_ES.UTF-8 .. cs_CZ.ISO8859-2 .. cs_CZ.UTF-8 .. da_DK.ISO8859-1 .. da_DK.ISO8859-15 .. da_DK.UTF-8 .. de_AT.ISO8859-1 .. de_AT.ISO8859-15 .. de_AT.UTF-8 .. de_CH.ISO8859-1 .. de_CH.ISO8859-15 .. de_CH.UTF-8 .. de_DE.ISO8859-1 .. de_DE.ISO8859-15 .. de_DE.UTF-8 .. el_GR.ISO8859-7 .. el_GR.UTF-8 .. en_AU.ISO8859-1 .. en_AU.ISO8859-15 .. en_AU.US-ASCII .. en_AU.UTF-8 .. en_CA.ISO8859-1 .. en_CA.ISO8859-15 .. en_CA.US-ASCII .. en_CA.UTF-8 .. en_GB.ISO8859-1 .. en_GB.ISO8859-15 .. en_GB.US-ASCII .. en_GB.UTF-8 .. en_IE.UTF-8 .. en_NZ.ISO8859-1 .. en_NZ.ISO8859-15 .. en_NZ.US-ASCII .. en_NZ.UTF-8 .. en_US.ISO8859-1 .. en_US.ISO8859-15 .. en_US.UTF-8 .. es_ES.ISO8859-1 .. es_ES.ISO8859-15 .. es_ES.UTF-8 .. et_EE.ISO8859-15 .. et_EE.UTF-8 .. fi_FI.ISO8859-1 .. fi_FI.ISO8859-15 .. fi_FI.UTF-8 .. fr_BE.ISO8859-1 .. fr_BE.ISO8859-15 .. fr_BE.UTF-8 .. fr_CA.ISO8859-1 .. fr_CA.ISO8859-15 .. fr_CA.UTF-8 .. fr_CH.ISO8859-1 .. fr_CH.ISO8859-15 .. fr_CH.UTF-8 .. fr_FR.ISO8859-1 .. fr_FR.ISO8859-15 .. fr_FR.UTF-8 .. gl_ES.ISO8859-1 .. he_IL.UTF-8 .. hi_IN.ISCII-DEV .. hr_HR.ISO8859-2 .. hr_HR.UTF-8 .. hu_HU.ISO8859-2 .. hu_HU.UTF-8 .. hy_AM.ARMSCII-8 .. hy_AM.UTF-8 .. is_IS.ISO8859-1 .. is_IS.ISO8859-15 .. is_IS.UTF-8 .. it_CH.ISO8859-1 .. it_CH.ISO8859-15 .. it_CH.UTF-8 .. it_IT.ISO8859-1 .. it_IT.ISO8859-15 .. it_IT.UTF-8 .. ja_JP.SJIS .. ja_JP.UTF-8 .. ja_JP.eucJP .. kk_KZ.PT154 .. kk_KZ.UTF-8 .. ko_KR.CP949 .. ko_KR.UTF-8 .. ko_KR.eucKR .. lt_LT.ISO8859-13 .. lt_LT.UTF-8 .. lv_LV.ISO8859-13 .. lv_LV.UTF-8 .. mn_MN.UTF-8 .. nl_BE.ISO8859-1 .. nl_BE.ISO8859-15 .. nl_BE.UTF-8 .. nl_NL.ISO8859-1 .. nl_NL.ISO8859-15 .. nl_NL.UTF-8 .. no_NO.ISO8859-1 .. no_NO.ISO8859-15 .. no_NO.UTF-8 .. pl_PL.ISO8859-2 .. pl_PL.UTF-8 .. pt_BR.ISO8859-1 .. pt_BR.UTF-8 .. pt_PT.ISO8859-1 .. pt_PT.ISO8859-15 .. pt_PT.UTF-8 .. ro_RO.ISO8859-2 .. ro_RO.UTF-8 .. ru_RU.CP1251 .. ru_RU.CP866 .. ru_RU.ISO8859-5 .. ru_RU.KOI8-R .. ru_RU.UTF-8 .. sk_SK.ISO8859-2 .. sk_SK.UTF-8 .. sl_SI.ISO8859-2 .. sl_SI.UTF-8 .. sr_YU.ISO8859-2 .. sr_YU.ISO8859-5 .. sr_YU.UTF-8 .. sv_SE.ISO8859-1 .. sv_SE.ISO8859-15 .. sv_SE.UTF-8 .. tr_TR.ISO8859-9 .. tr_TR.UTF-8 .. uk_UA.ISO8859-5 .. uk_UA.KOI8-U .. uk_UA.UTF-8 .. zh_CN.GB18030 .. zh_CN.GB2312 .. zh_CN.GBK .. zh_CN.UTF-8 .. zh_CN.eucCN .. zh_HK.UTF-8 .. zh_TW.UTF-8 .. .. openssl man man1 .. man3 .. man5 .. man7 .. .. .. security .. sendmail .. skel .. snmp defs .. mibs .. .. syscons fonts .. keymaps .. scrnmaps .. .. tabset .. vi catalog .. .. vt fonts .. keymaps .. .. zfs compatibility.d .. .. zoneinfo Africa .. America Argentina .. Indiana .. Kentucky .. North_Dakota .. .. Antarctica .. Arctic .. Asia .. Atlantic .. Australia .. Brazil .. Canada .. Chile .. Etc .. Europe .. Indian .. Mexico .. Pacific .. US .. .. .. src nochange .. .. diff --git a/usr.sbin/bhyve/Makefile b/usr.sbin/bhyve/Makefile index e35d528ab605..d55022d05f18 100644 --- a/usr.sbin/bhyve/Makefile +++ b/usr.sbin/bhyve/Makefile @@ -1,135 +1,136 @@ # # $FreeBSD$ # .include CFLAGS+=-I${.CURDIR}/../../contrib/lib9p CFLAGS+=-I${SRCTOP}/sys .PATH: ${SRCTOP}/sys/cam/ctl PROG= bhyve PACKAGE= bhyve MAN= bhyve.8 bhyve_config.5 BHYVE_SYSDIR?=${SRCTOP} SRCS= \ atkbdc.c \ acpi.c \ audio.c \ bhyvegc.c \ bhyverun.c \ block_if.c \ bootrom.c \ config.c \ console.c \ ctl_util.c \ ctl_scsi_all.c \ fwctl.c \ gdb.c \ hda_codec.c \ inout.c \ ioapic.c \ kernemu_dev.c \ mem.c \ mevent.c \ mptbl.c \ net_backends.c \ net_utils.c \ pci_ahci.c \ pci_e82545.c \ pci_emul.c \ pci_hda.c \ pci_fbuf.c \ pci_hostbridge.c \ pci_irq.c \ pci_lpc.c \ pci_nvme.c \ pci_passthru.c \ pci_virtio_9p.c \ pci_virtio_block.c \ pci_virtio_console.c \ pci_virtio_net.c \ pci_virtio_rnd.c \ pci_virtio_scsi.c \ pci_uart.c \ pci_xhci.c \ pctestdev.c \ pm.c \ post.c \ ps2kbd.c \ ps2mouse.c \ rfb.c \ rtc.c \ smbiostbl.c \ sockstream.c \ task_switch.c \ uart_emul.c \ usb_emul.c \ usb_mouse.c \ virtio.c \ vga.c \ vmgenc.c \ xmsr.c \ spinup_ap.c \ iov.c .if ${MK_BHYVE_SNAPSHOT} != "no" SRCS+= snapshot.c .endif CFLAGS.kernemu_dev.c+= -I${SRCTOP}/sys/amd64 .PATH: ${BHYVE_SYSDIR}/sys/amd64/vmm SRCS+= vmm_instruction_emul.c LIBADD= vmmapi md nv pthread z util sbuf cam 9p .if ${MK_CASPER} != "no" LIBADD+= casper LIBADD+= cap_pwd LIBADD+= cap_grp # Temporary disable capsicum, until we integrate checkpoint code with it. #CFLAGS+=-DWITH_CASPER .endif .if ${MK_BHYVE_SNAPSHOT} != "no" LIBADD+= ucl xo .endif .if ${MK_INET_SUPPORT} != "no" CFLAGS+=-DINET .endif .if ${MK_INET6_SUPPORT} != "no" CFLAGS+=-DINET6 .endif .if ${MK_NETGRAPH_SUPPORT} != "no" CFLAGS+=-DNETGRAPH LIBADD+= netgraph .endif .if ${MK_OPENSSL} == "no" CFLAGS+=-DNO_OPENSSL .else LIBADD+= crypto .endif CFLAGS+= -I${BHYVE_SYSDIR}/sys/dev/e1000 CFLAGS+= -I${BHYVE_SYSDIR}/sys/dev/mii CFLAGS+= -I${BHYVE_SYSDIR}/sys/dev/usb/controller .if ${MK_BHYVE_SNAPSHOT} != "no" CFLAGS+= -I${SRCTOP}/contrib/libucl/include # Temporary disable capsicum, until we integrate checkpoint code with it. CFLAGS+= -DWITHOUT_CAPSICUM CFLAGS+= -DBHYVE_SNAPSHOT .endif .ifdef GDB_LOG CFLAGS+=-DGDB_LOG .endif WARNS?= 2 +SUBDIR= kbdlayout .include diff --git a/usr.sbin/bhyve/bhyve.8 b/usr.sbin/bhyve/bhyve.8 index ddd74cc819f1..f56f4e771b70 100644 --- a/usr.sbin/bhyve/bhyve.8 +++ b/usr.sbin/bhyve/bhyve.8 @@ -1,954 +1,962 @@ .\" Copyright (c) 2013 Peter Grehan .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" $FreeBSD$ .\" .Dd August 19, 2022 .Dt BHYVE 8 .Os .Sh NAME .Nm bhyve .Nd "run a guest operating system inside a virtual machine" .Sh SYNOPSIS .Nm .Op Fl AaCDeHhPSuWwxY .Oo .Sm off .Fl c\~ .Oo .Op Cm cpus= .Ar numcpus .Oc .Op Cm ,sockets= Ar n .Op Cm ,cores= Ar n .Op Cm ,threads= Ar n .Oc .Sm on .Oo Fl G .Sm off .Oo Ar w Oc .Oo Ar bind_address: Oc .Ar port .Sm on .Oc .Op Fl k Ar config_file +.Op Fl K Ar layout .Oo Fl l .Sm off .Ar lpcdev Op Cm \&, Ar conf .Sm on .Oc .Oo Fl m .Sm off .Ar memsize .Oo .Cm K | Cm k | Cm M | Cm m | Cm G | Cm g | Cm T | Cm t .Oc .Sm on .Oc .Op Fl o Ar var Ns Cm = Ns Ar value .Op Fl p Ar vcpu Ns Cm \&: Ns Ar hostcpu .Op Fl r Ar file .Sm off .Oo Fl s\~ .Ar slot Cm \&, Ar emulation Op Cm \&, Ar conf .Sm on .Oc .Op Fl U Ar uuid .Ar vmname .Nm .Fl l Cm help .Nm .Fl s Cm help .Sh DESCRIPTION .Nm is a hypervisor that runs guest operating systems inside a virtual machine. .Pp Parameters such as the number of virtual CPUs, amount of guest memory, and I/O connectivity can be specified with command-line parameters. .Pp If not using a boot ROM, the guest operating system must be loaded with .Xr bhyveload 8 or a similar boot loader before running .Nm , otherwise, it is enough to run .Nm with a boot ROM of choice. .Pp .Nm runs until the guest operating system reboots or an unhandled hypervisor exit is detected. .Sh OPTIONS .Bl -tag -width 10n .It Fl A Generate ACPI tables. Required for .Fx Ns /amd64 guests. .It Fl a The guest's local APIC is configured in xAPIC mode. The xAPIC mode is the default setting so this option is redundant. It will be deprecated in a future version. .It Fl C Include guest memory in core file. .It Fl c Op Ar setting ... Number of guest virtual CPUs and/or the CPU topology. The default value for each of .Ar numcpus , .Ar sockets , .Ar cores , and .Ar threads is 1. The current maximum number of guest virtual CPUs is 16. If .Ar numcpus is not specified then it will be calculated from the other arguments. The topology must be consistent in that the .Ar numcpus must equal the product of .Ar sockets , .Ar cores , and .Ar threads . If a .Ar setting is specified more than once the last one has precedence. .It Fl D Destroy the VM on guest initiated power-off. .It Fl e Force .Nm to exit when a guest issues an access to an I/O port that is not emulated. This is intended for debug purposes. .It Fl G Xo .Sm off .Oo Ar w Oc .Oo Ar bind_address: Oc .Ar port .Sm on .Xc Start a debug server that uses the GDB protocol to export guest state to a debugger. An IPv4 TCP socket will be bound to the supplied .Ar bind_address and .Ar port to listen for debugger connections. Only a single debugger may be attached to the debug server at a time. If the option begins with .Sq w , .Nm will pause execution at the first instruction waiting for a debugger to attach. .It Fl H Yield the virtual CPU thread when a HLT instruction is detected. If this option is not specified, virtual CPUs will use 100% of a host CPU. .It Fl h Print help message and exit. .It Fl k Ar config_file Set configuration variables from a simple, key-value config file. Each line of the config file is expected to consist of a config variable name, an equals sign +.It Fl K Ar layout +Specify the keyboard layout. +The value that can be specified sets the file name in +.Ar /usr/share/bhyve/kbdlayout . +This specification only works when loaded with UEFI mode for VNC. +When using a VNC client that supports QEMU Extended Key Event Message (e.g. TigerVNC), this option isn't needed. +When using a VNC client that doesn't support QEMU Extended Key Event Message (e.g. tightVNC), the layout defaults to the US keyboard unless specified otherwise. .Pq Sq = , and a value. No spaces are permitted between the variable name, equals sign, or value. Blank lines and lines starting with .Sq # are ignored. See .Xr bhyve_config 5 for more details. .It Fl l Cm help Print a list of supported LPC devices. .It Fl l Ar lpcdev Ns Op Cm \&, Ns Ar conf Allow devices behind the LPC PCI-ISA bridge to be configured. The only supported devices are the TTY-class devices .Cm com1 , com2 , com3 , and .Cm com4 , the boot ROM device .Cm bootrom , and the debug/test device .Cm pc-testdev . .Pp The possible values for the .Ar conf argument are listed in the .Fl s flag description. .It Xo .Fl m Ar memsize Ns Oo .Sm off .Cm K | k | M | m | G | g | T | t .Sm on .Oc .Xc Set the guest physical memory size This must be the same size that was given to .Xr bhyveload 8 . .Pp The size argument may be suffixed with one of .Cm K , M , G or .Cm T (either upper or lower case) to indicate a multiple of kilobytes, megabytes, gigabytes, or terabytes. If no suffix is given, the value is assumed to be in megabytes. .Pp The default is 256M. .It Fl o Ar var Ns Cm = Ns Ar value Set the configuration variable .Ar var to .Ar value . .It Fl P Force the guest virtual CPU to exit when a PAUSE instruction is detected. .It Fl p Ar vcpu Ns Cm \& : Ns Ar hostcpu Pin guest's virtual CPU .Em vcpu to .Em hostcpu . .It Fl r Ar file Resume a guest from a snapshot. The guest memory contents are restored from .Ar file , and the guest device and vCPU state are restored from the file .Dq Ar file Ns .kern . .Pp Note that the current snapshot file format requires that the configuration of devices in the new VM match the VM from which the snapshot was taken by specifying the same .Fl s and .Fl l options. The count of vCPUs and memory configuration are read from the snapshot. .It Fl S Wire guest memory. .It Fl s Cm help Print a list of supported PCI devices. .It Fl s Ar slot Ns Cm \&, Ns Ar emulation Ns Op Cm \&, Ns Ar conf Configure a virtual PCI slot and function. .Pp .Nm provides PCI bus emulation and virtual devices that can be attached to slots on the bus. There are 32 available slots, with the option of providing up to 8 functions per slot. .Pp The .Ar slot can be specified in one of the following formats: .Pp .Bl -bullet -compact .It .Ar pcislot .It .Sm off .Ar pcislot Cm \&: Ar function .Sm on .It .Sm off .Ar bus Cm \&: Ar pcislot Cm \&: Ar function .Sm on .El .Pp The .Ar pcislot value is 0 to 31. The optional .Ar function value is 0 to 7. The optional .Ar bus value is 0 to 255. If not specified, the .Ar function value defaults to 0. If not specified, the .Ar bus value defaults to 0. .Pp The .Ar emulation argument can be one of the following: .Bl -tag -width "amd_hostbridge" .It Cm hostbridge A simple host bridge. This is usually configured at slot 0, and is required by most guest operating systems. .It Cm amd_hostbridge Emulation identical to .Cm hostbridge using a PCI vendor ID of AMD. .It Cm passthru PCI pass-through device. .It Cm virtio-net Virtio network interface. .It Cm virtio-blk Virtio block storage interface. .It Cm virtio-scsi Virtio SCSI interface. .It Cm virtio-9p Virtio 9p (VirtFS) interface. .It Cm virtio-rnd Virtio RNG interface. .It Cm virtio-console Virtio console interface, which exposes multiple ports to the guest in the form of simple char devices for simple IO between the guest and host userspaces. .It Cm ahci AHCI controller attached to arbitrary devices. .It Cm ahci-cd AHCI controller attached to an ATAPI CD/DVD. .It Cm ahci-hd AHCI controller attached to a SATA hard drive. .It Cm e1000 Intel e82545 network interface. .It Cm uart PCI 16550 serial device. .It Cm lpc LPC PCI-ISA bridge with COM1, COM2, COM3, and COM4 16550 serial ports, a boot ROM, and, optionally, the debug/test device. The LPC bridge emulation can only be configured on bus 0. .It Cm fbuf Raw framebuffer device attached to VNC server. .It Cm xhci eXtensible Host Controller Interface (xHCI) USB controller. .It Cm nvme NVM Express (NVMe) controller. .It Cm hda High Definition Audio Controller. .El .Pp The optional parameter .Ar conf describes the backend for device emulations. If .Ar conf is not specified, the device emulation has no backend and can be considered unconnected. .Pp Network device backends: .Sm off .Bl -bullet .It .Xo .Cm tap Ar N .Op Cm \&,mac= Ar xx:xx:xx:xx:xx:xx .Op Cm \&,mtu= Ar N .Xc .It .Xo .Cm vmnet Ar N .Op Cm \&,mac= Ar xx:xx:xx:xx:xx:xx .Op Cm \&,mtu= Ar N .Xc .It .Xo .Cm netgraph,path= Ar ADDRESS Cm \&,peerhook= Ar HOOK .Op Cm \&,socket= Ar NAME .Op Cm \&,hook= Ar HOOK .Op Cm \&,mac= Ar xx:xx:xx:xx:xx:xx .Op Cm \&,mtu= Ar N .Xc .El .Sm on .Pp If .Cm mac is not specified, the MAC address is derived from a fixed OUI and the remaining bytes from an MD5 hash of the slot and function numbers and the device name. .Pp The MAC address is an ASCII string in .Xr ethers 5 format. .Pp With .Cm virtio-net devices, the .Cm mtu parameter can be specified to inform the guest about the largest MTU that should be allowed, expressed in bytes. .Pp With .Cm netgraph backend, the .Cm path and .Cm peerhook parameters must be specified to set the destination node and corresponding hook. The optional parameters .Cm socket and .Cm hook may be used to set the .Xr ng_socket 4 node name and source hook. The .Ar ADDRESS , .Ar HOOK , and .Ar NAME must comply with .Xr netgraph 4 addressing rules. .Pp Block storage device backends: .Sm off .Bl -bullet .It .Ar /filename Op Cm \&, Ar block-device-options .It .Ar /dev/xxx Op Cm \&, Ar block-device-options .El .Sm on .Pp The .Ar block-device-options are: .Bl -tag -width 10n .It Cm nocache Open the file with .Dv O_DIRECT . .It Cm direct Open the file using .Dv O_SYNC . .It Cm ro Force the file to be opened read-only. .It Cm sectorsize= Ns Ar logical Ns Oo Cm \&/ Ns Ar physical Oc Specify the logical and physical sector sizes of the emulated disk. The physical sector size is optional and is equal to the logical sector size if not explicitly specified. .It Cm nodelete Disable emulation of guest trim requests via .Dv DIOCGDELETE requests. .El .Pp SCSI device backends: .Sm off .Bl -bullet .It .Pa /dev/cam/ctl Oo Ar pp Cm \&. Ar vp Oc Oo Cm \&, Ar scsi-device-options Oc .El .Sm on .Pp The .Ar scsi-device-options are: .Bl -tag -width 10n .It Cm iid= Ns Ar IID Initiator ID to use when sending requests to specified CTL port. The default value is 0. .El .Pp 9P device backends: .Sm off .Bl -bullet .It .Ar sharename Cm = Ar /path/to/share Op Cm \&, Ar 9p-device-options .El .Sm on .Pp The .Ar 9p-device-options are: .Bl -tag -width 10n .It Cm ro Expose the share in read-only mode. .El .Pp TTY device backends: .Bl -tag -width 10n .It Cm stdio Connect the serial port to the standard input and output of the .Nm process. .It Ar /dev/xxx Use the host TTY device for serial port I/O. .El .Pp Boot ROM device backends: .Bl -tag -width 10n .It Ar romfile Map .Ar romfile in the guest address space reserved for boot firmware. .El .Pp Pass-through device backends: .Sm off .Bl -bullet .It .Cm ppt Ar N Oo , Ar passthru-device-options Oc .It .Ns Ar bus Cm \&/ Ar slot Cm \&/ Ar function .Op , Ar passthru-device-options .It .Cm pci Ar bus Cm : Ar slot Cm : Ns Ar function .Op , Ar passthru-device-options .El .Sm on .Pp Connect to a PCI device on the host either named ppt .Ns Ar N or at the selector described by .Ar slot , .Ar bus , and .Ar function numbers. .Pp The .Ar passthru-device-options are: .Bl -tag -width 10n .It Cm rom= Ns Ar romfile Add .Ar romfile as option ROM to the PCI device. The ROM will be loaded by firmware and should be capable of initializing the device. .El .Pp Guest memory must be wired using the .Fl S option when a pass-through device is configured. .Pp The host device must have been reserved at boot-time using the .Va pptdevs loader variable as described in .Xr vmm 4 . .Pp Virtio console device backends: .Bl -bullet .Sm off .It .Cm port1= Ns Ar /path/to/port1.sock Ns Op Cm ,port Ns Ar N Cm \&= Ns Ar /path/to/port2.sock No \~ Ar ... .Sm on .El .Pp A maximum of 16 ports per device can be created. Every port is named and corresponds to a Unix domain socket created by .Nm . .Nm accepts at most one connection per port at a time. .Pp Limitations: .Bl -bullet .It Due to lack of destructors in .Nm , sockets on the filesystem must be cleaned up manually after .Nm exits. .It There is no way to use the .Dq console port feature, nor the console port resize at present. .It Emergency write is advertised, but no-op at present. .El .Pp Framebuffer devices backends: .Bl -bullet .Sm off .It .Op Cm rfb= Ar ip-and-port .Op Cm ,w= Ar width .Op Cm ,h= Ar height .Op Cm ,vga= Ar vgaconf .Op Cm ,wait .Op Cm ,password= Ar password .Sm on .El .Pp Configuration options are defined as follows: .Bl -tag -width 10n .It Cm rfb= Ns Ar ip-and-port Pq or Cm tcp= Ns Ar ip-and-port An IP address and a port VNC should listen on. There are two formats: .Pp .Bl -bullet -compact .It .Sm off .Op Ar IPv4 Cm \&: .Ar port .Sm on .It .Sm off .Cm \&[ Ar IPv6%zone Cm \&] Cm \&: Ar port .Sm on .El .Pp The default is to listen on localhost IPv4 address and default VNC port 5900. An IPv6 address must be enclosed in square brackets and may contain an optional zone identifier. .It Cm w= Ns Ar width No and Cm h= Ns Ar height A display resolution, width and height, respectively. If not specified, a default resolution of 1024x768 pixels will be used. Minimal supported resolution is 640x480 pixels, and maximum is 1920x1200 pixels. .It Cm vga= Ns Ar vgaconf Possible values for this option are .Cm io (default), .Cm on , and .Cm off . PCI graphics cards have a dual personality in that they are standard PCI devices with BAR addressing, but may also implicitly decode legacy VGA I/O space .Pq Ad 0x3c0-3df and memory space .Pq 64KB at Ad 0xA0000 . The default .Cm io option should be used for guests that attempt to issue BIOS calls which result in I/O port queries, and fail to boot if I/O decode is disabled. .Pp The .Cm on option should be used along with the CSM BIOS capability in UEFI to boot traditional BIOS guests that require the legacy VGA I/O and memory regions to be available. .Pp The .Cm off option should be used for the UEFI guests that assume that VGA adapter is present if they detect the I/O ports. An example of such a guest is .Ox in UEFI mode. .Pp Please refer to the .Nm .Fx wiki page .Pq Lk https://wiki.freebsd.org/bhyve for configuration notes of particular guests. .It Cm wait Instruct .Nm to only boot upon the initiation of a VNC connection, simplifying the installation of operating systems that require immediate keyboard input. This can be removed for post-installation use. .It Cm password= Ns Ar password This type of authentication is known to be cryptographically weak and is not intended for use on untrusted networks. Many implementations will want to use stronger security, such as running the session over an encrypted channel provided by IPsec or SSH. .El .Pp xHCI USB device backends: .Bl -tag -width 10n .It Cm tablet A USB tablet device which provides precise cursor synchronization when using VNC. .El .Pp NVMe device backends: .Bl -bullet .Sm off .It .Ar devpath .Op Cm ,maxq= Ar # .Op Cm ,qsz= Ar # .Op Cm ,ioslots= Ar # .Op Cm ,sectsz= Ar # .Op Cm ,ser= Ar # .Op Cm ,eui64= Ar # .Op Cm ,dsm= Ar opt .Sm on .El .Pp Configuration options are defined as follows: .Bl -tag -width 10n .It Ar devpath Accepted device paths are: .Ar /dev/blockdev or .Ar /path/to/image or .Cm ram= Ns Ar size_in_MiB . .It Cm maxq Max number of queues. .It Cm qsz Max elements in each queue. .It Cm ioslots Max number of concurrent I/O requests. .It Cm sectsz Sector size (defaults to blockif sector size). .It Cm ser Serial number with maximum 20 characters. .It Cm eui64 IEEE Extended Unique Identifier (8 byte value). .It Cm dsm DataSet Management support. Supported values are: .Cm auto , enable , and .Cm disable . .El .Pp AHCI device backends: .Bl -bullet .It .Sm off .Op Oo Cm hd\&: | cd\&: Oc Ar path .Op Cm ,nmrr= Ar nmrr .Op Cm ,ser= Ar # .Op Cm ,rev= Ar # .Op Cm ,model= Ar # .Sm on .El .Pp Configuration options are defined as follows: .Bl -tag -width 10n .It Cm nmrr Nominal Media Rotation Rate, known as RPM. Value 1 will indicate device as Solid State Disk. Default value is 0, not report. .It Cm ser Serial Number with maximum 20 characters. .It Cm rev Revision Number with maximum 8 characters. .It Cm model Model Number with maximum 40 characters. .El .Pp HD Audio device backends: .Bl -bullet .It .Sm off .Op Cm play= Ar playback .Op Cm ,rec= Ar recording .Sm on .El .Pp Configuration options are defined as follows: .Bl -tag -width 10n .It Cm play Playback device, typically .Ar /dev/dsp0 . .It Cm rec Recording device, typically .Ar /dev/dsp0 . .El .It Fl U Ar uuid Set the universally unique identifier .Pq UUID in the guest's System Management BIOS System Information structure. By default a UUID is generated from the host's hostname and .Ar vmname . .It Fl u RTC keeps UTC time. .It Fl W Force virtio PCI device emulations to use MSI interrupts instead of MSI-X interrupts. .It Fl w Ignore accesses to unimplemented Model Specific Registers (MSRs). This is intended for debug purposes. .It Fl x The guest's local APIC is configured in x2APIC mode. .It Fl Y Disable MPtable generation. .It Ar vmname Alphanumeric name of the guest. This should be the same as that created by .Xr bhyveload 8 . .El .Sh CONFIGURATION VARIABLES .Nm uses an internal tree of configuration variables to describe global and per-device settings. When .Nm starts, it parses command line options (including config files) in the order given on the command line. Each command line option sets one or more configuration variables. For example, the .Fl s option creates a new tree node for a PCI device and sets one or more variables under that node including the device model and device model-specific variables. Variables may be set multiple times during this parsing stage with the final value overriding previous values. .Pp Once all of the command line options have been processed, the configuration values are frozen. .Nm then uses the value of configuration values to initialize device models and global settings. .Pp More details on configuration variables can be found in .Xr bhyve_config 5 . .Sh DEBUG SERVER The current debug server provides limited support for debuggers. .Ss Registers Each virtual CPU is exposed to the debugger as a thread. .Pp General purpose registers can be queried for each virtual CPU, but other registers such as floating-point and system registers cannot be queried. .Ss Memory Memory (including memory mapped I/O regions) can be read and written by the debugger. Memory operations use virtual addresses that are resolved to physical addresses via the current virtual CPU's active address translation. .Ss Control The running guest can be interrupted by the debugger at any time .Pq for example, by pressing Ctrl-C in the debugger . .Pp Single stepping is only supported on Intel CPUs supporting the MTRAP VM exit. .Pp Breakpoints are supported on Intel CPUs that support single stepping. Note that continuing from a breakpoint while interrupts are enabled in the guest may not work as expected due to timer interrupts firing while single stepping over the breakpoint. .Sh SIGNAL HANDLING .Nm deals with the following signals: .Pp .Bl -tag -width SIGTERM -compact .It SIGTERM Trigger ACPI poweroff for a VM .El .Sh EXIT STATUS Exit status indicates how the VM was terminated: .Pp .Bl -tag -width indent -compact .It 0 rebooted .It 1 powered off .It 2 halted .It 3 triple fault .It 4 exited due to an error .El .Sh EXAMPLES If not using a boot ROM, the guest operating system must have been loaded with .Xr bhyveload 8 or a similar boot loader before .Xr bhyve 4 can be run. Otherwise, the boot loader is not needed. .Pp To run a virtual machine with 1GB of memory, two virtual CPUs, a virtio block device backed by the .Pa /my/image filesystem image, and a serial port for the console: .Bd -literal -offset indent bhyve -c 2 -s 0,hostbridge -s 1,lpc -s 2,virtio-blk,/my/image \\ -l com1,stdio -A -H -P -m 1G vm1 .Ed .Pp Run a 24GB single-CPU virtual machine with three network ports, one of which has a MAC address specified: .Bd -literal -offset indent bhyve -s 0,hostbridge -s 1,lpc -s 2:0,virtio-net,tap0 \\ -s 2:1,virtio-net,tap1 \\ -s 2:2,virtio-net,tap2,mac=00:be:fa:76:45:00 \\ -s 3,virtio-blk,/my/image -l com1,stdio \\ -A -H -P -m 24G bigvm .Ed .Pp Run an 8GB quad-CPU virtual machine with 8 AHCI SATA disks, an AHCI ATAPI CD-ROM, a single virtio network port, an AMD hostbridge, and the console port connected to an .Xr nmdm 4 null-modem device. .Bd -literal -offset indent bhyve -c 4 \\ -s 0,amd_hostbridge -s 1,lpc \\ -s 1:0,ahci,hd:/images/disk.1,hd:/images/disk.2,\\ hd:/images/disk.3,hd:/images/disk.4,\\ hd:/images/disk.5,hd:/images/disk.6,\\ hd:/images/disk.7,hd:/images/disk.8,\\ cd:/images/install.iso \\ -s 3,virtio-net,tap0 \\ -l com1,/dev/nmdm0A \\ -A -H -P -m 8G .Ed .Pp Run a UEFI virtual machine with a display resolution of 800 by 600 pixels that can be accessed via VNC at: 0.0.0.0:5900. .Bd -literal -offset indent bhyve -c 2 -m 4G -w -H \\ -s 0,hostbridge \\ -s 3,ahci-cd,/path/to/uefi-OS-install.iso \\ -s 4,ahci-hd,disk.img \\ -s 5,virtio-net,tap0 \\ -s 29,fbuf,tcp=0.0.0.0:5900,w=800,h=600,wait \\ -s 30,xhci,tablet \\ -s 31,lpc -l com1,stdio \\ -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \\ uefivm .Ed .Pp Run a UEFI virtual machine with a VNC display that is bound to all IPv6 addresses on port 5900. .Bd -literal -offset indent bhyve -c 2 -m 4G -w -H \\ -s 0,hostbridge \\ -s 4,ahci-hd,disk.img \\ -s 5,virtio-net,tap0 \\ -s 29,fbuf,tcp=[::]:5900,w=800,h=600 \\ -s 30,xhci,tablet \\ -s 31,lpc -l com1,stdio \\ -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \\ uefivm .Ed .Sh SEE ALSO .Xr bhyve 4 , .Xr netgraph 4 , .Xr ng_socket 4 , .Xr nmdm 4 , .Xr vmm 4 , .Xr bhyve_config 5 , .Xr ethers 5 , .Xr bhyvectl 8 , .Xr bhyveload 8 .Pp .Rs .%A Intel .%B 64 and IA-32 Architectures Software Developer’s Manual .%V Volume 3 .Re .Sh HISTORY .Nm first appeared in .Fx 10.0 . .Sh AUTHORS .An Neel Natu Aq Mt neel@freebsd.org .An Peter Grehan Aq Mt grehan@freebsd.org diff --git a/usr.sbin/bhyve/bhyve_config.5 b/usr.sbin/bhyve/bhyve_config.5 index 488dfb21bab7..882479bf7b00 100644 --- a/usr.sbin/bhyve/bhyve_config.5 +++ b/usr.sbin/bhyve/bhyve_config.5 @@ -1,654 +1,660 @@ .\" SPDX-License-Identifier: BSD-2-Clause .\" .\" Copyright (c) 2021 John H. Baldwin .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .Dd August 19, 2022 .Dt BHYVE_CONFIG 5 .Os .Sh NAME .Nm bhyve_config .Nd "bhyve configuration variables" .Sh DESCRIPTION .Xr bhyve 8 uses a hierarchical tree of configuration variables to describe global and per-device settings. Internal nodes in this tree do not have a value, only leaf nodes have values. This manual describes the configuration variables understood by .Xr bhyve 8 . If additional variables are defined, .Xr bhyve 8 will ignore them and will not emit errors for unknown variables. However, these additional variables can be referenced by other variables as described below. .Sh VARIABLE VALUES Configuration variable values are stored as strings. A configuration variable value may refer to one or more other configuration values by name. Instances of the pattern .Sq % Ns Pq Ar var are replaced by the value of the configuration variable .Va var . To avoid unwanted expansion, .Sq % characters can be escaped by a leading .Sq % . For example, if a configuration variable .Va disk uses the value .Pa /dev/zvol/bhyve/%(name) , then the final value of the .Va disk variable will be set to the path of a ZFS volume whose name matches the name of the virtual machine on the pool .Pa bhyve . .Pp Some configuration variables may be interpreted as a boolean value. For those variables the following case-insensitive values may be used to indicate true: .Pp .Bl -bullet -offset indent -compact .It true .It on .It yes .It 1 .El .Pp The following values may be used to indicate false: .Pp .Bl -bullet -offset indent -compact .It false .It off .It no .It 0 .El .Pp Some configuration variables may be interperted as an integer. For those variables, any syntax supported by .Xr strtol 3 may be used. .Sh GLOBAL SETTINGS .Ss Architecture Neutral Settings .Bl -column "memory.guest_in_core" "integer" "Default" .It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description .It Va name Ta string Ta Ta The name of the VM. .It Va cpus Ta integer Ta 1 Ta The total number of virtual CPUs. .It Va cores Ta integer Ta 1 Ta The number of virtual cores in each virtual socket. .It Va threads Ta integer Ta 1 Ta The number of virtual CPUs in each virtual core. .It Va sockets Ta integer Ta 1 Ta The number of virtual sockets. .It Va memory.guest_in_core Ta bool Ta false Ta Include guest memory in core file. .It Va memory.size Ta string Ta 256M Ta Guest physical memory size in bytes. The value must be formatted as described in .Xr expand_number 3 . .It Va memory.wired Ta bool Ta false Ta Wire guest memory. .It Va acpi_tables Ta bool Ta false Ta Generate ACPI tables. .It Va destroy_on_poweroff Ta bool Ta false Ta Destroy the VM on guest-initiated power-off. .It Va gdb.address Ta string Ta localhost Ta Hostname, IP address, or IPv6 address for the debug server. .It Va gdb.port Ta integer Ta 0 Ta TCP port number for the debug server. If this is set to a non-zero value, a debug server will listen for connections on this port. .It Va gdb.wait Ta bool Ta false Ta If the debug server is enabled, wait for a debugger to connect before starting the guest. +.It Va keyboard.layout Ta string Ta Ta +Specify the keyboard layout name with the file name in +.Ar /usr/share/bhyve/kbdlayout . +This value only works when loaded with UEFI mode for VNC, and +used a VNC client that don't support QEMU Extended Key Event +Message (e.g. TightVNC). .It Va rtc.use_localtime Ta bool Ta true Ta The real time clock uses the local time of the host. If this is set to false, the real time clock uses UTC. .It Va uuid Ta string Ta Ta The universally unique identifier (UUID) to use in the guest's System Management BIOS System Information structure. If an explicit value is not set, a valid UUID is generated from the host's hostname and the VM name. .It Va virtio_msix Ta bool Ta true Ta Use MSI-X interrupts for PCI VirtIO devices. If set to false, MSI interrupts are used instead. .It Va config.dump Ta bool Ta false Ta If this value is set to true after .Xr bhyve 8 has finished parsing command line options, then .Xr bhyve 8 will write all of its configuration variables to stdout and exit. No VM will be started. .It Va bios.vendor Ta string Ta BHYVE Ta This value is used for the guest's System Management BIOS System Information structure. .It Va bios.version Ta string Ta 14.0 Ta This value is used for the guest's System Management BIOS System Information structure. .It Va bios.release_date Ta string Ta 10/17/2021 Ta This value is used for the guest's System Management BIOS System Information structure. .It Va system.family_name Ta string Ta Virtual Machine Ta Family the computer belongs to. This value is used for the guest's System Management BIOS System Information structure. .It Va system.manufacturer Ta string Ta FreeBSD Ta This value is used for the guest's System Management BIOS System Information structure. .It Va system.product_name Ta string Ta BHYVE Ta This value is used for the guest's System Management BIOS System Information structure. .It Va system.serial_number Ta string Ta None Ta This value is used for the guest's System Management BIOS System Information structure. .It Va system.sku Ta string Ta None Ta Stock keeping unit of the computer. It's also called product ID or purchase order number. This value is used for the guest's System Management BIOS System Information structure. .It Va system.version Ta string Ta 1.0 Ta This value is used for the guest's System Management BIOS System Information structure. .It Va board.manufacturer Ta string Ta FreeBSD Ta This value is used for the guest's System Management BIOS System Information structure. .It Va board.product_name Ta string Ta BHYVE Ta This value is used for the guest's System Management BIOS System Information structure. .It Va board.version Ta string Ta 1.0 Ta This value is used for the guest's System Management BIOS System Information structure. .It Va board.serial_number Ta string Ta None Ta This value is used for the guest's System Management BIOS System Information structure. .It Va board.asset_tag Ta string Ta None Ta This value is used for the guest's System Management BIOS System Information structure. .It Va board.location Ta string Ta None Ta Describes the board's location within the chassis. This value is used for the guest's System Management BIOS System Information structure. .It Va chassis.manufacturer Ta string Ta FreeBSD Ta This value is used for the guest's System Management BIOS System Information structure. .It Va chassis.version Ta string Ta 1.0 Ta This value is used for the guest's System Management BIOS System Information structure. .It Va chassis.serial_number Ta string Ta None Ta This value is used for the guest's System Management BIOS System Information structure. .It Va chassis.asset_tag Ta string Ta None Ta This value is used for the guest's System Management BIOS System Information structure. .It Va chassis.sku Ta string Ta None Ta Stock keeping unit of the chassis. It's also called product ID or purchase order number. This value is used for the guest's System Management BIOS System Information structure. .El .Ss x86-Specific Settings .Bl -column "x86.vmexit_on_pause" "integer" "Default" .It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description .It Va x86.mptable Ta bool Ta true Ta Generate an MPTable. .It Va x86.x2apic Ta bool Ta false Ta Configure guest's local APICs in x2APIC mode. .It Va x86.strictio Ta bool Ta false Ta Exit if a guest accesses an I/O port that is not emulated. By default, writes are ignored and reads return all bits set. .It Va x86.strictmsr Ta bool Ta true Ta Inject a general protection fault if a guest accesses a Model Specific Register (MSR) that is not emulated. If this is false, writes are ignored and reads return zero. .It Va x86.vmexit_on_hlt Ta bool Ta false Ta Force a VM exit when a guest CPU executes the .Dv HLT instruction. This allows idle guest CPUs to yield the host CPU. .It Va x86.vmexit_on_pause Ta bool Ta false Ta Force a VM exit when a guest CPU executes the .Dv PAUSE instruction. .El .Sh DEVICE SETTINGS Device settings are stored under a device node. The device node's name is set by the parent bus of the device. .Ss PCI Device Settings PCI devices are described by a device node named .Dq pci Ns Ar bus . Ns Ar slot . Ns Ar function where each of .Ar bus , .Ar slot , and .Ar function are formatted as decimal values with no padding. All PCI device nodes must contain a configuration variable named .Dq device which specifies the device model to use. The following PCI device models are supported: .Bl -tag -indent .It Li hostbridge Provide a simple PCI-Host bridge device. This is usually configured at pci0:0:0 and is required by most guest operating systems. .It Li ahci AHCI storage controller. .It Li e1000 Intel e82545 network interface. .It Li fbuf VGA framebuffer device attached to VNC server. .It Li lpc LPC PCI-ISA bridge with COM1-COM4 16550 serial ports, a boot ROM, and an optional debug/test device. This device must be configured on bus 0. .It Li hda High Definition audio controller. .It Li nvme NVM Express (NVMe) controller. .It Li passthru PCI pass-through device. .It Li uart PCI 16550 serial device. .It Li virtio-9p VirtIO 9p (VirtFS) interface. .It Li virtio-blk VirtIO block storage interface. .It Li virtio-console VirtIO console interface. .It Li virtio-net VirtIO network interface. .It Li virtio-rnd VirtIO RNG interface. .It Li virtio-scsi VirtIO SCSI interface. .It Li xhci Extensible Host Controller Interface (XHCI) USB controller. .El .Ss USB Device Settings USB controller devices contain zero or more child USB devices attached to slots. Each USB device stores its settings in a node named .Dq slot. Ns Va N under the controller's device node. .Va N is the number of the slot to which the USB device is attached. Note that USB slot numbers begin at 1. All USB device nodes must contain a configuration variable named .Dq device which specifies the device model to use. The following USB device models are supported: .Bl -tag -indent .It Li tablet A USB tablet device which provides precise cursor synchronization when using VNC. .El .Ss Block Device Settings Block devices use the following settings to configure their backing store. These settings are stored in the configuration node of the respective device. .Bl -column "sectorsize" "logical[/physical]" "Default" .It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description .It path Ta string Ta Ta The path of the file or disk device to use as the backing store. .It nocache Ta bool Ta false Ta Disable caching on the backing file by opening the backing file with .Dv O_DIRECT . .It nodelete Ta bool Ta false Ta Disable emulation of guest trim requests via .Dv DIOCGDELETE requests. .It sync Ta bool Ta false Ta Write changes to the backing file with synchronous writes. .It direct Ta bool Ta false Ta An alias for .Va sync . .It ro Ta bool Ta false Ta Disable writes to the backing file. .It sectorsize Ta Va logical Ns Op / Ns Va physical Ta Ta Specify the logical and physical sector size of the emulated disk. If the physical size is not specified, it is equal to the logical size. .El .Ss Network Backend Settings Network devices use the following settings to configure their backend. The backend is responsible for passing packets between the device model and a desired destination. Configuring a backend requires setting the .Va backend variable. The type of a backend can either be set explicitly via the .Va type variable or it can be inferred from the value of .Va backend . .Pp The following types of backends are supported: .Bl -tag -width "netgraph" .It tap Use the .Xr tap 4 interface named in .Va backend as the backend. .It netgraph Use a .Xr netgraph 4 socket hook as the backend. This backend uses the following additional variables: .Bl -column "peerhook" "Format" "Default" .It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description .It Va path Ta string Ta Ta The name of the .Xr netgraph 4 destination node. .It Va peerhook Ta string Ta Ta The name of the destination hook. .It Va socket Ta string Ta Ta The name of the created .Xr ng_socket 4 node. .It Va hook Ta string Ta vmlink Ta The name of the source hook on the created .Xr ng_socket 4 node. .El .It netmap Use .Xr netmap 4 either on a network interface or a port on a .Xr vale 4 bridge as the backend. The value of .Va backend is passed to .Xr nm_open to connect to a netmap port. .El .Pp If .Va type is not specified explicitly, then it is inferred from .Va backend based on the following patterns: .Bl -column -offset indent "valuebridge:port" .It Sy Pattern Ta Sy Type .It tap Ns Va N Ta tap .It vmnet Ns Va N Ta tap .It netgraph Ta netgraph .It netmap: Ns Va interface Ta netmap .It vale Ns Va bridge : Ns Va port Ta netmap .El .Ss UART Device Settings .Bl -column "Name" "Format" "Default" .It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description .It Va path Ta path Ta Ta Backend device for the serial port. Either the pathname of a character device or .Dq stdio to use standard input and output of the .Xr bhyve 8 process. .El .Ss Host Bridge Settings .Bl -column "vendor" "integer" "Default" .It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description .It Va vendor Ta integer Ta 0x1275 Ta PCI vendor ID. .It Va devid Ta integer Ta 0x1275 Ta PCI device ID. .El .Ss AHCI Controller Settings AHCI controller devices contain zero or more ports each of which provides a storage device. Each port stores its settings in a node named .Dq port. Ns Va N under the controller's device node. The .Va N values are formatted as successive decimal values starting with 0. In addition to the block device settings described above, each port supports the following settings: .Bl -column "model" "integer" "generated" .It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description .It Va type Ta string Ta Ta The type of storage device to emulate. Must be set to either .Dq cd or .Dq hd . .It Va nmrr Ta integer Ta 0 Ta Nominal Media Rotation Rate, also known as RPM. A value 1 of indicates a device with no rate such as a Solid State Disk. .It Va ser Ta string Ta generated Ta Serial number of up to twenty characters. A default serial number is generated using a hash of the backing store's pathname. .It Va rev Ta string Ta 001 Ta Revision number of up to eight characters. .It Va model Ta string Ta Ta Model number of up to forty characters. Separate default model strings are used for .Dq cd and .Dq hd device types. .El .Ss e1000 Settings In addition to the network backend settings, Intel e82545 network interfaces support the following variables: .Bl -column "Name" "MAC address" "generated" .It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description .It Va mac Ta MAC address Ta generated Ta MAC address. If an explicit address is not provided, a MAC address is generated from a hash of the device's PCI address. .El .Ss Frame Buffer Settings .Bl -column "password" "[IP:]port" "127.0.0.1:5900" .It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description .It Va wait Ta bool Ta false Ta Wait for a remote connection before starting the VM. .It Va rfb Ta Oo Ar IP Ns : Oc Ns Ar port Ta 127.0.0.1:5900 Ta TCP address to listen on for remote connections. The IP address must be given as a numeric address. IPv6 addresses must be enclosed in square brackets and support scoped identifiers as described in .Xr getaddrinfo 3 . A bare port number may be given in which case the IPv4 localhost address is used. .It Va vga Ta string Ta io Ta VGA configuration. More details are provided in .Xr bhyve 8 . .It Va w Ta integer Ta 1024 Ta Frame buffer width in pixels. .It Va h Ta integer Ta 768 Ta Frame buffer height in pixels. .It Va password Ta string Ta Ta Password to use for VNC authentication. This type of authentication is known to be cryptographically weak and is not intended for use on untrusted networks. .El .Ss High Definition Audio Settings .Bl -column "Name" "Format" "Default" .It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description .It Va play Ta path Ta Ta Host playback device, typically .Pa /dev/dsp0 . .It Va rec Ta path Ta Ta Host recording device, typically .Pa /dev/dsp0 . .El .Ss LPC Device Settings The LPC bridge stores its configuration under a top-level .Va lpc node rather than under the PCI LPC device's node. The following nodes are available under .Va lpc : .Bl -column "pc-testdev" "Format" "Default" .It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description .It Va bootrom Ta path Ta Ta Path to a boot ROM. The contents of this file are copied into the guest's memory ending just before the 4GB physical address. If a boot ROM is present, a firmware interface device is also enabled for use by the boot ROM. .It Va com1 Ta node Ta Ta Settings for the COM1 serial port device. .It Va com2 Ta node Ta Ta Settings for the COM2 serial port device. .It Va com3 Ta node Ta Ta Settings for the COM3 serial port device. .It Va com4 Ta node Ta Ta Settings for the COM4 serial port device. .It Va pc-testdev Ta bool Ta false Ta Enable the PC debug/test device. .El .Ss NVMe Controller Settings Each NVMe controller supports a single storage device. The device can be backed either by a memory disk described by the .Va ram variable, or a block device using the the block device settings described above. In addition, each controller supports the following settings: .Bl -column "ioslots" "Format" "Default" .It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description .It Va maxq Ta integer Ta 16 Ta Maximum number of I/O submission and completion queue pairs. .It Va qsz Ta integer Ta 2058 Ta Number of elements in each I/O queue. .It Va ioslots Ta integer Ta 8 Ta Maximum number of concurrent I/O requests. .It Va sectsz Ta integer Ta Ta Sector size. Can be one of 512, 4096, or 8192. Devices backed by a memory disk use 4096 as the default. Devices backed by a block device use the block device's sector size as the default. .It Va ser Ta string Ta Ta Serial number of up to twenty characters. A default serial number is generated using a hash of the device's PCI address. .It Va eui64 Ta integer Ta Ta IEEE Extended Unique Identifier. If an EUI is not provided, a default is generated using a checksum of the device's PCI address. .It Va dsm Ta string Ta auto Ta Whether or not to advertise DataSet Management support. One of .Dq auto , .Dq enable , or .Dq disable . The .Dq auto setting only advertises support if the backing store supports resource freeing, for example via TRIM. .It Va ram Ta integer Ta Ta If set, allocate a memory disk as the backing store. The value of this variable is the size of the memory disk in megabytes. .El .Ss PCI Passthrough Settings The .Xr ppt 4 device driver must be attached to the PCI device being passed through. The device to pass through can be identified either by name or its host PCI bus location. .Bl -column "Name" "integer" "Default" .It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description .It Va bus Ta integer Ta Ta Host PCI bus address of device to pass through. .It Va slot Ta integer Ta Ta Host PCI slot address of device to pass through. .It Va func Ta integer Ta Ta Host PCI function address of device to pass through. .It Va pptdev Ta string Ta Ta Name of a .Xr ppt 4 device to pass through. .It Va rom Ta path Ta Ta ROM file of the device which will be executed by OVMF to init the device. .El .Ss VirtIO 9p Settings Each VirtIO 9p device exposes a single filesystem from a host path. .Bl -column "sharename" "Format" "Default" .It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description .It Va sharename Ta string Ta Ta The share name exposed to the guest. .It Va path Ta path Ta Ta The path of a directory on the host to export to the guest. .It Va ro Ta bool Ta false Ta If true, the guest filesystem is read-only. .El .Ss VirtIO Block Device Settings In addition to the block device settings described above, each VirtIO block device supports the following settings: .Bl -column "model" "integer" "generated" .It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description .It Va ser Ta string Ta generated Ta Serial number of up to twenty characters. A default serial number is generated using a hash of the backing store's pathname. .El .Ss VirtIO Console Device Settings Each VirtIO Console device contains one or more console ports. Each port stores its settings in a node named .Dq port. Ns Va N under the controller's device node. The .Va N values are formatted as successive decimal values starting with 0. Each port supports the following settings: .Bl -column "Name" "Format" "Default" .It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description .It Va name Ta string Ta Ta The name of the port exposed to the guest. .It Va path Ta path Ta Ta The path of a UNIX domain socket providing the host connection for the port. .El .Ss VirtIO Network Interface Settings In addition to the network backend settings, VirtIO network interfaces support the following variables: .Bl -column "Name" "MAC address" "generated" .It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description .It Va mac Ta MAC address Ta generated Ta MAC address. If an explicit address is not provided, a MAC address is generated from a hash of the device's PCI address. .It Va mtu Ta integer Ta 1500 Ta The largest supported MTU advertised to the guest. .El .Ss VirtIO SCSI Settings .Bl -column "Name" "integer" "Default" .It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description .It Va dev Ta path Ta Ta The path of a CAM target layer (CTL) device to export: .Pa /dev/cam/ctl Ns Oo Ar pp . Ns Ar vp Oc . .It Va iid Ta integer Ta 0 Ta Initiator ID to use when sending requests to the CTL port. .El .Sh SEE ALSO .Xr expand_number 3 , .Xr getaddrinfo 3 , .Xr strtol 3 , .Xr netgraph 4 , .Xr netmap 4 , .Xr ng_socket 4 , .Xr tap 4 , .Xr vale 4 , .Xr vmnet 4 , .Xr bhyve 8 diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c index e9fc3c98ddeb..27166d9046e5 100644 --- a/usr.sbin/bhyve/bhyverun.c +++ b/usr.sbin/bhyve/bhyverun.c @@ -1,1594 +1,1598 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2011 NetApp, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #include __FBSDID("$FreeBSD$"); #include #ifndef WITHOUT_CAPSICUM #include #endif #include #ifdef BHYVE_SNAPSHOT #include #include #endif #include #ifdef BHYVE_SNAPSHOT #include #endif #include #include #include #ifndef WITHOUT_CAPSICUM #include #endif #include #include #include #include #include #ifdef BHYVE_SNAPSHOT #include #endif #include #include #include #include #include #include #include #include #ifdef BHYVE_SNAPSHOT #include #include #include #endif #include #ifndef WITHOUT_CAPSICUM #include #endif #include #include #include "bhyverun.h" #include "acpi.h" #include "atkbdc.h" #include "bootrom.h" #include "config.h" #include "inout.h" #include "debug.h" #include "fwctl.h" #include "gdb.h" #include "ioapic.h" #include "kernemu_dev.h" #include "mem.h" #include "mevent.h" #include "mptbl.h" #include "pci_emul.h" #include "pci_irq.h" #include "pci_lpc.h" #include "smbiostbl.h" #ifdef BHYVE_SNAPSHOT #include "snapshot.h" #endif #include "xmsr.h" #include "spinup_ap.h" #include "rtc.h" #include "vmgenc.h" #define GUEST_NIO_PORT 0x488 /* guest upcalls via i/o port */ #define MB (1024UL * 1024) #define GB (1024UL * MB) static const char * const vmx_exit_reason_desc[] = { [EXIT_REASON_EXCEPTION] = "Exception or non-maskable interrupt (NMI)", [EXIT_REASON_EXT_INTR] = "External interrupt", [EXIT_REASON_TRIPLE_FAULT] = "Triple fault", [EXIT_REASON_INIT] = "INIT signal", [EXIT_REASON_SIPI] = "Start-up IPI (SIPI)", [EXIT_REASON_IO_SMI] = "I/O system-management interrupt (SMI)", [EXIT_REASON_SMI] = "Other SMI", [EXIT_REASON_INTR_WINDOW] = "Interrupt window", [EXIT_REASON_NMI_WINDOW] = "NMI window", [EXIT_REASON_TASK_SWITCH] = "Task switch", [EXIT_REASON_CPUID] = "CPUID", [EXIT_REASON_GETSEC] = "GETSEC", [EXIT_REASON_HLT] = "HLT", [EXIT_REASON_INVD] = "INVD", [EXIT_REASON_INVLPG] = "INVLPG", [EXIT_REASON_RDPMC] = "RDPMC", [EXIT_REASON_RDTSC] = "RDTSC", [EXIT_REASON_RSM] = "RSM", [EXIT_REASON_VMCALL] = "VMCALL", [EXIT_REASON_VMCLEAR] = "VMCLEAR", [EXIT_REASON_VMLAUNCH] = "VMLAUNCH", [EXIT_REASON_VMPTRLD] = "VMPTRLD", [EXIT_REASON_VMPTRST] = "VMPTRST", [EXIT_REASON_VMREAD] = "VMREAD", [EXIT_REASON_VMRESUME] = "VMRESUME", [EXIT_REASON_VMWRITE] = "VMWRITE", [EXIT_REASON_VMXOFF] = "VMXOFF", [EXIT_REASON_VMXON] = "VMXON", [EXIT_REASON_CR_ACCESS] = "Control-register accesses", [EXIT_REASON_DR_ACCESS] = "MOV DR", [EXIT_REASON_INOUT] = "I/O instruction", [EXIT_REASON_RDMSR] = "RDMSR", [EXIT_REASON_WRMSR] = "WRMSR", [EXIT_REASON_INVAL_VMCS] = "VM-entry failure due to invalid guest state", [EXIT_REASON_INVAL_MSR] = "VM-entry failure due to MSR loading", [EXIT_REASON_MWAIT] = "MWAIT", [EXIT_REASON_MTF] = "Monitor trap flag", [EXIT_REASON_MONITOR] = "MONITOR", [EXIT_REASON_PAUSE] = "PAUSE", [EXIT_REASON_MCE_DURING_ENTRY] = "VM-entry failure due to machine-check event", [EXIT_REASON_TPR] = "TPR below threshold", [EXIT_REASON_APIC_ACCESS] = "APIC access", [EXIT_REASON_VIRTUALIZED_EOI] = "Virtualized EOI", [EXIT_REASON_GDTR_IDTR] = "Access to GDTR or IDTR", [EXIT_REASON_LDTR_TR] = "Access to LDTR or TR", [EXIT_REASON_EPT_FAULT] = "EPT violation", [EXIT_REASON_EPT_MISCONFIG] = "EPT misconfiguration", [EXIT_REASON_INVEPT] = "INVEPT", [EXIT_REASON_RDTSCP] = "RDTSCP", [EXIT_REASON_VMX_PREEMPT] = "VMX-preemption timer expired", [EXIT_REASON_INVVPID] = "INVVPID", [EXIT_REASON_WBINVD] = "WBINVD", [EXIT_REASON_XSETBV] = "XSETBV", [EXIT_REASON_APIC_WRITE] = "APIC write", [EXIT_REASON_RDRAND] = "RDRAND", [EXIT_REASON_INVPCID] = "INVPCID", [EXIT_REASON_VMFUNC] = "VMFUNC", [EXIT_REASON_ENCLS] = "ENCLS", [EXIT_REASON_RDSEED] = "RDSEED", [EXIT_REASON_PM_LOG_FULL] = "Page-modification log full", [EXIT_REASON_XSAVES] = "XSAVES", [EXIT_REASON_XRSTORS] = "XRSTORS" }; typedef int (*vmexit_handler_t)(struct vmctx *, struct vm_exit *, int *vcpu); extern int vmexit_task_switch(struct vmctx *, struct vm_exit *, int *vcpu); int guest_ncpus; uint16_t cpu_cores, cpu_sockets, cpu_threads; int raw_stdio = 0; static char *progname; static const int BSP = 0; static cpuset_t cpumask; static void vm_loop(struct vmctx *ctx, int vcpu, uint64_t rip); static struct vm_exit *vmexit; struct bhyvestats { uint64_t vmexit_bogus; uint64_t vmexit_reqidle; uint64_t vmexit_hlt; uint64_t vmexit_pause; uint64_t vmexit_mtrap; uint64_t vmexit_inst_emul; uint64_t cpu_switch_rotate; uint64_t cpu_switch_direct; } stats; struct mt_vmm_info { pthread_t mt_thr; struct vmctx *mt_ctx; int mt_vcpu; } *mt_vmm_info; static cpuset_t **vcpumap; static void usage(int code) { fprintf(stderr, "Usage: %s [-AaCDeHhPSuWwxY]\n" " %*s [-c [[cpus=]numcpus][,sockets=n][,cores=n][,threads=n]]\n" " %*s [-G port] [-k config_file] [-l lpc] [-m mem] [-o var=value]\n" " %*s [-p vcpu:hostcpu] [-r file] [-s pci] [-U uuid] vmname\n" " -A: create ACPI tables\n" " -a: local apic is in xAPIC mode (deprecated)\n" " -C: include guest memory in core file\n" " -c: number of CPUs and/or topology specification\n" " -D: destroy on power-off\n" " -e: exit on unhandled I/O access\n" " -G: start a debug server\n" " -H: vmexit from the guest on HLT\n" " -h: help\n" " -k: key=value flat config file\n" + " -K: PS2 keyboard layout\n" " -l: LPC device configuration\n" " -m: memory size\n" " -o: set config 'var' to 'value'\n" " -P: vmexit from the guest on pause\n" " -p: pin 'vcpu' to 'hostcpu'\n" #ifdef BHYVE_SNAPSHOT " -r: path to checkpoint file\n" #endif " -S: guest memory cannot be swapped\n" " -s: PCI slot config\n" " -U: UUID\n" " -u: RTC keeps UTC time\n" " -W: force virtio to use single-vector MSI\n" " -w: ignore unimplemented MSRs\n" " -x: local APIC is in x2APIC mode\n" " -Y: disable MPtable generation\n", progname, (int)strlen(progname), "", (int)strlen(progname), "", (int)strlen(progname), ""); exit(code); } /* * XXX This parser is known to have the following issues: * 1. It accepts null key=value tokens ",," as setting "cpus" to an * empty string. * * The acceptance of a null specification ('-c ""') is by design to match the * manual page syntax specification, this results in a topology of 1 vCPU. */ static int topology_parse(const char *opt) { char *cp, *str; if (*opt == '\0') { set_config_value("sockets", "1"); set_config_value("cores", "1"); set_config_value("threads", "1"); set_config_value("cpus", "1"); return (0); } str = strdup(opt); if (str == NULL) errx(4, "Failed to allocate memory"); while ((cp = strsep(&str, ",")) != NULL) { if (strncmp(cp, "cpus=", strlen("cpus=")) == 0) set_config_value("cpus", cp + strlen("cpus=")); else if (strncmp(cp, "sockets=", strlen("sockets=")) == 0) set_config_value("sockets", cp + strlen("sockets=")); else if (strncmp(cp, "cores=", strlen("cores=")) == 0) set_config_value("cores", cp + strlen("cores=")); else if (strncmp(cp, "threads=", strlen("threads=")) == 0) set_config_value("threads", cp + strlen("threads=")); #ifdef notyet /* Do not expose this until vmm.ko implements it */ else if (strncmp(cp, "maxcpus=", strlen("maxcpus=")) == 0) set_config_value("maxcpus", cp + strlen("maxcpus=")); #endif else if (strchr(cp, '=') != NULL) goto out; else set_config_value("cpus", cp); } free(str); return (0); out: free(str); return (-1); } static int parse_int_value(const char *key, const char *value, int minval, int maxval) { char *cp; long lval; errno = 0; lval = strtol(value, &cp, 0); if (errno != 0 || *cp != '\0' || cp == value || lval < minval || lval > maxval) errx(4, "Invalid value for %s: '%s'", key, value); return (lval); } /* * Set the sockets, cores, threads, and guest_cpus variables based on * the configured topology. * * The limits of UINT16_MAX are due to the types passed to * vm_set_topology(). vmm.ko may enforce tighter limits. */ static void calc_topology(void) { const char *value; bool explicit_cpus; uint64_t ncpus; value = get_config_value("cpus"); if (value != NULL) { guest_ncpus = parse_int_value("cpus", value, 1, UINT16_MAX); explicit_cpus = true; } else { guest_ncpus = 1; explicit_cpus = false; } value = get_config_value("cores"); if (value != NULL) cpu_cores = parse_int_value("cores", value, 1, UINT16_MAX); else cpu_cores = 1; value = get_config_value("threads"); if (value != NULL) cpu_threads = parse_int_value("threads", value, 1, UINT16_MAX); else cpu_threads = 1; value = get_config_value("sockets"); if (value != NULL) cpu_sockets = parse_int_value("sockets", value, 1, UINT16_MAX); else cpu_sockets = guest_ncpus; /* * Compute sockets * cores * threads avoiding overflow. The * range check above insures these are 16 bit values. */ ncpus = (uint64_t)cpu_sockets * cpu_cores * cpu_threads; if (ncpus > UINT16_MAX) errx(4, "Computed number of vCPUs too high: %ju", (uintmax_t)ncpus); if (explicit_cpus) { if (guest_ncpus != ncpus) errx(4, "Topology (%d sockets, %d cores, %d threads) " "does not match %d vCPUs", cpu_sockets, cpu_cores, cpu_threads, guest_ncpus); } else guest_ncpus = ncpus; } static int pincpu_parse(const char *opt) { const char *value; char *newval; char key[16]; int vcpu, pcpu; if (sscanf(opt, "%d:%d", &vcpu, &pcpu) != 2) { fprintf(stderr, "invalid format: %s\n", opt); return (-1); } if (vcpu < 0) { fprintf(stderr, "invalid vcpu '%d'\n", vcpu); return (-1); } if (pcpu < 0 || pcpu >= CPU_SETSIZE) { fprintf(stderr, "hostcpu '%d' outside valid range from " "0 to %d\n", pcpu, CPU_SETSIZE - 1); return (-1); } snprintf(key, sizeof(key), "vcpu.%d.cpuset", vcpu); value = get_config_value(key); if (asprintf(&newval, "%s%s%d", value != NULL ? value : "", value != NULL ? "," : "", pcpu) == -1) { perror("failed to build new cpuset string"); return (-1); } set_config_value(key, newval); free(newval); return (0); } static void parse_cpuset(int vcpu, const char *list, cpuset_t *set) { char *cp, *token; int pcpu, start; CPU_ZERO(set); start = -1; token = __DECONST(char *, list); for (;;) { pcpu = strtoul(token, &cp, 0); if (cp == token) errx(4, "invalid cpuset for vcpu %d: '%s'", vcpu, list); if (pcpu < 0 || pcpu >= CPU_SETSIZE) errx(4, "hostcpu '%d' outside valid range from 0 to %d", pcpu, CPU_SETSIZE - 1); switch (*cp) { case ',': case '\0': if (start >= 0) { if (start > pcpu) errx(4, "Invalid hostcpu range %d-%d", start, pcpu); while (start < pcpu) { CPU_SET(start, vcpumap[vcpu]); start++; } start = -1; } CPU_SET(pcpu, vcpumap[vcpu]); break; case '-': if (start >= 0) errx(4, "invalid cpuset for vcpu %d: '%s'", vcpu, list); start = pcpu; break; default: errx(4, "invalid cpuset for vcpu %d: '%s'", vcpu, list); } if (*cp == '\0') break; token = cp + 1; } } static void build_vcpumaps(void) { char key[16]; const char *value; int vcpu; vcpumap = calloc(guest_ncpus, sizeof(*vcpumap)); for (vcpu = 0; vcpu < guest_ncpus; vcpu++) { snprintf(key, sizeof(key), "vcpu.%d.cpuset", vcpu); value = get_config_value(key); if (value == NULL) continue; vcpumap[vcpu] = malloc(sizeof(cpuset_t)); if (vcpumap[vcpu] == NULL) err(4, "Failed to allocate cpuset for vcpu %d", vcpu); parse_cpuset(vcpu, value, vcpumap[vcpu]); } } void vm_inject_fault(void *arg, int vcpu, int vector, int errcode_valid, int errcode) { struct vmctx *ctx; int error, restart_instruction; ctx = arg; restart_instruction = 1; error = vm_inject_exception(ctx, vcpu, vector, errcode_valid, errcode, restart_instruction); assert(error == 0); } void * paddr_guest2host(struct vmctx *ctx, uintptr_t gaddr, size_t len) { return (vm_map_gpa(ctx, gaddr, len)); } #ifdef BHYVE_SNAPSHOT uintptr_t paddr_host2guest(struct vmctx *ctx, void *addr) { return (vm_rev_map_gpa(ctx, addr)); } #endif int fbsdrun_virtio_msix(void) { return (get_config_bool_default("virtio_msix", true)); } static void * fbsdrun_start_thread(void *param) { char tname[MAXCOMLEN + 1]; struct mt_vmm_info *mtp; int vcpu; mtp = param; vcpu = mtp->mt_vcpu; snprintf(tname, sizeof(tname), "vcpu %d", vcpu); pthread_set_name_np(mtp->mt_thr, tname); #ifdef BHYVE_SNAPSHOT checkpoint_cpu_add(vcpu); #endif gdb_cpu_add(vcpu); vm_loop(mtp->mt_ctx, vcpu, vmexit[vcpu].rip); /* not reached */ exit(1); return (NULL); } void fbsdrun_addcpu(struct vmctx *ctx, int fromcpu, int newcpu, uint64_t rip) { int error; assert(fromcpu == BSP); /* * The 'newcpu' must be activated in the context of 'fromcpu'. If * vm_activate_cpu() is delayed until newcpu's pthread starts running * then vmm.ko is out-of-sync with bhyve and this can create a race * with vm_suspend(). */ error = vm_activate_cpu(ctx, newcpu); if (error != 0) err(EX_OSERR, "could not activate CPU %d", newcpu); CPU_SET_ATOMIC(newcpu, &cpumask); /* * Set up the vmexit struct to allow execution to start * at the given RIP */ vmexit[newcpu].rip = rip; vmexit[newcpu].inst_length = 0; mt_vmm_info[newcpu].mt_ctx = ctx; mt_vmm_info[newcpu].mt_vcpu = newcpu; error = pthread_create(&mt_vmm_info[newcpu].mt_thr, NULL, fbsdrun_start_thread, &mt_vmm_info[newcpu]); assert(error == 0); } static int fbsdrun_deletecpu(struct vmctx *ctx, int vcpu) { if (!CPU_ISSET(vcpu, &cpumask)) { fprintf(stderr, "Attempting to delete unknown cpu %d\n", vcpu); exit(4); } CPU_CLR_ATOMIC(vcpu, &cpumask); return (CPU_EMPTY(&cpumask)); } static int vmexit_handle_notify(struct vmctx *ctx, struct vm_exit *vme, int *pvcpu, uint32_t eax) { #if BHYVE_DEBUG /* * put guest-driven debug here */ #endif return (VMEXIT_CONTINUE); } static int vmexit_inout(struct vmctx *ctx, struct vm_exit *vme, int *pvcpu) { int error; int bytes, port, in, out; int vcpu; vcpu = *pvcpu; port = vme->u.inout.port; bytes = vme->u.inout.bytes; in = vme->u.inout.in; out = !in; /* Extra-special case of host notifications */ if (out && port == GUEST_NIO_PORT) { error = vmexit_handle_notify(ctx, vme, pvcpu, vme->u.inout.eax); return (error); } error = emulate_inout(ctx, vcpu, vme); if (error) { fprintf(stderr, "Unhandled %s%c 0x%04x at 0x%lx\n", in ? "in" : "out", bytes == 1 ? 'b' : (bytes == 2 ? 'w' : 'l'), port, vmexit->rip); return (VMEXIT_ABORT); } else { return (VMEXIT_CONTINUE); } } static int vmexit_rdmsr(struct vmctx *ctx, struct vm_exit *vme, int *pvcpu) { uint64_t val; uint32_t eax, edx; int error; val = 0; error = emulate_rdmsr(ctx, *pvcpu, vme->u.msr.code, &val); if (error != 0) { fprintf(stderr, "rdmsr to register %#x on vcpu %d\n", vme->u.msr.code, *pvcpu); if (get_config_bool("x86.strictmsr")) { vm_inject_gp(ctx, *pvcpu); return (VMEXIT_CONTINUE); } } eax = val; error = vm_set_register(ctx, *pvcpu, VM_REG_GUEST_RAX, eax); assert(error == 0); edx = val >> 32; error = vm_set_register(ctx, *pvcpu, VM_REG_GUEST_RDX, edx); assert(error == 0); return (VMEXIT_CONTINUE); } static int vmexit_wrmsr(struct vmctx *ctx, struct vm_exit *vme, int *pvcpu) { int error; error = emulate_wrmsr(ctx, *pvcpu, vme->u.msr.code, vme->u.msr.wval); if (error != 0) { fprintf(stderr, "wrmsr to register %#x(%#lx) on vcpu %d\n", vme->u.msr.code, vme->u.msr.wval, *pvcpu); if (get_config_bool("x86.strictmsr")) { vm_inject_gp(ctx, *pvcpu); return (VMEXIT_CONTINUE); } } return (VMEXIT_CONTINUE); } static int vmexit_spinup_ap(struct vmctx *ctx, struct vm_exit *vme, int *pvcpu) { (void)spinup_ap(ctx, *pvcpu, vme->u.spinup_ap.vcpu, vme->u.spinup_ap.rip); return (VMEXIT_CONTINUE); } #define DEBUG_EPT_MISCONFIG #ifdef DEBUG_EPT_MISCONFIG #define VMCS_GUEST_PHYSICAL_ADDRESS 0x00002400 static uint64_t ept_misconfig_gpa, ept_misconfig_pte[4]; static int ept_misconfig_ptenum; #endif static const char * vmexit_vmx_desc(uint32_t exit_reason) { if (exit_reason >= nitems(vmx_exit_reason_desc) || vmx_exit_reason_desc[exit_reason] == NULL) return ("Unknown"); return (vmx_exit_reason_desc[exit_reason]); } static int vmexit_vmx(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu) { fprintf(stderr, "vm exit[%d]\n", *pvcpu); fprintf(stderr, "\treason\t\tVMX\n"); fprintf(stderr, "\trip\t\t0x%016lx\n", vmexit->rip); fprintf(stderr, "\tinst_length\t%d\n", vmexit->inst_length); fprintf(stderr, "\tstatus\t\t%d\n", vmexit->u.vmx.status); fprintf(stderr, "\texit_reason\t%u (%s)\n", vmexit->u.vmx.exit_reason, vmexit_vmx_desc(vmexit->u.vmx.exit_reason)); fprintf(stderr, "\tqualification\t0x%016lx\n", vmexit->u.vmx.exit_qualification); fprintf(stderr, "\tinst_type\t\t%d\n", vmexit->u.vmx.inst_type); fprintf(stderr, "\tinst_error\t\t%d\n", vmexit->u.vmx.inst_error); #ifdef DEBUG_EPT_MISCONFIG if (vmexit->u.vmx.exit_reason == EXIT_REASON_EPT_MISCONFIG) { vm_get_register(ctx, *pvcpu, VMCS_IDENT(VMCS_GUEST_PHYSICAL_ADDRESS), &ept_misconfig_gpa); vm_get_gpa_pmap(ctx, ept_misconfig_gpa, ept_misconfig_pte, &ept_misconfig_ptenum); fprintf(stderr, "\tEPT misconfiguration:\n"); fprintf(stderr, "\t\tGPA: %#lx\n", ept_misconfig_gpa); fprintf(stderr, "\t\tPTE(%d): %#lx %#lx %#lx %#lx\n", ept_misconfig_ptenum, ept_misconfig_pte[0], ept_misconfig_pte[1], ept_misconfig_pte[2], ept_misconfig_pte[3]); } #endif /* DEBUG_EPT_MISCONFIG */ return (VMEXIT_ABORT); } static int vmexit_svm(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu) { fprintf(stderr, "vm exit[%d]\n", *pvcpu); fprintf(stderr, "\treason\t\tSVM\n"); fprintf(stderr, "\trip\t\t0x%016lx\n", vmexit->rip); fprintf(stderr, "\tinst_length\t%d\n", vmexit->inst_length); fprintf(stderr, "\texitcode\t%#lx\n", vmexit->u.svm.exitcode); fprintf(stderr, "\texitinfo1\t%#lx\n", vmexit->u.svm.exitinfo1); fprintf(stderr, "\texitinfo2\t%#lx\n", vmexit->u.svm.exitinfo2); return (VMEXIT_ABORT); } static int vmexit_bogus(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu) { assert(vmexit->inst_length == 0); stats.vmexit_bogus++; return (VMEXIT_CONTINUE); } static int vmexit_reqidle(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu) { assert(vmexit->inst_length == 0); stats.vmexit_reqidle++; return (VMEXIT_CONTINUE); } static int vmexit_hlt(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu) { stats.vmexit_hlt++; /* * Just continue execution with the next instruction. We use * the HLT VM exit as a way to be friendly with the host * scheduler. */ return (VMEXIT_CONTINUE); } static int vmexit_pause(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu) { stats.vmexit_pause++; return (VMEXIT_CONTINUE); } static int vmexit_mtrap(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu) { assert(vmexit->inst_length == 0); stats.vmexit_mtrap++; #ifdef BHYVE_SNAPSHOT checkpoint_cpu_suspend(*pvcpu); #endif gdb_cpu_mtrap(*pvcpu); #ifdef BHYVE_SNAPSHOT checkpoint_cpu_resume(*pvcpu); #endif return (VMEXIT_CONTINUE); } static int vmexit_inst_emul(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu) { int err, i, cs_d; struct vie *vie; enum vm_cpu_mode mode; stats.vmexit_inst_emul++; vie = &vmexit->u.inst_emul.vie; if (!vie->decoded) { /* * Attempt to decode in userspace as a fallback. This allows * updating instruction decode in bhyve without rebooting the * kernel (rapid prototyping), albeit with much slower * emulation. */ vie_restart(vie); mode = vmexit->u.inst_emul.paging.cpu_mode; cs_d = vmexit->u.inst_emul.cs_d; if (vmm_decode_instruction(mode, cs_d, vie) != 0) goto fail; if (vm_set_register(ctx, *pvcpu, VM_REG_GUEST_RIP, vmexit->rip + vie->num_processed) != 0) goto fail; } err = emulate_mem(ctx, *pvcpu, vmexit->u.inst_emul.gpa, vie, &vmexit->u.inst_emul.paging); if (err) { if (err == ESRCH) { EPRINTLN("Unhandled memory access to 0x%lx\n", vmexit->u.inst_emul.gpa); } goto fail; } return (VMEXIT_CONTINUE); fail: fprintf(stderr, "Failed to emulate instruction sequence [ "); for (i = 0; i < vie->num_valid; i++) fprintf(stderr, "%02x", vie->inst[i]); FPRINTLN(stderr, " ] at 0x%lx", vmexit->rip); return (VMEXIT_ABORT); } static pthread_mutex_t resetcpu_mtx = PTHREAD_MUTEX_INITIALIZER; static pthread_cond_t resetcpu_cond = PTHREAD_COND_INITIALIZER; static int vmexit_suspend(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu) { enum vm_suspend_how how; how = vmexit->u.suspended.how; fbsdrun_deletecpu(ctx, *pvcpu); if (*pvcpu != BSP) { pthread_mutex_lock(&resetcpu_mtx); pthread_cond_signal(&resetcpu_cond); pthread_mutex_unlock(&resetcpu_mtx); pthread_exit(NULL); } pthread_mutex_lock(&resetcpu_mtx); while (!CPU_EMPTY(&cpumask)) { pthread_cond_wait(&resetcpu_cond, &resetcpu_mtx); } pthread_mutex_unlock(&resetcpu_mtx); switch (how) { case VM_SUSPEND_RESET: exit(0); case VM_SUSPEND_POWEROFF: if (get_config_bool_default("destroy_on_poweroff", false)) vm_destroy(ctx); exit(1); case VM_SUSPEND_HALT: exit(2); case VM_SUSPEND_TRIPLEFAULT: exit(3); default: fprintf(stderr, "vmexit_suspend: invalid reason %d\n", how); exit(100); } return (0); /* NOTREACHED */ } static int vmexit_debug(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu) { #ifdef BHYVE_SNAPSHOT checkpoint_cpu_suspend(*pvcpu); #endif gdb_cpu_suspend(*pvcpu); #ifdef BHYVE_SNAPSHOT checkpoint_cpu_resume(*pvcpu); #endif return (VMEXIT_CONTINUE); } static int vmexit_breakpoint(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu) { gdb_cpu_breakpoint(*pvcpu, vmexit); return (VMEXIT_CONTINUE); } static vmexit_handler_t handler[VM_EXITCODE_MAX] = { [VM_EXITCODE_INOUT] = vmexit_inout, [VM_EXITCODE_INOUT_STR] = vmexit_inout, [VM_EXITCODE_VMX] = vmexit_vmx, [VM_EXITCODE_SVM] = vmexit_svm, [VM_EXITCODE_BOGUS] = vmexit_bogus, [VM_EXITCODE_REQIDLE] = vmexit_reqidle, [VM_EXITCODE_RDMSR] = vmexit_rdmsr, [VM_EXITCODE_WRMSR] = vmexit_wrmsr, [VM_EXITCODE_MTRAP] = vmexit_mtrap, [VM_EXITCODE_INST_EMUL] = vmexit_inst_emul, [VM_EXITCODE_SPINUP_AP] = vmexit_spinup_ap, [VM_EXITCODE_SUSPENDED] = vmexit_suspend, [VM_EXITCODE_TASK_SWITCH] = vmexit_task_switch, [VM_EXITCODE_DEBUG] = vmexit_debug, [VM_EXITCODE_BPT] = vmexit_breakpoint, }; static void vm_loop(struct vmctx *ctx, int vcpu, uint64_t startrip) { int error, rc; enum vm_exitcode exitcode; cpuset_t active_cpus; if (vcpumap[vcpu] != NULL) { error = pthread_setaffinity_np(pthread_self(), sizeof(cpuset_t), vcpumap[vcpu]); assert(error == 0); } error = vm_active_cpus(ctx, &active_cpus); assert(CPU_ISSET(vcpu, &active_cpus)); error = vm_set_register(ctx, vcpu, VM_REG_GUEST_RIP, startrip); assert(error == 0); while (1) { error = vm_run(ctx, vcpu, &vmexit[vcpu]); if (error != 0) break; exitcode = vmexit[vcpu].exitcode; if (exitcode >= VM_EXITCODE_MAX || handler[exitcode] == NULL) { fprintf(stderr, "vm_loop: unexpected exitcode 0x%x\n", exitcode); exit(4); } rc = (*handler[exitcode])(ctx, &vmexit[vcpu], &vcpu); switch (rc) { case VMEXIT_CONTINUE: break; case VMEXIT_ABORT: abort(); default: exit(4); } } fprintf(stderr, "vm_run error %d, errno %d\n", error, errno); } static int num_vcpus_allowed(struct vmctx *ctx) { uint16_t sockets, cores, threads, maxcpus; int tmp, error; /* * The guest is allowed to spinup more than one processor only if the * UNRESTRICTED_GUEST capability is available. */ error = vm_get_capability(ctx, BSP, VM_CAP_UNRESTRICTED_GUEST, &tmp); if (error != 0) return (1); error = vm_get_topology(ctx, &sockets, &cores, &threads, &maxcpus); if (error == 0) return (maxcpus); else return (1); } void fbsdrun_set_capabilities(struct vmctx *ctx, int cpu) { int err, tmp; if (get_config_bool_default("x86.vmexit_on_hlt", false)) { err = vm_get_capability(ctx, cpu, VM_CAP_HALT_EXIT, &tmp); if (err < 0) { fprintf(stderr, "VM exit on HLT not supported\n"); exit(4); } vm_set_capability(ctx, cpu, VM_CAP_HALT_EXIT, 1); if (cpu == BSP) handler[VM_EXITCODE_HLT] = vmexit_hlt; } if (get_config_bool_default("x86.vmexit_on_pause", false)) { /* * pause exit support required for this mode */ err = vm_get_capability(ctx, cpu, VM_CAP_PAUSE_EXIT, &tmp); if (err < 0) { fprintf(stderr, "SMP mux requested, no pause support\n"); exit(4); } vm_set_capability(ctx, cpu, VM_CAP_PAUSE_EXIT, 1); if (cpu == BSP) handler[VM_EXITCODE_PAUSE] = vmexit_pause; } if (get_config_bool_default("x86.x2apic", false)) err = vm_set_x2apic_state(ctx, cpu, X2APIC_ENABLED); else err = vm_set_x2apic_state(ctx, cpu, X2APIC_DISABLED); if (err) { fprintf(stderr, "Unable to set x2apic state (%d)\n", err); exit(4); } vm_set_capability(ctx, cpu, VM_CAP_ENABLE_INVPCID, 1); } static struct vmctx * do_open(const char *vmname) { struct vmctx *ctx; int error; bool reinit, romboot; reinit = romboot = false; if (lpc_bootrom()) romboot = true; error = vm_create(vmname); if (error) { if (errno == EEXIST) { if (romboot) { reinit = true; } else { /* * The virtual machine has been setup by the * userspace bootloader. */ } } else { perror("vm_create"); exit(4); } } else { if (!romboot) { /* * If the virtual machine was just created then a * bootrom must be configured to boot it. */ fprintf(stderr, "virtual machine cannot be booted\n"); exit(4); } } ctx = vm_open(vmname); if (ctx == NULL) { perror("vm_open"); exit(4); } #ifndef WITHOUT_CAPSICUM if (vm_limit_rights(ctx) != 0) err(EX_OSERR, "vm_limit_rights"); #endif if (reinit) { error = vm_reinit(ctx); if (error) { perror("vm_reinit"); exit(4); } } error = vm_set_topology(ctx, cpu_sockets, cpu_cores, cpu_threads, 0 /* maxcpus, unimplemented */); if (error) errx(EX_OSERR, "vm_set_topology"); return (ctx); } void spinup_vcpu(struct vmctx *ctx, int vcpu) { int error; uint64_t rip; error = vm_get_register(ctx, vcpu, VM_REG_GUEST_RIP, &rip); assert(error == 0); fbsdrun_set_capabilities(ctx, vcpu); error = vm_set_capability(ctx, vcpu, VM_CAP_UNRESTRICTED_GUEST, 1); assert(error == 0); fbsdrun_addcpu(ctx, BSP, vcpu, rip); } static bool parse_config_option(const char *option) { const char *value; char *path; value = strchr(option, '='); if (value == NULL || value[1] == '\0') return (false); path = strndup(option, value - option); if (path == NULL) err(4, "Failed to allocate memory"); set_config_value(path, value + 1); return (true); } static void parse_simple_config_file(const char *path) { FILE *fp; char *line, *cp; size_t linecap; unsigned int lineno; fp = fopen(path, "r"); if (fp == NULL) err(4, "Failed to open configuration file %s", path); line = NULL; linecap = 0; lineno = 1; for (lineno = 1; getline(&line, &linecap, fp) > 0; lineno++) { if (*line == '#' || *line == '\n') continue; cp = strchr(line, '\n'); if (cp != NULL) *cp = '\0'; if (!parse_config_option(line)) errx(4, "%s line %u: invalid config option '%s'", path, lineno, line); } free(line); fclose(fp); } static void parse_gdb_options(char *optarg) { const char *sport; char *colon; if (optarg[0] == 'w') { set_config_bool("gdb.wait", true); optarg++; } colon = strrchr(optarg, ':'); if (colon == NULL) { sport = optarg; } else { *colon = '\0'; colon++; sport = colon; set_config_value("gdb.address", optarg); } set_config_value("gdb.port", sport); } static void set_defaults(void) { set_config_bool("acpi_tables", false); set_config_value("memory.size", "256M"); set_config_bool("x86.strictmsr", true); } int main(int argc, char *argv[]) { int c, error, err; int max_vcpus, memflags; struct vmctx *ctx; uint64_t rip; size_t memsize; const char *value, *vmname; char *optstr; #ifdef BHYVE_SNAPSHOT char *restore_file; struct restore_state rstate; int vcpu; restore_file = NULL; #endif init_config(); set_defaults(); progname = basename(argv[0]); #ifdef BHYVE_SNAPSHOT - optstr = "aehuwxACDHIPSWYk:o:p:G:c:s:m:l:U:r:"; + optstr = "aehuwxACDHIPSWYk:o:p:G:c:s:m:l:K:U:r:"; #else - optstr = "aehuwxACDHIPSWYk:o:p:G:c:s:m:l:U:"; + optstr = "aehuwxACDHIPSWYk:o:p:G:c:s:m:l:K:U:"; #endif while ((c = getopt(argc, argv, optstr)) != -1) { switch (c) { case 'a': set_config_bool("x86.x2apic", false); break; case 'A': set_config_bool("acpi_tables", true); break; case 'D': set_config_bool("destroy_on_poweroff", true); break; case 'p': if (pincpu_parse(optarg) != 0) { errx(EX_USAGE, "invalid vcpu pinning " "configuration '%s'", optarg); } break; case 'c': if (topology_parse(optarg) != 0) { errx(EX_USAGE, "invalid cpu topology " "'%s'", optarg); } break; case 'C': set_config_bool("memory.guest_in_core", true); break; case 'G': parse_gdb_options(optarg); break; case 'k': parse_simple_config_file(optarg); break; + case 'K': + set_config_value("keyboard.layout", optarg); + break; case 'l': if (strncmp(optarg, "help", strlen(optarg)) == 0) { lpc_print_supported_devices(); exit(0); } else if (lpc_device_parse(optarg) != 0) { errx(EX_USAGE, "invalid lpc device " "configuration '%s'", optarg); } break; #ifdef BHYVE_SNAPSHOT case 'r': restore_file = optarg; break; #endif case 's': if (strncmp(optarg, "help", strlen(optarg)) == 0) { pci_print_supported_devices(); exit(0); } else if (pci_parse_slot(optarg) != 0) exit(4); else break; case 'S': set_config_bool("memory.wired", true); break; case 'm': set_config_value("memory.size", optarg); break; case 'o': if (!parse_config_option(optarg)) errx(EX_USAGE, "invalid configuration option '%s'", optarg); break; case 'H': set_config_bool("x86.vmexit_on_hlt", true); break; case 'I': /* * The "-I" option was used to add an ioapic to the * virtual machine. * * An ioapic is now provided unconditionally for each * virtual machine and this option is now deprecated. */ break; case 'P': set_config_bool("x86.vmexit_on_pause", true); break; case 'e': set_config_bool("x86.strictio", true); break; case 'u': set_config_bool("rtc.use_localtime", false); break; case 'U': set_config_value("uuid", optarg); break; case 'w': set_config_bool("x86.strictmsr", false); break; case 'W': set_config_bool("virtio_msix", false); break; case 'x': set_config_bool("x86.x2apic", true); break; case 'Y': set_config_bool("x86.mptable", false); break; case 'h': usage(0); default: usage(1); } } argc -= optind; argv += optind; if (argc > 1) usage(1); #ifdef BHYVE_SNAPSHOT if (restore_file != NULL) { error = load_restore_file(restore_file, &rstate); if (error) { fprintf(stderr, "Failed to read checkpoint info from " "file: '%s'.\n", restore_file); exit(1); } vmname = lookup_vmname(&rstate); if (vmname != NULL) set_config_value("name", vmname); } #endif if (argc == 1) set_config_value("name", argv[0]); vmname = get_config_value("name"); if (vmname == NULL) usage(1); if (get_config_bool_default("config.dump", false)) { dump_config(); exit(1); } calc_topology(); build_vcpumaps(); value = get_config_value("memory.size"); error = vm_parse_memsize(value, &memsize); if (error) errx(EX_USAGE, "invalid memsize '%s'", value); ctx = do_open(vmname); #ifdef BHYVE_SNAPSHOT if (restore_file != NULL) { guest_ncpus = lookup_guest_ncpus(&rstate); memflags = lookup_memflags(&rstate); memsize = lookup_memsize(&rstate); } if (guest_ncpus < 1) { fprintf(stderr, "Invalid guest vCPUs (%d)\n", guest_ncpus); exit(1); } #endif max_vcpus = num_vcpus_allowed(ctx); if (guest_ncpus > max_vcpus) { fprintf(stderr, "%d vCPUs requested but only %d available\n", guest_ncpus, max_vcpus); exit(4); } fbsdrun_set_capabilities(ctx, BSP); memflags = 0; if (get_config_bool_default("memory.wired", false)) memflags |= VM_MEM_F_WIRED; if (get_config_bool_default("memory.guest_in_core", false)) memflags |= VM_MEM_F_INCORE; vm_set_memflags(ctx, memflags); err = vm_setup_memory(ctx, memsize, VM_MMAP_ALL); if (err) { fprintf(stderr, "Unable to setup memory (%d)\n", errno); exit(4); } error = init_msr(); if (error) { fprintf(stderr, "init_msr error %d", error); exit(4); } init_mem(guest_ncpus); init_inout(); kernemu_dev_init(); init_bootrom(ctx); atkbdc_init(ctx); pci_irq_init(ctx); ioapic_init(ctx); rtc_init(ctx); sci_init(ctx); /* * Exit if a device emulation finds an error in its initilization */ if (init_pci(ctx) != 0) { perror("device emulation initialization error"); exit(4); } /* * Initialize after PCI, to allow a bootrom file to reserve the high * region. */ if (get_config_bool("acpi_tables")) vmgenc_init(ctx); init_gdb(ctx); if (lpc_bootrom()) { if (vm_set_capability(ctx, BSP, VM_CAP_UNRESTRICTED_GUEST, 1)) { fprintf(stderr, "ROM boot failed: unrestricted guest " "capability not available\n"); exit(4); } error = vcpu_reset(ctx, BSP); assert(error == 0); } #ifdef BHYVE_SNAPSHOT if (restore_file != NULL) { fprintf(stdout, "Pausing pci devs...\r\n"); if (vm_pause_user_devs(ctx) != 0) { fprintf(stderr, "Failed to pause PCI device state.\n"); exit(1); } fprintf(stdout, "Restoring vm mem...\r\n"); if (restore_vm_mem(ctx, &rstate) != 0) { fprintf(stderr, "Failed to restore VM memory.\n"); exit(1); } fprintf(stdout, "Restoring pci devs...\r\n"); if (vm_restore_user_devs(ctx, &rstate) != 0) { fprintf(stderr, "Failed to restore PCI device state.\n"); exit(1); } fprintf(stdout, "Restoring kernel structs...\r\n"); if (vm_restore_kern_structs(ctx, &rstate) != 0) { fprintf(stderr, "Failed to restore kernel structs.\n"); exit(1); } fprintf(stdout, "Resuming pci devs...\r\n"); if (vm_resume_user_devs(ctx) != 0) { fprintf(stderr, "Failed to resume PCI device state.\n"); exit(1); } } #endif error = vm_get_register(ctx, BSP, VM_REG_GUEST_RIP, &rip); assert(error == 0); /* * build the guest tables, MP etc. */ if (get_config_bool_default("x86.mptable", true)) { error = mptable_build(ctx, guest_ncpus); if (error) { perror("error to build the guest tables"); exit(4); } } error = smbios_build(ctx); assert(error == 0); if (get_config_bool("acpi_tables")) { error = acpi_build(ctx, guest_ncpus); assert(error == 0); } if (lpc_bootrom()) fwctl_init(); /* * Change the proc title to include the VM name. */ setproctitle("%s", vmname); #ifndef WITHOUT_CAPSICUM caph_cache_catpages(); if (caph_limit_stdout() == -1 || caph_limit_stderr() == -1) errx(EX_OSERR, "Unable to apply rights for sandbox"); if (caph_enter() == -1) errx(EX_OSERR, "cap_enter() failed"); #endif #ifdef BHYVE_SNAPSHOT if (restore_file != NULL) destroy_restore_state(&rstate); /* * checkpointing thread for communication with bhyvectl */ if (init_checkpoint_thread(ctx) < 0) printf("Failed to start checkpoint thread!\r\n"); if (restore_file != NULL) vm_restore_time(ctx); #endif /* Allocate per-VCPU resources. */ vmexit = calloc(guest_ncpus, sizeof(*vmexit)); mt_vmm_info = calloc(guest_ncpus, sizeof(*mt_vmm_info)); /* * Add CPU 0 */ fbsdrun_addcpu(ctx, BSP, BSP, rip); #ifdef BHYVE_SNAPSHOT /* * If we restore a VM, start all vCPUs now (including APs), otherwise, * let the guest OS to spin them up later via vmexits. */ if (restore_file != NULL) { for (vcpu = 0; vcpu < guest_ncpus; vcpu++) { if (vcpu == BSP) continue; fprintf(stdout, "spinning up vcpu no %d...\r\n", vcpu); spinup_vcpu(ctx, vcpu); } } #endif /* * Head off to the main event dispatch loop */ mevent_dispatch(); exit(4); } diff --git a/usr.sbin/bhyve/kbdlayout/Makefile b/usr.sbin/bhyve/kbdlayout/Makefile new file mode 100644 index 000000000000..dc608508f67e --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/Makefile @@ -0,0 +1,40 @@ +# $FreeBSD$ + +FILESDIR= ${SHAREDIR}/bhyve/kbdlayout +FILES= default \ + am \ + be be_acc \ + bg_bds bg_phonetic \ + br br_noacc \ + centraleuropean \ + ch ch_acc ch_macbook_acc ch-fr ch-fr_acc \ + cz \ + de de_acc de_noacc \ + dk dk_macbook \ + ee \ + es es_acc es_dvorak \ + fi \ + fr fr_acc fr_dvorak fr_dvorak_acc fr_macbook \ + gr gr_101_acc gr_elot_acc \ + hr \ + hu_101 hu_102 \ + is is_acc \ + it \ + jp jp_capsctrl \ + kz_io kz_kst \ + latinamerican latinamerican_acc \ + lt \ + nl \ + no no_dvorak nordic_asus-eee \ + pl_dvorak \ + pt pt_acc \ + ru ru_shift ru_win \ + se \ + si \ + tr tr_f \ + ua ua_shift_alt \ + uk uk_capsctrl uk_dvorak uk_macbook \ + us_dvorak us_dvorakl us_dvorakp us_dvorakr us_dvorakx \ + us_emacs us_unix + +.include diff --git a/usr.sbin/bhyve/kbdlayout/Makefile.depend b/usr.sbin/bhyve/kbdlayout/Makefile.depend new file mode 100644 index 000000000000..f80275d86ab1 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/Makefile.depend @@ -0,0 +1,11 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/usr.sbin/bhyve/kbdlayout/am b/usr.sbin/bhyve/kbdlayout/am new file mode 100644 index 000000000000..c102fb10801a --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/am @@ -0,0 +1,10 @@ +# bhyve ps2kbd keyboard layout file +# (am : Armenian phonetic layout) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +')',0x87; ) (0x29) +'+',0xce; + (0x2b) + diff --git a/usr.sbin/bhyve/kbdlayout/be b/usr.sbin/bhyve/kbdlayout/be new file mode 100644 index 000000000000..26f8cdc3acbc --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/be @@ -0,0 +1,45 @@ +# bhyve ps2kbd keyboard layout file +# (be : Belgian) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'!',0x3e; ! (0x21) +'"',0x26; " (0x22) +'$',0x5b; $ (0x24) +'%',0x52; % (0x25) +'&',0x16; & (0x26) +''',0x25; ' (0x27) +'(',0x2e; ( (0x28) +')',0x4e; ) (0x29) +'*',0x5b; * (0x2a) +'+',0x4a; + (0x2b) +',',0x3a; , (0x2c) +'-',0x55; - (0x2d) +'.',0x41; . (0x2e) +':',0x49; : (0x3a) +';',0x41; ; (0x3b) +'<',0x61; < (0x3c) +'=',0x4a; = (0x3d) +'>',0x61; > (0x3e) +'?',0x3a; ? (0x3f) +'A',0x15; A (0x41) +'M',0x4c; M (0x4d) +'Q',0x1c; Q (0x51) +'W',0x1a; W (0x57) +'Z',0x1d; Z (0x5a) +'\',0x61; \ (0x5c) +'^',0x54; ^ (0x5e) +'_',0x55; _ (0x5f) +'`',0x5d; ` (0x60) +'a',0x15; a (0x61) +'m',0x4c; m (0x6d) +'q',0x1c; q (0x71) +'w',0x1a; w (0x77) +'z',0x1d; z (0x7a) +'{',0x46; { (0x7b) +'|',0x16; | (0x7c) +'}',0x45; } (0x7d) +'~',0x4a; ~ (0x7e) + diff --git a/usr.sbin/bhyve/kbdlayout/be_acc b/usr.sbin/bhyve/kbdlayout/be_acc new file mode 100644 index 000000000000..adf136634eb2 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/be_acc @@ -0,0 +1,42 @@ +# bhyve ps2kbd keyboard layout file +# (be_acc : Belgian (accent keys)) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'!',0x3e; ! (0x21) +'"',0x26; " (0x22) +'$',0x5b; $ (0x24) +'%',0x52; % (0x25) +'&',0x16; & (0x26) +''',0x25; ' (0x27) +'(',0x2e; ( (0x28) +')',0x4e; ) (0x29) +'*',0x5b; * (0x2a) +'+',0x4a; + (0x2b) +',',0x3a; , (0x2c) +'-',0x55; - (0x2d) +'.',0x41; . (0x2e) +':',0x49; : (0x3a) +';',0x41; ; (0x3b) +'<',0x61; < (0x3c) +'=',0x4a; = (0x3d) +'>',0x61; > (0x3e) +'?',0x3a; ? (0x3f) +'A',0x15; A (0x41) +'M',0x4c; M (0x4d) +'Q',0x1c; Q (0x51) +'W',0x1a; W (0x57) +'Z',0x1d; Z (0x5a) +'\',0x61; \ (0x5c) +'_',0x55; _ (0x5f) +'a',0x15; a (0x61) +'m',0x4c; m (0x6d) +'q',0x1c; q (0x71) +'w',0x1a; w (0x77) +'z',0x1d; z (0x7a) +'{',0x46; { (0x7b) +'|',0x16; | (0x7c) +'}',0x45; } (0x7d) + diff --git a/usr.sbin/bhyve/kbdlayout/bg_bds b/usr.sbin/bhyve/kbdlayout/bg_bds new file mode 100644 index 000000000000..9c25ed4640d3 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/bg_bds @@ -0,0 +1,10 @@ +# bhyve ps2kbd keyboard layout file +# (bg_bds : Bulgarian (BDS)) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'(',0xa9; ( (0x28) +'*',0xb7; * (0x2a) + diff --git a/usr.sbin/bhyve/kbdlayout/bg_phonetic b/usr.sbin/bhyve/kbdlayout/bg_phonetic new file mode 100644 index 000000000000..dfe972db5b5b --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/bg_phonetic @@ -0,0 +1,9 @@ +# bhyve ps2kbd keyboard layout file +# (bg_phonetic : Bulgarian (Phonetic)) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'*',0xb7; * (0x2a) + diff --git a/usr.sbin/bhyve/kbdlayout/br b/usr.sbin/bhyve/kbdlayout/br new file mode 100644 index 000000000000..b4605e1748c3 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/br @@ -0,0 +1,19 @@ +# bhyve ps2kbd keyboard layout file +# (br : Brazilian (accent keys)) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'"',0x0e; " (0x22) +''',0x0e; ' (0x27) +':',0x4a; : (0x3a) +';',0x4a; ; (0x3b) +'?',0x51; ? (0x3f) +'[',0x5b; [ (0x5b) +'\',0x61; \ (0x5c) +']',0x5d; ] (0x5d) +'{',0x5b; { (0x7b) +'|',0x61; | (0x7c) +'}',0x5d; } (0x7d) + diff --git a/usr.sbin/bhyve/kbdlayout/br_noacc b/usr.sbin/bhyve/kbdlayout/br_noacc new file mode 100644 index 000000000000..62bea6254ced --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/br_noacc @@ -0,0 +1,22 @@ +# bhyve ps2kbd keyboard layout file +# (br_noacc : Brazilian (without accent keys)) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'"',0x0e; " (0x22) +''',0x0e; ' (0x27) +':',0x4a; : (0x3a) +';',0x4a; ; (0x3b) +'?',0x51; ? (0x3f) +'[',0x5b; [ (0x5b) +'\',0x61; \ (0x5c) +']',0x5d; ] (0x5d) +'^',0x52; ^ (0x5e) +'`',0x54; ` (0x60) +'{',0x5b; { (0x7b) +'|',0x61; | (0x7c) +'}',0x5d; } (0x7d) +'~',0x52; ~ (0x7e) + diff --git a/usr.sbin/bhyve/kbdlayout/centraleuropean b/usr.sbin/bhyve/kbdlayout/centraleuropean new file mode 100644 index 000000000000..7b3a2f883aaa --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/centraleuropean @@ -0,0 +1,12 @@ +# bhyve ps2kbd keyboard layout file +# (centraleuropean : Central European) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'Y',0x1a; Y (0x59) +'Z',0x35; Z (0x5a) +'y',0x1a; y (0x79) +'z',0x35; z (0x7a) + diff --git a/usr.sbin/bhyve/kbdlayout/ch b/usr.sbin/bhyve/kbdlayout/ch new file mode 100644 index 000000000000..c68f78a49ede --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/ch @@ -0,0 +1,36 @@ +# bhyve ps2kbd keyboard layout file +# (ch : Swiss-German) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'!',0x5b; ! (0x21) +'"',0x1e; " (0x22) +'$',0x5d; $ (0x24) +'&',0x36; & (0x26) +''',0x4e; ' (0x27) +'(',0x3e; ( (0x28) +')',0x46; ) (0x29) +'*',0x26; * (0x2a) +'+',0x16; + (0x2b) +'-',0x4a; - (0x2d) +':',0x49; : (0x3a) +';',0x41; ; (0x3b) +'<',0x61; < (0x3c) +'=',0x45; = (0x3d) +'>',0x61; > (0x3e) +'?',0x4e; ? (0x3f) +'Y',0x1a; Y (0x59) +'Z',0x35; Z (0x5a) +'\',0x61; \ (0x5c) +'^',0x55; ^ (0x5e) +'_',0x4a; _ (0x5f) +'`',0x55; ` (0x60) +'y',0x1a; y (0x79) +'z',0x35; z (0x7a) +'{',0x52; { (0x7b) +'|',0x16; | (0x7c) +'}',0x5d; } (0x7d) +'~',0x55; ~ (0x7e) + diff --git a/usr.sbin/bhyve/kbdlayout/ch-fr b/usr.sbin/bhyve/kbdlayout/ch-fr new file mode 100644 index 000000000000..33d747f58f5a --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/ch-fr @@ -0,0 +1,36 @@ +# bhyve ps2kbd keyboard layout file +# (ch-fr : Swiss-French) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'!',0x5b; ! (0x21) +'"',0x1e; " (0x22) +'$',0x5d; $ (0x24) +'&',0x36; & (0x26) +''',0x4e; ' (0x27) +'(',0x3e; ( (0x28) +')',0x46; ) (0x29) +'*',0x26; * (0x2a) +'+',0x16; + (0x2b) +'-',0x4a; - (0x2d) +':',0x49; : (0x3a) +';',0x41; ; (0x3b) +'<',0x61; < (0x3c) +'=',0x45; = (0x3d) +'>',0x61; > (0x3e) +'?',0x4e; ? (0x3f) +'Y',0x1a; Y (0x59) +'Z',0x35; Z (0x5a) +'\',0x61; \ (0x5c) +'^',0x55; ^ (0x5e) +'_',0x4a; _ (0x5f) +'`',0x55; ` (0x60) +'y',0x1a; y (0x79) +'z',0x35; z (0x7a) +'{',0x52; { (0x7b) +'|',0x16; | (0x7c) +'}',0x5d; } (0x7d) +'~',0x55; ~ (0x7e) + diff --git a/usr.sbin/bhyve/kbdlayout/ch-fr_acc b/usr.sbin/bhyve/kbdlayout/ch-fr_acc new file mode 100644 index 000000000000..3d081fb6711c --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/ch-fr_acc @@ -0,0 +1,33 @@ +# bhyve ps2kbd keyboard layout file +# (ch-fr_acc : Swiss-French (accent keys)) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'!',0x5b; ! (0x21) +'"',0x1e; " (0x22) +'$',0x5d; $ (0x24) +'&',0x36; & (0x26) +''',0x4e; ' (0x27) +'(',0x3e; ( (0x28) +')',0x46; ) (0x29) +'*',0x26; * (0x2a) +'+',0x16; + (0x2b) +'-',0x4a; - (0x2d) +':',0x49; : (0x3a) +';',0x41; ; (0x3b) +'<',0x61; < (0x3c) +'=',0x45; = (0x3d) +'>',0x61; > (0x3e) +'?',0x4e; ? (0x3f) +'Y',0x1a; Y (0x59) +'Z',0x35; Z (0x5a) +'\',0x61; \ (0x5c) +'_',0x4a; _ (0x5f) +'y',0x1a; y (0x79) +'z',0x35; z (0x7a) +'{',0x52; { (0x7b) +'|',0x16; | (0x7c) +'}',0x5d; } (0x7d) + diff --git a/usr.sbin/bhyve/kbdlayout/ch_acc b/usr.sbin/bhyve/kbdlayout/ch_acc new file mode 100644 index 000000000000..5b916d444e6f --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/ch_acc @@ -0,0 +1,33 @@ +# bhyve ps2kbd keyboard layout file +# (ch_acc : Swiss-German (accent keys)) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'!',0x5b; ! (0x21) +'"',0x1e; " (0x22) +'$',0x5d; $ (0x24) +'&',0x36; & (0x26) +''',0x4e; ' (0x27) +'(',0x3e; ( (0x28) +')',0x46; ) (0x29) +'*',0x26; * (0x2a) +'+',0x16; + (0x2b) +'-',0x4a; - (0x2d) +':',0x49; : (0x3a) +';',0x41; ; (0x3b) +'<',0x61; < (0x3c) +'=',0x45; = (0x3d) +'>',0x61; > (0x3e) +'?',0x4e; ? (0x3f) +'Y',0x1a; Y (0x59) +'Z',0x35; Z (0x5a) +'\',0x61; \ (0x5c) +'_',0x4a; _ (0x5f) +'y',0x1a; y (0x79) +'z',0x35; z (0x7a) +'{',0x52; { (0x7b) +'|',0x16; | (0x7c) +'}',0x5d; } (0x7d) + diff --git a/usr.sbin/bhyve/kbdlayout/ch_macbook_acc b/usr.sbin/bhyve/kbdlayout/ch_macbook_acc new file mode 100644 index 000000000000..3c7a032bebe6 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/ch_macbook_acc @@ -0,0 +1,37 @@ +# bhyve ps2kbd keyboard layout file +# (ch_macbook_acc : Swiss-German Macbook/Macbook Pro (accent keys)) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'!',0x5b; ! (0x21) +'"',0x1e; " (0x22) +'$',0x5d; $ (0x24) +'&',0x36; & (0x26) +''',0x4e; ' (0x27) +'(',0x3e; ( (0x28) +')',0x46; ) (0x29) +'*',0x26; * (0x2a) +'+',0x16; + (0x2b) +'-',0x4a; - (0x2d) +':',0x49; : (0x3a) +';',0x41; ; (0x3b) +'<',0x0e; < (0x3c) +'=',0x45; = (0x3d) +'>',0x0e; > (0x3e) +'?',0x4e; ? (0x3f) +'@',0x34; @ (0x40) +'Y',0x1a; Y (0x59) +'Z',0x35; Z (0x5a) +'[',0x2e; [ (0x5b) +'\',0x61; \ (0x5c) +']',0x36; ] (0x5d) +'_',0x4a; _ (0x5f) +'y',0x1a; y (0x79) +'z',0x35; z (0x7a) +'{',0x3e; { (0x7b) +'|',0x3d; | (0x7c) +'}',0x46; } (0x7d) +'~',0x31; ~ (0x7e) + diff --git a/usr.sbin/bhyve/kbdlayout/cz b/usr.sbin/bhyve/kbdlayout/cz new file mode 100644 index 000000000000..98f6108231ee --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/cz @@ -0,0 +1,11 @@ +# bhyve ps2kbd keyboard layout file +# (cz : Czech (QWERTZ, accent keys)) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +')',0x9b; ) (0x29) +'*',0xb7; * (0x2a) +'+',0x82; + (0x2b) + diff --git a/usr.sbin/bhyve/kbdlayout/de b/usr.sbin/bhyve/kbdlayout/de new file mode 100644 index 000000000000..745f826a9de2 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/de @@ -0,0 +1,37 @@ +# bhyve ps2kbd keyboard layout file +# (de : German) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'"',0x1e; " (0x22) +'#',0x5d; # (0x23) +'&',0x36; & (0x26) +''',0x5d; ' (0x27) +'(',0x3e; ( (0x28) +')',0x46; ) (0x29) +'*',0x5b; * (0x2a) +'+',0x5b; + (0x2b) +'-',0x4a; - (0x2d) +':',0x49; : (0x3a) +';',0x41; ; (0x3b) +'<',0x61; < (0x3c) +'=',0x45; = (0x3d) +'>',0x61; > (0x3e) +'?',0x4e; ? (0x3f) +'@',0x15; @ (0x40) +'Y',0x1a; Y (0x59) +'Z',0x35; Z (0x5a) +'[',0x3e; [ (0x5b) +'\',0x4e; \ (0x5c) +']',0x46; ] (0x5d) +'^',0x0e; ^ (0x5e) +'_',0x4a; _ (0x5f) +'y',0x1a; y (0x79) +'z',0x35; z (0x7a) +'{',0x3d; { (0x7b) +'|',0x61; | (0x7c) +'}',0x45; } (0x7d) +'~',0x5b; ~ (0x7e) + diff --git a/usr.sbin/bhyve/kbdlayout/de_acc b/usr.sbin/bhyve/kbdlayout/de_acc new file mode 100644 index 000000000000..2ba06f3d166b --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/de_acc @@ -0,0 +1,36 @@ +# bhyve ps2kbd keyboard layout file +# (de_acc : German (accent keys)) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'"',0x1e; " (0x22) +'#',0x5d; # (0x23) +'&',0x36; & (0x26) +''',0x5d; ' (0x27) +'(',0x3e; ( (0x28) +')',0x46; ) (0x29) +'*',0x5b; * (0x2a) +'+',0x5b; + (0x2b) +'-',0x4a; - (0x2d) +':',0x49; : (0x3a) +';',0x41; ; (0x3b) +'<',0x61; < (0x3c) +'=',0x45; = (0x3d) +'>',0x61; > (0x3e) +'?',0x4e; ? (0x3f) +'@',0x15; @ (0x40) +'Y',0x1a; Y (0x59) +'Z',0x35; Z (0x5a) +'[',0x3e; [ (0x5b) +'\',0x4e; \ (0x5c) +']',0x46; ] (0x5d) +'^',0x0e; ^ (0x5e) +'_',0x4a; _ (0x5f) +'y',0x1a; y (0x79) +'z',0x35; z (0x7a) +'{',0x3d; { (0x7b) +'|',0x61; | (0x7c) +'}',0x45; } (0x7d) + diff --git a/usr.sbin/bhyve/kbdlayout/de_noacc b/usr.sbin/bhyve/kbdlayout/de_noacc new file mode 100644 index 000000000000..4d215116e2a7 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/de_noacc @@ -0,0 +1,38 @@ +# bhyve ps2kbd keyboard layout file +# (de_noacc : German (no accent keys)) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'"',0x1e; " (0x22) +'#',0x5d; # (0x23) +'&',0x36; & (0x26) +''',0x55; ' (0x27) +'(',0x3e; ( (0x28) +')',0x46; ) (0x29) +'*',0x5b; * (0x2a) +'+',0x5b; + (0x2b) +'-',0x4a; - (0x2d) +':',0x49; : (0x3a) +';',0x41; ; (0x3b) +'<',0x61; < (0x3c) +'=',0x45; = (0x3d) +'>',0x61; > (0x3e) +'?',0x4e; ? (0x3f) +'@',0x15; @ (0x40) +'Y',0x1a; Y (0x59) +'Z',0x35; Z (0x5a) +'[',0x3e; [ (0x5b) +'\',0x4e; \ (0x5c) +']',0x46; ] (0x5d) +'^',0x0e; ^ (0x5e) +'_',0x4a; _ (0x5f) +'`',0x55; ` (0x60) +'y',0x1a; y (0x79) +'z',0x35; z (0x7a) +'{',0x3d; { (0x7b) +'|',0x61; | (0x7c) +'}',0x45; } (0x7d) +'~',0x5b; ~ (0x7e) + diff --git a/usr.sbin/bhyve/kbdlayout/default b/usr.sbin/bhyve/kbdlayout/default new file mode 100644 index 000000000000..8674c280280b --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/default @@ -0,0 +1,248 @@ +# bhyve ps2kbd keyboard layout file (US - default) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +# for those who create the Keyboard Layout File. ****************************** +# To create the keyboard layout file, first copy this 'default' file into the +# same dir. with the layout name as the file name. +# The file name is a character string that can be specified as it is in the +# -k option of the bhyve command, so a normal language name is desirable. +# Then, it is necessary to define the difference between the standard US keyboard +# and the keyboard for each language according to the setting method described +# in the comment below. +# +# Note that lines starting with '#' and blank lines are ignored. +# In addition, the definition of the standard layout setting (US keyboard) +# is described as a comment line below for reference. +# So you usually only need to remove the '#' and fix it to the correct ScanCode +# only on the lines of the key that you can't type correctly with the standard +# US keyboard settings. + + +# Alphabet/Number/Sign Keys --------------------------------------------------- +# Format: +# 'Chr',ScanCode(Hex); +# or +# AsciiCode(Hex),ScanCode(Hex); +# +# If there are ASCII characters that cannot be entered correctly with the +# standard settings(US Keyboard layout), delete the "#" at the beginning of the +# relevant line below and set the correct ScanCode. +# +# For example, when a Japanese Keyboard is used, the '@' sign cannot be input +# correctly and the number '2' is input. +# This is because the US keyboard can input the '@' sign with the Shift + number'2' +# keys, and the ScanCode of the '@' sign is the number '2' key by default. +# In this case, remove the '#' at the beginning of the line with the '@' sign +# below and correct the ScanCode from 0x1e to 0x54 so that you can enter it +# correctly. +# ScanCode differs depending on the keyboard of eash language, so check it on +# the Internet. +# Note that keys that have no problems with input have the same settings as +# the US keyboard, so you do not need to set anything below. +# See the "/usr/share/bhyve/kbdlayout/jp106" file for the specific setting method. + +# '!',0x16; ! (0x21) +# '"',0x52; " (0x22) +# '#',0x26; # (0x23) +# '$',0x25; $ (0x24) +# '%',0x2e; % (0x25) +# '&',0x3d; & (0x26) +# ''',0x52; ' (0x27) +# '(',0x46; ( (0x28) +# ')',0x45; ) (0x29) +# '*',0x3e; * (0x2a) +# '+',0x55; + (0x2b) +# ',',0x41; , (0x2c) +# '-',0x4e; - (0x2d) +# '.',0x49; . (0x2e) +# '/',0x4a; / (0x2f) + +# '0',0x45; 0 (0x30) +# '1',0x16; 1 (0x31) +# '2',0x1e; 2 (0x32) +# '3',0x26; 3 (0x33) +# '4',0x25; 4 (0x34) +# '5',0x2e; 5 (0x35) +# '6',0x36; 6 (0x36) +# '7',0x3d; 7 (0x37) +# '8',0x3e; 8 (0x38) +# '9',0x46; 9 (0x39) +# ':',0x4c; : (0x3a) +# ';',0x4c; ; (0x3b) +# '<',0x41; < (0x3c) +# '=',0x55; = (0x3d) +# '>',0x49; > (0x3e) +# '?',0x4a; ? (0x3f) + +# '@',0x1e; @ (0x40) +# 'A',0x1c; A (0x41) +# 'B',0x32; B (0x42) +# 'C',0x21; C (0x43) +# 'D',0x23; D (0x44) +# 'E',0x24; E (0x45) +# 'F',0x2b; F (0x46) +# 'G',0x34; G (0x47) +# 'H',0x33; H (0x48) +# 'I',0x43; I (0x49) +# 'J',0x3b; J (0x4a) +# 'K',0x42; K (0x4b) +# 'L',0x4b; L (0x4c) +# 'M',0x3a; M (0x4d) +# 'N',0x31; N (0x4e) +# 'O',0x44; O (0x4f) + +# 'P',0x4d; P (0x50) +# 'Q',0x15; Q (0x51) +# 'R',0x2d; R (0x52) +# 'S',0x1b; S (0x53) +# 'T',0x2c; T (0x54) +# 'U',0x3c; U (0x55) +# 'V',0x2a; V (0x56) +# 'W',0x1d; W (0x57) +# 'X',0x22; X (0x58) +# 'Y',0x35; Y (0x59) +# 'Z',0x1a; Z (0x5a) +# '[',0x54; [ (0x5b) +# '\',0x5d; \ (0x5c) +# ']',0x5b; ] (0x5d) +# '^',0x36; ^ (0x5e) +# '_',0x4e; _ (0x5f) + +# '`',0x0e; ` (0x60) +# 'a',0x1c; a (0x61) +# 'b',0x32; b (0x62) +# 'c',0x21; c (0x63) +# 'd',0x23; d (0x64) +# 'e',0x24; e (0x65) +# 'f',0x2b; f (0x66) +# 'g',0x34; g (0x67) +# 'h',0x33; h (0x68) +# 'i',0x43; i (0x69) +# 'j',0x3b; j (0x6a) +# 'k',0x42; k (0x6b) +# 'l',0x4b; l (0x6c) +# 'm',0x3a; m (0x6d) +# 'n',0x31; n (0x6e) +# 'o',0x44; o (0x6f) + +# 'p',0x4d; p (0x70) +# 'q',0x15; q (0x71) +# 'r',0x2d; r (0x72) +# 's',0x1b; s (0x73) +# 't',0x2c; t (0x74) +# 'u',0x3c; u (0x75) +# 'v',0x2a; v (0x76) +# 'w',0x1d; w (0x77) +# 'x',0x22; x (0x78) +# 'y',0x35; y (0x79) +# 'z',0x1a; z (0x7a) +# '{',0x54; { (0x7b) +# '|',0x5d; | (0x7c) +# '}',0x5b; } (0x7d) +# '~',0x0e; ~ (0x7e) + + +# Functional Keys ------------------------------------------------------------- +# Format: +# Xorg KeySym(Hex:2Byte),ScanCode(Hex); +# or +# Xorg KeySym(Hex:2Byte),ScanCode(Hex),Prefix(Hex); +# +# Key definitions other than alphanumeric characters such as Enter and Escape +# are set in this section. +# If there is a key that can not be entered correctly with the standard settings +# (US Keyboard layout),, delete the '#' at the beginning of the corresponding +# line and set the correct scan code. +# The Xorg KeySym Code can be checked by using the 'xev' command from X window +# on the guest OS. +# In addition, some keys have ScanCodes that have a Prefix Byte. +# In this case, define '0xe0' as the third argument.(example Home Key,etc) +# Note that keys that have no problems with input have the same settings as +# the US keyboard, so you do not need to set anything below. +# See the "/usr/share/bhyve/kbdlayout/jp106" file for the specific setting method. + +# 0xff08,0x66; Back space +# 0xff09,0x0d; Tab +# 0xff0d,0x5a; Return +# 0xff1b,0x76; Escape +# 0xff50,0x6c,0xe0; Home +# 0xff51,0x6b,0xe0; Left arrow +# 0xff52,0x75,0xe0; Up arrow +# 0xff53,0x74,0xe0; Right arrow +# 0xff54,0x72,0xe0; Down arrow +# 0xff55,0x7d,0xe0; PgUp +# 0xff56,0x7a,0xe0; PgDown +# 0xff57,0x69,0xe0; End +# 0xff63,0x70,0xe0; Ins +# 0xff8d,0x5a,0xe0; Keypad Enter +# 0xffe1,0x12; Left shift +# 0xffe2,0x59; Right shift +# 0xffe3,0x14; Left control +# 0xffe4,0x14,0xe0; Right control +# 0xffe9,0x11; Left alt +# 0xfe03,0x11,0xe0; AltGr +# 0xffea,0x11,0xe0; Right alt +# 0xffeb,0x1f,0xe0; Left Windows +# 0xffec,0x27,0xe0; Right Windows +# 0xffbe,0x05; F1 +# 0xffbf,0x06; F2 +# 0xffc0,0x04; F3 +# 0xffc1,0x0c; F4 +# 0xffc2,0x03; F5 +# 0xffc3,0x0b; F6 +# 0xffc4,0x83; F7 +# 0xffc5,0x0a; F8 +# 0xffc6,0x01; F9 +# 0xffc7,0x09; F10 +# 0xffc8,0x78; F11 +# 0xffc9,0x07; F12 +# 0xffff,0x71,0xe0; Del +# 0xff14,0x7e; ScrollLock + + +# NumLock and Keypads --------------------------------------------------------- +# +# The numeric keypad settings are the same as the Functional Key section above. + +# 0xff7f,0x77; NumLock +# 0xffaf,0x4a,0xe0; Keypad slash +# 0xffaa,0x7c; Keypad asterisk +# 0xffad,0x7b; Keypad minus +# 0xffab,0x79; Keypad plus +# 0xffb7,0x6c; Keypad 7 +# 0xff95,0x6c; Keypad home +# 0xffb8,0x75; Keypad 8 +# 0xff97,0x75; Keypad up arrow +# 0xffb9,0x7d; Keypad 9 +# 0xff9a,0x7d; Keypad PgUp +# 0xffb4,0x6b; Keypad 4 +# 0xff96,0x6b; Keypad left arrow +# 0xffb5,0x73; Keypad 5 +# 0xff9d,0x73; Keypad empty +# 0xffb6,0x74; Keypad 6 +# 0xff98,0x74; Keypad right arrow +# 0xffb1,0x69; Keypad 1 +# 0xff9c,0x69; Keypad end +# 0xffb2,0x72; Keypad 2 +# 0xff99,0x72; Keypad down arrow +# 0xffb3,0x7a; Keypad 3 +# 0xff9b,0x7a; Keypad PgDown +# 0xffb0,0x70; Keypad 0 +# 0xff9e,0x70; Keypad ins +# 0xffae,0x71; Keypad . +# 0xff9f,0x71; Keypad del + + +# Language Specific Keys ------------------------------------------------------- +# +# If a key not exist in the US keyboard is added to the keyboard of each language, +# it is necessary to add the combination of Xorg KeySym and ScanCode of the +# corresponding key. +# The setting format is the same as the Functional Key section above. +# example: +# 0xff2a,0x0e; Hankaku/Zenkaku|Kanji (Japanese 106 keyboard original Key) + + diff --git a/usr.sbin/bhyve/kbdlayout/dk b/usr.sbin/bhyve/kbdlayout/dk new file mode 100644 index 000000000000..5183691bfb78 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/dk @@ -0,0 +1,32 @@ +# bhyve ps2kbd keyboard layout file +# (dk : Danish) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'"',0x5b; " (0x22) +'&',0x36; & (0x26) +''',0x55; ' (0x27) +'(',0x3e; ( (0x28) +')',0x46; ) (0x29) +'*',0x5d; * (0x2a) +'+',0x4e; + (0x2b) +'-',0x4a; - (0x2d) +':',0x49; : (0x3a) +';',0x41; ; (0x3b) +'<',0x61; < (0x3c) +'=',0x45; = (0x3d) +'>',0x61; > (0x3e) +'?',0x4e; ? (0x3f) +'[',0x3e; [ (0x5b) +'\',0x61; \ (0x5c) +']',0x46; ] (0x5d) +'^',0x5b; ^ (0x5e) +'_',0x4a; _ (0x5f) +'`',0x55; ` (0x60) +'{',0x3d; { (0x7b) +'|',0x55; | (0x7c) +'}',0x45; } (0x7d) +'~',0x5b; ~ (0x7e) + diff --git a/usr.sbin/bhyve/kbdlayout/dk_macbook b/usr.sbin/bhyve/kbdlayout/dk_macbook new file mode 100644 index 000000000000..a9d9c1b7435e --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/dk_macbook @@ -0,0 +1,35 @@ +# bhyve ps2kbd keyboard layout file +# (dk_macbook : Danish (macbook)) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'"',0x1e; " (0x22) +'$',0x0e; $ (0x24) +'&',0x36; & (0x26) +''',0x5d; ' (0x27) +'(',0x3e; ( (0x28) +')',0x46; ) (0x29) +'*',0x5d; * (0x2a) +'+',0x4e; + (0x2b) +'-',0x4a; - (0x2d) +':',0x49; : (0x3a) +';',0x41; ; (0x3b) +'<',0x61; < (0x3c) +'=',0x45; = (0x3d) +'>',0x61; > (0x3e) +'?',0x4e; ? (0x3f) +'@',0x5d; @ (0x40) +'G',0x7a,0xe0; G (0x47) +'I',0x6c,0xe0; I (0x49) +'O',0x69,0xe0; O (0x4f) +'Q',0x7d,0xe0; Q (0x51) +'[',0x3e; [ (0x5b) +'\',0x61; \ (0x5c) +']',0x46; ] (0x5d) +'^',0x5b; ^ (0x5e) +'_',0x4a; _ (0x5f) +'|',0x43; | (0x7c) +'~',0x5b; ~ (0x7e) + diff --git a/usr.sbin/bhyve/kbdlayout/ee b/usr.sbin/bhyve/kbdlayout/ee new file mode 100644 index 000000000000..c2ebbdb08116 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/ee @@ -0,0 +1,31 @@ +# bhyve ps2kbd keyboard layout file +# (ee : Nordic layout on Asus eeePC Estonian) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'"',0x1e; " (0x22) +'&',0x36; & (0x26) +''',0x5d; ' (0x27) +'(',0x3e; ( (0x28) +')',0x46; ) (0x29) +'*',0x5d; * (0x2a) +'+',0x4e; + (0x2b) +'-',0x4a; - (0x2d) +':',0x49; : (0x3a) +';',0x41; ; (0x3b) +'<',0x61; < (0x3c) +'=',0x45; = (0x3d) +'>',0x61; > (0x3e) +'?',0x4e; ? (0x3f) +'[',0x3e; [ (0x5b) +'\',0x4e; \ (0x5c) +']',0x46; ] (0x5d) +'^',0x52; ^ (0x5e) +'_',0x4a; _ (0x5f) +'`',0x55; ` (0x60) +'{',0x3d; { (0x7b) +'|',0x61; | (0x7c) +'}',0x45; } (0x7d) + diff --git a/usr.sbin/bhyve/kbdlayout/es b/usr.sbin/bhyve/kbdlayout/es new file mode 100644 index 000000000000..54ffb24bfc10 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/es @@ -0,0 +1,28 @@ +# bhyve ps2kbd keyboard layout file +# (es : Spanish (accent keys)) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'"',0x1e; " (0x22) +'&',0x36; & (0x26) +''',0x4e; ' (0x27) +'(',0x3e; ( (0x28) +')',0x46; ) (0x29) +'*',0x5b; * (0x2a) +'+',0x5b; + (0x2b) +'-',0x4a; - (0x2d) +':',0x49; : (0x3a) +';',0x41; ; (0x3b) +'<',0x61; < (0x3c) +'=',0x45; = (0x3d) +'>',0x61; > (0x3e) +'?',0x4e; ? (0x3f) +'\',0x0e; \ (0x5c) +'_',0x4a; _ (0x5f) +'{',0x52; { (0x7b) +'|',0x16; | (0x7c) +'}',0x5d; } (0x7d) +'~',0x25; ~ (0x7e) + diff --git a/usr.sbin/bhyve/kbdlayout/es_acc b/usr.sbin/bhyve/kbdlayout/es_acc new file mode 100644 index 000000000000..cd091791c055 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/es_acc @@ -0,0 +1,28 @@ +# bhyve ps2kbd keyboard layout file +# (es_acc : Spanish (accent keys)) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'"',0x1e; " (0x22) +'&',0x36; & (0x26) +''',0x4e; ' (0x27) +'(',0x3e; ( (0x28) +')',0x46; ) (0x29) +'*',0x5b; * (0x2a) +'+',0x5b; + (0x2b) +'-',0x4a; - (0x2d) +':',0x49; : (0x3a) +';',0x41; ; (0x3b) +'<',0x61; < (0x3c) +'=',0x45; = (0x3d) +'>',0x61; > (0x3e) +'?',0x4e; ? (0x3f) +'\',0x0e; \ (0x5c) +'_',0x4a; _ (0x5f) +'{',0x52; { (0x7b) +'|',0x16; | (0x7c) +'}',0x5d; } (0x7d) +'~',0x25; ~ (0x7e) + diff --git a/usr.sbin/bhyve/kbdlayout/es_dvorak b/usr.sbin/bhyve/kbdlayout/es_dvorak new file mode 100644 index 000000000000..b84e95c91354 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/es_dvorak @@ -0,0 +1,78 @@ +# bhyve ps2kbd keyboard layout file +# (es_dvorak : Spanish Dvorak) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'"',0x1e; " (0x22) +'&',0x36; & (0x26) +''',0x4e; ' (0x27) +'(',0x3e; ( (0x28) +')',0x46; ) (0x29) +'*',0x5b; * (0x2a) +'+',0x5b; + (0x2b) +',',0x1d; , (0x2c) +'-',0x1a; - (0x2d) +'.',0x15; . (0x2e) +':',0x15; : (0x3a) +';',0x1d; ; (0x3b) +'<',0x61; < (0x3c) +'=',0x45; = (0x3d) +'>',0x61; > (0x3e) +'?',0x4e; ? (0x3f) +'B',0x31; B (0x42) +'C',0x43; C (0x43) +'D',0x33; D (0x44) +'E',0x23; E (0x45) +'F',0x35; F (0x46) +'G',0x3c; G (0x47) +'H',0x44; H (0x48) +'I',0x34; I (0x49) +'J',0x21; J (0x4a) +'K',0x2a; K (0x4b) +'L',0x4d; L (0x4c) +'N',0x4b; N (0x4e) +'O',0x1b; O (0x4f) +'P',0x2d; P (0x50) +'Q',0x22; Q (0x51) +'R',0x3b; R (0x52) +'S',0x4c; S (0x53) +'T',0x42; T (0x54) +'U',0x2b; U (0x55) +'V',0x49; V (0x56) +'W',0x41; W (0x57) +'X',0x32; X (0x58) +'Y',0x2c; Y (0x59) +'Z',0x4a; Z (0x5a) +'\',0x0e; \ (0x5c) +'_',0x1a; _ (0x5f) +'b',0x31; b (0x62) +'c',0x43; c (0x63) +'d',0x33; d (0x64) +'e',0x23; e (0x65) +'f',0x35; f (0x66) +'g',0x3c; g (0x67) +'h',0x44; h (0x68) +'i',0x34; i (0x69) +'j',0x21; j (0x6a) +'k',0x2a; k (0x6b) +'l',0x4d; l (0x6c) +'n',0x4b; n (0x6e) +'o',0x1b; o (0x6f) +'p',0x2d; p (0x70) +'q',0x22; q (0x71) +'r',0x3b; r (0x72) +'s',0x4c; s (0x73) +'t',0x42; t (0x74) +'u',0x2b; u (0x75) +'v',0x49; v (0x76) +'w',0x41; w (0x77) +'x',0x32; x (0x78) +'y',0x2c; y (0x79) +'z',0x4a; z (0x7a) +'{',0x52; { (0x7b) +'|',0x0e; | (0x7c) +'}',0x5d; } (0x7d) +'~',0x25; ~ (0x7e) + diff --git a/usr.sbin/bhyve/kbdlayout/fi b/usr.sbin/bhyve/kbdlayout/fi new file mode 100644 index 000000000000..c4bdea09a617 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/fi @@ -0,0 +1,32 @@ +# bhyve ps2kbd keyboard layout file +# (fi : Finnish) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'"',0x1e; " (0x22) +'&',0x36; & (0x26) +''',0x5d; ' (0x27) +'(',0x3e; ( (0x28) +')',0x46; ) (0x29) +'*',0x5d; * (0x2a) +'+',0x4e; + (0x2b) +'-',0x4a; - (0x2d) +':',0x49; : (0x3a) +';',0x41; ; (0x3b) +'<',0x61; < (0x3c) +'=',0x45; = (0x3d) +'>',0x61; > (0x3e) +'?',0x4e; ? (0x3f) +'[',0x3e; [ (0x5b) +'\',0x4e; \ (0x5c) +']',0x46; ] (0x5d) +'^',0x5b; ^ (0x5e) +'_',0x4a; _ (0x5f) +'`',0x55; ` (0x60) +'{',0x3d; { (0x7b) +'|',0x4c; | (0x7c) +'}',0x45; } (0x7d) +'~',0x5b; ~ (0x7e) + diff --git a/usr.sbin/bhyve/kbdlayout/fr b/usr.sbin/bhyve/kbdlayout/fr new file mode 100644 index 000000000000..6009090ff090 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/fr @@ -0,0 +1,46 @@ +# bhyve ps2kbd keyboard layout file +# (fr : French French Canadian (accent keys) Swiss-French) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'!',0x4a; ! (0x21) +'"',0x26; " (0x22) +'$',0x5b; $ (0x24) +'%',0x52; % (0x25) +'&',0x16; & (0x26) +''',0x25; ' (0x27) +'(',0x2e; ( (0x28) +')',0x4e; ) (0x29) +'*',0x5d; * (0x2a) +',',0x3a; , (0x2c) +'-',0x36; - (0x2d) +'.',0x41; . (0x2e) +':',0x49; : (0x3a) +';',0x41; ; (0x3b) +'<',0x61; < (0x3c) +'>',0x61; > (0x3e) +'?',0x3a; ? (0x3f) +'@',0x45; @ (0x40) +'A',0x15; A (0x41) +'M',0x4c; M (0x4d) +'Q',0x1c; Q (0x51) +'W',0x1a; W (0x57) +'Z',0x1d; Z (0x5a) +'[',0x2e; [ (0x5b) +'\',0x3e; \ (0x5c) +']',0x4e; ] (0x5d) +'^',0x46; ^ (0x5e) +'_',0x3e; _ (0x5f) +'`',0x3d; ` (0x60) +'a',0x15; a (0x61) +'m',0x4c; m (0x6d) +'q',0x1c; q (0x71) +'w',0x1a; w (0x77) +'z',0x1d; z (0x7a) +'{',0x25; { (0x7b) +'|',0x36; | (0x7c) +'}',0x55; } (0x7d) +'~',0x1e; ~ (0x7e) + diff --git a/usr.sbin/bhyve/kbdlayout/fr_acc b/usr.sbin/bhyve/kbdlayout/fr_acc new file mode 100644 index 000000000000..ef8730f62f46 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/fr_acc @@ -0,0 +1,46 @@ +# bhyve ps2kbd keyboard layout file +# (fr_acc : French (accent keys) Swiss-French (accent keys)) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'!',0x4a; ! (0x21) +'"',0x26; " (0x22) +'$',0x5b; $ (0x24) +'%',0x52; % (0x25) +'&',0x16; & (0x26) +''',0x25; ' (0x27) +'(',0x2e; ( (0x28) +')',0x4e; ) (0x29) +'*',0x5d; * (0x2a) +',',0x3a; , (0x2c) +'-',0x36; - (0x2d) +'.',0x41; . (0x2e) +':',0x49; : (0x3a) +';',0x41; ; (0x3b) +'<',0x61; < (0x3c) +'>',0x61; > (0x3e) +'?',0x3a; ? (0x3f) +'@',0x45; @ (0x40) +'A',0x15; A (0x41) +'M',0x4c; M (0x4d) +'Q',0x1c; Q (0x51) +'W',0x1a; W (0x57) +'Z',0x1d; Z (0x5a) +'[',0x2e; [ (0x5b) +'\',0x3e; \ (0x5c) +']',0x4e; ] (0x5d) +'^',0x46; ^ (0x5e) +'_',0x3e; _ (0x5f) +'`',0x3d; ` (0x60) +'a',0x15; a (0x61) +'m',0x4c; m (0x6d) +'q',0x1c; q (0x71) +'w',0x1a; w (0x77) +'z',0x1d; z (0x7a) +'{',0x25; { (0x7b) +'|',0x36; | (0x7c) +'}',0x55; } (0x7d) +'~',0x1e; ~ (0x7e) + diff --git a/usr.sbin/bhyve/kbdlayout/fr_dvorak b/usr.sbin/bhyve/kbdlayout/fr_dvorak new file mode 100644 index 000000000000..f739c8e15502 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/fr_dvorak @@ -0,0 +1,87 @@ +# bhyve ps2kbd keyboard layout file +# (fr_dvorak : French Dvorak-like) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'!',0x2c; ! (0x21) +'"',0x45; " (0x22) +'#',0x5d; # (0x23) +'%',0x55; % (0x25) +'&',0x5b; & (0x26) +''',0x1d; ' (0x27) +'(',0x3d; ( (0x28) +')',0x46; ) (0x29) +'*',0x61; * (0x2a) +'+',0x61; + (0x2b) +',',0x21; , (0x2c) +'-',0x26; - (0x2d) +'.',0x2c; . (0x2e) +'/',0x2e; / (0x2f) +':',0x15; : (0x3a) +';',0x1a; ; (0x3b) +'<',0x1d; < (0x3c) +'=',0x16; = (0x3d) +'>',0x24; > (0x3e) +'?',0x15; ? (0x3f) +'@',0x1a; @ (0x40) +'A',0x1b; A (0x41) +'B',0x34; B (0x42) +'C',0x43; C (0x43) +'D',0x4c; D (0x44) +'E',0x2b; E (0x45) +'F',0x33; F (0x46) +'G',0x2d; G (0x47) +'H',0x35; H (0x48) +'I',0x2a; I (0x49) +'J',0x4a; J (0x4a) +'K',0x4d; K (0x4b) +'L',0x41; L (0x4c) +'M',0x44; M (0x4d) +'N',0x4b; N (0x4e) +'O',0x1c; O (0x4f) +'P',0x49; P (0x50) +'Q',0x22; Q (0x51) +'R',0x3a; R (0x52) +'S',0x3b; S (0x53) +'T',0x42; T (0x54) +'U',0x23; U (0x55) +'V',0x3c; V (0x56) +'W',0x52; W (0x57) +'X',0x31; X (0x58) +'Y',0x32; Y (0x59) +'Z',0x54; Z (0x5a) +'[',0x4e; [ (0x5b) +'\',0x21; \ (0x5c) +']',0x55; ] (0x5d) +'`',0x3e; ` (0x60) +'a',0x1b; a (0x61) +'b',0x34; b (0x62) +'c',0x43; c (0x63) +'d',0x4c; d (0x64) +'e',0x2b; e (0x65) +'f',0x33; f (0x66) +'g',0x2d; g (0x67) +'h',0x35; h (0x68) +'i',0x2a; i (0x69) +'j',0x4a; j (0x6a) +'k',0x4d; k (0x6b) +'l',0x41; l (0x6c) +'m',0x44; m (0x6d) +'n',0x4b; n (0x6e) +'o',0x1c; o (0x6f) +'p',0x49; p (0x70) +'q',0x22; q (0x71) +'r',0x3a; r (0x72) +'s',0x3b; s (0x73) +'t',0x42; t (0x74) +'u',0x23; u (0x75) +'v',0x3c; v (0x76) +'w',0x52; w (0x77) +'x',0x31; x (0x78) +'y',0x32; y (0x79) +'z',0x54; z (0x7a) +'|',0x4e; | (0x7c) +'~',0x5d; ~ (0x7e) + diff --git a/usr.sbin/bhyve/kbdlayout/fr_dvorak_acc b/usr.sbin/bhyve/kbdlayout/fr_dvorak_acc new file mode 100644 index 000000000000..c126572b7e16 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/fr_dvorak_acc @@ -0,0 +1,86 @@ +# bhyve ps2kbd keyboard layout file +# (fr_dvorak_acc : French Dvorak-like (accent keys)) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'!',0x2c; ! (0x21) +'"',0x45; " (0x22) +'#',0x5d; # (0x23) +'%',0x55; % (0x25) +'&',0x5b; & (0x26) +''',0x1d; ' (0x27) +'(',0x3d; ( (0x28) +')',0x46; ) (0x29) +'*',0x0e; * (0x2a) +'+',0x4e; + (0x2b) +',',0x21; , (0x2c) +'-',0x26; - (0x2d) +'.',0x2c; . (0x2e) +'/',0x1e; / (0x2f) +':',0x15; : (0x3a) +';',0x1a; ; (0x3b) +'<',0x1d; < (0x3c) +'=',0x16; = (0x3d) +'>',0x24; > (0x3e) +'?',0x15; ? (0x3f) +'@',0x21; @ (0x40) +'A',0x1b; A (0x41) +'B',0x34; B (0x42) +'C',0x43; C (0x43) +'D',0x4c; D (0x44) +'E',0x2b; E (0x45) +'F',0x33; F (0x46) +'G',0x2d; G (0x47) +'H',0x35; H (0x48) +'I',0x2a; I (0x49) +'J',0x4a; J (0x4a) +'K',0x4d; K (0x4b) +'L',0x41; L (0x4c) +'M',0x44; M (0x4d) +'N',0x4b; N (0x4e) +'O',0x1c; O (0x4f) +'P',0x49; P (0x50) +'Q',0x22; Q (0x51) +'R',0x3a; R (0x52) +'S',0x3b; S (0x53) +'T',0x42; T (0x54) +'U',0x23; U (0x55) +'V',0x3c; V (0x56) +'W',0x52; W (0x57) +'X',0x31; X (0x58) +'Y',0x32; Y (0x59) +'Z',0x54; Z (0x5a) +'[',0x4e; [ (0x5b) +'\',0x2e; \ (0x5c) +']',0x55; ] (0x5d) +'_',0x0e; _ (0x5f) +'a',0x1b; a (0x61) +'b',0x34; b (0x62) +'c',0x43; c (0x63) +'d',0x4c; d (0x64) +'e',0x2b; e (0x65) +'f',0x33; f (0x66) +'g',0x2d; g (0x67) +'h',0x35; h (0x68) +'i',0x2a; i (0x69) +'j',0x4a; j (0x6a) +'k',0x4d; k (0x6b) +'l',0x41; l (0x6c) +'m',0x44; m (0x6d) +'n',0x4b; n (0x6e) +'o',0x1c; o (0x6f) +'p',0x49; p (0x70) +'q',0x22; q (0x71) +'r',0x3a; r (0x72) +'s',0x3b; s (0x73) +'t',0x42; t (0x74) +'u',0x23; u (0x75) +'v',0x3c; v (0x76) +'w',0x52; w (0x77) +'x',0x31; x (0x78) +'y',0x32; y (0x79) +'z',0x54; z (0x7a) +'|',0x1a; | (0x7c) + diff --git a/usr.sbin/bhyve/kbdlayout/fr_macbook b/usr.sbin/bhyve/kbdlayout/fr_macbook new file mode 100644 index 000000000000..ddb756c8a648 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/fr_macbook @@ -0,0 +1,49 @@ +# bhyve ps2kbd keyboard layout file +# (fr_macbook : French Macbook/Macbook Pro (accent keys)) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'!',0x3e; ! (0x21) +'"',0x26; " (0x22) +'#',0x0e; # (0x23) +'$',0x5b; $ (0x24) +'%',0x52; % (0x25) +'&',0x16; & (0x26) +''',0x25; ' (0x27) +'(',0x2e; ( (0x28) +')',0x4e; ) (0x29) +'*',0x5b; * (0x2a) +'+',0x4a; + (0x2b) +',',0x3a; , (0x2c) +'-',0x55; - (0x2d) +'.',0x41; . (0x2e) +':',0x49; : (0x3a) +';',0x41; ; (0x3b) +'<',0x61; < (0x3c) +'=',0x4a; = (0x3d) +'>',0x61; > (0x3e) +'?',0x3a; ? (0x3f) +'@',0x0e; @ (0x40) +'A',0x15; A (0x41) +'M',0x4c; M (0x4d) +'Q',0x1c; Q (0x51) +'W',0x1a; W (0x57) +'Z',0x1d; Z (0x5a) +'[',0x2e; [ (0x5b) +'\',0x3e; \ (0x5c) +']',0x4e; ] (0x5d) +'^',0x46; ^ (0x5e) +'_',0x55; _ (0x5f) +'`',0x3d; ` (0x60) +'a',0x15; a (0x61) +'m',0x4c; m (0x6d) +'q',0x1c; q (0x71) +'w',0x1a; w (0x77) +'z',0x1d; z (0x7a) +'{',0x25; { (0x7b) +'|',0x36; | (0x7c) +'}',0x55; } (0x7d) +'~',0x1e; ~ (0x7e) + diff --git a/usr.sbin/bhyve/kbdlayout/gr b/usr.sbin/bhyve/kbdlayout/gr new file mode 100644 index 000000000000..cba917509594 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/gr @@ -0,0 +1,9 @@ +# bhyve ps2kbd keyboard layout file +# (gr : Greek (104 keys)) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'*',0xb7; * (0x2a) + diff --git a/usr.sbin/bhyve/kbdlayout/gr_101_acc b/usr.sbin/bhyve/kbdlayout/gr_101_acc new file mode 100644 index 000000000000..1a4ef7657f1d --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/gr_101_acc @@ -0,0 +1,9 @@ +# bhyve ps2kbd keyboard layout file +# (gr_101_acc : Greek (101 keys)) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'*',0xb7; * (0x2a) + diff --git a/usr.sbin/bhyve/kbdlayout/gr_elot_acc b/usr.sbin/bhyve/kbdlayout/gr_elot_acc new file mode 100644 index 000000000000..2e84a99633dc --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/gr_elot_acc @@ -0,0 +1,17 @@ +# bhyve ps2kbd keyboard layout file +# (gr_elot_acc : Greek ELOT) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'"',0x1e; " (0x22) +'#',0x5d; # (0x23) +''',0x0e; ' (0x27) +'*',0xb7; * (0x2a) +'/',0x52; / (0x2f) +'@',0x52; @ (0x40) +'\',0x61; \ (0x5c) +'|',0x61; | (0x7c) +'~',0x5d; ~ (0x7e) + diff --git a/usr.sbin/bhyve/kbdlayout/hr b/usr.sbin/bhyve/kbdlayout/hr new file mode 100644 index 000000000000..8ec2e11dcbd3 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/hr @@ -0,0 +1,36 @@ +# bhyve ps2kbd keyboard layout file +# (hr : Croatian) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'"',0x1e; " (0x22) +'&',0x36; & (0x26) +''',0x4e; ' (0x27) +'(',0x3e; ( (0x28) +')',0x46; ) (0x29) +'*',0x55; * (0x2a) +'-',0x4a; - (0x2d) +':',0x49; : (0x3a) +';',0x41; ; (0x3b) +'<',0x61; < (0x3c) +'=',0x45; = (0x3d) +'>',0x61; > (0x3e) +'?',0x4e; ? (0x3f) +'@',0x2a; @ (0x40) +'Y',0x1a; Y (0x59) +'Z',0x35; Z (0x5a) +'[',0x2b; [ (0x5b) +'\',0x15; \ (0x5c) +']',0x34; ] (0x5d) +'^',0x26; ^ (0x5e) +'_',0x4a; _ (0x5f) +'`',0x3d; ` (0x60) +'y',0x1a; y (0x79) +'z',0x35; z (0x7a) +'{',0x32; { (0x7b) +'|',0x1d; | (0x7c) +'}',0x31; } (0x7d) +'~',0x16; ~ (0x7e) + diff --git a/usr.sbin/bhyve/kbdlayout/hu_101 b/usr.sbin/bhyve/kbdlayout/hu_101 new file mode 100644 index 000000000000..00d4176d1bca --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/hu_101 @@ -0,0 +1,9 @@ +# bhyve ps2kbd keyboard layout file +# (hu_101 : Hungarian (101 keys)) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'*',0xb7; * (0x2a) + diff --git a/usr.sbin/bhyve/kbdlayout/hu_102 b/usr.sbin/bhyve/kbdlayout/hu_102 new file mode 100644 index 000000000000..eb9d0ae4e465 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/hu_102 @@ -0,0 +1,41 @@ +# bhyve ps2kbd keyboard layout file +# (hu_102 : Hungarian (102 keys)) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'!',0x25; ! (0x21) +'"',0x1e; " (0x22) +'#',0x22; # (0x23) +'$',0x4c; $ (0x24) +'&',0x21; & (0x26) +''',0x16; ' (0x27) +'(',0x3e; ( (0x28) +')',0x46; ) (0x29) +'*',0x4a; * (0x2a) +'+',0x26; + (0x2b) +'-',0x4a; - (0x2d) +'0',0x0e; 0 (0x30) +':',0x49; : (0x3a) +';',0x41; ; (0x3b) +'<',0x3a; < (0x3c) +'=',0x3d; = (0x3d) +'>',0x1a; > (0x3e) +'?',0x41; ? (0x3f) +'@',0x2a; @ (0x40) +'Y',0x1a; Y (0x59) +'Z',0x35; Z (0x5a) +'[',0x2b; [ (0x5b) +'\',0x15; \ (0x5c) +']',0x34; ] (0x5d) +'^',0x26; ^ (0x5e) +'_',0x4a; _ (0x5f) +'`',0x3d; ` (0x60) +'y',0x1a; y (0x79) +'z',0x35; z (0x7a) +'{',0x32; { (0x7b) +'|',0x1d; | (0x7c) +'}',0x31; } (0x7d) +'~',0x16; ~ (0x7e) + diff --git a/usr.sbin/bhyve/kbdlayout/is b/usr.sbin/bhyve/kbdlayout/is new file mode 100644 index 000000000000..4cfd793f7326 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/is @@ -0,0 +1,33 @@ +# bhyve ps2kbd keyboard layout file +# (is : Icelandic) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'"',0x1e; " (0x22) +'&',0x36; & (0x26) +''',0x5b; ' (0x27) +'(',0x3e; ( (0x28) +')',0x46; ) (0x29) +'*',0x5d; * (0x2a) +'+',0x5d; + (0x2b) +'-',0x55; - (0x2d) +':',0x49; : (0x3a) +';',0x41; ; (0x3b) +'<',0x61; < (0x3c) +'=',0x45; = (0x3d) +'>',0x61; > (0x3e) +'?',0x5b; ? (0x3f) +'@',0x15; @ (0x40) +'[',0x3e; [ (0x5b) +'\',0x4e; \ (0x5c) +']',0x46; ] (0x5d) +'^',0x0e; ^ (0x5e) +'_',0x55; _ (0x5f) +'`',0x5d; ` (0x60) +'{',0x3d; { (0x7b) +'|',0x4c; | (0x7c) +'}',0x45; } (0x7d) +'~',0x5b; ~ (0x7e) + diff --git a/usr.sbin/bhyve/kbdlayout/is_acc b/usr.sbin/bhyve/kbdlayout/is_acc new file mode 100644 index 000000000000..f7391b35298f --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/is_acc @@ -0,0 +1,32 @@ +# bhyve ps2kbd keyboard layout file +# (is_acc : Icelandic (accent keys)) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'"',0x1e; " (0x22) +'&',0x36; & (0x26) +''',0x5b; ' (0x27) +'(',0x3e; ( (0x28) +')',0x46; ) (0x29) +'*',0x5d; * (0x2a) +'+',0x5d; + (0x2b) +'-',0x55; - (0x2d) +':',0x49; : (0x3a) +';',0x41; ; (0x3b) +'<',0x61; < (0x3c) +'=',0x45; = (0x3d) +'>',0x61; > (0x3e) +'?',0x5b; ? (0x3f) +'@',0x15; @ (0x40) +'[',0x3e; [ (0x5b) +'\',0x4e; \ (0x5c) +']',0x46; ] (0x5d) +'_',0x55; _ (0x5f) +'`',0x5d; ` (0x60) +'{',0x3d; { (0x7b) +'|',0x4c; | (0x7c) +'}',0x45; } (0x7d) +'~',0x5b; ~ (0x7e) + diff --git a/usr.sbin/bhyve/kbdlayout/it b/usr.sbin/bhyve/kbdlayout/it new file mode 100644 index 000000000000..a286bf8684fa --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/it @@ -0,0 +1,34 @@ +# bhyve ps2kbd keyboard layout file +# (it : Italian) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'"',0x1e; " (0x22) +'#',0x52; # (0x23) +'&',0x36; & (0x26) +''',0x4e; ' (0x27) +'(',0x3e; ( (0x28) +')',0x46; ) (0x29) +'*',0x5b; * (0x2a) +'+',0x5b; + (0x2b) +'-',0x4a; - (0x2d) +':',0x49; : (0x3a) +';',0x41; ; (0x3b) +'<',0x61; < (0x3c) +'=',0x45; = (0x3d) +'>',0x61; > (0x3e) +'?',0x4e; ? (0x3f) +'@',0x15; @ (0x40) +'[',0x3e; [ (0x5b) +'\',0x0e; \ (0x5c) +']',0x46; ] (0x5d) +'^',0x55; ^ (0x5e) +'_',0x4a; _ (0x5f) +'`',0x4e; ` (0x60) +'{',0x3d; { (0x7b) +'|',0x0e; | (0x7c) +'}',0x45; } (0x7d) +'~',0x55; ~ (0x7e) + diff --git a/usr.sbin/bhyve/kbdlayout/jp b/usr.sbin/bhyve/kbdlayout/jp new file mode 100644 index 000000000000..550571ea1dfe --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/jp @@ -0,0 +1,36 @@ +# bhyve ps2kbd keyboard layout file +# (jp : Japanese 106) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +# Alphabet/Number/Sign Keys --------------------------------------------------- +'"',0x1e; " (0x22) +'&',0x36; & (0x26) +''',0x3d; ' (0x27) +'(',0x3e; ( (0x28) +')',0x46; ) (0x29) +'*',0x52; * (0x2a) +'+',0x4c; + (0x2b) +':',0x52; : (0x3a) +'=',0x4e; = (0x3d) +'@',0x54; @ (0x40) +'[',0x5b; [ (0x5b) +'\',0x51; \ (0x5c) +']',0x5d; ] (0x5d) +'^',0x55; ^ (0x5e) +'_',0x51; _ (0x5f) +'`',0x54; ` (0x60) +'{',0x5b; { (0x7b) +'|',0x6a; | (0x7c) +'}',0x5d; } (0x7d) +'~',0x55; ~ (0x7e) + +# Language Specific Keys ------------------------------------------------------ +0xff2a,0x0e; Hankaku/Zenkaku|Kanji +0xffe5,0x58; CapsLock +0xff22,0x67; Muhenkan +0xff23,0x64; Henkan_Mode +0xff27,0x13; Katakana-Hiragana/RomaJi + diff --git a/usr.sbin/bhyve/kbdlayout/jp_capsctrl b/usr.sbin/bhyve/kbdlayout/jp_capsctrl new file mode 100644 index 000000000000..46fd6e154a38 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/jp_capsctrl @@ -0,0 +1,37 @@ +# bhyve ps2kbd keyboard layout file +# (jp.capsctrl : Japanese 106x) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +# Alphabet/Number/Sign Keys --------------------------------------------------- +'"',0x1e; " (0x22) +'&',0x36; & (0x26) +''',0x3d; ' (0x27) +'(',0x3e; ( (0x28) +')',0x46; ) (0x29) +'*',0x52; * (0x2a) +'+',0x4c; + (0x2b) +':',0x52; : (0x3a) +'=',0x4e; = (0x3d) +'@',0x54; @ (0x40) +'[',0x5b; [ (0x5b) +'\',0x51; \ (0x5c) +']',0x5d; ] (0x5d) +'^',0x55; ^ (0x5e) +'_',0x51; _ (0x5f) +'`',0x54; ` (0x60) +'{',0x5b; { (0x7b) +'|',0x6a; | (0x7c) +'}',0x5d; } (0x7d) +'~',0x55; ~ (0x7e) + +# Language Specific Keys ------------------------------------------------------ +0xff2a,0x0e; Hankaku/Zenkaku|Kanji +0xffe5,0x58; CapsLock +0xff22,0x67; Muhenkan +0xff23,0x64; Henkan_Mode +0xff27,0x13; Katakana-Hiragana/RomaJi +0xffe3,0x58; Left control + diff --git a/usr.sbin/bhyve/kbdlayout/kz_io b/usr.sbin/bhyve/kbdlayout/kz_io new file mode 100644 index 000000000000..c158028e0ad5 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/kz_io @@ -0,0 +1,11 @@ +# bhyve ps2kbd keyboard layout file +# (kz_io : Kazakh) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'"',0x82; " (0x22) +'(',0xa9; ( (0x28) +'*',0xb7; * (0x2a) + diff --git a/usr.sbin/bhyve/kbdlayout/kz_kst b/usr.sbin/bhyve/kbdlayout/kz_kst new file mode 100644 index 000000000000..7c1281a7dc4d --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/kz_kst @@ -0,0 +1,11 @@ +# bhyve ps2kbd keyboard layout file +# (kz_kst : Kazakh) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'"',0x82; " (0x22) +'(',0xa9; ( (0x28) +'*',0xb7; * (0x2a) + diff --git a/usr.sbin/bhyve/kbdlayout/latinamerican b/usr.sbin/bhyve/kbdlayout/latinamerican new file mode 100644 index 000000000000..ac2920ab4af7 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/latinamerican @@ -0,0 +1,33 @@ +# bhyve ps2kbd keyboard layout file +# (latinamerican : Latin American) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'"',0x1e; " (0x22) +'&',0x36; & (0x26) +''',0x4e; ' (0x27) +'(',0x3e; ( (0x28) +')',0x46; ) (0x29) +'*',0x5b; * (0x2a) +'+',0x5b; + (0x2b) +'-',0x4a; - (0x2d) +':',0x49; : (0x3a) +';',0x41; ; (0x3b) +'<',0x61; < (0x3c) +'=',0x45; = (0x3d) +'>',0x61; > (0x3e) +'?',0x4e; ? (0x3f) +'@',0x15; @ (0x40) +'[',0x52; [ (0x5b) +'\',0x4e; \ (0x5c) +']',0x5d; ] (0x5d) +'^',0x52; ^ (0x5e) +'_',0x4a; _ (0x5f) +'`',0x5d; ` (0x60) +'{',0x52; { (0x7b) +'|',0x0e; | (0x7c) +'}',0x5d; } (0x7d) +'~',0x5b; ~ (0x7e) + diff --git a/usr.sbin/bhyve/kbdlayout/latinamerican_acc b/usr.sbin/bhyve/kbdlayout/latinamerican_acc new file mode 100644 index 000000000000..7fd97dc3dba8 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/latinamerican_acc @@ -0,0 +1,31 @@ +# bhyve ps2kbd keyboard layout file +# (latinamerican_acc : Latin American (accent keys)) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'"',0x1e; " (0x22) +'&',0x36; & (0x26) +''',0x4e; ' (0x27) +'(',0x3e; ( (0x28) +')',0x46; ) (0x29) +'*',0x5b; * (0x2a) +'+',0x5b; + (0x2b) +'-',0x4a; - (0x2d) +':',0x49; : (0x3a) +';',0x41; ; (0x3b) +'<',0x61; < (0x3c) +'=',0x45; = (0x3d) +'>',0x61; > (0x3e) +'?',0x4e; ? (0x3f) +'@',0x15; @ (0x40) +'[',0x52; [ (0x5b) +'\',0x4e; \ (0x5c) +']',0x5d; ] (0x5d) +'_',0x4a; _ (0x5f) +'{',0x52; { (0x7b) +'|',0x0e; | (0x7c) +'}',0x5d; } (0x7d) +'~',0x5b; ~ (0x7e) + diff --git a/usr.sbin/bhyve/kbdlayout/lt b/usr.sbin/bhyve/kbdlayout/lt new file mode 100644 index 000000000000..114d0624dfe2 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/lt @@ -0,0 +1,10 @@ +# bhyve ps2kbd keyboard layout file +# (lt : Lithuanian Ukrainian (with Russian) (shift)) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'*',0xb7; * (0x2a) +0xffea,0x61; Right alt + diff --git a/usr.sbin/bhyve/kbdlayout/nl b/usr.sbin/bhyve/kbdlayout/nl new file mode 100644 index 000000000000..f715494337e4 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/nl @@ -0,0 +1,31 @@ +# bhyve ps2kbd keyboard layout file +# (nl : Dutch (accent keys)) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'"',0x1e; " (0x22) +'&',0x36; & (0x26) +''',0x45; ' (0x27) +'(',0x3e; ( (0x28) +')',0x46; ) (0x29) +'*',0x5b; * (0x2a) +'+',0x4c; + (0x2b) +'-',0x4a; - (0x2d) +'/',0x4e; / (0x2f) +':',0x49; : (0x3a) +';',0x41; ; (0x3b) +'<',0x5d; < (0x3c) +'=',0x4a; = (0x3d) +'>',0x5d; > (0x3e) +'?',0x4e; ? (0x3f) +'@',0x0e; @ (0x40) +'[',0x61; [ (0x5b) +'\',0x4e; \ (0x5c) +']',0x61; ] (0x5d) +'_',0x3d; _ (0x5f) +'{',0x3e; { (0x7b) +'|',0x5b; | (0x7c) +'}',0x46; } (0x7d) + diff --git a/usr.sbin/bhyve/kbdlayout/no b/usr.sbin/bhyve/kbdlayout/no new file mode 100644 index 000000000000..bd2620631616 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/no @@ -0,0 +1,32 @@ +# bhyve ps2kbd keyboard layout file +# (no : Norwegian) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'"',0x1e; " (0x22) +'&',0x36; & (0x26) +''',0x5d; ' (0x27) +'(',0x3e; ( (0x28) +')',0x46; ) (0x29) +'*',0x5d; * (0x2a) +'+',0x4e; + (0x2b) +'-',0x4a; - (0x2d) +':',0x49; : (0x3a) +';',0x41; ; (0x3b) +'<',0x61; < (0x3c) +'=',0x45; = (0x3d) +'>',0x61; > (0x3e) +'?',0x4e; ? (0x3f) +'[',0x3e; [ (0x5b) +'\',0x55; \ (0x5c) +']',0x46; ] (0x5d) +'^',0x5b; ^ (0x5e) +'_',0x4a; _ (0x5f) +'`',0x55; ` (0x60) +'{',0x3d; { (0x7b) +'|',0x0e; | (0x7c) +'}',0x45; } (0x7d) +'~',0x5b; ~ (0x7e) + diff --git a/usr.sbin/bhyve/kbdlayout/no_dvorak b/usr.sbin/bhyve/kbdlayout/no_dvorak new file mode 100644 index 000000000000..f4197864590e --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/no_dvorak @@ -0,0 +1,81 @@ +# bhyve ps2kbd keyboard layout file +# (no_dvorak : Norwegian dvorak) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'"',0x1e; " (0x22) +'&',0x36; & (0x26) +''',0x54; ' (0x27) +'(',0x3e; ( (0x28) +')',0x46; ) (0x29) +'*',0x54; * (0x2a) +'+',0x4e; + (0x2b) +',',0x1d; , (0x2c) +'-',0x52; - (0x2d) +'.',0x24; . (0x2e) +':',0x24; : (0x3a) +';',0x1d; ; (0x3b) +'<',0x5d; < (0x3c) +'=',0x45; = (0x3d) +'>',0x5d; > (0x3e) +'?',0x4e; ? (0x3f) +'B',0x31; B (0x42) +'C',0x43; C (0x43) +'D',0x33; D (0x44) +'E',0x23; E (0x45) +'F',0x35; F (0x46) +'G',0x3c; G (0x47) +'H',0x3b; H (0x48) +'I',0x34; I (0x49) +'J',0x21; J (0x4a) +'K',0x2a; K (0x4b) +'L',0x4d; L (0x4c) +'N',0x4b; N (0x4e) +'O',0x1b; O (0x4f) +'P',0x2d; P (0x50) +'Q',0x22; Q (0x51) +'R',0x44; R (0x52) +'S',0x4c; S (0x53) +'T',0x42; T (0x54) +'U',0x2b; U (0x55) +'V',0x49; V (0x56) +'W',0x41; W (0x57) +'X',0x32; X (0x58) +'Y',0x2c; Y (0x59) +'Z',0x4a; Z (0x5a) +'[',0x3e; [ (0x5b) +'\',0x55; \ (0x5c) +']',0x46; ] (0x5d) +'^',0x5b; ^ (0x5e) +'_',0x52; _ (0x5f) +'`',0x55; ` (0x60) +'b',0x31; b (0x62) +'c',0x43; c (0x63) +'d',0x33; d (0x64) +'e',0x23; e (0x65) +'f',0x35; f (0x66) +'g',0x3c; g (0x67) +'h',0x3b; h (0x68) +'i',0x34; i (0x69) +'j',0x21; j (0x6a) +'k',0x2a; k (0x6b) +'l',0x4d; l (0x6c) +'n',0x4b; n (0x6e) +'o',0x1b; o (0x6f) +'p',0x2d; p (0x70) +'q',0x22; q (0x71) +'r',0x44; r (0x72) +'s',0x4c; s (0x73) +'t',0x42; t (0x74) +'u',0x2b; u (0x75) +'v',0x49; v (0x76) +'w',0x41; w (0x77) +'x',0x32; x (0x78) +'y',0x2c; y (0x79) +'z',0x4a; z (0x7a) +'{',0x3d; { (0x7b) +'|',0x0e; | (0x7c) +'}',0x45; } (0x7d) + diff --git a/usr.sbin/bhyve/kbdlayout/nordic_asus-eee b/usr.sbin/bhyve/kbdlayout/nordic_asus-eee new file mode 100644 index 000000000000..c0fb79ca4fdd --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/nordic_asus-eee @@ -0,0 +1,32 @@ +# bhyve ps2kbd keyboard layout file +# (nordic_asus-eee : Nordic layout on Asus eeePC) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'"',0x1e; " (0x22) +'&',0x36; & (0x26) +''',0x5d; ' (0x27) +'(',0x3e; ( (0x28) +')',0x46; ) (0x29) +'*',0x5d; * (0x2a) +'+',0x4e; + (0x2b) +'-',0x4a; - (0x2d) +':',0x49; : (0x3a) +';',0x41; ; (0x3b) +'<',0x61; < (0x3c) +'=',0x45; = (0x3d) +'>',0x61; > (0x3e) +'?',0x4e; ? (0x3f) +'[',0x3e; [ (0x5b) +'\',0x4e; \ (0x5c) +']',0x46; ] (0x5d) +'^',0x5b; ^ (0x5e) +'_',0x4a; _ (0x5f) +'`',0x55; ` (0x60) +'{',0x3d; { (0x7b) +'|',0x4c; | (0x7c) +'}',0x45; } (0x7d) +'~',0x5b; ~ (0x7e) + diff --git a/usr.sbin/bhyve/kbdlayout/pl_dvorak b/usr.sbin/bhyve/kbdlayout/pl_dvorak new file mode 100644 index 000000000000..4162839eb89d --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/pl_dvorak @@ -0,0 +1,74 @@ +# bhyve ps2kbd keyboard layout file +# (pl_dvorak : Polish Dvorak) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'"',0x15; " (0x22) +''',0x15; ' (0x27) +'+',0x5b; + (0x2b) +',',0x1d; , (0x2c) +'-',0x52; - (0x2d) +'.',0x24; . (0x2e) +'/',0x54; / (0x2f) +':',0x1a; : (0x3a) +';',0x1a; ; (0x3b) +'<',0x1d; < (0x3c) +'=',0x5b; = (0x3d) +'>',0x24; > (0x3e) +'?',0x54; ? (0x3f) +'B',0x31; B (0x42) +'C',0x43; C (0x43) +'D',0x33; D (0x44) +'E',0x23; E (0x45) +'F',0x35; F (0x46) +'G',0x3c; G (0x47) +'H',0x3b; H (0x48) +'I',0x34; I (0x49) +'J',0x21; J (0x4a) +'K',0x2a; K (0x4b) +'L',0x4d; L (0x4c) +'N',0x4b; N (0x4e) +'O',0x1b; O (0x4f) +'P',0x2d; P (0x50) +'Q',0x22; Q (0x51) +'R',0x44; R (0x52) +'S',0x4c; S (0x53) +'T',0x42; T (0x54) +'U',0x2b; U (0x55) +'V',0x49; V (0x56) +'W',0x41; W (0x57) +'X',0x32; X (0x58) +'Y',0x2c; Y (0x59) +'Z',0x4a; Z (0x5a) +'[',0x4e; [ (0x5b) +']',0x55; ] (0x5d) +'_',0x52; _ (0x5f) +'b',0x31; b (0x62) +'c',0x43; c (0x63) +'d',0x33; d (0x64) +'e',0x23; e (0x65) +'f',0x35; f (0x66) +'g',0x3c; g (0x67) +'h',0x3b; h (0x68) +'i',0x34; i (0x69) +'j',0x21; j (0x6a) +'k',0x2a; k (0x6b) +'l',0x4d; l (0x6c) +'n',0x4b; n (0x6e) +'o',0x1b; o (0x6f) +'p',0x2d; p (0x70) +'q',0x22; q (0x71) +'r',0x44; r (0x72) +'s',0x4c; s (0x73) +'t',0x42; t (0x74) +'u',0x2b; u (0x75) +'v',0x49; v (0x76) +'w',0x41; w (0x77) +'x',0x32; x (0x78) +'y',0x2c; y (0x79) +'z',0x4a; z (0x7a) +'{',0x4e; { (0x7b) +'}',0x55; } (0x7d) + diff --git a/usr.sbin/bhyve/kbdlayout/pt b/usr.sbin/bhyve/kbdlayout/pt new file mode 100644 index 000000000000..9ca6dc125a6b --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/pt @@ -0,0 +1,31 @@ +# bhyve ps2kbd keyboard layout file +# (pt : Portuguese) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'"',0x1e; " (0x22) +'&',0x36; & (0x26) +''',0x4e; ' (0x27) +'(',0x3e; ( (0x28) +')',0x46; ) (0x29) +'*',0x54; * (0x2a) +'+',0x54; + (0x2b) +'-',0x4a; - (0x2d) +':',0x49; : (0x3a) +';',0x41; ; (0x3b) +'<',0x61; < (0x3c) +'>',0x61; > (0x3e) +'?',0x4e; ? (0x3f) +'[',0x3e; [ (0x5b) +'\',0x0e; \ (0x5c) +']',0x46; ] (0x5d) +'^',0x5d; ^ (0x5e) +'_',0x4a; _ (0x5f) +'`',0x5b; ` (0x60) +'{',0x3d; { (0x7b) +'|',0x0e; | (0x7c) +'}',0x45; } (0x7d) +'~',0x5d; ~ (0x7e) + diff --git a/usr.sbin/bhyve/kbdlayout/pt_acc b/usr.sbin/bhyve/kbdlayout/pt_acc new file mode 100644 index 000000000000..85ca7485afa9 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/pt_acc @@ -0,0 +1,28 @@ +# bhyve ps2kbd keyboard layout file +# (pt_acc : Portuguese (accent keys)) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'"',0x1e; " (0x22) +'&',0x36; & (0x26) +''',0x4e; ' (0x27) +'(',0x3e; ( (0x28) +')',0x46; ) (0x29) +'*',0x54; * (0x2a) +'+',0x54; + (0x2b) +'-',0x4a; - (0x2d) +':',0x49; : (0x3a) +';',0x41; ; (0x3b) +'<',0x61; < (0x3c) +'>',0x61; > (0x3e) +'?',0x4e; ? (0x3f) +'[',0x3e; [ (0x5b) +'\',0x0e; \ (0x5c) +']',0x46; ] (0x5d) +'_',0x4a; _ (0x5f) +'{',0x3d; { (0x7b) +'|',0x0e; | (0x7c) +'}',0x45; } (0x7d) + diff --git a/usr.sbin/bhyve/kbdlayout/ru b/usr.sbin/bhyve/kbdlayout/ru new file mode 100644 index 000000000000..32bcf88dcf79 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/ru @@ -0,0 +1,14 @@ +# bhyve ps2kbd keyboard layout file +# (ru : Russian) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'!',0x82; ! (0x21) +'"',0x00; " (0x22) +'(',0x8a; ( (0x28) +')',0x8b; ) (0x29) +'*',0x85; * (0x2a) +':',0x86; : (0x3a) + diff --git a/usr.sbin/bhyve/kbdlayout/ru_shift b/usr.sbin/bhyve/kbdlayout/ru_shift new file mode 100644 index 000000000000..1edc9310d2b0 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/ru_shift @@ -0,0 +1,9 @@ +# bhyve ps2kbd keyboard layout file +# (ru_shift : Russian (shift)) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'*',0xb7; * (0x2a) + diff --git a/usr.sbin/bhyve/kbdlayout/ru_win b/usr.sbin/bhyve/kbdlayout/ru_win new file mode 100644 index 000000000000..04b2775bf79f --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/ru_win @@ -0,0 +1,9 @@ +# bhyve ps2kbd keyboard layout file +# (ru_win : Russian (winkeys)) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'*',0xb7; * (0x2a) + diff --git a/usr.sbin/bhyve/kbdlayout/se b/usr.sbin/bhyve/kbdlayout/se new file mode 100644 index 000000000000..afd0aca06cd9 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/se @@ -0,0 +1,32 @@ +# bhyve ps2kbd keyboard layout file +# (se : Swedish) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'"',0x1e; " (0x22) +'&',0x36; & (0x26) +''',0x5d; ' (0x27) +'(',0x3e; ( (0x28) +')',0x46; ) (0x29) +'*',0x5d; * (0x2a) +'+',0x4e; + (0x2b) +'-',0x4a; - (0x2d) +':',0x49; : (0x3a) +';',0x41; ; (0x3b) +'<',0x61; < (0x3c) +'=',0x45; = (0x3d) +'>',0x61; > (0x3e) +'?',0x4e; ? (0x3f) +'[',0x3e; [ (0x5b) +'\',0x4e; \ (0x5c) +']',0x46; ] (0x5d) +'^',0x5b; ^ (0x5e) +'_',0x4a; _ (0x5f) +'`',0x55; ` (0x60) +'{',0x3d; { (0x7b) +'|',0x4c; | (0x7c) +'}',0x45; } (0x7d) +'~',0x5b; ~ (0x7e) + diff --git a/usr.sbin/bhyve/kbdlayout/si b/usr.sbin/bhyve/kbdlayout/si new file mode 100644 index 000000000000..4c3f119e0351 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/si @@ -0,0 +1,36 @@ +# bhyve ps2kbd keyboard layout file +# (si : Slovenian) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'"',0x1e; " (0x22) +'&',0x36; & (0x26) +''',0x4e; ' (0x27) +'(',0x3e; ( (0x28) +')',0x46; ) (0x29) +'*',0x55; * (0x2a) +'-',0x4a; - (0x2d) +':',0x49; : (0x3a) +';',0x41; ; (0x3b) +'<',0x61; < (0x3c) +'=',0x45; = (0x3d) +'>',0x61; > (0x3e) +'?',0x4e; ? (0x3f) +'@',0x2a; @ (0x40) +'Y',0x1a; Y (0x59) +'Z',0x35; Z (0x5a) +'[',0x2b; [ (0x5b) +'\',0x15; \ (0x5c) +']',0x34; ] (0x5d) +'^',0x26; ^ (0x5e) +'_',0x4a; _ (0x5f) +'`',0x3d; ` (0x60) +'y',0x1a; y (0x79) +'z',0x35; z (0x7a) +'{',0x32; { (0x7b) +'|',0x1d; | (0x7c) +'}',0x31; } (0x7d) +'~',0x16; ~ (0x7e) + diff --git a/usr.sbin/bhyve/kbdlayout/tr b/usr.sbin/bhyve/kbdlayout/tr new file mode 100644 index 000000000000..5c80df6b5067 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/tr @@ -0,0 +1,36 @@ +# bhyve ps2kbd keyboard layout file +# (tr : Turkish (Q)) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'"',0x0e; " (0x22) +'&',0x36; & (0x26) +''',0x1e; ' (0x27) +'(',0x3e; ( (0x28) +')',0x46; ) (0x29) +'*',0x4e; * (0x2a) +'+',0x25; + (0x2b) +',',0x5d; , (0x2c) +'-',0x55; - (0x2d) +'.',0x4a; . (0x2e) +':',0x4a; : (0x3a) +';',0x5d; ; (0x3b) +'<',0x61; < (0x3c) +'=',0x45; = (0x3d) +'>',0x61; > (0x3e) +'?',0x4e; ? (0x3f) +'@',0x15; @ (0x40) +'[',0x3e; [ (0x5b) +'\',0x4e; \ (0x5c) +']',0x46; ] (0x5d) +'^',0x26; ^ (0x5e) +'_',0x55; _ (0x5f) +'`',0x5d; ` (0x60) +'i',0x52; i (0x69) +'{',0x3d; { (0x7b) +'|',0x61; | (0x7c) +'}',0x45; } (0x7d) +'~',0x5b; ~ (0x7e) + diff --git a/usr.sbin/bhyve/kbdlayout/tr_f b/usr.sbin/bhyve/kbdlayout/tr_f new file mode 100644 index 000000000000..9f4fe1512b48 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/tr_f @@ -0,0 +1,81 @@ +# bhyve ps2kbd keyboard layout file +# (tr_f : Turkish (F)) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'"',0x1e; " (0x22) +'&',0x36; & (0x26) +''',0x3d; ' (0x27) +'(',0x3e; ( (0x28) +')',0x46; ) (0x29) +'*',0x0e; * (0x2a) +'+',0x0e; + (0x2b) +',',0x4a; , (0x2c) +'-',0x55; - (0x2d) +'/',0x4e; / (0x2f) +':',0x49; : (0x3a) +';',0x4a; ; (0x3b) +'<',0x61; < (0x3c) +'=',0x45; = (0x3d) +'>',0x61; > (0x3e) +'?',0x4e; ? (0x3f) +'@',0x15; @ (0x40) +'A',0x2b; A (0x41) +'B',0x41; B (0x42) +'C',0x2a; C (0x43) +'D',0x35; D (0x44) +'E',0x23; E (0x45) +'F',0x15; F (0x46) +'G',0x1d; G (0x47) +'H',0x44; H (0x48) +'I',0x2d; I (0x49) +'J',0x1a; J (0x4a) +'K',0x3b; K (0x4b) +'M',0x42; M (0x4d) +'N',0x43; N (0x4e) +'O',0x2c; O (0x4f) +'Q',0x54; Q (0x51) +'R',0x3c; R (0x52) +'S',0x3a; S (0x53) +'T',0x33; T (0x54) +'U',0x1c; U (0x55) +'V',0x21; V (0x56) +'W',0x5b; W (0x57) +'X',0x5d; X (0x58) +'Y',0x4c; Y (0x59) +'Z',0x31; Z (0x5a) +'[',0x3e; [ (0x5b) +'\',0x4e; \ (0x5c) +']',0x46; ] (0x5d) +'^',0x26; ^ (0x5e) +'_',0x55; _ (0x5f) +'a',0x2b; a (0x61) +'b',0x41; b (0x62) +'c',0x2a; c (0x63) +'d',0x35; d (0x64) +'e',0x23; e (0x65) +'f',0x15; f (0x66) +'g',0x1d; g (0x67) +'h',0x44; h (0x68) +'i',0x1b; i (0x69) +'j',0x1a; j (0x6a) +'k',0x3b; k (0x6b) +'m',0x42; m (0x6d) +'n',0x43; n (0x6e) +'o',0x2c; o (0x6f) +'q',0x54; q (0x71) +'r',0x3c; r (0x72) +'s',0x3a; s (0x73) +'t',0x33; t (0x74) +'u',0x1c; u (0x75) +'v',0x21; v (0x76) +'w',0x5b; w (0x77) +'x',0x5d; x (0x78) +'y',0x4c; y (0x79) +'z',0x31; z (0x7a) +'{',0x3d; { (0x7b) +'|',0x55; | (0x7c) +'}',0x45; } (0x7d) + diff --git a/usr.sbin/bhyve/kbdlayout/ua b/usr.sbin/bhyve/kbdlayout/ua new file mode 100644 index 000000000000..683b39c5053b --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/ua @@ -0,0 +1,9 @@ +# bhyve ps2kbd keyboard layout file +# (ua : Ukrainian) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'*',0xb7; * (0x2a) + diff --git a/usr.sbin/bhyve/kbdlayout/ua_shift_alt b/usr.sbin/bhyve/kbdlayout/ua_shift_alt new file mode 100644 index 000000000000..be5d7041078f --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/ua_shift_alt @@ -0,0 +1,10 @@ +# bhyve ps2kbd keyboard layout file +# (ua_shift_alt : Ukrainian (with Russian) (shift)) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'*',0xb7; * (0x2a) +0xffb5,0x71; Keypad 5 + diff --git a/usr.sbin/bhyve/kbdlayout/uk b/usr.sbin/bhyve/kbdlayout/uk new file mode 100644 index 000000000000..25289fa6d255 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/uk @@ -0,0 +1,14 @@ +# bhyve ps2kbd keyboard layout file +# (uk : United Kingdom) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'"',0x1e; " (0x22) +'#',0x5d; # (0x23) +'@',0x52; @ (0x40) +'\',0x61; \ (0x5c) +'|',0x61; | (0x7c) +'~',0x5d; ~ (0x7e) + diff --git a/usr.sbin/bhyve/kbdlayout/uk_capsctrl b/usr.sbin/bhyve/kbdlayout/uk_capsctrl new file mode 100644 index 000000000000..8b869bf88308 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/uk_capsctrl @@ -0,0 +1,14 @@ +# bhyve ps2kbd keyboard layout file +# (uk_capsctrl : United Kingdom (Caps Lock acts as Left Ctrl)) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'"',0x1e; " (0x22) +'#',0x5d; # (0x23) +'@',0x52; @ (0x40) +'\',0x61; \ (0x5c) +'|',0x61; | (0x7c) +'~',0x5d; ~ (0x7e) + diff --git a/usr.sbin/bhyve/kbdlayout/uk_dvorak b/usr.sbin/bhyve/kbdlayout/uk_dvorak new file mode 100644 index 000000000000..0b365b7ead4d --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/uk_dvorak @@ -0,0 +1,78 @@ +# bhyve ps2kbd keyboard layout file +# (uk_dvorak : United Kingdom Dvorak) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'"',0x1e; " (0x22) +'#',0x5d; # (0x23) +''',0x15; ' (0x27) +'+',0x5b; + (0x2b) +',',0x1d; , (0x2c) +'-',0x52; - (0x2d) +'.',0x24; . (0x2e) +'/',0x54; / (0x2f) +':',0x1a; : (0x3a) +';',0x1a; ; (0x3b) +'<',0x1d; < (0x3c) +'=',0x5b; = (0x3d) +'>',0x24; > (0x3e) +'?',0x54; ? (0x3f) +'@',0x15; @ (0x40) +'B',0x31; B (0x42) +'C',0x43; C (0x43) +'D',0x33; D (0x44) +'E',0x23; E (0x45) +'F',0x35; F (0x46) +'G',0x3c; G (0x47) +'H',0x3b; H (0x48) +'I',0x34; I (0x49) +'J',0x21; J (0x4a) +'K',0x2a; K (0x4b) +'L',0x4d; L (0x4c) +'N',0x4b; N (0x4e) +'O',0x1b; O (0x4f) +'P',0x2d; P (0x50) +'Q',0x22; Q (0x51) +'R',0x44; R (0x52) +'S',0x4c; S (0x53) +'T',0x42; T (0x54) +'U',0x2b; U (0x55) +'V',0x49; V (0x56) +'W',0x41; W (0x57) +'X',0x32; X (0x58) +'Y',0x2c; Y (0x59) +'Z',0x4a; Z (0x5a) +'[',0x4e; [ (0x5b) +'\',0x61; \ (0x5c) +']',0x55; ] (0x5d) +'_',0x52; _ (0x5f) +'b',0x31; b (0x62) +'c',0x43; c (0x63) +'d',0x33; d (0x64) +'e',0x23; e (0x65) +'f',0x35; f (0x66) +'g',0x3c; g (0x67) +'h',0x3b; h (0x68) +'i',0x34; i (0x69) +'j',0x21; j (0x6a) +'k',0x2a; k (0x6b) +'l',0x4d; l (0x6c) +'n',0x4b; n (0x6e) +'o',0x1b; o (0x6f) +'p',0x2d; p (0x70) +'q',0x22; q (0x71) +'r',0x44; r (0x72) +'s',0x4c; s (0x73) +'t',0x42; t (0x74) +'u',0x2b; u (0x75) +'v',0x49; v (0x76) +'w',0x41; w (0x77) +'x',0x32; x (0x78) +'y',0x2c; y (0x79) +'z',0x4a; z (0x7a) +'{',0x4e; { (0x7b) +'|',0x61; | (0x7c) +'}',0x55; } (0x7d) + diff --git a/usr.sbin/bhyve/kbdlayout/uk_macbook b/usr.sbin/bhyve/kbdlayout/uk_macbook new file mode 100644 index 000000000000..6283842afa5e --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/uk_macbook @@ -0,0 +1,10 @@ +# bhyve ps2kbd keyboard layout file +# (uk_macbook : United Kingdom Macbook) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'`',0x61; ` (0x60) +'~',0x61; ~ (0x7e) + diff --git a/usr.sbin/bhyve/kbdlayout/us_dvorak b/usr.sbin/bhyve/kbdlayout/us_dvorak new file mode 100644 index 000000000000..6fa21a2bca75 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/us_dvorak @@ -0,0 +1,74 @@ +# bhyve ps2kbd keyboard layout file +# (us_dvorak : United States of America dvorak) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'"',0x15; " (0x22) +''',0x15; ' (0x27) +'+',0x5b; + (0x2b) +',',0x1d; , (0x2c) +'-',0x52; - (0x2d) +'.',0x24; . (0x2e) +'/',0x54; / (0x2f) +':',0x1a; : (0x3a) +';',0x1a; ; (0x3b) +'<',0x1d; < (0x3c) +'=',0x5b; = (0x3d) +'>',0x24; > (0x3e) +'?',0x54; ? (0x3f) +'B',0x31; B (0x42) +'C',0x43; C (0x43) +'D',0x33; D (0x44) +'E',0x23; E (0x45) +'F',0x35; F (0x46) +'G',0x3c; G (0x47) +'H',0x3b; H (0x48) +'I',0x34; I (0x49) +'J',0x21; J (0x4a) +'K',0x2a; K (0x4b) +'L',0x4d; L (0x4c) +'N',0x4b; N (0x4e) +'O',0x1b; O (0x4f) +'P',0x2d; P (0x50) +'Q',0x22; Q (0x51) +'R',0x44; R (0x52) +'S',0x4c; S (0x53) +'T',0x42; T (0x54) +'U',0x2b; U (0x55) +'V',0x49; V (0x56) +'W',0x41; W (0x57) +'X',0x32; X (0x58) +'Y',0x2c; Y (0x59) +'Z',0x4a; Z (0x5a) +'[',0x4e; [ (0x5b) +']',0x55; ] (0x5d) +'_',0x52; _ (0x5f) +'b',0x31; b (0x62) +'c',0x43; c (0x63) +'d',0x33; d (0x64) +'e',0x23; e (0x65) +'f',0x35; f (0x66) +'g',0x3c; g (0x67) +'h',0x3b; h (0x68) +'i',0x34; i (0x69) +'j',0x21; j (0x6a) +'k',0x2a; k (0x6b) +'l',0x4d; l (0x6c) +'n',0x4b; n (0x6e) +'o',0x1b; o (0x6f) +'p',0x2d; p (0x70) +'q',0x22; q (0x71) +'r',0x44; r (0x72) +'s',0x4c; s (0x73) +'t',0x42; t (0x74) +'u',0x2b; u (0x75) +'v',0x49; v (0x76) +'w',0x41; w (0x77) +'x',0x32; x (0x78) +'y',0x2c; y (0x79) +'z',0x4a; z (0x7a) +'{',0x4e; { (0x7b) +'}',0x55; } (0x7d) + diff --git a/usr.sbin/bhyve/kbdlayout/us_dvorakl b/usr.sbin/bhyve/kbdlayout/us_dvorakl new file mode 100644 index 000000000000..38e6857f69ab --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/us_dvorakl @@ -0,0 +1,88 @@ +# bhyve ps2kbd keyboard layout file +# (us_dvorakl : United States of America lefthand dvorak) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'!',0x55; ! (0x21) +'"',0x1a; " (0x22) +'#',0x45; # (0x23) +'$',0x46; $ (0x24) +'%',0x54; % (0x25) +'&',0x52; & (0x26) +''',0x1a; ' (0x27) +'(',0x4a; ( (0x28) +')',0x49; ) (0x29) +'*',0x4c; * (0x2a) +'+',0x5b; + (0x2b) +'-',0x1c; - (0x2d) +'.',0x44; . (0x2e) +'/',0x26; / (0x2f) +'0',0x49; 0 (0x30) +'1',0x55; 1 (0x31) +'2',0x4e; 2 (0x32) +'3',0x45; 3 (0x33) +'4',0x46; 4 (0x34) +'5',0x54; 5 (0x35) +'6',0x4d; 6 (0x36) +'7',0x52; 7 (0x37) +'8',0x4c; 8 (0x38) +'9',0x4a; 9 (0x39) +':',0x15; : (0x3a) +';',0x15; ; (0x3b) +'=',0x5b; = (0x3d) +'>',0x44; > (0x3e) +'?',0x26; ? (0x3f) +'@',0x4e; @ (0x40) +'A',0x42; A (0x41) +'B',0x24; B (0x42) +'C',0x23; C (0x43) +'D',0x2b; D (0x44) +'E',0x3b; E (0x45) +'F',0x2e; F (0x46) +'G',0x21; G (0x47) +'I',0x3a; I (0x49) +'J',0x3e; J (0x4a) +'K',0x1b; K (0x4b) +'L',0x3d; L (0x4c) +'M',0x36; M (0x4d) +'O',0x43; O (0x4f) +'P',0x25; P (0x50) +'Q',0x1d; Q (0x51) +'R',0x3c; R (0x52) +'S',0x35; S (0x53) +'T',0x34; T (0x54) +'U',0x2c; U (0x55) +'W',0x32; W (0x57) +'Y',0x2d; Y (0x59) +'Z',0x4b; Z (0x5a) +'[',0x16; [ (0x5b) +']',0x1e; ] (0x5d) +'^',0x4d; ^ (0x5e) +'_',0x1c; _ (0x5f) +'a',0x42; a (0x61) +'b',0x24; b (0x62) +'c',0x23; c (0x63) +'d',0x2b; d (0x64) +'e',0x3b; e (0x65) +'f',0x2e; f (0x66) +'g',0x21; g (0x67) +'i',0x3a; i (0x69) +'j',0x3e; j (0x6a) +'k',0x1b; k (0x6b) +'l',0x3d; l (0x6c) +'m',0x36; m (0x6d) +'o',0x43; o (0x6f) +'p',0x25; p (0x70) +'q',0x1d; q (0x71) +'r',0x3c; r (0x72) +'s',0x35; s (0x73) +'t',0x34; t (0x74) +'u',0x2c; u (0x75) +'w',0x32; w (0x77) +'y',0x2d; y (0x79) +'z',0x4b; z (0x7a) +'{',0x16; { (0x7b) +'}',0x1e; } (0x7d) + diff --git a/usr.sbin/bhyve/kbdlayout/us_dvorakp b/usr.sbin/bhyve/kbdlayout/us_dvorakp new file mode 100644 index 000000000000..c66c9d5e4b03 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/us_dvorakp @@ -0,0 +1,95 @@ +# bhyve ps2kbd keyboard layout file +# (us_dvorakp : United States of America Programmer Dvorak) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'!',0x4e; ! (0x21) +'"',0x1a; " (0x22) +'#',0x55; # (0x23) +'$',0x0e; $ (0x24) +'%',0x16; % (0x25) +'&',0x16; & (0x26) +''',0x1a; ' (0x27) +'(',0x2e; ( (0x28) +')',0x3e; ) (0x29) +'*',0x3d; * (0x2a) +'+',0x46; + (0x2b) +',',0x1d; , (0x2c) +'-',0x52; - (0x2d) +'.',0x24; . (0x2e) +'/',0x54; / (0x2f) +'0',0x3d; 0 (0x30) +'1',0x2e; 1 (0x31) +'2',0x3e; 2 (0x32) +'3',0x25; 3 (0x33) +'4',0x46; 4 (0x34) +'5',0x26; 5 (0x35) +'6',0x45; 6 (0x36) +'7',0x1e; 7 (0x37) +'8',0x4e; 8 (0x38) +'9',0x36; 9 (0x39) +':',0x15; : (0x3a) +';',0x15; ; (0x3b) +'<',0x1d; < (0x3c) +'=',0x36; = (0x3d) +'>',0x24; > (0x3e) +'?',0x54; ? (0x3f) +'@',0x5b; @ (0x40) +'B',0x31; B (0x42) +'C',0x43; C (0x43) +'D',0x33; D (0x44) +'E',0x23; E (0x45) +'F',0x35; F (0x46) +'G',0x3c; G (0x47) +'H',0x3b; H (0x48) +'I',0x34; I (0x49) +'J',0x21; J (0x4a) +'K',0x2a; K (0x4b) +'L',0x4d; L (0x4c) +'N',0x4b; N (0x4e) +'O',0x1b; O (0x4f) +'P',0x2d; P (0x50) +'Q',0x22; Q (0x51) +'R',0x44; R (0x52) +'S',0x4c; S (0x53) +'T',0x42; T (0x54) +'U',0x2b; U (0x55) +'V',0x49; V (0x56) +'W',0x41; W (0x57) +'X',0x32; X (0x58) +'Y',0x2c; Y (0x59) +'Z',0x4a; Z (0x5a) +'[',0x1e; [ (0x5b) +']',0x45; ] (0x5d) +'^',0x5b; ^ (0x5e) +'_',0x52; _ (0x5f) +'`',0x55; ` (0x60) +'b',0x31; b (0x62) +'c',0x43; c (0x63) +'d',0x33; d (0x64) +'e',0x23; e (0x65) +'f',0x35; f (0x66) +'g',0x3c; g (0x67) +'h',0x3b; h (0x68) +'i',0x34; i (0x69) +'j',0x21; j (0x6a) +'k',0x2a; k (0x6b) +'l',0x4d; l (0x6c) +'n',0x4b; n (0x6e) +'o',0x1b; o (0x6f) +'p',0x2d; p (0x70) +'q',0x22; q (0x71) +'r',0x44; r (0x72) +'s',0x4c; s (0x73) +'t',0x42; t (0x74) +'u',0x2b; u (0x75) +'v',0x49; v (0x76) +'w',0x41; w (0x77) +'x',0x32; x (0x78) +'y',0x2c; y (0x79) +'z',0x4a; z (0x7a) +'{',0x26; { (0x7b) +'}',0x25; } (0x7d) + diff --git a/usr.sbin/bhyve/kbdlayout/us_dvorakr b/usr.sbin/bhyve/kbdlayout/us_dvorakr new file mode 100644 index 000000000000..95485730c460 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/us_dvorakr @@ -0,0 +1,86 @@ +# bhyve ps2kbd keyboard layout file +# (us_dvorakr : United States of America righthand dvorak) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'"',0x4a; " (0x22) +'%',0x15; % (0x25) +'&',0x1c; & (0x26) +''',0x4a; ' (0x27) +'(',0x1a; ( (0x28) +')',0x22; ) (0x29) +'*',0x1b; * (0x2a) +'+',0x5b; + (0x2b) +',',0x2a; , (0x2c) +'-',0x52; - (0x2d) +'.',0x2d; . (0x2e) +'/',0x45; / (0x2f) +'0',0x22; 0 (0x30) +'5',0x15; 5 (0x35) +'6',0x1d; 6 (0x36) +'7',0x1c; 7 (0x37) +'8',0x1b; 8 (0x38) +'9',0x1a; 9 (0x39) +':',0x54; : (0x3a) +';',0x54; ; (0x3b) +'<',0x2a; < (0x3c) +'=',0x5b; = (0x3d) +'>',0x2d; > (0x3e) +'?',0x45; ? (0x3f) +'A',0x2b; A (0x41) +'B',0x4d; B (0x42) +'C',0x4b; C (0x43) +'D',0x42; D (0x44) +'E',0x34; E (0x45) +'F',0x3e; F (0x46) +'G',0x49; G (0x47) +'I',0x32; I (0x49) +'J',0x2e; J (0x4a) +'K',0x4c; K (0x4b) +'L',0x36; L (0x4c) +'M',0x3d; M (0x4d) +'O',0x2c; O (0x4f) +'P',0x46; P (0x50) +'Q',0x24; Q (0x51) +'R',0x35; R (0x52) +'S',0x3c; S (0x53) +'T',0x3b; T (0x54) +'U',0x43; U (0x55) +'V',0x41; V (0x56) +'W',0x3a; W (0x57) +'X',0x21; X (0x58) +'Y',0x44; Y (0x59) +'Z',0x23; Z (0x5a) +'[',0x4e; [ (0x5b) +']',0x55; ] (0x5d) +'^',0x1d; ^ (0x5e) +'_',0x52; _ (0x5f) +'a',0x2b; a (0x61) +'b',0x4d; b (0x62) +'c',0x4b; c (0x63) +'d',0x42; d (0x64) +'e',0x34; e (0x65) +'f',0x3e; f (0x66) +'g',0x49; g (0x67) +'i',0x32; i (0x69) +'j',0x2e; j (0x6a) +'k',0x4c; k (0x6b) +'l',0x36; l (0x6c) +'m',0x3d; m (0x6d) +'o',0x2c; o (0x6f) +'p',0x46; p (0x70) +'q',0x24; q (0x71) +'r',0x35; r (0x72) +'s',0x3c; s (0x73) +'t',0x3b; t (0x74) +'u',0x43; u (0x75) +'v',0x41; v (0x76) +'w',0x3a; w (0x77) +'x',0x21; x (0x78) +'y',0x44; y (0x79) +'z',0x23; z (0x7a) +'{',0x4e; { (0x7b) +'}',0x55; } (0x7d) + diff --git a/usr.sbin/bhyve/kbdlayout/us_dvorakx b/usr.sbin/bhyve/kbdlayout/us_dvorakx new file mode 100644 index 000000000000..24195875001a --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/us_dvorakx @@ -0,0 +1,80 @@ +# bhyve ps2kbd keyboard layout file +# (us_dvorakx : United States of America dvorakx) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'"',0x15; " (0x22) +''',0x15; ' (0x27) +'+',0x5d; + (0x2b) +',',0x1d; , (0x2c) +'-',0x52; - (0x2d) +'.',0x24; . (0x2e) +'/',0x54; / (0x2f) +':',0x1a; : (0x3a) +';',0x1a; ; (0x3b) +'<',0x1d; < (0x3c) +'=',0x5d; = (0x3d) +'>',0x24; > (0x3e) +'?',0x54; ? (0x3f) +'B',0x31; B (0x42) +'C',0x43; C (0x43) +'D',0x33; D (0x44) +'E',0x23; E (0x45) +'F',0x35; F (0x46) +'G',0x3c; G (0x47) +'H',0x3b; H (0x48) +'I',0x34; I (0x49) +'J',0x21; J (0x4a) +'K',0x2a; K (0x4b) +'L',0x4d; L (0x4c) +'N',0x4b; N (0x4e) +'O',0x1b; O (0x4f) +'P',0x2d; P (0x50) +'Q',0x22; Q (0x51) +'R',0x44; R (0x52) +'S',0x4c; S (0x53) +'T',0x42; T (0x54) +'U',0x2b; U (0x55) +'V',0x49; V (0x56) +'W',0x41; W (0x57) +'X',0x32; X (0x58) +'Y',0x2c; Y (0x59) +'Z',0x4a; Z (0x5a) +'[',0x4e; [ (0x5b) +'\',0x5b; \ (0x5c) +']',0x55; ] (0x5d) +'_',0x52; _ (0x5f) +'`',0x76; ` (0x60) +'b',0x31; b (0x62) +'c',0x43; c (0x63) +'d',0x33; d (0x64) +'e',0x23; e (0x65) +'f',0x35; f (0x66) +'g',0x3c; g (0x67) +'h',0x3b; h (0x68) +'i',0x34; i (0x69) +'j',0x21; j (0x6a) +'k',0x2a; k (0x6b) +'l',0x4d; l (0x6c) +'n',0x4b; n (0x6e) +'o',0x1b; o (0x6f) +'p',0x2d; p (0x70) +'q',0x22; q (0x71) +'r',0x44; r (0x72) +'s',0x4c; s (0x73) +'t',0x42; t (0x74) +'u',0x2b; u (0x75) +'v',0x49; v (0x76) +'w',0x41; w (0x77) +'x',0x32; x (0x78) +'y',0x2c; y (0x79) +'z',0x4a; z (0x7a) +'{',0x4e; { (0x7b) +'|',0x5b; | (0x7c) +'}',0x55; } (0x7d) +'~',0x76; ~ (0x7e) +0xff1b,0x0e; Escape +0xffe3,0x58; Left control + diff --git a/usr.sbin/bhyve/kbdlayout/us_emacs b/usr.sbin/bhyve/kbdlayout/us_emacs new file mode 100644 index 000000000000..01b108583fc3 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/us_emacs @@ -0,0 +1,9 @@ +# bhyve ps2kbd keyboard layout file +# (us_emacs : United States of America Emacs optimized layout) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +0xffff,0x66; Del + diff --git a/usr.sbin/bhyve/kbdlayout/us_unix b/usr.sbin/bhyve/kbdlayout/us_unix new file mode 100644 index 000000000000..c4b2739ad194 --- /dev/null +++ b/usr.sbin/bhyve/kbdlayout/us_unix @@ -0,0 +1,14 @@ +# bhyve ps2kbd keyboard layout file +# (us_unix : United States of America Traditional Unix Workstation) +# +# Created by: Koine Yuusuke(koinec) +# +# $FreeBSD$ + +'`',0x76; ` (0x60) +'~',0x76; ~ (0x7e) +0xff08,0x71; Back space +0xff1b,0x0e; Escape +0xffe3,0x58; Left control +0xffff,0x66; Del + diff --git a/usr.sbin/bhyve/ps2kbd.c b/usr.sbin/bhyve/ps2kbd.c index 012c66160ebe..619bed81c412 100644 --- a/usr.sbin/bhyve/ps2kbd.c +++ b/usr.sbin/bhyve/ps2kbd.c @@ -1,427 +1,516 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2015 Tycho Nightingale * Copyright (c) 2015 Nahanni Systems Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include __FBSDID("$FreeBSD$"); #include +#include #include #include #include #include #include #include #include #include #include +#include +#include +#include "bhyverun.h" #include "atkbdc.h" #include "debug.h" +#include "config.h" #include "console.h" /* keyboard device commands */ #define PS2KC_RESET_DEV 0xff #define PS2KC_DISABLE 0xf5 #define PS2KC_ENABLE 0xf4 #define PS2KC_SET_TYPEMATIC 0xf3 #define PS2KC_SEND_DEV_ID 0xf2 #define PS2KC_SET_SCANCODE_SET 0xf0 #define PS2KC_ECHO 0xee #define PS2KC_SET_LEDS 0xed #define PS2KC_BAT_SUCCESS 0xaa #define PS2KC_ACK 0xfa #define PS2KBD_FIFOSZ 16 +#define PS2KBD_LAYOUT_BASEDIR "/usr/share/bhyve/kbdlayout/" + +#define MAX_PATHNAME 256 + struct fifo { uint8_t buf[PS2KBD_FIFOSZ]; int rindex; /* index to read from */ int windex; /* index to write to */ int num; /* number of bytes in the fifo */ int size; /* size of the fifo */ }; struct ps2kbd_softc { struct atkbdc_softc *atkbdc_sc; pthread_mutex_t mtx; bool enabled; struct fifo fifo; uint8_t curcmd; /* current command for next byte */ }; #define SCANCODE_E0_PREFIX 1 struct extended_translation { uint32_t keysym; uint8_t scancode; int flags; }; /* * FIXME: Pause/break and Print Screen/SysRq require special handling. */ -static const struct extended_translation extended_translations[] = { +static struct extended_translation extended_translations[128] = { {0xff08, 0x66}, /* Back space */ {0xff09, 0x0d}, /* Tab */ {0xff0d, 0x5a}, /* Return */ {0xff1b, 0x76}, /* Escape */ {0xff50, 0x6c, SCANCODE_E0_PREFIX}, /* Home */ {0xff51, 0x6b, SCANCODE_E0_PREFIX}, /* Left arrow */ {0xff52, 0x75, SCANCODE_E0_PREFIX}, /* Up arrow */ {0xff53, 0x74, SCANCODE_E0_PREFIX}, /* Right arrow */ {0xff54, 0x72, SCANCODE_E0_PREFIX}, /* Down arrow */ {0xff55, 0x7d, SCANCODE_E0_PREFIX}, /* PgUp */ {0xff56, 0x7a, SCANCODE_E0_PREFIX}, /* PgDown */ {0xff57, 0x69, SCANCODE_E0_PREFIX}, /* End */ {0xff63, 0x70, SCANCODE_E0_PREFIX}, /* Ins */ {0xff8d, 0x5a, SCANCODE_E0_PREFIX}, /* Keypad Enter */ {0xffe1, 0x12}, /* Left shift */ {0xffe2, 0x59}, /* Right shift */ {0xffe3, 0x14}, /* Left control */ {0xffe4, 0x14, SCANCODE_E0_PREFIX}, /* Right control */ /* {0xffe7, XXX}, Left meta */ /* {0xffe8, XXX}, Right meta */ {0xffe9, 0x11}, /* Left alt */ {0xfe03, 0x11, SCANCODE_E0_PREFIX}, /* AltGr */ {0xffea, 0x11, SCANCODE_E0_PREFIX}, /* Right alt */ {0xffeb, 0x1f, SCANCODE_E0_PREFIX}, /* Left Windows */ {0xffec, 0x27, SCANCODE_E0_PREFIX}, /* Right Windows */ {0xffbe, 0x05}, /* F1 */ {0xffbf, 0x06}, /* F2 */ {0xffc0, 0x04}, /* F3 */ {0xffc1, 0x0c}, /* F4 */ {0xffc2, 0x03}, /* F5 */ {0xffc3, 0x0b}, /* F6 */ {0xffc4, 0x83}, /* F7 */ {0xffc5, 0x0a}, /* F8 */ {0xffc6, 0x01}, /* F9 */ {0xffc7, 0x09}, /* F10 */ {0xffc8, 0x78}, /* F11 */ {0xffc9, 0x07}, /* F12 */ {0xffff, 0x71, SCANCODE_E0_PREFIX}, /* Del */ {0xff14, 0x7e}, /* ScrollLock */ /* NumLock and Keypads*/ {0xff7f, 0x77}, /* NumLock */ {0xffaf, 0x4a, SCANCODE_E0_PREFIX}, /* Keypad slash */ {0xffaa, 0x7c}, /* Keypad asterisk */ {0xffad, 0x7b}, /* Keypad minus */ {0xffab, 0x79}, /* Keypad plus */ {0xffb7, 0x6c}, /* Keypad 7 */ {0xff95, 0x6c}, /* Keypad home */ {0xffb8, 0x75}, /* Keypad 8 */ {0xff97, 0x75}, /* Keypad up arrow */ {0xffb9, 0x7d}, /* Keypad 9 */ {0xff9a, 0x7d}, /* Keypad PgUp */ {0xffb4, 0x6b}, /* Keypad 4 */ {0xff96, 0x6b}, /* Keypad left arrow */ {0xffb5, 0x73}, /* Keypad 5 */ {0xff9d, 0x73}, /* Keypad empty */ {0xffb6, 0x74}, /* Keypad 6 */ {0xff98, 0x74}, /* Keypad right arrow */ {0xffb1, 0x69}, /* Keypad 1 */ {0xff9c, 0x69}, /* Keypad end */ {0xffb2, 0x72}, /* Keypad 2 */ {0xff99, 0x72}, /* Keypad down arrow */ {0xffb3, 0x7a}, /* Keypad 3 */ {0xff9b, 0x7a}, /* Keypad PgDown */ {0xffb0, 0x70}, /* Keypad 0 */ {0xff9e, 0x70}, /* Keypad ins */ {0xffae, 0x71}, /* Keypad . */ {0xff9f, 0x71}, /* Keypad del */ {0, 0, 0} /* Terminator */ }; /* ASCII to type 2 scancode lookup table */ -static const uint8_t ascii_translations[128] = { +static uint8_t ascii_translations[128] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, 0x16, 0x52, 0x26, 0x25, 0x2e, 0x3d, 0x52, 0x46, 0x45, 0x3e, 0x55, 0x41, 0x4e, 0x49, 0x4a, 0x45, 0x16, 0x1e, 0x26, 0x25, 0x2e, 0x36, 0x3d, 0x3e, 0x46, 0x4c, 0x4c, 0x41, 0x55, 0x49, 0x4a, 0x1e, 0x1c, 0x32, 0x21, 0x23, 0x24, 0x2b, 0x34, 0x33, 0x43, 0x3b, 0x42, 0x4b, 0x3a, 0x31, 0x44, 0x4d, 0x15, 0x2d, 0x1b, 0x2c, 0x3c, 0x2a, 0x1d, 0x22, 0x35, 0x1a, 0x54, 0x5d, 0x5b, 0x36, 0x4e, 0x0e, 0x1c, 0x32, 0x21, 0x23, 0x24, 0x2b, 0x34, 0x33, 0x43, 0x3b, 0x42, 0x4b, 0x3a, 0x31, 0x44, 0x4d, 0x15, 0x2d, 0x1b, 0x2c, 0x3c, 0x2a, 0x1d, 0x22, 0x35, 0x1a, 0x54, 0x5d, 0x5b, 0x0e, 0x00, }; /* ScanCode set1 to set2 lookup table */ const uint8_t keyset1to2_translations[128] = { 0, 0x76, 0x16, 0x1E, 0x26, 0x25, 0x2e, 0x36, 0x3d, 0x3e, 0x46, 0x45, 0x4e, 0x55, 0x66, 0x0d, 0x15, 0x1d, 0x24, 0x2d, 0x2c, 0x35, 0x3c, 0x43, 0x44, 0x4d, 0x54, 0x5b, 0x5a, 0x14, 0x1c, 0x1b, 0x23, 0x2b, 0x34, 0x33, 0x3b, 0x42, 0x4b, 0x4c, 0x52, 0x0e, 0x12, 0x5d, 0x1a, 0x22, 0x21, 0x2a, 0x32, 0x31, 0x3a, 0x41, 0x49, 0x4a, 0x59, 0x7c, 0x11, 0x29, 0x58, 0x05, 0x06, 0x04, 0x0c, 0x03, 0x0b, 0x83, 0x0a, 0x01, 0x09, 0x77, 0x7e, 0x6c, 0x75, 0x7d, 0x7b, 0x6b, 0x73, 0x74, 0x79, 0x69, 0x72, 0x7a, 0x70, 0x71, 0x84, 0x60, 0x61, 0x78, 0x07, 0x0f, 0x17, 0x1f, 0x27, 0x2f, 0x37, 0x3f, 0x47, 0x4f, 0x56, 0x5e, 0x08, 0x10, 0x18, 0x20, 0x28, 0x30, 0x38, 0x40, 0x48, 0x50, 0x57, 0x6f, 0x13, 0x19, 0x39, 0x51, 0x53, 0x5c, 0x5f, 0x62, 0x63, 0x64, 0x65, 0x67, 0x68, 0x6a, 0x6d, 0x6e, }; static void fifo_init(struct ps2kbd_softc *sc) { struct fifo *fifo; fifo = &sc->fifo; fifo->size = sizeof(((struct fifo *)0)->buf); } static void fifo_reset(struct ps2kbd_softc *sc) { struct fifo *fifo; fifo = &sc->fifo; bzero(fifo, sizeof(struct fifo)); fifo->size = sizeof(((struct fifo *)0)->buf); } static void fifo_put(struct ps2kbd_softc *sc, uint8_t val) { struct fifo *fifo; fifo = &sc->fifo; if (fifo->num < fifo->size) { fifo->buf[fifo->windex] = val; fifo->windex = (fifo->windex + 1) % fifo->size; fifo->num++; } } static int fifo_get(struct ps2kbd_softc *sc, uint8_t *val) { struct fifo *fifo; fifo = &sc->fifo; if (fifo->num > 0) { *val = fifo->buf[fifo->rindex]; fifo->rindex = (fifo->rindex + 1) % fifo->size; fifo->num--; return (0); } return (-1); } int ps2kbd_read(struct ps2kbd_softc *sc, uint8_t *val) { int retval; pthread_mutex_lock(&sc->mtx); retval = fifo_get(sc, val); pthread_mutex_unlock(&sc->mtx); return (retval); } void ps2kbd_write(struct ps2kbd_softc *sc, uint8_t val) { pthread_mutex_lock(&sc->mtx); if (sc->curcmd) { switch (sc->curcmd) { case PS2KC_SET_TYPEMATIC: fifo_put(sc, PS2KC_ACK); break; case PS2KC_SET_SCANCODE_SET: fifo_put(sc, PS2KC_ACK); break; case PS2KC_SET_LEDS: fifo_put(sc, PS2KC_ACK); break; default: EPRINTLN("Unhandled ps2 keyboard current " "command byte 0x%02x", val); break; } sc->curcmd = 0; } else { switch (val) { case 0x00: fifo_put(sc, PS2KC_ACK); break; case PS2KC_RESET_DEV: fifo_reset(sc); fifo_put(sc, PS2KC_ACK); fifo_put(sc, PS2KC_BAT_SUCCESS); break; case PS2KC_DISABLE: sc->enabled = false; fifo_put(sc, PS2KC_ACK); break; case PS2KC_ENABLE: sc->enabled = true; fifo_reset(sc); fifo_put(sc, PS2KC_ACK); break; case PS2KC_SET_TYPEMATIC: sc->curcmd = val; fifo_put(sc, PS2KC_ACK); break; case PS2KC_SEND_DEV_ID: fifo_put(sc, PS2KC_ACK); fifo_put(sc, 0xab); fifo_put(sc, 0x83); break; case PS2KC_SET_SCANCODE_SET: sc->curcmd = val; fifo_put(sc, PS2KC_ACK); break; case PS2KC_ECHO: fifo_put(sc, PS2KC_ECHO); break; case PS2KC_SET_LEDS: sc->curcmd = val; fifo_put(sc, PS2KC_ACK); break; default: EPRINTLN("Unhandled ps2 keyboard command " "0x%02x", val); break; } } pthread_mutex_unlock(&sc->mtx); } /* * Translate keysym to type 2 scancode and insert into keyboard buffer. */ static void ps2kbd_keysym_queue(struct ps2kbd_softc *sc, int down, uint32_t keysym, uint32_t keycode) { assert(pthread_mutex_isowned_np(&sc->mtx)); int e0_prefix, found; uint8_t code; - const struct extended_translation *trans; + struct extended_translation *trans; if (keycode) { code = keyset1to2_translations[(uint8_t)(keycode & 0x7f)]; e0_prefix = ((keycode & 0x80) ? SCANCODE_E0_PREFIX : 0); found = 1; } else { found = 0; if (keysym < 0x80) { code = ascii_translations[keysym]; e0_prefix = 0; found = 1; } else { for (trans = &(extended_translations[0]); trans->keysym != 0; trans++) { if (keysym == trans->keysym) { code = trans->scancode; e0_prefix = trans->flags & SCANCODE_E0_PREFIX; found = 1; break; } } } } if (!found) { EPRINTLN("Unhandled ps2 keyboard keysym 0x%x", keysym); return; } if (e0_prefix) fifo_put(sc, 0xe0); if (!down) fifo_put(sc, 0xf0); fifo_put(sc, code); } static void ps2kbd_event(int down, uint32_t keysym, uint32_t keycode, void *arg) { struct ps2kbd_softc *sc = arg; int fifo_full; pthread_mutex_lock(&sc->mtx); if (!sc->enabled) { pthread_mutex_unlock(&sc->mtx); return; } fifo_full = sc->fifo.num == PS2KBD_FIFOSZ; ps2kbd_keysym_queue(sc, down, keysym, keycode); pthread_mutex_unlock(&sc->mtx); if (!fifo_full) atkbdc_event(sc->atkbdc_sc, 1); } +static void +ps2kbd_update_extended_translation(uint32_t keycode, uint32_t scancode, uint32_t prefix) +{ + int i = 0; + + do { + if (extended_translations[i].keysym == keycode) + break; + } while(extended_translations[++i].keysym); + + if (i == (sizeof(extended_translations) / sizeof(struct extended_translation) - 1)) + return; + + if (!extended_translations[i].keysym) { + extended_translations[i].keysym = keycode; + + extended_translations[i+1].keysym = 0; + extended_translations[i+1].scancode = 0; + extended_translations[i+1].flags = 0; + } + + extended_translations[i].scancode = (uint8_t)(scancode & 0xff); + extended_translations[i].flags = (prefix ? SCANCODE_E0_PREFIX : 0); +} + +static void +ps2kbd_setkbdlayout(void) +{ + int err; + int fd; + char path[MAX_PATHNAME]; + char *buf, *next, *line; + struct stat sb; + size_t sz; + uint8_t ascii; + uint32_t keycode, scancode, prefix; + + snprintf(path, MAX_PATHNAME, PS2KBD_LAYOUT_BASEDIR"%s", get_config_value("keyboard.layout") ); + + err = stat(path, &sb); + if (err) + return; + + buf = (char *)malloc(sizeof(char) * sb.st_size); + if (buf == NULL) + return; + + fd = open(path, O_RDONLY); + if (fd == -1) + goto out; + + sz = read(fd, buf, sb.st_size ); + + close(fd); + + if (sz != sb.st_size ) + goto out; + + next = buf; + while ((line = strsep(&next, "\n")) != NULL) { + if (sscanf(line, "'%c',%x;", &ascii, &scancode) == 2) { + if (ascii < 0x80) + ascii_translations[ascii] = (uint8_t)(scancode & 0xff); + } else if (sscanf(line, "%x,%x,%x;", &keycode, &scancode, &prefix) == 3 ) { + ps2kbd_update_extended_translation(keycode, scancode, prefix); + } else if (sscanf(line, "%x,%x;", &keycode, &scancode) == 2) { + if (keycode < 0x80) + ascii_translations[(uint8_t)(keycode & 0xff)] = (uint8_t)(scancode & 0xff); + else + ps2kbd_update_extended_translation(keycode, scancode, 0); + } + } + +out: + free(buf); +} + struct ps2kbd_softc * ps2kbd_init(struct atkbdc_softc *atkbdc_sc) { struct ps2kbd_softc *sc; + if (get_config_value("keyboard.layout") != NULL) + ps2kbd_setkbdlayout(); + sc = calloc(1, sizeof (struct ps2kbd_softc)); pthread_mutex_init(&sc->mtx, NULL); fifo_init(sc); sc->atkbdc_sc = atkbdc_sc; console_kbd_register(ps2kbd_event, sc, 1); return (sc); } #ifdef BHYVE_SNAPSHOT int ps2kbd_snapshot(struct ps2kbd_softc *sc, struct vm_snapshot_meta *meta) { int ret; SNAPSHOT_VAR_OR_LEAVE(sc->enabled, meta, ret, done); SNAPSHOT_VAR_OR_LEAVE(sc->curcmd, meta, ret, done); done: return (ret); } #endif