Commit graph

7282 commits

Author SHA1 Message Date
cinap_lenrek ecdf3f921e ?l: remove direct hunk manipulation from linkers, just call malloc()
as with recent changes, cc's malloc() could make the hunk pointer
misaligned. in the the compilers, the hunk pointer is used directly
by the lexer with no effort to to keep the hunk pointer aligned.

alloc/malloc still return aligned pointers, but hunk itself can
be on a odd address after allocation of a odd sized amount of bytes.

however, in the linkers, this assumption appears to be differnet. as
most allocations mostly allocate padded structures. however, symbol
lookup allocates strings on byte-size ganularity and the cc's malloc
would misalign the hunk pointer after the malloc() call. while the
rest of the code assumed hunk pointer was always aligned.

this change removes all the hunk pointer fiddling from the linker,
and we just call malloc() (which will use the fast implmenentation
of cc, and should not really make much of a performance difference).
2020-05-12 22:04:30 +02:00
Ori Bernstein 73f38fc546 [ape] add missing conversion flags for scanf
We're missing type flags for:

	hh: char
	ll: vlong
	z:  size_t
	t:  ptrdiff_t
	j:  intmax_t

The lack of '%lld' was causing us to fail when parsing
timezone files. This brings us in line with the specifiers
in the C99 standard, section 7.19.6.2p11
2020-05-12 10:48:33 -07:00
cinap_lenrek 27fc79b04b devip: fix ifc recursive rlock() deadlock
ipiput4() and ipiput6() are called with the incoming interface rlocked
while ipoput4() and ipoput6() also rlock() the outgoing interface once
a route has been found. it is common that the incoming and outgoing
interfaces are the same recusive rlocking().

the deadlock happens when a reader holds the rlock for the incoming interface,
then ip/ipconfig tries to add a new address, trying to wlock the interface.
as there are still active readers on the ifc, ip/ipconfig process gets queued
on the inteface RWlock.

now the reader finds the outgoing route which has the same interface as the
incoming packet and tries to rlock the ifc again. but now theres a writer
queued, so we also go to sleep waiting four outselfs to release the lock.

the solution is to never wait for the outgoing interface rlock, but instead
use non-queueing canrlock() and if it cannot be acquired, discard the packet.
2020-05-10 22:51:40 +02:00
cinap_lenrek dbfec06bf1 kernel: fix checkpages() and segflush() on SG_PHYSICAL type segments
do not touch s->map on SG_PHYSICAL type segments as they do
not have a pte map (s->mapsize == 0 && s->map == nil).

also remove the SG_PHYSICAL switch in freepte(), this is never
reached.
2020-05-10 16:54:42 +02:00
kvik 0099db7b5b merge 2020-05-10 03:24:19 +02:00
kvik 1c3a6fc67e acme: add missed error checks 2020-05-10 03:18:57 +02:00
cinap_lenrek 662aff21a8 merge 2020-05-10 02:44:37 +02:00
cinap_lenrek c474179f9a usbxhci: fix wrong control endpoint 0 output device context address
the calculation for the control endpoint0 output device context
missed the context size scaling shift, resulting in botched
stall handling as we would not read the correct endpoint status
value.

note, this calculation only affected control endpoint 0, which
was handled separately from all other endpoints.
2020-05-10 02:43:39 +02:00
Ori Bernstein bfc8cdfff5 fix '%[]' specifiers and '%n' (thanks phil9)
When a match() fails, we need to unget the character we
tried to match against, rather than leaving it consumed.

Also, we can't break out of a conversion before we reach
the end of a format string, because things like the '%n'
conversion do not consume anything, and should still be
handled.
2020-05-09 15:10:39 -07:00
kvik 758edf2b14 nusb/kb: add quirks for Elecom HUGE trackball
As said in the code comment:

	Elecom trackball report descriptor lies by
	omission, failing to mention all its buttons.
	We patch the descriptor with a correct count
	which lets us parse full reports. Tested with:
		Elecom HUGE (M-HT1DRBK, M-HT1URBK)

The descriptor fixup is adapted from Linux kernel:
	drivers/hid/hid-elecom.c
in which a more detailed account of why and how this
works may be found.

A followup change to nusb/kb will be needed to expose
these additional events for potential remapping.
2020-05-08 20:49:11 +02:00
cinap_lenrek 2c3e60d95b merge 2020-05-07 23:28:55 +02:00
cinap_lenrek 04066fe973 bcm64: fix kernels cmpswap() function
spectacular bug. cmpswap() had a sign extension bug
using sign extending MOV to load the old compare
value and LDXRW using zero extension while the CMP
instruction compared 64 bit registers.

this caused cmpswap with negative old value always
to fail.

interestingly, libc's version of this function was
fine.
2020-05-07 23:27:27 +02:00
Ori Bernstein ec4011acf7 fix typo: mouse->xy, not w->mc.xy 2020-05-07 13:23:15 -07:00
kvik 6d25e194e2 aux/getflags: remove rogue debug print 2020-05-07 18:37:08 +02:00
Ori Bernstein 5749900573 bring stdint.h closer to spec
C99 requires that if intXX_t types are defined, int_fastxx_t and
int_leastxx_t types are defined as well. We define all three to
be identical (intXX_t == int_fastXX_t == int_leastXX_t).
2020-05-06 15:39:12 -07:00
kvik ccf5d3fb9d aux/getflags: improve flagfmt parser
This makes the flagfmt parser more robust and accepting
a looser input language — namely by allowing whitespace
around specifier fields and ignoring any empty fields.

Long flagfmts can thus be pleasingly displayed:

	flagfmt='
		a, b, c, C:cache,
		m:mtpt mountpoint,
		s:srvn srvname'
2020-05-07 00:10:09 +02:00
Ori Bernstein 0dc9c8d019 Reset click count on mouse motion. 2020-05-06 13:38:39 -07:00
Sigrid 7de7414e88 tmac.eai: wrapper around -me: auto indexing sections, .TC macro (thanks sirjofri) 2020-05-04 11:57:24 +02:00
Sigrid 5e7959182a add missing /sys/lib/tmac/me files (thanks sirjofri) 2020-05-04 11:55:29 +02:00
cinap_lenrek ac88ce4f7f make bind(2) error handling consistent
The mount() and bind() syscalls return -1 on error,
and the mountid sequence number on success.

The manpage states that the mountid sequence number
is a positive integer, but the kernels implementation
currently uses a unsigned 32-bit integer and does not
guarantee that the mountid will not become negative.

Most code just cares about the error, so test for
the -1 error value only.
2020-05-02 17:32:01 +02:00
cinap_lenrek 7ff6ea0f70 libdraw: fix mount() error handling in newwindow() 2020-05-02 17:05:17 +02:00
cinap_lenrek 19cc46bc5e sed: accept and ignore -E and -r flags for unix compatibility 2020-05-02 16:56:52 +02:00
cinap_lenrek d0c87bada6 ip/cifsd: implement primitive per-share unix id mapping for wstat() 2020-05-02 16:53:52 +02:00
cinap_lenrek badbf50b0c merge 2020-05-02 15:34:00 +02:00
cinap_lenrek 8e2cfc0464 ether82543gc, ether82557, ethervirtio: do kproc() call ouside of spinlock 2020-05-02 15:32:19 +02:00
Ori Bernstein d935bb25d2 use #error when missing define
This makes it easier to figure out what's going wrong when
we forget to define _POSIX_SOURCE.
2020-05-01 13:29:08 -07:00
Ori Bernstein eb73718c25 merge 2020-04-28 20:51:19 -07:00
Ori Bernstein 9b8af27299 facelift for mothra: flat ui is in.
Remove false 3d, add borders for visual separation between
content area and navigation area.
2020-04-28 20:50:10 -07:00
Sigrid 3bdf242555 libsec/base58enc: null-terminate the result 2020-04-28 12:49:05 +02:00
Ori Bernstein dcf96a006d missing headers rate a FATAL. 2020-04-27 20:13:16 -07:00
cinap_lenrek 39c3fd117a lib9p: reject reads on closed fids and writes on directories
mischief provided the following test that shows the issue:

ramfs -S crash

aux/9pcon /srv/crash <<EOF
Tversion 8192 9P2000
Tattach 0 -1 $user ''
Tcreate 0 dir 020000000777 0
Tattach 5 -1 $user ''
Twalk 5 6 dir
Tread 6 0 512
EOF

the problem is that lib9p wrongly allowed reads on closed fids,
due to the permission check only considering the lower 2 bits.
a closed fid has fid->omode == -1 and it would pass on read for:

(-1 & 3) == 3 == OEXEC

the following change explicitely checks for for the closed case
and also rejects writes on directories (they are rejected on
open/create, but a broken 9p client could still issue the request).
2020-04-27 19:55:42 +02:00
cinap_lenrek 00bfe3ec2b merge 2020-04-26 19:55:53 +02:00
cinap_lenrek 61a062ee9f kernel: improve page reclaimation strategy and locking
when reclaiming pages from an image, always reclaim all
the hash chains equally. that way, we avoid being biased
towards the chains at the start of the Image.pghash[] array.

images can be in two states: active or inactive. inactive
images are the ones which are not used by program while
active ones aare.

when reclaiming pages, we should try to reclaim pages
from inactive images first and only if that set becomes
exhausted attempt to release text pages and attempt to
reclaim pages from active images.

when we run out of Image structures, it makes only sense
to reclaim pages from inactive images, as reclaiming pages
from active ones will never free any Image structures.

change putimage() to require a image already locked and
make it unlock the image. this avoids many pointless
unlock()/lock() sequences as all callers of putimage()
already had the image locked.
2020-04-26 19:54:46 +02:00
qwx 0fc1abc73d mothra: fix a few errors in previous patch
- nil check pl_blue allocation, and don't do it every time pl_rtdraw is called
- fix re-adding previously removed flushimage calls
- correct format for pointer
- sysfatal in pl_drawinit on error
2020-04-26 19:43:10 +02:00
Ori Bernstein c6f7989176 copy all the tokens from the tokenrows with a paste.
if we do 'CAT(foo bar, baz quux)', the resulting token row
should have 3 tokens: 'foo', 'barbaz', 'quux'.

tested by jonasa, rebuilding /sys/src, perl, netsurf, and nuklear.
2020-04-26 09:32:42 -07:00
Ori Bernstein 8ebe958ddf add missing header change (thanks qwx) 2020-04-26 09:03:42 -07:00
Ori Bernstein d6598a2a31 Support for neo2 keyboard layout
Modify aux/kbdfs to work with neo2 layout.
- add new modifier, increase limit on layers.
- Add Kaltgr for mod3
- Add mod4

This change only implements the alphanumeric
block of the keyboard in the kbmap, as neo2
is mainly used for blind typing and is not
needed that much anywhere else, this leaves
the numpad like it is.

(Thanks, jstsmthrgk@jstsmthrgk.eu)
2020-04-25 20:46:45 -07:00
stanley lieber 2614fa02f7 mothra: make user interface monochrome 2020-04-25 21:55:43 -04:00
stanley lieber 9a7c5d5653 mothra: remove extraneous lines and decoration (fake 3d). patch extracted from my forked mess by Ori_B. 2020-04-25 21:53:54 -04:00
Ori Bernstein 60c34ebb2d tweak selection criteria
grow selection from point of click, not start of selection region.
starting at the beginning of the selection region causes the match
logic to kick in, which is confusing.
2020-04-25 15:18:04 -07:00
cinap_lenrek 7feab4dc59 cc: simplify macexpand() and off-by-one error
the caller of macexpand() needs one more byte in
the buffer to append peekc.

make macexpand() actually check for buffer overflow.

just use strdup() to duplicate include file name
instead of the hunk dance.

move GETC() macro in cc.h
2020-04-25 22:16:44 +02:00
Ori Bernstein 4adb1d68d1 fix typos in time calculation
the results of the time calculation were garbled -- and
apparently negative on my system when testing, so the
test passed when it shouldn't have.
2020-04-25 11:00:27 -07:00
Ori Bernstein d52d7bc121 Backed out changeset 2737b9af622b
not what I wanted to commit.
2020-04-25 10:57:17 -07:00
Ori Bernstein 2de164c51d fix typos in time calculation
the results of the time calculation were garbled -- and
apparently negative on my system when testing, so the
test passed when it shouldn't have.
2020-04-25 10:43:39 -07:00
Ori Bernstein 5d7e9bee3c Bump protocol version for Ttclick 2020-04-25 09:38:02 -07:00
Ori Bernstein 8bc290cc0f triple click selection in acme
see the last 2 commits.
2020-04-25 08:59:14 -07:00
Ori Bernstein 6f44393958 triple click selection in rio
same as sam and vt, three clicks selects a
whitespace-delimited line.
2020-04-25 08:58:24 -07:00
Ori Bernstein f616a0c1bd triple click selection in sam
three clicks selects a whitespace-delimited line.
2020-04-25 08:57:26 -07:00
cinap_lenrek 4fb7462bd5 pc, pc64: use softscreen double buffering for *bootscreen= framebuffer
it is probably almost always a good idea to use
double buffering with a unaccelerated framebuffer.
2020-04-24 20:26:38 +02:00
cinap_lenrek 759656ad4c bcm, bcm64: dancing to the drum of the linux clowns for device tree memory size detection (thanks kenji)
looks like linux changed the device tree names for
the memory node:

4b17654f51 (diff-ac03c9402b807c11d42edc9e8d03dfc7)

this fixes the memory size detection with latest firmware
on raspberry pi4-b (4GB) for kenji.
2020-04-22 19:57:25 +02:00
stanley lieber 77048feb25 /sys/man/1/mothra: add description of Plumb menu item. 2020-04-21 21:14:26 -04:00
stanley lieber 27743b56d8 mothra.c: add Plumb menu item, and update man page. my original changes sanity-checked by Ori_B. 2020-04-21 21:12:32 -04:00
stanley lieber bd78cd2dd3 rdhtml.c: restore original fonts. dejavusans was my change, my fault. it never looked right outside of drawterm on osx (mea culpa). this is easy to change for anyone who prefers something else, but it's difficult to imagine native users preferring our very fuzzy dejavusans to anything else. 2020-04-21 21:09:12 -04:00
Ori Bernstein eb266ded8d remove unused macro from chan.c 2020-04-21 17:32:02 -07:00
cinap_lenrek 81c9ede53f samterm: don't scroll invisible (command) window (thanks umbraticus)
with scroll-wheel scrolling, this case can happen with the
command window:

umbraticus → cinap: create fullscreen file buffer by right-clicking in cmd window
2020-04-22 00:55:58 +02:00
cinap_lenrek 2c317dccea merge 2020-04-20 00:08:35 +02:00
cinap_lenrek 8499401ada ?a, ?c: fix macro debug prints 2020-04-19 23:57:33 +02:00
cinap_lenrek 313216e6fb ?c: get rid of sprint(), strcpy() and strcat()/strncat(), cleanup 2020-04-19 23:51:18 +02:00
cinap_lenrek b43720e3f7 [257]l: cleanup fmt routines, replace sprint() 2020-04-19 23:47:23 +02:00
cinap_lenrek c66b3739ac cc: cc.h changes needed by previous commit 2020-04-19 23:42:02 +02:00
cinap_lenrek 0d59a2358a ?a, cc: fix buffer overflows in built-in preprocessor (macbody)
add a buffer size argument to macexpand() and check for
overflow.

check for overflow when parsing #include directives.
2020-04-19 23:37:05 +02:00
cinap_lenrek e24bfa4941 ?a: catch symb[NSYMB] buffer overflow in lexer, cleanup, assume thechar is a rune 2020-04-19 22:59:21 +02:00
cinap_lenrek 3f87ffea44 cc: get rid of sprint() and temporary buffer for type conversion fuction
slookup() copies to symb, so use the symb[NSYMB] buffer directly
to declare type conversion functions and get rid of the arbitrary
sized local buffer. replace sprint() with snprint().
2020-04-19 20:44:19 +02:00
Ori Bernstein 260d1eaaa7 Make priority array max size explicit.
we were implicitly depending on UMINUS being the last entry
in the operator table -- that's fragile.
2020-04-19 11:26:31 -07:00
Ori Bernstein 15a32f0683 fix cpp operator associativity
We used to treat all operators as right associative,
which means that we would evaluate them incorrecty.
For example, '2 - 1 + 1' would evaluate as '2 - (1 + 2)',
instead of '(2 - 1) + 1'.

This adds an assoc parameter to struct pri, and then uses
it to decide how to evaluate operators.
2020-04-19 11:15:13 -07:00
Ori Bernstein 2c596d0021 merge 2020-04-19 09:03:35 -07:00
Ori Bernstein 21831527cb dont overflow the stack
when pushing expressions in cpp, particularly complex ones could
overflow the stack and silently corrupt our data structures. add
checks when we push, and bump the stack size up.
2020-04-19 09:02:21 -07:00
rgl 3a79916c9b libmemdraw: remove inexistent build targets 2020-04-19 15:30:58 +02:00
cinap_lenrek d441767904 merge 2020-04-19 04:34:16 +02:00
cinap_lenrek 34a1b1bb22 ?c: fix Bconv() misusage of strncat() 2020-04-19 04:33:07 +02:00
stanley lieber 03aeeafffb fortunes: As much as I'd love to I feel I have to let it go -- rminnich 2020-04-18 21:37:53 -04:00
cinap_lenrek e6634fbd0c 6c: conserve registers for floating point operations
for floating point operations, reuse the return register
on the right hand side if it has higher complex number
than the left hand side to conserve registers.

this makes the following code compile, that was previously
run out of floating point register:

float
f(float r[15])
{
	return (r[0] + (r[1] * (r[2] + r[3] * (r[4] + r[5] * (r[6] + r[7] * (r[8] + r[9] * (r[10] + r[11] * (r[12] + r[13] * r[14]))))))));
}

the downside is that this produces extra move operations.
2020-04-19 01:25:35 +02:00
Ori Bernstein 380adf8b48 aux/getflags: support named flags
When using aux/getflags, it produces unnecessarily obscure
names for the flags. This allows the caller of aux/getflags
to support arbitrary names.
2020-04-18 15:38:38 -07:00
cinap_lenrek 8ae77554dd 7l, ql: dont assume . is in the path for running mkcname (thanks sam-d) 2020-04-18 19:07:06 +02:00
cinap_lenrek 94bd7700aa rc: fix code serialization for PIPEFD (thanks BurnZeZ)
BurnZeZ reported this the other day. It seems like if we have
a pipeline that looks like:

	fn foo{cat < <{echo hi}}

then the '<' will get merged in /env/'fn#foo'. This change
fixes pcmd to add a space. It looks to me like this is the
only token that can get merged this way by pcmd.
2020-04-18 18:20:34 +02:00
cinap_lenrek 57d690c482 ip(3): remove outdated maximum ipstack number limit.
the maximum number of ip stacks is a implementation detail
of devip. it is 128 currently, instead of 16 as suggested
in the manpage.
2020-04-15 18:16:22 +02:00
23hiro fe6affc20f draw(3): typo dp 2020-04-13 00:33:26 +02:00
cinap_lenrek 0e96bbd073 merge 2020-04-12 16:12:41 +02:00
cinap_lenrek 1aa80c1d10 kernel: remove unused mem2bl() prototype 2020-04-12 16:11:41 +02:00
Ori Bernstein d68f4adeba merge 2020-04-11 14:20:53 -07:00
Ori Bernstein 2d1dac07f7 triple-click to select non-whitespace segment
The previous patch to plumb non-whitespace segments was
confusing due to lack of visual feedback. This removes
the empty selecton plumb behavior, and instead makes
triple clicking work to get a plumbable selection.
2020-04-11 14:19:46 -07:00
cinap_lenrek 3cdbbcd859 merge 2020-04-11 22:37:30 +02:00
cinap_lenrek 0c7da78f45 ip/ipconfig: ignore default routes targeting ourselfs
when running ndb configuration, we might inherit the ipgw=
attribute from the ipnet pointing to our own ip address
(we are the default gateway). ignore such entries.

do not add default routes with gateway equal to our own
local (ip4) or link-local ip address (ipv6).
2020-04-11 22:36:19 +02:00
Ori Bernstein ebb3e31118 vt plumbing: don't require selection
Plumbing text in vt requires selecting the text that you
want to plumb precisely. This patch makes plumbing behave
the same way that it does in rio.
2020-04-11 11:56:04 -07:00
cinap_lenrek a7dab2728b ip/ipconfig: resolve ipgw to an ip address as neccesary (thanks k0ga)
ndb(6) states that ipgw needs to be an ip address,
however, attempting to resolve ipgw is not difficult
and already done by ip/dhcpd.
2020-04-11 18:09:48 +02:00
cinap_lenrek d8545806fc vl: remove unused mysbrk() prototype 2020-04-11 14:20:41 +02:00
cinap_lenrek 550b6d1aad qa: remove ALLOC() and ALLOCN() macros 2020-04-11 14:20:13 +02:00
cinap_lenrek ca9d65e40b cc: remove mysbrk(), exponentially increase gethunk() allocation delta
mysbrk() was only used in gethunk() and should not be
called by anyone, so dont export the symbol.

simplify gethunk() using brk().

double allocation size on each call until we reach
1000*NHUNK.

use signed long for nhunk as alignment rountin might
make it negative and handle that case.
2020-04-11 14:19:35 +02:00
cinap_lenrek 49c159b50f 6c: remove mystery sys.c file 2020-04-11 05:19:11 +02:00
cinap_lenrek 1b8a569417 cc, ?[acl]: fix gethunk() and move common memory allocator code to cc/compat
for gethunk() to work, all allocators have to use it,
including allocations done by libc thru malloc(),
so the fake allocation functions are mandatory for
everyone.

to avoid duplication the code is moved to cc/compat
and prototypes provided in new cc/compat.h header.
2020-04-11 05:03:49 +02:00
cinap_lenrek 9d46360c9d backout the gethunk() again, as that breaks the assemblers
the assemblers share gethunk() cc/macbody but are compiled
without compat.c, so calls such as getenv() trigger malloc()
which does its own sbrk() calls, breaking the continuity
of the hunk.

so this change needs another revision. until then, this is
backed out.
2020-04-11 01:26:36 +02:00
cinap_lenrek 1d3644a168 cc, ?l: fix gethunk() to actually grow allocation
the compilers and linkers use ther own memory allocator.
free memory is between hunk and hunk+nhunk. allocation
works by checking if nhunk is bigger or equal to the
amount needed, and if not, repeatedly call gethunk()
until there is. after that, the allocated amount is added
from hunk and subtracted from nhunk by the user.

the problem was when the needed amount was bigger than
the default NHUNK size gethunk() allocates per call.
gethunk() would not actually grow nhunk, but instead
just set hunk and nhunk variables to the last allocated
block. this resulted in a infinite loop of calls to
gethunk() until sbrk() would hit the maximum size for
the BSS segment.

this change makes gethunk() actually grow the hunk space,
increasing nhunk, and only updating hunk when nhunk was
previously zero. we assume that mysbrk() retuns increasing
addresses and that the space between the previous hunk+nhunk
and the new block base returned by mysbrk() is usable.
2020-04-10 23:11:25 +02:00
cinap_lenrek e610ffaf1b merge 2020-04-10 22:26:37 +02:00
cinap_lenrek a39cc60c52 cc: backout gethunk() change
the real problem is that gethunk() does not grow the allocation
but just allocates a new hunk, so repeated calls to gethunk()
wont make nhunk grow to satisfy the allocation.

this will be fixed in a upcoming commit.
2020-04-10 22:25:29 +02:00
Sigrid 2cdf1a3c79 cc, ?a, ?l: change thunk type to uintptr 2020-04-10 20:38:45 +02:00
Sigrid 6018316eef cc: sbrk in bigger chunks as it grows, so it gets a chance to use the ram/swap available 2020-04-10 17:19:44 +02:00
cinap_lenrek 1fe3143e4c kernel: cleanup the software mouse cursor mess
The swcursor used a 32x32 image for saving/restoring
screen contents for no reason.

Add a doflush argument to swcursorhide(), so that
disabling software cursor with a double buffered
softscreen is properly hidden. The doflush parameter
should be set to 0 in all other cases as swcursordraw()
will flushes both (current and previours) locations.

Make sure swcursorinit() and swcursorhide() clear the
visibility flag, even when gscreen is nil.

Remove the cursor locking and just do everything within
the drawlock. All cursor functions such as curson(),
cursoff() and setcursor() will be called drawlock
locked. This also means &cursor can be read.

Fix devmouse cursor reads and writes. We now have the
global cursor variable that is only modified under
the drawlock. So copy under drawlock.

Move the pc software cursor implementation into vgasoft
driver, so screen.c does not need to handle it as
a special case.

Remove unused functions such as drawhasclients().
2020-04-10 17:12:51 +02:00
cinap_lenrek 7b309d2e28 pc, pc64: remove "got unassigned irq" prints
most pc's are multiprocessors these days, that use apic or
msi interrupts, then the irq does not matter anymore. and
uefi does not even assign irq to pci devices anymore. if
we have a problem enabling an interrupt, we will print.
2020-04-09 13:05:10 +02:00
cinap_lenrek 6041d2048c 9bootpxe: simplify 2020-04-08 23:48:09 +02:00
cinap_lenrek abc5a66c56 9bootpxe: continues the war against random DHCPv6 DUIDs
Some UEFI implementations use random UUID based DUID instead of
ethernet address, but use ethernet derived link-local addresses.
So extract the MAC from our IPv6 address.
2020-04-08 23:37:38 +02:00
Alex Musolino a3f6976a76 notify(2): fix typo 2020-04-07 12:14:12 +09:30
cinap_lenrek 665b78da23 merge 2020-04-06 01:31:35 +02:00
cinap_lenrek 9e2344a5be pc64: remove rampage() nil check
rampage() never returns nil
2020-04-06 01:29:12 +02:00
cinap_lenrek a35cd0f861 pc: zero rampage() memory (thanks LordCreepity)
memory returned by rampage() is not zeroed, so we have to
zero it ourselfs. apparently, this bug didnt show up as we
where zeroing conventional low memory before the new memory
map code. also rampage() never returns nil.
2020-04-06 01:28:34 +02:00
Alex Musolino 80fdafd1d6 file: try ismp4() before ismp3()
It is possible to find the mp3 sync word near the start of an mp4
file.  As such, file(1) could incorrectly identify some mp4s as mp3s.
2020-04-05 23:26:52 +09:30
cinap_lenrek 0ba0820070 dossrv: fix falloc() for >31 bit sector numbers (thanks sl) 2020-04-05 03:46:47 +02:00
cinap_lenrek ecba7822e3 nusb/usbd: fix portreset error handling
error handling in portreset() was wrong. we called closedev()
on the device without changing the reference.

just call portdetach() when the reset fails.
2020-04-05 03:05:06 +02:00
cinap_lenrek 315f20b9f4 nusb/audio: set frequency only when supported
before setting the sampling rate, check bit D0
"Sampling Frequency" in the audio class specific
endpoint descriptor.
2020-04-05 00:59:47 +02:00
cinap_lenrek f5352eb501 merge 2020-04-04 17:17:15 +02:00
cinap_lenrek 339112abc3 mtx, ppc: use proctab() to index into process table 2020-04-04 16:52:08 +02:00
cinap_lenrek 30cbaa5c48 kernel: remove scheddump() comment for delay() in */fns.h 2020-04-04 16:50:37 +02:00
cinap_lenrek 5f1b70f437 pc, pc64: new memory map code
This replaces the memory map code for both pc and pc64
kernels with a unified implementation using the new
portable memory map code.

The main motivation is to be robust against broken
e820 memory maps by the bios and delay the Conf.mem[]
allocation after archinit(), so mp and acpi tables
can be reserved and excluded from user memory.

There are a few changes:

new memreserve() function has been added for archinit()
to reserve bios and acpi tables.

upareserve() has been replaced by upaalloc(), which now
has an address argument.

umbrwmalloc() and umbmalloc() have been replaced by
umballoc().

both upaalloc() and umballoc() return physical addresses
or -1 on error. the physical address -1 is now used as
a sentinel value instead of 0 when dealing with physical
addresses.

archmp and archacpi now always use vmap() to access
the bios tables and reserve the ranges. more overflow
checks have been added.

ramscan() has been rewritten using vmap().

to handle the population of kernel memory, pc and pc64
now have pmap() and punmap() functions to do permanent
mappings.
2020-04-04 16:48:37 +02:00
cinap_lenrek 8debb0736e kernel: add portable memory map code (port/memmap.c)
This is a generic memory map for physical addresses. Entries
can be added with memmapadd() giving a range and a type.
Ranges can be allocated and freed from the map. The code
automatically resolves overlapping ranges by type priority.
2020-04-04 16:04:27 +02:00
cinap_lenrek 7451bb405d ether8390: remove unused variables 2020-04-04 15:55:48 +02:00
cinap_lenrek 6498ce3bf2 ether8003: use physical addresses for ISAConfig ether->mem
Fix the inconsistent use of ether->mem. Always use physical
addresses. Let ether8390 convert to virtual addresses using
KADDR() when we have to copy data in/out.
2020-04-04 15:47:50 +02:00
Alex Musolino ad3da2fac2 merge 2020-04-01 22:57:15 +10:30
Alex Musolino c393806718 upas/fs: fix sending of "delete" plumb messages
Broken by changeset 2cc069392228.
2020-04-01 22:49:19 +10:30
Sigrid 55033d9aed kbd(1): revert repeat/delay change 2020-04-01 11:42:35 +02:00
Sigrid 4756cf549a devkbd: bits bad! revert repeat/delay, better patches welcome 2020-04-01 11:31:19 +02:00
cinap_lenrek d3512f60df ip/dhcp6d: work arround non-ethernet based client duid
in ndb, we use the ethernet mac to identify the client.
in dhcpv6, there is just a uniqueue device id that
might even be generated randomly. to find the ethernet
address of a client, check the duid type and only use
it when the dudid is of type 1 (link layer) or 3 (link
layer address + time) and the link layer address type
is 1 (ethernet). otherwise, assume the source ip is
a link local address and extract it from that.

this hack works for thinkpad t495, which uses random
uuid based client duid.
2020-03-31 21:57:53 +02:00
cinap_lenrek 480ce0314e audiohda: add pci vid/did for AMD Raven HD Audio Controller (T495) 2020-03-31 19:00:32 +02:00
Sigrid ddaaf65efe kbd(3): fix a typo (thanks Alex Musolino) 2020-03-31 10:04:24 +02:00
cinap_lenrek 4dcb3ce2ab xen: fix rebootcode linkage
need to strip the a.out header, just like with the pc
kernel.
2020-03-29 22:47:42 +02:00
BurnZeZ 11025d6f4a lib9p: fix re-use of root Qid when using createfile(); remove unused dirqidgen 2020-03-29 17:39:30 +00:00
Sigrid f5f37ba5eb pc64: enable uartpci (thanks taw9 for testing) 2020-03-29 19:28:39 +02:00
Ori Bernstein 7ae64cec10 merge 2020-03-28 20:33:47 -07:00
Ori Bernstein 8589a591de we prefer nil over 0, make the example show it. 2020-03-28 20:32:53 -07:00
cinap_lenrek 1b8d87555a pc, pc64: ignore the 64-bit bar flag when reserving membar
a bar with bit 3 set means the bar is the low half of
a 64-bit wide bar.
2020-03-29 00:49:07 +01:00
cinap_lenrek 3c36cadefd pc: fix mp boot regression due mistake in mkfile
the previous mkfile had a sneaky hack that would use
sed to delete the first 2 lines of hex output to strip
the 32 byte long a.out header for apbootstrap and rebootcode.

use 8l -H3 flag to strip the header from the output file.
2020-03-29 00:44:09 +01:00
Sigrid 9014360921 kbd: add "repeat" file to set typematic repeat rate/delay on PS/2 keyboards 2020-03-28 15:37:48 +01:00
Alex Musolino 47e3c088c9 grep: fix handling of -b flag
Output buffering is automatically disabled when reading from stdin.
In this case, supplying the -b flag ought to be redundant.  However,
since Bflag was being XORed into the flag set - rather than simply
ORed - supplying -b would actually enable output buffering.
2020-03-26 18:24:39 +10:30
Ori Bernstein 2f67e21393 turn ptrdiff_t into a 64 bit type
while technically a 32 bit ptrdiff_t is in spec on
systems with 64 bit ponters as long as we guarantee
that individual objects are small enough, this can
confuse legitimate code, so lets fix this.
2020-03-24 14:45:15 -07:00
Ori Bernstein 0e1fec841e add intmax_t/uintmax_t as required by c99 7.18.1.5 2020-03-24 14:41:31 -07:00
Ori Bernstein 3fe2924287 evaluate #if expressions using vlong
#if expressions are expected to be evaluated using intmax_t,
according to the C99 spec, 6.10.1 p3. On plan9, intmax_t maps
to vlong.
2020-03-23 09:18:44 -07:00
Sigrid 87e437a856 update colemak kbmap, simpler version with scroll working (thanks jeremy) 2020-03-21 01:50:11 +01:00
Sigrid 3377b78cd3 add colemak kbmap (thanks Silas McCroskey) 2020-03-21 01:40:03 +01:00
Sigrid 5da2b91989 add swiss german kbmap (thanks mike) 2020-03-21 01:07:40 +01:00
BurnZeZ aa5e86a8ca kbdfs: fix kbmapread() not accounting for reads smaller than the size of the line 2020-03-20 18:08:34 +00:00
Ori Bernstein 37b86df09f Improve the posix preprocessor.
This fixes token pasting, making it expand when
it should expand, and paste before expansion when
it should paste before expanding.

	#define CAT(a, b) a ## b
	#define BAR	3
	#define FOO	CAT(BAR, 3)
	FOO

now produces 33, while

	#define CAT(a, b) a ## b
	#define EOF	(-1)
	#define NOP(x)	x
	NOP(CAT(foo, EOF))
	CAT(,EOF)
	CAT(,)

produces

	fooEOF
	(-1)
	<empty>

respectively.
2020-03-17 22:03:25 -07:00
Ori Bernstein 52dc943702 fix ccom idempotency
ccom may be called multiple times on the same
node, via 'goto loop' calls from the commute
label, OADD, and a few other places.

Casts to void could null out the LHS of the
node, which would cause the compiler to crash
if the cast was revisited due to one of these
cases, because we tried frobbing n->left.

Now, if n->left is nil, we just return.w
2020-03-15 15:08:04 -07:00
Ori Bernstein 5bc9b0c3ca improve usage messages (thanks henesy)
Fix inconsistencies between programs and their usage
messages,  correct instances where information seems
to be missing or lost. This  includes missing arguments,
making usage consistent with manuals, and so on.
2020-03-10 10:09:34 -07:00
Ori Bernstein fc90f7a666 fix heredoc crash
we emitted an error on heredoc tags, but we
continued on, and added a heredoc entry to
the list, with a tag that we couldn't handle.

when processing this heredoc, rc would segfault.

fix: don't add a heredoc to the list on error.
2020-03-09 14:24:02 -07:00
Ori Bernstein 698837e715 fix alignment in ape malloc
We used to have a padding int in the structure
after the next pointer, to align it to 16 bytes.
On 64 bit architectures, the pointer was already
8 bits, so the padding misaligned things to 20
bytes.

This fixes it so that we're explcit about the
data alignment we want, instead of hoping that
the various sizes line up.
2020-03-09 08:02:22 -07:00
Sigrid 446e454c5a sam: ^ does not need current file 2020-03-09 13:58:41 +01:00
Sigrid 290c921d1d sam(1): document $% and $%dot 2020-03-09 13:22:10 +01:00
Sigrid 27f36483d4 sam: add $%dot (thanks kvik) 2020-03-09 13:21:50 +01:00
Ori Bernstein 50791b8755 add usage messages to auth/(enable disable status).
print useful message when user invokes these commands incorrectly
(thanks henesy)
2020-03-08 16:31:30 -07:00
cinap_lenrek e9e55a21f6 lib9p: implement automatic remove-on-close cleanup in postsharesrv(), remove postfd() and sharefd() functions
with the latest changes to shr(3), we can use ORCLOSE on
the control file to get the mount in the share automatically
removed when the server exits or something goes wrong during
postsharesrv().

do not expose postfd() and sharefd() functions. they where
undocumented and leak the control file descriptors.
2020-03-08 22:00:23 +01:00
cinap_lenrek 28f3a3aad8 boorc, nusbrc: fix wrong redirections after &
the rc & operator changes stdin to /dev/null, so we
have to do the <[0=1] inside the {}

this never showed up as an issue because many
fileservers just read 9p messages from standard
output.
2020-03-08 20:53:30 +01:00
cinap_lenrek f99b9cae6a devshr: unmount service on #σc/share/mount removal
when the control mountpoint side gets removed, close
mount channel immediately. this is usefull for implementing
automatic cleanup with ORCLOSE create mode.
2020-03-08 18:23:07 +01:00
cinap_lenrek fe39388250 nusb/usbd: cleanup processes on unmount
this makes sure that when postsharesrv() fails (for
example because the shr file already exists), the
worker process gets killed and all file descriptors
to devusb get closed.
2020-03-08 16:06:37 +01:00
cinap_lenrek 06b9aa5039 9p(2): document all the effective rfork flags for postmountsrv() 2020-03-08 15:29:32 +01:00
cinap_lenrek bc1212faf2 9p(2): document the filedescriptor sharing behaviour of postmountsrv() 2020-03-08 14:49:34 +01:00
cinap_lenrek a609c1a2f8 devproc: return process id when reading /proc/n/ctl file
allow reading the control file of a process and return
its pid number. if the process has exited, return an error.

this can be usefull as a way to test if a process is
still alive. and also makes it behave similar to
network protocol directories.

another side effect is that processes who erroneously
open the ctl file ORDWR would be allowed todo so as
along as they have write permission and the process is
not a kernel process.
2020-03-08 14:11:23 +01:00
cinap_lenrek 57741d473f games/playlistfs: open /proc/n/ctl OWRITE, not ORDWR 2020-03-08 13:13:25 +01:00
cinap_lenrek 5826140ce3 lib9p: restore previous behaviour of fd group sharing
it appears that too many fileservers rely on the fileserver
process sharing the filedescriptors with children of the
caller to postmntsrv() or threadpostmntsrv().

restoring previous behaviour for now.
2020-03-08 05:52:23 +01:00
cinap_lenrek 59fdb3a12c sshnet: fix fork race conditions
sshreadproc() needs to be started after opening the sshfd file
descriptor.

fsnetproc() needs to run in the same filedescriptor group as
the fileserver.
2020-03-08 04:54:37 +01:00
cinap_lenrek 2c53dd32b5 aux/realemu: fix exit code 2020-03-08 03:34:55 +01:00
cinap_lenrek cea9e2267a aux/realemu: run cpuproc in same fd group as fileserver 2020-03-08 03:25:35 +01:00
cinap_lenrek 7aaa481f9f aux/timesync: open /proc/n/ctl with OWRITE, not ORDWR 2020-03-08 03:12:00 +01:00
cinap_lenrek a0879abae4 devproc: don't allow /proc/$pid/ctl to be opens for reading 2020-03-07 23:58:47 +01:00
cinap_lenrek efd64da989 nusb/usbd: fix /env/usbbusy bug
run the usb hub poll "work()" proc in the same filedescriptor
group as the fileserver by forking the process in Srv.start
callback.

this also prevents the usbbusy filedescriptor from being kept
open by the fileserver process.
2020-03-07 22:26:49 +01:00
cinap_lenrek 1a1b4b54b3 rio: fix goodrect() bug (thanks mike)
mike from eff0ff.net reported the following:

> I was running a second instance of rio inside a rio window and
> suddenly weird things started happening. The second instance started
> imposing arbitrary limits on the size of its windows and refused to
> resize some of its windows when its own window was resized.
> Turns out this happens if rio's screen is 3 times as high as wide
> because of a tiny mistake in its goodrect function.

... and kindly provided a patch. thanks!
2020-03-07 20:41:46 +01:00
cinap_lenrek feb6d6f0a3 dossrv, 9660srv, hjfs: stop *READING* standard *OUTPUT* with -s flag
with the -s flag, we should read 9P messages from
standard *INPUT* (fd 0) and write responses to
standard *OUTPUT* (fd 1).

before these servers where reading from fd 1,
assuming they where both the same files.
2020-03-07 20:27:20 +01:00
cinap_lenrek 225c359bea lib9p: get rid of Srv.nopipe and Srv.leavefdsopen hacks
it is unclear how Srv.nopipe flag should work inside
postmountserv(). if a server wants to serve on stdio
descriptors, he can just call srv() after initializing
Srv.infd and Srv.outfd.

The Srv.leavefdsopen hack can be removed now that acme
win has been fixed.
2020-03-07 20:19:14 +01:00
cinap_lenrek 022087cdcd lib9p: fix typo 2020-03-07 15:20:07 +01:00
cinap_lenrek 8f64e44854 lib9p: zero out per connection state in Srv template for listensrv()
in case listensrv() is called with a previously active Srv,
we have to make sure that per connection state is zeroed
out (locks and reference conuts).

also, dont assume anything about the Ref structure. there
might be implementations that have a spinlock in them.
2020-03-07 15:01:29 +01:00
cinap_lenrek dce28e58e4 dossrv: output iotrack error message to stderr 2020-03-07 14:23:34 +01:00
cinap_lenrek e0cb81af94 ramfs: don't use Srv.nopipe 2020-03-07 13:35:46 +01:00
cinap_lenrek b053f5d060 aux/acpi, aux/apm: remove nopipe -i flag 2020-03-07 13:23:34 +01:00
cinap_lenrek a87c9cfc6c devproc: fix syscalltrace read for ratrace 2020-03-05 20:46:01 +01:00
cinap_lenrek 17136370d8 hgfs: fix loadrevinfo() for empty log bug
loadrevinfo() would fail on a empty log portion due
to a bug in the previous commit.

the loop is supposed to skip all bytes until we encounter
a empty line. the loop starts at the beginning of a line
so when we encounter a \n, we have to terminate, otherwise
read bytes until we see \n (end of a line) and then read
another and test the condition again.
2020-03-01 23:23:01 +01:00
cinap_lenrek 2f976d8b56 libsec: move AES XTS function prototypes to AES definition section in the header file 2020-03-01 16:02:56 +01:00
cinap_lenrek 64640083de libsec: remove hash pickle functions, document ripemd160, cleanup sechash(2) manpage 2020-03-01 15:07:44 +01:00
cinap_lenrek 69e28c6513 kernel: simplify exec()
progarg[0] can be assigned to elem directly as it is a
copy in kernel memory, so the char proelem[64] buffer
is not neccesary.

do the close-on-exit outside of the segment lock. there
is no reason to keep the segment table locked.
2020-02-29 21:06:45 +01:00
cinap_lenrek 17a92f3995 devproc: make sure writewatchpt() doesnt overflow the watchpoint array
the user buffer could be changed while we parse it resulting
in a different number of watchpoints than initially calculated.
so add a check to the parse loop so we wont overflow the
watchpoint array.
2020-02-28 16:48:42 +01:00
cinap_lenrek adb36de077 kernel: make sure we wont run into the tos when copying exec() arguments
in case the calling process changes its arguments under us, it could
happen that the final argument string lengths become bigger than
initially calculated. this is fine as we still make sure we wont
overflow the stack segment, but we could overrun into the tos
structure at the end of the stack. so change the limit to the
base of the tos, not the end of the stack segment.
2020-02-28 16:45:20 +01:00
cinap_lenrek ff3e0eeb22 devproc: cleanup procwrite size checks
writes to /proc/n/notepg and /proc/n/note should be able to write
at ERRMAX-1 bytes, not ERRMAX-2.

simplify write to /proc/n/args by just copying to local buf first
and then doing a kstrdup(). the value of Proc.nargs does not matter
when Proc.setargs is 1.
2020-02-28 16:41:09 +01:00
Ori Bernstein 3df95385bc fix special case for null pointer constants in cond expressions
Section 6.5.15 of the C99 spec requires that if
	one argument of a ?: expression is a null pointer
	constant, and the other has a pointer type T*, then
	the type of the expression is T*.

	We were attempting to follow this rule, however,
	we only handled literal expressions when checking
	for null pointers.

	This change looks through casts, so 'nil' and 'NULL',
	and their expansion '(void*)0' are all detected as
	null pointer constants.
2020-02-27 15:09:10 -05:00
Ori Bernstein 1ccd0cd04d include section 9 in manpage plumb rules.
We added section 9 to the manual. However,
	the plumb rule only recognized sections 1
	through 8. Fix it to include section 9.
2020-02-26 20:52:20 -08:00
BurnZeZ 7bd7776935 ape/cc: stop spamming arguments that are only needed once 2020-02-23 20:33:27 +00:00
cinap_lenrek ab5c4799d9 devcons: fix permissions for reboot and sysstat
#c/reboot is a write only file
#c/sysstat should not be writable by everyone (write resets counters)
2020-02-23 20:42:00 +01:00
cinap_lenrek 9fcce48b38 kernel: avoid selecting the boot process in killbig() 2020-02-23 18:58:06 +01:00
cinap_lenrek 4a80d9d029 kernel: fix multiple devproc bugs and pid reuse issues
devproc assumes that when we hold the Proc.debug qlock,
the process will be prevented from exiting. but there is
another race where the process has already exited and
the Proc* slot gets reused. to solve this, on process
creation we also have to acquire the debug qlock while
initializing the fields of the process. this also means
newproc() should only initialize fields *not* protected
by the debug qlock.

always acquire the Proc.debug qlock when changing strings
in the proc structure to avoid doublefree on concurrent
update. for changing the user string, we add a procsetuser()
function that does this for auth.c and devcap.

remove pgrpnote() from pgrp.c and replace by static
postnotepg() in devproc.

avoid the assumption that the Proc* entries returned by
proctab() are continuous.

fixed devproc permission issues:
	- make sure only eve can access /proc/trace
	- none should only be allowed to read its own /proc/n/text
	- move Proc.kp checks into procopen()

pid reuse was not handled correctly, as we where only
checking if a pid had a living process, but there still
could be processes expecting a particular parentpid or
noteid.

this is now addressed with reference counted Pid
structures which are organized in a hash table.
read access to the hash table does not require locks
which will be usefull for dtracy later.
2020-02-23 18:00:21 +01:00
cinap_lenrek f7c6023066 devswap: dont assume Proc* structures returned from proctab() are continuous 2020-02-23 14:08:33 +01:00
cinap_lenrek b7089d66ad sdiahci, sdodin: avoid calling kproc() while holding ilock() 2020-02-23 14:05:01 +01:00
Sigrid 68f15d6594 /sys/lib/kbmap: update 0xf860 to Kshift value, fix fake shifts on esc1 2020-02-23 00:57:05 +01:00
cinap_lenrek 219741ac01 sed: allow whitespace after ! negation (thanks k0ga) 2020-02-19 19:26:43 +01:00
spew 234aafb38d acme(1): fix scrolling when swiping text at the top or bottom of a frame 2020-02-13 16:09:25 -05:00
Ori Bernstein 98374d6eea remove C99_SPRINTF_EXTENSION define.
It's been 20 years since c99 came out. By now, if code
hasn't been fixed, it's not going to be. Requiring this
define just confuses porters.
2020-02-10 19:26:39 -08:00
Roberto E. Vargas Caballero 5f7a6b7ea3 bcm: change ARGB32 to XRGB32 for framebuffer to avoid slow drawing 2020-02-09 21:39:17 +01:00
Ori Bernstein 8b59286ef1 upas/fs plumb modify messages for self-changed flags
Currently upas/fs plumbs modify messages only if the flag
	changes are made by another imap connection.  If the flag
	changes are made within the running upas/fs no modify message
	is plumbed.

	This changes upas/fs to set the modify flag if we made the
	change ourself. It also moves the flag setting before the
	imap read, so that we don't clobber flag changes coming
	from the imap server with our own flags.

	(Thanks Tobias Heinicke)
2020-02-05 14:11:15 -08:00
rgl 7004384568 image(6): fix typo 2020-02-04 21:32:33 +01:00
cinap_lenrek 77a7e3f8fc kernel: cleanup makefile for $CONF.$O target 2020-02-02 20:46:58 +01:00
cinap_lenrek 04c4a9ca8b merge 2020-02-02 20:33:40 +01:00
cinap_lenrek be8cbcc852 listen(1): implement one-shot mode flag for listen1 (thanks kivik) 2020-02-02 20:31:48 +01:00
Ori Bernstein 8ce18a6338 fix double free in acme.
in acmerrorproc():
		sendp(s);
		free(s);

	in waitthread():
		recv(&err)
		free(err)

	We only want waitthread to free.
2020-01-31 09:25:39 -08:00
rgl efd4eb8933 document common emulator keys 2020-01-29 19:27:07 +01:00
BurnZeZ 2c0ccff286 walk: add D and T fmt characters (fileserver device/type) 2020-01-28 01:27:41 +00:00
BurnZeZ 0f1b442bc0 walk(1): formatting/corrections 2020-01-28 00:53:58 +00:00
BurnZeZ 7facfb5548 walk: remove superfluous newline 2020-01-28 00:44:44 +00:00
cinap_lenrek 023d957e6b kernel: restore old behaviour that kprocs have ther noteid == pid 2020-01-27 02:17:14 +01:00
cinap_lenrek 46a733c328 kernel: fix mistake from previous commit (noteid not being inherited by default) 2020-01-27 01:51:35 +01:00
cinap_lenrek 8d51e7fa1a kernel: implement portable userinit() and simplify process creation
replace machine specific userinit() by a portable
implemntation that uses kproc() to create the first
process. the initcode text is mapped using kmap(),
so there is no need for machine specific tmpmap()
functions.

initcode stack preparation should be done in init0()
where the stack is mapped and can be accessed directly.

replacing the machine specific userinit() allows some
big simplifications as sysrfork() and kproc() are now
the only callers of newproc() and we can avoid initializing
fields that we know are being initialized by these
callers.

rename autogenerated init.h and reboot.h headers.
the initcode[] and rebootcode[] blobs are now in *.i
files and hex generation was moved to portmkfile. the
machine specific mkfile only needs to specify how to
build rebootcode.out and initcode.out.
2020-01-26 19:01:36 +01:00
cinap_lenrek 60bb408acc ppc: remove old duplicate of devtls.c 2020-01-25 18:37:28 +01:00
aiju 6f80913ac7 add v8e 2020-01-22 13:09:09 +00:00
Alex Musolino 1ecdf09aee page(1): fix troff manual example 2020-01-20 14:59:04 +10:30
cinap_lenrek 09eac381e5 merge 2020-01-19 19:21:10 +01:00
Roberto E. Vargas Caballero 47bae09b33 Apply http://www.9paste.net/qrstuv/patch/acme-movetodelmesg/ 2020-01-19 19:18:12 +01:00
cinap_lenrek 16f11e4cd6 merge 2020-01-19 18:45:04 +01:00
cinap_lenrek a898d31f76 acme: fix off by one in colclose(), make dellist() code consistent 2020-01-19 18:43:51 +01:00
Roberto E. Vargas Caballero b099753597 acme: Restore call to movetodel() in colclose 2020-01-19 18:36:50 +01:00
aiju 639500b748 cycv: support for registers 2020-01-13 23:22:35 +00:00
aiju 561346d07f cyclone v kernel: fpga support, fix CONFADDR 2020-01-12 03:40:42 +00:00
cinap_lenrek 7cf8369411 vnc/devdraw: fix topnwindows() panic when images are not windows (thanks aiju)
see changeset 319be6cfe7ef
2020-01-12 00:19:39 +01:00
cinap_lenrek 16784a2e45 devdraw: fix topnwindows() panic when images are not windows (thanks aiju)
Crashes drawterm and native:

#include <u.h>
#include <libc.h>
#include <draw.h>

void
main(int argc, char **argv)
{
 	initdraw(nil, nil, nil);

 	Image *a[] = {screen, display->black};

 	topnwindows(a, nelem(a));
 	flushimage(display, 1);
}
2020-01-12 00:07:27 +01:00
cinap_lenrek 5254e41f6b pc64: adapt vgaradeon driver to 64-bit (thanks Robert Ransom)
Not yet tested.
2020-01-11 23:31:54 +01:00
cinap_lenrek 361b65e4df kernel: remove relics of CPU 'load balancing' policy in scheduler (thanks Robert Ransom)
This code was deleted from Plan 9 before the 9front repo began.
Proc.movetime was used by it, but has never been referenced in 9front.
2020-01-11 21:26:42 +01:00
cinap_lenrek dfda1cc878 bootrc: fix comment typo (thanks Robert Ransom) 2020-01-11 21:25:05 +01:00
cinap_lenrek 0b12020f10 ip/cifsd: implement SMB_SET_FILE_UNIX_BASIC for wstat 2020-01-11 14:50:52 +01:00
Sigrid e55ee7fafd libFLAC: 1.3.1 -> 1.3.3 2020-01-11 13:25:02 +01:00
aiju ffd9c39d1c dont spin on MDIO 2020-01-10 20:43:24 +00:00
aiju 9ab87f6241 merge 2020-01-10 18:49:39 +00:00
aiju d64f76c96c add cycv ethernet driver 2020-01-10 18:49:33 +00:00
Ori Bernstein 8150f68995 show line numbers in dtracy type errors 2020-01-09 11:59:44 -08:00
aiju 17ebe55031 add cycv kernel 2020-01-08 02:35:01 +00:00
aiju 826c76f90d dumb bug 2020-01-08 02:27:09 +00:00
aiju 76ed5d2e4b add aux/aout2uimage 2020-01-08 02:22:20 +00:00
cinap_lenrek f12744b5db devip: fix packet loss when interface is wlocked
to prevent deadlock on media unbind (which is called with
the interface wlock()'ed), the medias reader processes
that unbind was waiting for used to discard packets when
the interface could not be rlocked.

this has the unfortunate side effect that when we change
addresses on a interface that packets are getting lost.
this is problematic for the processing of ipv6 router
advertisements when multiple RA's are getting received
in quick succession.

this change removes that packet dropping behaviour and
instead changes the unbind process to avoid the deadlock
by wunlock()ing the interface temporarily while waiting
for the reader processes to finish. the interface media
is also changed to the mullmedium before unlocking (see
the comment).
2020-01-05 18:20:47 +01:00
rgl 645b5f8724 /sys/man/9: more pages added
in addition to the pages, there's also changes to the mkfile
to generate the index for the new section.
2020-01-04 18:02:54 +01:00
cinap_lenrek c739f57ac2 ip/ipconfig: keep on sending router solicitation after initial RA
avm fritzbox uses very long RA period so it effectively only
responds after a router solicitation. when there are multiple
fritzbox routers on the lan, then while configuring one prefix
of the first RA, the ip stack can drop the second router
advertisement and we would never get the second route.

packets can always get lost. so we just keep on sending router
solicitations (up to 3 times) to make sure we got all the RA's.
2020-01-04 11:49:50 +01:00
23hiro 4eee8f13cf rio, kbdfs: increase read buffer for high latency kbdfs support 2019-12-23 01:31:30 +01:00
cinap_lenrek 95c166fc35 9p(2): fix sentence for wstat function (thanks jsmoody) 2019-12-21 15:31:10 +01:00
rgl d00b2c8466 sleep(9): recover comment with the right reference 2019-12-20 23:15:07 +01:00
rgl 6cf9fb7b80 kproc(9) and sleep(9) corrections 2019-12-20 18:01:43 +01:00
Alex Musolino 0bc963f928 thread(2): fix description of when/why procexec(l) functions return 2019-12-19 17:12:15 +10:30
Alex Musolino 8fa9b7d6ff pc, pc64: fix cputemp decimal handling in amd10temprd (thanks Robert Ransom) 2019-12-19 15:19:02 +10:30
Alex Musolino 47c188c0c6 flate(2): fix typos (thanks rgl) 2019-12-18 09:01:38 +10:30
cinap_lenrek b820d892a6 ip(3): document special null-address hack for accepting all incoming connections 2019-12-15 13:59:08 +01:00
cinap_lenrek c3af90c6c7 date: make ISO 8601 time output compatible to RFC3339
RFC3339 is a stricter subset of ISO 8601, in particular
the timezone offset needs to be specified as +HH:MM while
in ISO 8601 the colon is optional.
2019-12-14 17:09:14 +01:00
Ori Bernstein 685670b0dd normalize error messages in yacc, stop writing to closed fd. 2019-12-11 23:26:15 -08:00
cinap_lenrek 80ecdec0ec merge 2019-12-11 23:53:10 +01:00
cinap_lenrek 52e4e51b50 devcons: fix write length of writebintime() (thanks BurnZeZ) 2019-12-11 23:52:05 +01:00
Ori Bernstein 375d8f4370 remove unused code. 2019-12-10 23:13:25 -08:00
Ori Bernstein b038443959 only ensurecache() on doplumb(). 2019-12-10 23:01:06 -08:00
Ori Bernstein 993c7b5fdf merge 2019-12-10 18:21:05 -08:00
Alex Musolino 0f18938914 crop(1): remove duplicate -b option in synopsis 2019-12-10 15:13:44 +10:30
Ori Bernstein f7431283d9 upas/fs plumb flag changes.
This patch makes 3 changes:

- It makes upas/fs send plumb messages when a message
  changes in the background (eg, someone on another imap
  connection opens a message and sets the read flag)
- It makes faces not complain when it gets one of these
  new modify messages.
- It makes acme/Mail update the flags in the display
  when it gets one of these messages.
2019-12-09 12:46:27 -08:00
cinap_lenrek 55af35eeeb riostart: when system uses serial console, provide a system shell on it
on systems with serial console and graphics such as the raspberry pi,
it is nice to get a system shell on the serial console even when no
monitor is connected.
2019-12-09 18:08:02 +01:00
cinap_lenrek 57dbe35fb6 console(8): add console command and manpage
the console command runs a command or the system shell under
a new instance of kbdfs, optionally providing a serial console
when $console environment variable is set.
2019-12-09 17:44:28 +01:00