Commit graph

7848 commits

Author SHA1 Message Date
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 7734749e8a acme/win: pass on flags to winfs (fix undocumented -e flag) 2020-04-17 19:18:28 +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 fed50d79d3 /lib/face: add .dict entries for andrew.1 face files 2020-04-08 11:52:06 +09:30
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