]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoMFC r328785:
eadler [Mon, 19 Mar 2018 03:55:42 +0000 (03:55 +0000)]
MFC r328785:

Use standard 2-clause license where copyright is held by the FreeBSD Foundation

6 years agoMFC r312887:
eadler [Mon, 19 Mar 2018 03:53:46 +0000 (03:53 +0000)]
MFC r312887:

Hide unneeded message under bootverbose.

6 years agoMFC r328640:
eadler [Mon, 19 Mar 2018 03:49:54 +0000 (03:49 +0000)]
MFC r328640:

psm: Add a kludge to support 0x46 identity middle byte Synaptics touchpads

Most synaptics touchpads return 0x47 in middle byte in responce to identify
command as stated in p.4.4 of "Synaptics PS/2 TouchPad Interfacing Guide".
But some devices e.g. found on HP EliteBook 9470m return 0x46 here.
Allow them to be identified as Synaptics as well as 0x47.
ExtendedQueries return incorrect data on such a touchpads so we ignore
their result and set conservative defaults.

PR: 222667

6 years agoMFC r328638:
eadler [Mon, 19 Mar 2018 03:47:46 +0000 (03:47 +0000)]
MFC r328638:

psm(4): Reduce psm watchdog verbosity

Modern touchpads do not issue interrupts on inactivity so "lost interrupt"
message became annoying spam nowadays. This change quiets the message
if debug.psm.loglevel=5 (or less) is set in /boot/loader.conf

Approved by: gonzo

6 years agoMFC r328636:
eadler [Mon, 19 Mar 2018 03:46:12 +0000 (03:46 +0000)]
MFC r328636:

psm(4): Add support for HP EliteBook 1040 ForcePads.

ForcePads do not have any physical buttons, instead they detect click
based on finger pressure. Forcepads erroneously report button click
if there are 2 or more fingers on the touchpad breaking multifinger
gestures. To workaround this start reporting a click only after
4 consecutive single touch packets has been received. Skip these packets
in case more contacts appear.

PR: 223369

6 years agoMFC r326249:
eadler [Mon, 19 Mar 2018 03:44:19 +0000 (03:44 +0000)]
MFC r326249:

Update intro(6) - remove hint that doesn't work, add explicit list
of games instead, and mention the "bsdgames" port.

6 years agoMFC r303812:
eadler [Mon, 19 Mar 2018 03:38:59 +0000 (03:38 +0000)]
MFC r303812:

Use a more conventional spelling of "breakpoint".

6 years agoMFC r326482:
eadler [Mon, 19 Mar 2018 03:37:00 +0000 (03:37 +0000)]
MFC r326482:

lib/msun: remove trailing whitespace from e_pow.c

6 years agoMFC r314622:
eadler [Mon, 19 Mar 2018 03:34:40 +0000 (03:34 +0000)]
MFC r314622:

As suggested by several people, note that I prefer to communicate by email.

6 years agoMFC r326913:
eadler [Mon, 19 Mar 2018 03:28:24 +0000 (03:28 +0000)]
MFC r326913:

Sync with NetBSD's /usr/share/dict/words, with the exception of quim
due to its vulgar nature.

6 years agoMFC r320210:
eadler [Mon, 19 Mar 2018 03:22:43 +0000 (03:22 +0000)]
MFC r320210:

join(1): Fix field ordering for -v output

Per POSIX, join(1) (in modes other than -o) is a concatenation of selected
character fields.  The joined field is first, followed by fields in the
order they occurred in the input files.

Our join(1) utility previously handled this correctly for lines with a match
in the other file.  But it failed to order output fields correctly for
unmatched lines, printed in -a and -v modes.

A simple test case is:

$ touch a
$ echo "2 1" > b
$ join -v2 -2 2 a b
1 2

PR: 217711

6 years agoMFC r303412:
eadler [Mon, 19 Mar 2018 03:20:35 +0000 (03:20 +0000)]
MFC r303412:

Remove myself from kern_timeout.c yeah!

6 years agoMFC r325091:
eadler [Mon, 19 Mar 2018 03:19:29 +0000 (03:19 +0000)]
MFC r325091:

Prefer using https over http

6 years agoMFC r317798:
eadler [Mon, 19 Mar 2018 03:15:33 +0000 (03:15 +0000)]
MFC r317798:

bnxt: Add support for new Broadcom 100Gb adapter BCM57454

6 years agoMFC r317570:
eadler [Mon, 19 Mar 2018 03:13:42 +0000 (03:13 +0000)]
MFC r317570:

editline.3: Add missing argument to H_SET description

The H_SET operation of the history() function takes an int argument which is
the position of the item to which the cursor should be moved to.

6 years agoMFC r304725:
eadler [Mon, 19 Mar 2018 03:06:27 +0000 (03:06 +0000)]
MFC r304725:

Bring datasheet URL up to date.

6 years agoMFC r314052:
eadler [Mon, 19 Mar 2018 03:04:19 +0000 (03:04 +0000)]
MFC r314052:

Document what the different flags mean for locking.

6 years agoMFC r322991:
eadler [Mon, 19 Mar 2018 02:46:17 +0000 (02:46 +0000)]
MFC r322991:

Fix a day-one typo in tty.4 - the sysctls in question are "tty", not "tk"

6 years agoMFC r323135:
eadler [Mon, 19 Mar 2018 02:44:42 +0000 (02:44 +0000)]
MFC r323135:

Spelling.

6 years agoMFC r326601:
eadler [Mon, 19 Mar 2018 02:43:20 +0000 (02:43 +0000)]
MFC r326601:

mdocml: Add IEEE Std 1003.1-2008, 2016 edition

Also document IEEE Std 1003.1-2008, 2013 edition in mdoc(7) (as well as the
2016 edition).

6 years agoMFC r328525:
eadler [Mon, 19 Mar 2018 02:38:07 +0000 (02:38 +0000)]
MFC r328525:

ftp(1): Use closefrom() instead of individual close()s.

6 years agoMFC r303150:
eadler [Sun, 18 Mar 2018 22:55:07 +0000 (22:55 +0000)]
MFC r303150:

[mx25l] add new device id.

6 years agoMFC r314955:
eadler [Sun, 18 Mar 2018 22:42:32 +0000 (22:42 +0000)]
MFC r314955:

o Typo in the comment fixed.

6 years agoMFC r325215,r325216:
eadler [Sun, 18 Mar 2018 22:36:21 +0000 (22:36 +0000)]
MFC r325215,r325216:

Update tuning(7) some more

At this point its unclear how much help tuning(7) is whatsoever
but leave it around in case someone decides to spend some time on
it.

6 years agoMFC r315190:
eadler [Sun, 18 Mar 2018 22:29:41 +0000 (22:29 +0000)]
MFC r315190:

Add constants and descriptions for some new PCI class definitions

6 years agoMFC r319274:
eadler [Sun, 18 Mar 2018 22:24:29 +0000 (22:24 +0000)]
MFC r319274:

- Add a simple example to uname(1) manual page to show how the hardware
  platform (returned by -m) can be different from the machine's processor
  architecture (-p)
- Document that make(1) sets universal MACHINE and MACHINE_ARCH variables
  based on these values

6 years agoMFC r303452,r303482,r303483,r303484,r303485,r303487,r303489,r303498,r303499,r303502...
eadler [Sun, 18 Mar 2018 22:19:52 +0000 (22:19 +0000)]
MFC r303452,r303482,r303483,r303484,r303485,r303487,r303489,r303498,r303499,r303502,r303523,r303525,r303570,r303571,r303588,r303596,r303597,r303598,r303599,r303600,r303601,r303625,r303629,r303718,r304651,r304684,r304686,r305983,r309217,r309219,r309341,r309342,r309343,r309382,r309415,r309417,r309418,r309419,r310863,r311141,r314613,r318471,r321382,r321383,r321396:

indent(1): avoid calling write(2) with a negative second parameter.
indent(1): Avoid out of bound access of array codebuf.
indent(1): Avoid potential use-after-free.
indent(1): Fix breakage caused by single comment following "else".
indent(1) simply wasn't taught that "else" may be followed by a comment
without any opening brace anywhere on the line, so it was very confused
in such cases.
indent(1): fix struct termination detection.
indent(1): fix struct termination detection.
indent(1): Removed whitespace shouldn't be considered in column calculations.
indent(1): Support "f" and "F" floating constant suffixes.
indent(1): Use NULL instead of zero for pointers.
indent(1): Attempt to preserve some consistent style.
indent(1): Yet more style issues.
indent(1): Consistently indent declarations.
indent(1): Bail out if there's no more space on the parser stack.
indent(1): Remove dead code relating to unix-style comments.
indent(1): Simplify pr_comment().
indent(1): Fix wrapping of some lines in comments.
indent(1): Untangle the connection between pr_comment.c and io.c.
indent(1): Don't newline on cpp lines like #endif unless -bacc is on.
indent(1): replace function call to bzero with memset.
indent(1): Rearrange option parsing code to squelch clang's static analyzer.
indent(1): Use a dash in the license headers.
indent(1): accept offsetof(3) as a keyword.
indent(1): add some comments to quiet down Coverity.
indent(1): remove dead assignments.
indent(1): have the memset invocation somewhat more canonical.
indent(1): Capsicumify
indent(1): minor off-by-one error.
indent(1): fix regression introduced in r303596.
indent(1): Avoid out of bound access of array in_buffer
indent(1): Don't ignore newlines after comments that follow braces.
indent(1): Don't unnecessarily add a blank before a comment ends.
indent(1): Do not define opchar unless it will be used.
indent(1): Optimize parser stack usage.
indent(1): Remove an extra newline added in a previous commit.
indent(1): Avoid out-of-bound accesses of arrays.
indent(1): Avoid out-of-bound accesses of array ps.p_stack.
indent(1): Avoid out of bounds access of array ps.paren_indents
indent(1): add a piece missed in r311138.
indent(1): Support binary integer literals.
indent(1): don't produce unnecessary blank lines.
indent(1): rename the profile file.
indent(1): better alignment of comments on code.

6 years agoMFC: r331140
imp [Sun, 18 Mar 2018 19:07:07 +0000 (19:07 +0000)]
MFC: r331140

Merge ahead of schedule to fix pc98 build issues.

6 years agoDirect commit to stable
imp [Sun, 18 Mar 2018 19:05:06 +0000 (19:05 +0000)]
Direct commit to stable

Remove libstand32 here. pc98 is a 32-bit platform, so it shouldn't compile
the extra 32-bit copy of libsa. The copy built in libstand is already 32-bit.
Add a comment saying we need an empty Makefile.pc98 since otherwise it would
pull in Makefile.i386 and there is no EFI on pc98, and the machines are too
old to have ZFS or GELI be a viable option (and besides, those don't compile).

Note: We also need r331140 to be MFC'd for pc98 build to work in all cases.

6 years agoMFC r331016:
markj [Sun, 18 Mar 2018 16:57:40 +0000 (16:57 +0000)]
MFC r331016:
Add a space between a section number and a following comma.

6 years agoMFC r329950:
kp [Sun, 18 Mar 2018 11:25:39 +0000 (11:25 +0000)]
MFC r329950:

pf: Cope with overly large net.pf.states_hashsize

If the user configures a states_hashsize or source_nodes_hashsize value we may
not have enough memory to allocate this. This used to lock up pf, because these
allocations used M_WAITOK.

Cope with this by attempting the allocation with M_NOWAIT and falling back to
the default sizes (with M_WAITOK) if these fail.

PR: 209475
Submitted by: Fehmi Noyan Isi <fnoyanisi AT yahoo.com>

6 years agoMFC r330843:
eadler [Sun, 18 Mar 2018 02:59:14 +0000 (02:59 +0000)]
MFC r330843:

efirtc: Pass a dummy tmcap pointer to efi_get_time_locked

As noted in the comment, UEFI spec claims the capabilities pointer is
optional, but some implementations will choke and attempt to dereference it
without checking. This specific problem was found on a Lenovo Thinkpad X220
that would panic in efirtc_identify.

Requested by: kevans

6 years agoMFC r327958, r329601, r329602:
bryanv [Sat, 17 Mar 2018 20:37:01 +0000 (20:37 +0000)]
MFC r327958, r329601, r329602:

Sync VirtIO IDs with Linux

Add VirtIO bus config_generation method

Add more virtqueue getter methods

6 years agoMFC r329598:
bryanv [Sat, 17 Mar 2018 20:20:29 +0000 (20:20 +0000)]
MFC r329598:

Add PCI methods to iterate over the PCI capabilities

VirtIO V1 provides configuration in multiple VENDOR capabilities so this
allows all of the configuration to be discovered.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D14325

6 years agoRevert r330471 (MFC of r311861), since it results in compile errors
dim [Sat, 17 Mar 2018 19:04:36 +0000 (19:04 +0000)]
Revert r330471 (MFC of r311861), since it results in compile errors
like:

sys/net80211/ieee80211_tdma.c:179: error: 'IEEE80211_MODE_VHT_2GHZ' undeclared (first use in this function)
sys/net80211/ieee80211_tdma.c:180: error: 'IEEE80211_MODE_VHT_5GHZ' undeclared (first use in this function)

The IEEE80211_MODE_VHT_2GHZ and IEEE80211_MODE_VHT_5GHZ enum values are
defined in r310147, but that commit cannot be MFCd as-is, because it
likely breaks ABI.

6 years agoRepair obvious mismerge in r330897, resulting in misleading gcc error
dim [Sat, 17 Mar 2018 18:55:46 +0000 (18:55 +0000)]
Repair obvious mismerge in r330897, resulting in misleading gcc error
messages like "sys/net/if_fddisubr.c:1: error: expected '=', ',', ';',
'asm' or '__attribute__' before '-' token".

6 years agoMFC r328509:
eadler [Sat, 17 Mar 2018 07:04:41 +0000 (07:04 +0000)]
MFC r328509:

tools: remove note about diffburst.

Said tool was removed in 1999 in r51579

6 years agoMFC r317870:
eadler [Sat, 17 Mar 2018 06:44:39 +0000 (06:44 +0000)]
MFC r317870:

[mx25l] add new device ids.

6 years agoMFC r326387:
eadler [Sat, 17 Mar 2018 06:36:39 +0000 (06:36 +0000)]
MFC r326387:

Fix typo

6 years agoMFC r327941:
eadler [Sat, 17 Mar 2018 06:31:24 +0000 (06:31 +0000)]
MFC r327941:

timed: slave is an infinite loop, mark it as such

6 years agoMFC r328831:
eadler [Sat, 17 Mar 2018 06:05:33 +0000 (06:05 +0000)]
MFC r328831:

pthread: adding missing header to man page

6 years agoMFC r328839:
eadler [Sat, 17 Mar 2018 05:43:26 +0000 (05:43 +0000)]
MFC r328839:

Add the ThinkPad X1 (sandybridge) to the bsdinstall blacklist

Reviewed by: AllanJude (for mfc)

6 years agoMFC r328959:
eadler [Sat, 17 Mar 2018 05:36:51 +0000 (05:36 +0000)]
MFC r328959:

fsync.2: Cross-reference fsync(1)

6 years agoMFC r328430,r328431:
eadler [Sat, 17 Mar 2018 05:04:38 +0000 (05:04 +0000)]
MFC r328430,r328431:

devd: minor nits

- mark usage as noreturn

6 years agoMFC r328428:
eadler [Sat, 17 Mar 2018 05:00:07 +0000 (05:00 +0000)]
MFC r328428:

example cdev: use make_dev_s

Make use of make_dev_s in the example cdev. While here, fix warnings.

6 years agoMFC r328427:
eadler [Sat, 17 Mar 2018 03:00:24 +0000 (03:00 +0000)]
MFC r328427:

dd(1): Use a local swapbytes() function.

swab(3) has restrict qualifiers for src and dst.
Avoid relying on undefined overlapping swab behavior.

Obtained From: OpenBSD

6 years agoMFC r326959:
eadler [Sat, 17 Mar 2018 01:27:54 +0000 (01:27 +0000)]
MFC r326959:

arc lint: ignore /tests/ in chmod

shell scripts in scripts don't need
to be chmod +x to work. In fact most are not.
Of the tests I found from a simple search:
65 are chmod +x
84 are chmod -x

simply disable the check for test shell scripts.

6 years agoRevert attempted MFC. It included unwanted changes.
lidl [Fri, 16 Mar 2018 23:39:49 +0000 (23:39 +0000)]
Revert attempted MFC.  It included unwanted changes.

6 years agoMFC r328861: improve blacklist-helper shell script
lidl [Fri, 16 Mar 2018 23:34:44 +0000 (23:34 +0000)]
MFC r328861: improve blacklist-helper shell script

6 years agoMFC r329279: add support for user-supplied Host-Uniq tag to ng_pppoe(4).
eugen [Fri, 16 Mar 2018 15:04:13 +0000 (15:04 +0000)]
MFC r329279: add support for user-supplied Host-Uniq tag to ng_pppoe(4).

Submitted by: ale
Approved by: avg (mentor), mav (mentor)
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D9270

6 years agoMFC r330681: Fix Bad file descriptor error.
ume [Fri, 16 Mar 2018 14:05:45 +0000 (14:05 +0000)]
MFC r330681: Fix Bad file descriptor error.

6 years agoMFC r330940:
eadler [Fri, 16 Mar 2018 08:45:28 +0000 (08:45 +0000)]
MFC r330940:

Update to 2018-03-06

6 years agoMFC r327344:
eadler [Fri, 16 Mar 2018 08:44:44 +0000 (08:44 +0000)]
MFC r327344:

locale: add cnr (Montenegrin)

See https://www.loc.gov/standards/iso639-2/php/code_changes.php

6 years agoMFC r303041,r303320,r305905,r310087,r310346,r319368,r321879,r321923,r321979,r327554...
eadler [Fri, 16 Mar 2018 08:39:37 +0000 (08:39 +0000)]
MFC r303041,r303320,r305905,r310087,r310346,r319368,r321879,r321923,r321979,r327554,r329124,r329210,:

organizations.dot - misc changes

6 years agoMFC r311106,r311109,r311110,r320579,r327063,r327064,:
eadler [Fri, 16 Mar 2018 05:29:30 +0000 (05:29 +0000)]
MFC r311106,r311109,r311110,r320579,r327063,r327064,:

patch(1): replace strnlen() with a simpler strlen().
patch(1): add support for git generated diffs.
patch: rejname[] is also -r option buffer, and should be PATH_MAX.
patch: further cleanup to git-style diffs.

6 years agoMFC r305373,r312344,r318095,r319117,r320948,r320953,r328528:
eadler [Fri, 16 Mar 2018 02:44:18 +0000 (02:44 +0000)]
MFC r305373,r312344,r318095,r319117,r320948,r320953,r328528:

siba(4): Add missing bhnd_device/bhnd_device_quirk table terminator entries.

This resulted in an over-read on siba chipsets that failed to match the
existing entries.

r312344 | sbruno | 2017-01-17 14:52:48 +0000 (Tue, 17 Jan 2017) | 7 lines

Add 4k quirk for Micron 5100 and Intel S3610 SSDs

r318095 | loos | 2017-05-09 19:01:57 +0000 (Tue, 09 May 2017) | 9 lines

Add a new SDHCI quirk, SDHCI_QUIRK_BROKEN_AUTO_STOP, to workaround
controllers that do not support or have broken ACMD12 implementations.

r319117 | wma | 2017-05-29 09:22:53 +0000 (Mon, 29 May 2017) | 16 lines

Introduce Genesys GL3224 quirks

The Genesys chip is failing when issueing READ_CAP(16) command.
Force a quirk to disable it and use READ_CAP(10) instead.

Also, depending on used firmware, GL3224 can be recognized
either as 'storage device' or 'mass storage class' -
enable both variants in scsi_quirk_table.

r320948 | sbruno | 2017-07-13 15:33:08 +0000 (Thu, 13 Jul 2017) | 6 lines

Add 4K quirks for Samsung 750 EVO SSD

r320953 | sbruno | 2017-07-13 16:56:26 +0000 (Thu, 13 Jul 2017) | 5 lines

Add 4k and NCQ_TRIM_BROKEN quirks for Samsung 845 SSDs.

r328528 | ian | 2018-01-29 03:24:02 +0000 (Mon, 29 Jan 2018) | 3 lines

Add a NO_GETMAXLUN quirk for the JMicron JMS567 USB to SATA bridge, to
prevent lengthy timeout pauses while probing/attaching drives.

6 years agoMFC: r327929
marius [Thu, 15 Mar 2018 23:02:49 +0000 (23:02 +0000)]
MFC: r327929

Use the correct revision specifier (EXT_CSD revision rather than
system specification version) for deciding whether the EXT_CSD
register includes the EXT_CSD_GEN_CMD6_TIME field.

Submitted by: Masanobu SAITOH

6 years agoMFC: r327355, r327926
marius [Thu, 15 Mar 2018 23:01:00 +0000 (23:01 +0000)]
MFC: r327355, r327926

- Don't allow userland to switch partitions; it's next to impossible
  to recover from that, especially when something goes wrong.
- When userland changes EXT_CSD, update the kernel copy before using
  relevant EXT_CSD bits in mmcsd_switch_part().

6 years agoMFC: r327339, r327924
marius [Thu, 15 Mar 2018 22:58:31 +0000 (22:58 +0000)]
MFC: r327339, r327924

- There is no need to keep the tuning error and re-tuning interrupts
  enabled (though, no interrupt generation enabled for them) all the
  time as soon as (re-)tuning is supported; only enable them and let
  them generate interrupts when actually using (re-)tuning.
- Also disable all interrupts except SDHCI_INT_DATA_AVAIL ones while
  executing tuning and not just their signaling.
- Set the tuning error and re-tuning interrupt enable bits based on
  the SDHCI_TUNING_ENABLED rather than the SDHCI_TUNING_SUPPORTED flag,
  i. e. only when (re-)tuning is actually used. Currently, this change
  makes no net difference, though.

6 years agoMFC: r327315
marius [Thu, 15 Mar 2018 22:51:10 +0000 (22:51 +0000)]
MFC: r327315

Add quirks for Intel Denverton eMMC 5.0 controllers.

6 years agoMFC r330257: Add a function to retrieve the EFI realtime clock capabilities.
kevans [Thu, 15 Mar 2018 20:46:34 +0000 (20:46 +0000)]
MFC r330257: Add a function to retrieve the EFI realtime clock capabilities.

6 years agoMFC r324191: Hide kernel stuff from userspace.
kevans [Thu, 15 Mar 2018 20:40:27 +0000 (20:40 +0000)]
MFC r324191: Hide kernel stuff from userspace.

6 years agoMFC (partially) r326066, r326121: Add an EFI RTC Driver
kevans [Thu, 15 Mar 2018 20:29:48 +0000 (20:29 +0000)]
MFC (partially) r326066, r326121: Add an EFI RTC Driver

This is effectively a direct commit to stable/11 to avoid the arm64 bits, as
those are unfortunately not able to MFC'd.

MFC r326066:
Add a driver for the EFI RTC. This uses the EFI Runtime Services to query
the system time.

MFC r326121:
Zero struct efi_tm before setting the needed values. We don't use the dst
or timezone fields so ensure these are set.

6 years agoRevert r331022: MFC of EFI Runtime Service support on aarch64
kevans [Thu, 15 Mar 2018 20:09:24 +0000 (20:09 +0000)]
Revert r331022: MFC of EFI Runtime Service support on aarch64

Apologies; this is NOT an MFC'able change. It requires a good number of pcb
changes that would break KBI.

Pointy hat to: me

6 years agoMFC r324495: Support the EFI Runtime Services on arm64. As with amd64 we use
kevans [Thu, 15 Mar 2018 19:56:44 +0000 (19:56 +0000)]
MFC r324495: Support the EFI Runtime Services on arm64. As with amd64 we use
the 1:1 mapping. This uses the new common code shared with amd64.

The RTC should only be accessed via EFI. There is no locking around it as
the spec only has this as a requirement for the PC-AT CMOS device.

NOTE: r326311's changes to arm64/efirt_machdep.c have been hand-applied to
this import of efirt_machdep.c due to r326311 having already been merged.

6 years agor322279: Don't create /dev/efi without EFI runtime
kevans [Thu, 15 Mar 2018 19:41:26 +0000 (19:41 +0000)]
r322279: Don't create /dev/efi without EFI runtime

Turns out to be even simpler to just not create /dev/efi if we don't
have a efi runtime.

6 years agoMFC r322278,324177: EFIRT Improvements
kevans [Thu, 15 Mar 2018 19:31:39 +0000 (19:31 +0000)]
MFC r322278,324177: EFIRT Improvements

r322278 (imp): Fail to open efirt device when no EFI on system.

libefivar expects opening /dev/efi to indicate if the we can make efi
runtime calls. With a null routine, it was always succeeding leading
efi_variables_supported() to return the wrong value. Only succeed if
we have an efi_runtime table. Also, while I'm hear, out of an
abundance of caution, add a likely redundant check to make sure
efi_systbl is not NULL before dereferencing it. I know it can't be
NULL if efi_cfgtbl is non-NULL, but the compiler doesn't.

r324177 (andrew):
To prepare for adding EFI runtime services support on arm64 move the
machine independent parts of the existing code to a new file that can be
shared between amd64 and arm64.

Care has been taken to ensure that the MFC of r324177 did not clobber
cherry-picked MFC's.

6 years agoMFC r317055,r317056 (glebius): Include sys/vmmeter.h as included
kevans [Thu, 15 Mar 2018 19:08:33 +0000 (19:08 +0000)]
MFC r317055,r317056 (glebius): Include sys/vmmeter.h as included

r317055: All these files need sys/vmmeter.h, but now they got it implicitly
included via sys/pcpu.h.

r317056: Typo!

6 years agoMFC r328395: Install uefi.8 also on arm64
emaste [Thu, 15 Mar 2018 12:59:15 +0000 (12:59 +0000)]
MFC r328395: Install uefi.8 also on arm64

Our standard boot method for arm64 is via UEFI, so install the man page
that describes the boot process.

Sponsored by: The FreeBSD Foundation

6 years agoMFC r329370, r330239: Rationalize license text on Linuxolator files
emaste [Thu, 15 Mar 2018 12:56:22 +0000 (12:56 +0000)]
MFC r329370, r330239: Rationalize license text on Linuxolator files

Many licenses on Linuxolator files contained small variations from the
standard FreeBSD license text.  To avoid license proliferation switch to
the standard 2-clause FreeBSD license for those files where I have
permission from each of the listed copyright holders.

Approved by: dchagin, kan, marcel, rdivacky, sos
Sponsored by: The FreeBSD Foundation

6 years agoMFC r329363: read-behind / read-ahead support for zfs_getpages()
avg [Thu, 15 Mar 2018 12:05:17 +0000 (12:05 +0000)]
MFC r329363: read-behind / read-ahead support for zfs_getpages()

6 years agoMFC r329823: another rework of getzfsvfs / getzfsvfs_impl code
avg [Thu, 15 Mar 2018 11:06:04 +0000 (11:06 +0000)]
MFC r329823: another rework of getzfsvfs / getzfsvfs_impl code

6 years agoMFC r330057: add ZFS_ENTER protection to .zfs/snapshot vnode operations that need it
avg [Thu, 15 Mar 2018 11:03:39 +0000 (11:03 +0000)]
MFC r330057: add ZFS_ENTER protection to .zfs/snapshot vnode operations that need it

6 years agoMFC r329717: MFV r329715: 8997 ztest assertion failure in zil_lwb_write_issue
avg [Thu, 15 Mar 2018 10:52:08 +0000 (10:52 +0000)]
MFC r329717: MFV r329715: 8997 ztest assertion failure in zil_lwb_write_issue

6 years agoMFC r324441:
eadler [Thu, 15 Mar 2018 10:13:25 +0000 (10:13 +0000)]
MFC r324441:

Fix freebsd-update(8) erroneous message and exit status when "fetch install" used.

PR: 190660

6 years agoMFC r306135,r311859,r321763,r321764,r321766,r321767,r321768,r321769,r321771,r321774...
eadler [Thu, 15 Mar 2018 10:01:11 +0000 (10:01 +0000)]
MFC r306135,r311859,r321763,r321764,r321766,r321767,r321768,r321769,r321771,r321774,r321776,r321783,r321784,r321785,r321786,r321787,r321788,r321789,r321793,r321796,r321797,r321801,r321802,r321804,r321814,r321817,r321818,r321834,r321835,r321853,r321857,r321860,r321866,r321885,r321886,r321889,r321890,r321892,r321893,r321897,r321939,r321966,r321974,r321982,r321989,r322035,r322093,r322108,r322314,r322330,r322335,r322350,r322353,r322365,r322416,r322471,r322484,r322638,r322649,r322881,r322886,r323972,r330768,:

Misc calendar changes

6 years agoMFC r305857,r305858,r305859:
eadler [Thu, 15 Mar 2018 09:49:23 +0000 (09:49 +0000)]
MFC r305857,r305858,r305859:

sbin/rcorder/rcorder.8: Amend HISTORY

rcorder appeared in FreeBSD 5.0.
Address issues raised by igor.

PR: 212547
Submitted by: Sevan Janiyan <venture37@geeklan.co.uk>

------------------------------------------------------------------------
r305858 | allanjude | 2016-09-16 04:11:04 +0000 (Fri, 16 Sep 2016) | 10 lines

sbin/reboot/reboot.8: Amend HISTORY

A standalone reboot utility showed up in 4.0BSD, in AT&T UNIX init has a
case for reboot and is present in the version shipped with V5

either way, current entry is incorrect.

PR: 212548
Submitted by: Sevan Janiyan <venture37@geeklan.co.uk>

------------------------------------------------------------------------
r305859 | allanjude | 2016-09-16 04:12:32 +0000 (Fri, 16 Sep 2016) | 8 lines

sbin/umount/umount.8: Amend HISTORY

umount first appeared in V1, confirmed using TUHS archive
http://minnie.tuhs.org/cgi-bin/utree.pl?file=V1/man/man1/umount.1

PR: 212554
Submitted by: Sevan Janiyan <venture37@geeklan.co.uk>

6 years agoMFC r305139:
eadler [Thu, 15 Mar 2018 09:43:38 +0000 (09:43 +0000)]
MFC r305139:

df(1): Allow duplicate -l flags gracefully

Rather than producing a misleading error message when duplicate -l flags are
provided to df(1), simply ignore extra flags and proceed as if only one was
specified.  This seems most reasonable given the usage for -l:

     -l      Only display information about locally-mounted file systems.

l and t flags still conflict, as before.

PR: 208169

6 years agoMFC r327514,r327521,r327614,r327615,r327616,r327623:
eadler [Thu, 15 Mar 2018 09:38:18 +0000 (09:38 +0000)]
MFC r327514,r327521,r327614,r327615,r327616,r327623:

morse(6): several improvements

- add Ã±, ', and _
- remove lint support
- add missing header for ioctl
- fix two typod
- Use `-r` for "reverse" mode and to match DragonFlyBSD.
- Move defines around to clear up logic
- use `errx` instead of `fprintf` and `exit`
- Use copyright comment header
- Make it easier to compile on !FreeBSD
- Diff reduction against DragonFlyBSD
- bump Dd
- use 'r' instead of 'D' from the original submission

PR: 35109

6 years agoMFC r327474:
eadler [Thu, 15 Mar 2018 09:30:39 +0000 (09:30 +0000)]
MFC r327474:

bsdinstall: inform users that typing will not be visible

Some users, especially those that are new, might be confused when passwd
does not echo anything. Inform users that the password will not be
visible.

PR: 196113

6 years agoMFC r302485,r303203,r303341,r304025,r306133,r306518,r308576,r308686,r309019,r309059...
eadler [Thu, 15 Mar 2018 09:22:20 +0000 (09:22 +0000)]
MFC r302485,r303203,r303341,r304025,r306133,r306518,r308576,r308686,r309019,r309059,r310024,r311853,r312793,r313033,r313577,r313741,r314692,r317772,r317939,r319674,r319923,r321392,r322979,r323222,r323222,r323398,r323502,r323602,r323767,r323767,r323958,r325220,r326172,r326253,r330652,r330761,r330762,r330763,r330765,:

Misc. *.dot additions

6 years agoMFC r303036,r303038,r306822,r307923,:
eadler [Thu, 15 Mar 2018 09:04:23 +0000 (09:04 +0000)]
MFC r303036,r303038,r306822,r307923,:

makefs: reorder 'usage' alphabetically

From NetBSD, Mon Aug 15 14:45:01 2011 +0000 (wiz)

    Re-order `usage' alphabetically;
    rename option arguments in the manpage's `SYNOPSIS' section to
    match those from `usage' (not the other way around; the `usage'-line
    (and other parts of makefs.c) contain the correct names);
    minor punctuation improvements.

    From Snader_LB.

makefs.8 1.36
makefs.c 1.30

Obtained from: NetBSD

------------------------------------------------------------------------
r303038 | emaste | 2016-07-19 18:40:54 +0000 (Tue, 19 Jul 2016) | 56 lines

makefs: sync NetBSD IDs with upstream for changes that we already have

May 22 21:51:39 2011 +0000 (christos):

    From Nathan Whitehorn (nwhitehorn at freebsd dot org):
    Add code to generate bootable ISOs on Powermac and CHRP systems.
    Synthesize some partition maps (APM and MBR, respectively) pointing
    to (a) the whole disk, and (b) relevant El Torito boot images that
    have been added by other code. These partition maps are a little
    bit funny looking, but they seem to work. FreeBSD has been using
    this successfully in their release generation on powerpc, as well
    as generating all non-SPARC install media. SPARC support could
    probably be added as an extension of this patch.

makefs.8 1.33

Tue Aug 23 17:09:11 2011 +0000 (christos):

    PR/45285: Martin Matuska: makefs does not properly convert ISO level 1 and 2
    filenames (buffer overflow)

    makefs does not properly verify the maximum filename length in the
    special "." case for both ISO level 1 and ISO level 2 filename
    conversion.  This creates broken images or causes a buffer overflow
    (ISO level 2).

    ISO level 1:
    If a filename contains only dots or up to 8 characters followed by
    dots the 8+3 limit check doesn't work.

    ISO level 2:
    If a filename contains a dot in the first 30 characters and a dot
    on the 30th character, the length limit check doesn't work and the
    buffer is overflowed.

    $ mkdir level1
    $ touch level1/12345............
    $ makefs -t cd9660 -o isolevel=1 test.iso level1

    $ mkdir level2
    $ touch level2/1234567890.2345678901234567.....34567890123456789012345
    $ makefs -t cd9660 -o isolevel=2 test.iso level2

cd9660.c 1.32

Sun Oct 9 21:33:43 2011 +0000 (christos):

    add support for setting the ufs label. (Nathan Whitehorn)

ffs.c 1.45
ffs.h 1.2
mkfs.c 1.22
makefs.8 1.37

Obtained from: NetBSD

------------------------------------------------------------------------
r306822 | emaste | 2016-10-07 19:12:15 +0000 (Fri, 07 Oct 2016) | 4 lines

makefs: diff reduction with NetBSD

Obtained from: NetBSD usr.sbin/makefs/cd9660.c 1.33

------------------------------------------------------------------------
r307923 | marcel | 2016-10-25 16:21:38 +0000 (Tue, 25 Oct 2016) | 7 lines

Allow building makefs(8) from another Makefile (such as one in
a seperate directory hierarchy used to build tools). This boils
down to replacing the use of ${.CURDIR} with either ${SRCDIR}
or ${SRCTOP}. SRCDIR is defined as the directory in which the
Makefile lives that bmake(1) is currently reading. Use SRCTOP
when reaching outside of makefs's directory.

6 years agoMFC r303063,r311852,r311930,r317040,r320506,r321301,r325162,r326759,r329004,:
eadler [Thu, 15 Mar 2018 08:30:05 +0000 (08:30 +0000)]
MFC r303063,r311852,r311930,r317040,r320506,r321301,r325162,r326759,r329004,:

Add myself (stevek) as a src committer and mentor (sjg) to committers-src.dot

Approved by: sjg (mentor)

------------------------------------------------------------------------
r311852 | ler | 2017-01-10 04:31:56 +0000 (Tue, 10 Jan 2017) | 5 lines

Add myself to committers-ports.dot

Approved by: adamw (mentor)
Differential Revision: https://reviews.freebsd.org/D9117

------------------------------------------------------------------------
r311930 | dumbbell | 2017-01-11 19:29:28 +0000 (Wed, 11 Jan 2017) | 5 lines

committers-ports.dot: Add myself

Approved by: antoine (mentor)
Differential Revision: https://reviews.freebsd.org/D9143

------------------------------------------------------------------------
r317040 | ganbold | 2017-04-17 07:27:45 +0000 (Mon, 17 Apr 2017) | 2 lines

Belatedly add myself to committers-src.dot file.

------------------------------------------------------------------------
r320506 | kevans | 2017-06-30 20:01:31 +0000 (Fri, 30 Jun 2017) | 5 lines

Add myself to commiters-src.dot, emaste@ as mentor; sort his mentees while here

Approved by: emaste (mentor)
Differential Revision: https://reviews.freebsd.org/D11429

------------------------------------------------------------------------
r321301 | mjoras | 2017-07-20 18:14:27 +0000 (Thu, 20 Jul 2017) | 5 lines

Add myself and mentor line to committers-src.dot.

Approved by: rstone (mentor)
Differential Revision: https://reviews.freebsd.org/D11672

------------------------------------------------------------------------
r325162 | arichardson | 2017-10-30 18:17:02 +0000 (Mon, 30 Oct 2017) | 5 lines

Add myself to committers-src.dot

Reviewed by: jhb (mentor)
Approved by: jhb (mentor)

------------------------------------------------------------------------
r326759 | chuck | 2017-12-11 04:40:25 +0000 (Mon, 11 Dec 2017) | 6 lines

Add myself to committers-src.dot

Reviewed by: ken, imp
Approved by: ken (mentor), imp (mentor)
Differential Revision: https://reviews.freebsd.org/D13406

------------------------------------------------------------------------
r329004 | jeb | 2018-02-08 00:14:20 +0000 (Thu, 08 Feb 2018) | 5 lines

Add myself to committers-src.dot

Reviewed by: erj (mentor)
Approved by: erj (mentor)

6 years agoMFC r302533:
eadler [Thu, 15 Mar 2018 05:13:29 +0000 (05:13 +0000)]
MFC r302533:

mail(1): Fix a comment.

6 years agoMFC r327580,r327581:
eadler [Thu, 15 Mar 2018 05:04:46 +0000 (05:04 +0000)]
MFC r327580,r327581:

bits is never null when we call ot. Add an assert to that effect and
remove test for NULL.

Remove dead code (comma is either 0 or 1 for sure, no need to test).
Close /dev/pci when we're done with it.

6 years agoMFC r327279,r327571:
eadler [Thu, 15 Mar 2018 04:59:47 +0000 (04:59 +0000)]
MFC r327279,r327571:

Close fd when we're done dv-sending the file.

6 years agoMFC r329102:
eadler [Thu, 15 Mar 2018 02:32:22 +0000 (02:32 +0000)]
MFC r329102:

libcompat: Use %hu for unsigned shorts.

6 years agoMFC r302535:
eadler [Thu, 15 Mar 2018 02:25:28 +0000 (02:25 +0000)]
MFC r302535:

Do not allow whitespace in macro names.

6 years agoMFC r302525,r302526:
eadler [Thu, 15 Mar 2018 02:20:06 +0000 (02:20 +0000)]
MFC r302525,r302526:

Do allow auditing of read(2) and write(2) system calls, by assigning
those system calls audit event identifiers AUE_READ and AUE_WRITE.
While auditing file-descriptor I/O is not required by the Common
Criteria, in practice this proves useful for both live and forensic
analysis.

NB: freebsd32 already assigns AUE_READ and AUE_WRITE to read(2) and
write(2).

In process-descriptor close(2) and fstat(2), audit target process
information.  pgkill(2) already audits target process ID.

6 years agoMFC r330667: asmc: update temperature sensor name/description
emaste [Thu, 15 Mar 2018 00:43:25 +0000 (00:43 +0000)]
MFC r330667: asmc: update temperature sensor name/description

PR: 225911
Submitted by: Trev <fbsdbugs4 at sentry.org>

6 years agoMFC: 327314
marius [Wed, 14 Mar 2018 23:59:50 +0000 (23:59 +0000)]
MFC: 327314

With the advent of interrupt remapping, Intel has repurposed bit 11
(now: Interrupt_Index[15]) and assigned the previously reserved bits
55:48 (Interrupt_Index[14:0] goes into 63:49 while Destination Field
used 63:56 and bit 48 now is Interrupt_Format) in the IO redirection
tables (see the VT-d specification, "5.1.5.1 I/OxAPIC Programming").
Thus, when not using interrupt remapping, ensure that all previously
reserved bits in the high part of the RTEs are zero instead of doing
a read-modify-write for their Destination Field bits only.
Otherwise, on machines based on Apollo Lake and its derivatives such
as Denverton, typically some of the previously preserved bits remain
set after boot when not employing interrupt remapping. The result is
that INTx interrupts are not getting delivered.
Note: With an AMD IOMMU, interrupt remapping apparently bypasses the
IO APIC altogether.

Submitted by: loos (modulo comment)
Reviewed by: jhb (modulo comment)

6 years agoDocument SA-18:03.speculative_execution.
gjb [Wed, 14 Mar 2018 14:32:01 +0000 (14:32 +0000)]
Document SA-18:03.speculative_execution.

Sponsored by: The FreeBSD Foundation

6 years agoMFC r314624:
tijl [Wed, 14 Mar 2018 09:57:58 +0000 (09:57 +0000)]
MFC r314624:

Reject userland CCBs that have CAM_UNLOCKED set.

CAM_UNLOCKED is internal flag and cannot correctly be set by userland.
Return EINVAL from CAMIOCOMMAND and CAMIOQUEUE if it is set.

Also fix leaks in some of the error paths for CAMIOQUEUE.

PR: 215356

6 years agoMFC r302452:
eadler [Wed, 14 Mar 2018 08:48:40 +0000 (08:48 +0000)]
MFC r302452:

Add missing PORTS_OPTS to two make commands

6 years agoMFC r302509:
eadler [Wed, 14 Mar 2018 08:45:19 +0000 (08:45 +0000)]
MFC r302509:

Fix heap overflow in bhnd(4) SPROM parsing.

The bus_region_* APIs accept the number of data items to be read, while
the code was passing the total number of bytes, resulting in an overflow
of the SPROM parser's buffer.

6 years agoMFC r322663:
eadler [Wed, 14 Mar 2018 08:33:03 +0000 (08:33 +0000)]
MFC r322663:

Correct multicast address used in pfsync(4)
As stated in src/sys/netinet/in.h L395, address used is 224.0.0.240.

PR: 216885

6 years agoMFC r330834:
eadler [Wed, 14 Mar 2018 08:27:05 +0000 (08:27 +0000)]
MFC r330834:

vt_vga: check if VGA is available from ACPI FADT table

On x86 the IA-PC Boot Flags in the FADT can signal whether VGA is
available or not.

6 years agoMFC r316636,r316642,r316675,r316733,r316737,r316741,r316827,r316830,r316865,r316878:
eadler [Wed, 14 Mar 2018 08:15:26 +0000 (08:15 +0000)]
MFC r316636,r316642,r316675,r316733,r316737,r316741,r316827,r316830,r316865,r316878:

Fix removal of the keyboard cursor image in text mode, especially
in the vga renderer.  Removal used stale attributes and didn't try to
merge with the current attribute for cut marking, so special rendering
of cut marking was lost in many cases.  The gfb renderer is too broken
to support special rendering of cut marking at all, so this change is
supposed to be just a style fix for it.  Remove all traces of the
saveunder method which was used to implement this bug.

Fix drawing of the cursor image in text mode, only in the vga
renderer.  This used a stale attribute from the frame buffer instead
of from the saveunder, but did merge with the current attribute for
cut marking so it caused less obvious bugs (subtle misrendering for
the character under the cursor).

The saveunder method may be good in simpler drivers, but in syscons
the 'under' is already saved in a better way in the vtb.  Just redraw
it from there, with visible complications for cut marking and
invisible complications for mouse cursors.  Almost all drawing
requests are passed a flag 'flip' which currently means to flip to
reverse video for characters in the cut marking region, but should
mean that the the characters are in the cut marking regions so should
be rendered specially, preferably using something better than reverse
video.  The gfb renderer always ignores this flag.  The vga renderer
ignored it for removal of the text cursor -- the saveunder gave the
stale rendering at the time the cursor was drawn.  Mouse cursors need
even more complicated methods.  They are handled by drawing them last
and removing them first.  Removing them usually redraws many other
characters with the correct cut marking (but transiently loses the
keyboard cursor, which is redrawn soon).  This tended to hide the
saveunder bug for forward motions of the keyboard cursor.  But slow
backward motions of the keyboard cursor always lost the cut marking,
and fast backwards motions lost in for about 4 in every 5 characters,
depending on races with the scrn_update() timeout handler.  This is
because the forward motions are usually into the region redrawn for
the mouse cursor, while backwards motions rarely are.

Text cursor drawing in the vga renderer used also used a
possibly-stale copy of the character and its attribute.  The vga
render has the "optimization" of sometimes reading characters from the
screen instead of from the vtb (this was not so good even in 1990 when
main memory was only a few times faster than video RAM).  Due to care
in update orders, the character is never stale, but its attribute
might be (just the cut marking part, again due to care in order).

gfb doesn't have the scp->scr pointer used for the "optimization", and
vga only uses this pointer for text mode.  So most cases have to
refresh from the vtb, and we can be sure that the ordering of vtb
updates and drawing is as required for this to work.

------------------------------------------------------------------------
r316642 | bde | 2017-04-08 10:00:39 +0000 (Sat, 08 Apr 2017) | 36 lines

Quick fix for removal of the mouse cursor in vga direct graphics modes
(that is, in all supported 8, 15, 16 and 24-color modes).  Moving the
mouse cursor while holding down a button (giving cut marking) left a
trail of garbage from misremoved mouse cursors (usually colored
rectangles and not cursor shapes).  Cases with a button not held down
worked better and may even have worked.

No renderer support for removing (software) mouse cursors is needed
(and many renderers don't have any), since sc_remove_mouse_image()
marks for update the region containing the image and usually much
more.  The mouse cursor can be (partially) over as many as 4 character
cells, and removing it in only the 1-4 cells occupied by it would be
best for efficiency and for avoiding flicker.  However,
sc_remove_mouse_image() can only mark a single linear region and
usually marks a full row of cells and 1 more to be sure to cover the
4 cells.  It always does this, so using the special rendering method
just wastes even more time and gives even more flicker.  The special
methods will be removed soon.

The general method always works.  vga_pxlmouse_direct() appeared to
defer to it by returning immediately if !on.  However,
vga_pxlmouse_direct() actually did foot-shooting using a disguised
saveunder method.  Normal order near a mouse move is:
  (1) remove the mouse cursor in the renderer (optional)
  (2) remove the mouse cursor again and refresh the screen over the
      mouse cursor and much more from the vtb.  When the mouse has
      actually moved and a button is down, many attributes in this
      region are changed to be up to date with the new cut marking
  (3) draw the keyboard cursor again if it was clobbered by the update
  (4) draw the mouse cursor image in its new position.
The bug was to remove the mouse cursor again in step (4), before the
drawing it again in (4), using a saveunder that was valid in step (1)
at best.  The quick fix is to use the saveunder in step (1) and not
in step (4).  Using it in step (4) also used it before it was
initialized, initially and after  mode and screen switches.

------------------------------------------------------------------------
r316675 | bde | 2017-04-10 06:19:09 +0000 (Mon, 10 Apr 2017) | 29 lines

Special rendering methods for removing mouse cursors cannot be removed
like I hoped, since they are needed for removing parts over the border.
Continue fixing bugs in them.

In the vga planar mode renderer, remove removal of the part of the
image over the text window.  This was hard-coded for nearly 8x16 fonts
and in practice didn't remove enough for 8x8 fonts.  This used the
wrong attribute over cutmarked regions.  The caller refreshes with the
correct attribute later, so the attribute bug only caused flicker.
The caller uses the same hard-coding, so the refreshes fix up all the
spots with the wrong attribute, but keep missing the missed spots.
This still gives trails of bits of cursors for cursor motions in the
affected configurations (mainly depth 4 modes with 8x8) fonts.  8x14
fonts barely escape the problem since although the cursor is drawn
as 16x16, its active part is only 9x13 and the active part fits in
the hard-coded 2x2 character cell window for 8x14 fonts.  8x8 fonts
need a 2x3 window.

In the fb non-sparc64 renderer, the buggy image removal was buggier
and was already avoided by returning before it.  Remove it completely
and fix nearby style bugs.  It was essentially the same as for the vga
planar mode renderer (obfuscated by swapping x and y).  This was buggier
since fb should handle more types of hardware so the hard-coding is
wronger.

The remaining fb image removal is also buggier.  It never supported
software cursors drawn into the border, and the hardware cursor is
probably broken by other bugs to be fixed soon.

------------------------------------------------------------------------
r316733 | bde | 2017-04-12 16:21:55 +0000 (Wed, 12 Apr 2017) | 45 lines

Fix clobbering of the default attribute and the screen position in
scteken_init().  Move the internals of scteken_sync() into a local
function to help do this.

scteken_init() reset or adjusted the default attribute and screen
position at least 3 and 5 times, respectively.  Warm init shouldn't
do any more than reset the "input" state.
  (scterm-sc.c (which still works after minor editing), only resets
  the escape state and the saved cursor position, and then does a
  nearly-null sync of the current color.)

This mainly broke mode changes, and was most noticeable when the
background color is not teken's default (usually black).  Then the
screen gets cleared in the wrong color.  vidcontrol restores the
default normal attribute and tries to restore the default reverse
attribute.  vidcontrol doesn't clear the screen again after restoring
the attribute(s), and it is too late to do it there without flicker.
Now the default normal attribute is restored before the change affects
the rendering.

When the foreground color is not teken's default, clearing with the
wrong attributes gave strange cursor colors for some cursor types.

The default reverse attribute is not restored since it is unsupported.

2/3 of the clobbering was from 2 resetting window resizing calls.  The
second one is needed to restore the size, but must not reset.  Window
resizing also sanitizes the cursor position, and after the main reset
resets the window size, the cursor row would often be adjusted from
24 to 23 if it were not already reset to 0.  scteken_sync() is good
for restoring the window size and the cursor position in the correct
order, but was unusable at init time since scp->ts is not always
initialized then.  Adjust to use its internals.

I didn't notice any problems from the cursor reset.  The cursor should
be reset, and a previous fix was to reset it consistently a little
later.

Doing nothing for warm init works almost as well, if not better.  It
is not very useful to reset the escape state for mode changes, since
the reset is especially likely to be null then.  The escape state is
most likely to be non-initial and corrupted by its most normal uses
-- sloppy non-atomic output where a context switch or just mixing
stdout with stderr splits up escape sequences.

------------------------------------------------------------------------
r316737 | bde | 2017-04-12 18:52:06 +0000 (Wed, 12 Apr 2017) | 23 lines

Fix removal of mouse image by the vga planar renderer in the right border
in unusual cases.  Optimize and significantly clean up removal in this
renderer.  Optimize removal in the vga direct renderer.

Removal only needs to be done in the border (the part with pixels) in
both cases.  The planar renderer used the condition scp->xoff > 0 to
test whether a right border exists.  This actually tests for a left
border, and when the total horizontal border is 8 pixels, rounding gives
only a right border.  This was the unusual broken case.  An example
is easy to configure using something like "vidcontrol -f 8x16 iso-8x16
-g 79x25 MODE_27".

Optimize the planar case a little by only removing 9x13 active pixels
out of 16x16.  Optimize it a lot by not doing anything if there is no
overlap with the border.  Don't unroll the main loop or hard-code so
many assumptions about font sizes in it.  On my Haswell system, graphics
memory and i/o accesses takes about 520 cycles each so optimizations from
unrolling are in the noise.

Optimize the direct case to not do anything if there is no overlap with
the border.  Do a sanity check on the saveunder's coordinates.  This
requires a previous change to pass non-rounded coordinates.

------------------------------------------------------------------------
r316741 | bde | 2017-04-12 20:18:38 +0000 (Wed, 12 Apr 2017) | 24 lines

Improve drawing of the vga planar mode mouse image a little.  Unobfuscate
the method a lot.

Reduce the AND mask to the complement of the cursor's frame, so that area
inside the frame is not drawn first in black and then in lightwhite.  The
AND-OR method is only directly suitable for the text mouse image, since
it doesn't go to the hardware there.  Planar mode Mouse cursor drawing
takes 10-20 usec on my Haswell system (approx. 100 graphics accesses
at 130 nsec each), so the transient was not visible.

The method used the fancy read mode 1 and its color compare and color
don't care registers with value 0 in them so that all colors matched.
All that this did was make byte reads of frame buffer memory return 0xff,
so that the x86 case could obfuscate read+write as "and".  The read must
be done for its side effect on the graphics controller but is not used,
except it must return 0xff to avoid affecting the write when the write
is obfuscated as a read-modify-write "and".  Perhaps that was a good
optimization for 8088 CPUs where each extra instruction byte took as
long as a byte memory access.

Just use read+write after removing the fancy read mode.  Remove x86
ifdefs that did the "and".  After removing the "and" in the non-x86
part of the ifdefs, fix 4 of 6 cases where the shift was wrong.

------------------------------------------------------------------------
r316827 | bde | 2017-04-14 12:03:34 +0000 (Fri, 14 Apr 2017) | 19 lines

Further unobfuscate the method of drawing the mouse cursor in vga planar
mode.

Don't manually unroll the 2 inner loops.  On Haswell, doing so gave a
speedup of about 0.5% (about 4 cycles per iteration out of 1400), but
hard-coded a limit of width 9 and made better better optimizations
harder to see.  gcc-4.2.1 -O does the unrolling anyway, unless tricked
with a volatile hack.  gcc's unrolling is not very good and gives a
a speedup of about half as much (about 2 cycles per iteration).  (All
timing on i386.)

Manual unrolling was only feasible because the inner loop only iterates
once or twice.  Usually twice, but a dynamic check is needed to decide,
and was not moved from the second-innermost loop manually or by gcc.
This commit basically adds another dynamic check in the inner loop.

Cursor widths of 10-17 require 3 iterations in the inner loop and this
is not so easy to unroll -- even gcc stops at 2.

------------------------------------------------------------------------
r316830 | bde | 2017-04-14 14:00:13 +0000 (Fri, 14 Apr 2017) | 13 lines

Optimize drawing of the mouse cursor in vga planar mode almost as
much as possible, by avoiding null ANDs and ORs to the frame buffer.

Mouse cursors are fairly sparse, especially for their frame.  Pixels
are written in groups of 8 in planar mode and the per-group sparseness
is not as large, but it still averages about 40% with the current
9x13 mouse cursor.  The average drawing time is reduced by about this
amount (from 22 usec constant to 12.5 usec average on Haswell).

This optimization is relatively larger with larger cursors.  Width 10
requires 6 frame buffer accesses per line instead of 4 if not done
sparsely, but rarely more than 4 if done sparsely.

------------------------------------------------------------------------
r316865 | bde | 2017-04-14 17:02:24 +0000 (Fri, 14 Apr 2017) | 10 lines

Adjust shifting so that cursor widths up to 17 (was 9) work in vga planar
mode.

Direct mode always supported widths up to 32, except for its hard-coded
16s matching the pixmap size.  Text mode is still limited to 9 its 2x2
character cell method and missing adjustments for the gap between
characters, if any.

Cursor heights can be almost anything in graphics modes.

6 years agoMFC r316136:
eadler [Wed, 14 Mar 2018 07:58:11 +0000 (07:58 +0000)]
MFC r316136:

The switch to kernel terminal context needs to update more than the cursor
position.  Especially the screen size, and potentially everything except
the input state and attributes.  Do this by changing the cursor position
setting method to a general syncing method.

Use proper constructors instead of copying to create kernel terminal
contexts.  We really want clones and not new instances, but there is
no method for cloning and there is nothing in the active instance that
needs to be cloned exactly.

Add proper destructors for kernel terminal contexts.  I doubt that the
destructor code has every been reached, but if it was then it leaked the
memory of the clones.

Remove freeing of statically allocated memory for the non-kernel terminal
context for the same terminal as the kernel.  This is in the nearly
unreachable code.  This used to not happen because delicate context
swapping made the user context use the dynamic memory and kernel
context the static memory.  I didn't restore this swapping since it
would have been unnatural to have all kernel contexts except 1 dynamic.

The constructor for terminal context has bad layering for reasons
related to the bug.  It has to return static memory early before
malloc() works.  Callers also can't allocate memory until after the
first constructor selects an emulator and tells upper layers the size
of its context.  After that, the cloning hack required the cloning
code to allocate the memory, but for all other constructors it would
be better for the terminal layer to allocate and deallocate the
memory in all cases.

Zero the memory when allocating terminal contexts dynamically.

6 years agoMFC r315984:
eadler [Wed, 14 Mar 2018 07:55:29 +0000 (07:55 +0000)]
MFC r315984:

Restore switching to a separate kernel terminal "input" state and extend
it to a separate state for each CPU.

Terminal "input" is user or kernel output.  Its state includes the current
parser state for escape sequences and multi-byte characters, and some
results of previous parsing (mainly attributes), and in teken the cursor
position, but not completed output.  This state must be switched for kernel
output since the kernel can preempt anything, including itself, and this
must not affect the preempted state more than necessary.  Since vty0 is
shared, it is necessary to affect the frame buffer and cursor position and
history, but escape sequences must not be affected and attributes for
further output must not be affected.

This used to work.  The syscons terminal state contained mainly the parser
state for escape sequences and attributes, but not the cursor position,
and was switched.  This was first broken by SMP and/or preemptive kernels.
Then there should really be a separate state for each thread, and one more
for ddb, or locking to prevent preemption.  Serialization of printf() helps.
But it is arcane that full syscons escape sequences mostly work in kernel
printf(), and I have never seen them used except by me to test this fix.
They worked perfectly except for the races, since "input" from the kernel
was not special in any way.

This was broken to use teken.  The general switch was removed, and the
kernel normal attribute was switched specially.  The kernel reverse
attribute (config option SC_CONS_REVERSE_ATTR) became unused, and is
still unusable because teken doesn't support default reverse attributes
(it used to only be used via the ANSI escape sequence to set reverse
video).

The only new difficulty for using teken seems to be that the cursor
position is in the "input" state, so it must be updated in the active
input state for each half of the switch.  Do this to complete the
restoration.

The per-CPU state is mainly to make per-CPU coloring work cleanly, at
a cost of some space.  Each CPU gets its own full set of attribute
(not just the current attribute) maintained in the usual way.  This
also reduces races from unserialized printf()s.  However, this gives
races for serialized printf()s that otherwise have none.  Nothing
prevents the CPU doing the a printf() changing in the middle of an
escape sequence.