Commit Graph

283495 Commits

Author SHA1 Message Date
rin
e092cf89bf Switch earmv6{,hf}eb to BE8 in kernel side.
My strategy here is to define _ARM_ARCH_BE8 macro in arm/cdefs.h, if
__ARMEB__ && _ARM_ARCH_6.

Use this macro to determine whether system is compiled for and running on
BE8 mode or not.

Note that, for __ARMEB__, some conditions become compile-time constants
determined by _ARM_ARCH_BE8 macro, e.g., whether BE8 or BE32 are accepted
as a userland binary, or unaligned memory access is possible or not.
2020-12-01 02:43:13 +00:00
rin
a3e196b030 gcc.old: Switch earmv6{,hf}eb to BE8, ported from gcc. 2020-12-01 02:39:48 +00:00
rin
8f72a86eed Switch earmv6{,hf}eb from BE32 (deprecated) to BE8 (new), which enables
- binary compatibility with earmv7{,hf}eb and later, as well as
  COMPAT_NETBSD32 on aarch64eb
- unaligned memory access

whereas compatibility with earmv5{,hf}eb and prior is lost.

As we have never released kernel and userland for earmv6{,hf}eb yet,
this does not causes any compatibility problems.

Discussed on port-arm and tech-toolchain.
2020-12-01 02:39:08 +00:00
jkoshy
d1342fa268 Unbreak the lint build (sync to elftoolchain [r3912]). 2020-11-30 22:26:30 +00:00
sjg
25f0e79eda Added meta-cmd-cmp 2020-11-30 21:36:52 +00:00
rillig
30d7ed040f make(1): fix tests for :gmtime and :localtime for 32-bit time_t
https://bugs.freebsd.org/251465
2020-11-30 21:10:15 +00:00
skrll
b63e3dbc20 Ensure stores are observed before the 'sev' instructions. 2020-11-30 21:06:56 +00:00
rillig
6e61cbbfc0 make(1): clean up variable names in Dir_FindFile
The special path entry is called .DOTLAST, therefore the local variable
should have the same name.

A variable named 'base' must not point to the slash of a pathname.  It
may only point to the character after the slash, everything else is
confusing, even if it's only for a brief moment.
2020-11-30 20:25:37 +00:00
rillig
74587d252a make(1): document difference between 'cur' and 'dot' 2020-11-30 20:17:00 +00:00
rillig
cc33398f35 make(1): add test for directory cache and exists() 2020-11-30 20:12:29 +00:00
rillig
c574887a83 make(1): fix memory leak for lstat cache in -DCLEANUP mode 2020-11-30 18:49:58 +00:00
sjg
644330f605 Add some tests for meta mode 2020-11-30 18:32:49 +00:00
rillig
5bad562d79 make(1): document how short-circuit evaluation behaved on 2020-07-03 2020-11-30 18:20:20 +00:00
bouyer
df77affd56 Work in progress on dom0 PVH support. kernel boots and xl info works,
but we can't start a domU yet.
2020-11-30 17:06:02 +00:00
bouyer
d53e74a06f Switch some debug/informational printf to device_printf(). Usefull
for multiprocessor environnement.
2020-11-30 17:05:02 +00:00
bouyer
58850287e4 Introduce smap_enable()/smap_disable() functions, to be used from
C code.
2020-11-30 17:02:27 +00:00
kamil
a0bbc3d2d8 man.conf(5): Drop support for .me files
The .me troff macros are unused for any known man-pages.
2020-11-30 14:27:23 +00:00
msaitoh
eb6c0a84aa Apply ixgbe.c rev. 1.204 which was for ixgbe_msix_admin() to
ixgbe_legacy_irq(), too.

 >  An interrupt might not arrive when a module is inserted. When an link
 > status change interrupt occurred and the driver still regard SFP as
 > unplugged, issue the module softint before issuing LSC interrupt.

TODO: Reduce duplicated code.
2020-11-30 07:53:42 +00:00
msaitoh
48b6679adf s/ we we / we / 2020-11-30 05:30:56 +00:00
riastradh
92f37f2423 uhid(4): Omit needless softint indirection.
USB xfer callbacks already run in softint context at IPL_SOFTSERIAL,
and I see no reason why the call to psignal must happen instead at
the lower priority of IPL_SOFTCLOCK, so let's avoid using up the
scarce resource of softints for something that doesn't need 'em.

While here, use atomic_store_relaxed to update sc->sc_async and
atomic_load_relaxed to optimisitcally test it without acquiring
proc_lock.
2020-11-30 00:48:35 +00:00
riastradh
3766bfcd77 Note that open(O_ASYNC) does not work as advertised.
This matches Linux, which also advertises the same semantics and
fails to implement it, according to:

https://man7.org/linux/man-pages/man2/fcntl.2.html

(At what point should we collectively stop advertising the semantics
that doesn't work and call the bug a feature?)
2020-11-30 00:21:35 +00:00
msaitoh
ba72a7366e Add sgx, sgx_lc, serialize and tsxldtrk. 2020-11-30 00:04:02 +00:00
riastradh
e56a369d75 usb: Overhaul uhid(4) and uhidev(4) locking.
- uhidev API rules:

  1. Call uhidev_open when you want exclusive use of a report id.
     After it succeeds, you will get interrupts.

  2. Call uhidev_close when done with exclusive use of a report id.
     After it returns, you will no longer get interrupts.

     => uhidev_open/close do not nest.

  3. uhidev_write no longer requires the caller to have exclusive
     access -- if there is a write in progress, it will block
     interruptibly until done.  This way drivers for individual
     report ids need not work separately to coordinate their writes.

  4. You must uhidev_stop to abort any pending writes on the same
     report id.  (uhidev_stop no longer does anything else -- to
     ensure no more interrupts, just use uhidev_close.)

- Fix uhidev_open/close locking -- uhidev now has an interruptible
  config lock held only on first open and last close by any report id
  in the device, to serialize the transition between zero and nonzero
  numbers of references which requires opening/closing pipes and
  allocating/freeing buffers.

- Make /dev/uhidN selnotify(POLLHUP) when the device is yanked.

- Factor uhid device lookup and reference counting and dying
  detection and so on into uhid_enter/exit.

- Nix struct uhid_softc::sc_access_lock.  This served no purpose but
  to confuse me when trying to understand the logic of this beast
  (and to ensure uhidev_write exclusion, but it was uninterruptible,
  which is wrong for something that implements userland operations,
  and didn't actually work because uhidev_write did nothing to
  coordinate between different report ids).

- Fix locking in select/poll.

- Use atomics to manage UHID_IMMED to keep it simple.  (sc_lock would
  be fine too but it makes the code more verbose.)

- Omit needless UHID_ASLP -- cv_broadcast already has this
  micro-optimization.


With these changes, my Pinebook survives

for i in `jot 100`; do
        echo '###' $i
        for j in `jot 16`; do
                usbhidctl -rf /dev/uhid$j >/dev/null &
        done
        wait
done

while plugging and unplugging uhid(4) devices (U2F keys), and the U2F
keys still work as U2F keys.


ok nick, mrg

XXX pullup-9
XXX pullup-8?


Note on ABI and pullups: This changes the layout of struct
uhidev_softc, but with the sole exception of ucycom(4) -- which at
the moment is completely broken and unusable -- the only members that
USB HID drivers use are sc_udev and sc_iface, which haven't changed.
The layout of struct uhidev, which is allocated by each USB HID
driver in its own softc structure, is unchanged.
2020-11-29 22:54:51 +00:00
rillig
d8435a3ecc make(1): initialize global variables in dir.c
Calling CachedDir_Assign requires that the variable be initialized.  On
most systems, NULL is represented as all-zero bits already.  This change
is only for the few other systems.

Add some comments explaining the implementation of Dir_AddDir since that
is tricky to read from the code alone.
2020-11-29 21:50:50 +00:00
rillig
68212223a6 make(1): reduce memory allocation in meta_oodate 2020-11-29 21:31:55 +00:00
rillig
733418ce24 make(1): reduce memory allocation in meta mode 2020-11-29 21:28:06 +00:00
rillig
7a70c4ea70 make(1): add test variant for reference counting logging 2020-11-29 21:27:08 +00:00
rillig
22d703e606 make(1): clean up memory management for CachedDirs
Previously, the reference count for a newly created CacheDir had been
set to 1 in CacheNewDir.  This was wrong because at that point, the
object had not been referenced by any nonlocal variable.  The reference
count is no longer incremented at this point.

All callers of CacheNewDir either append the newly created CachedDir to
a SearchPath via Lst_Append and CachedDir_Ref, or they assign it to a
global variable via CachedDir_Assign.

Since the reference count is no longer wrongly incremented, it does not
need to be decremented more than necessary in Dir_End.  To keep the code
simple and maintainable, all assignments to global variables are now
handled by CachedDir_Assign.  Adding a CachedDir to a list is still done
manually via Lst_Append, and the corresponding code for decrementing is
in SearchPath_Clean and SearchPath_Free.  These details may be cleaned
up in a follow-up commit.

As a result, when OpenDirs_Done is called in the unit tests, the list of
open directories is empty.  It had been non-empty in a single unit test
before (dep-wildcards.mk), as a result of calling Dir_Expand.

The additional debug logging for the reference counting is not enabled
by default since it contains memory addresses, which makes the output
dependent on the memory allocator.

The function CachedDir_Destroy has been merged into CachedDir_Undef,
which had only been used in Dir_End before.  The new name emphasizes
that it corresponds to CachedDir_Ref.
2020-11-29 18:49:36 +00:00
rillig
d55908461f make(1): fix the reference count of dotLast going negative
The memory management for dotLast is quite simple.  It is initialized
exactly once main_Init > Init_Objdir > Dir_InitDir and freed exactly
once in main_CleanUp > Dir_End.  Previously, dotLast was not freed at all.

The first call to CachedDir_Unref decremented the refCount to 0 but
didn't free anything.  Next, CachedDir_Destroy was called, which
decremented the reference count to -1, therefore skipping the actual
freeing.  This was probably an implementation mistake.

Since Dir_End is called at the very end of main_CleanUp, no code
accesses dotLast after it has been freed.
2020-11-29 16:37:10 +00:00
rillig
b52551f521 make(1): move CachedDir_Destroy up to the related functions 2020-11-29 16:04:34 +00:00
rillig
85c7000e55 make(1): extract CachedDir_Free0 from CachedDir_Destroy 2020-11-29 15:58:37 +00:00
rillig
6034552ecf make(1): remove wrong comment in Dir_InitCur
In a makefile with repeated ".CURDIR=." lines, Dir_AddDir is called with
a NULL path, once per line.  Since the path is NULL, the search for
OpenDirs_Find is skipped and the directory is always read from disk.
The freshly read directory has a refCount of 1, and the refCount never
raises above 2.

In Dir_InitCur, the directory of the previous .CURDIR has a refCount of
2, which is decremented twice and then freed.  After this, the new
directory is placed in the global 'cur', after incrementing its refCount
to 2.

It still seems wrong that the refCount of 'cur' is 2 instead of 1, but
it works well.
2020-11-29 15:14:32 +00:00
rillig
470c3b700e make(1): add debug logging for OpenDirs_Done 2020-11-29 14:29:19 +00:00
phx
26c1d7d861 Message buffer is too small, since timestamps were enforced. 2020-11-29 12:38:44 +00:00
rillig
3afe048430 make(1): extract CacheNewDir from Dir_AddDir
Change the debug output for directories that are not found.
2020-11-29 12:30:40 +00:00
rillig
9c4948c9b0 make(1): make documentation of CachedDir.refCount more precise 2020-11-29 11:17:41 +00:00
rillig
09e000705a make(1): add debug logging for reference counting of CachedDir 2020-11-29 10:57:16 +00:00
rillig
432bd0ddcb make(1): normalize order of declarations in dir.c 2020-11-29 09:51:39 +00:00
rillig
087d4a0563 make(1): remove comment about returning const
The callers modify the reference count of the CachedDir, therefore it
must be modifiable.
2020-11-29 09:42:54 +00:00
rillig
c0a61e27e9 make(1): rename Dir_Destroy to CachedDir_Destroy
It is no longer exported by the Dir module.
2020-11-29 09:38:04 +00:00
rillig
84085cca68 make(1): use space instead of tab for preprocessor directives 2020-11-29 09:27:40 +00:00
rillig
95906832b0 style: fix typo 2020-11-29 09:15:33 +00:00
rillig
59d6def469 make(1): unexport CachedDir internals 2020-11-29 08:48:24 +00:00
rillig
6f66206a01 make(1): reduce memory allocation for dirSearchPath 2020-11-29 01:40:26 +00:00
rillig
40a620462f make(1): reduce memory allocations for parsing dependencies 2020-11-29 01:35:33 +00:00
rillig
d9f6df7cec make(1): reduce memory allocations in suffix storage 2020-11-29 01:30:38 +00:00
rillig
c91d221250 make(1): reduce memory allocations in suffix handling 2020-11-29 01:24:18 +00:00
rillig
ddcc472c42 make(1): reduce memory allocation in ExpandWildcards for suffixes 2020-11-29 01:19:11 +00:00
rillig
26c51dd6fc make(1): reduce memory allocation in ExpandChildren for suffixes 2020-11-29 01:16:37 +00:00
rillig
4c46d4bd3d make(1): reduce memory allocation in suffix candidate search 2020-11-29 01:12:45 +00:00