Commit graph

6986 commits

Author SHA1 Message Date
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
cinap_lenrek 1bfde84148 merge 2019-12-09 02:03:10 +01:00
cinap_lenrek 28d864953c hgfs: fix loadrevinfo() breakage on long lines using libbio (thanks deuterion) 2019-12-09 02:01:12 +01:00
Ori Bernstein 2b67ee6312 hack around timezone issues. 2019-12-08 11:58:52 -08:00
Ori Bernstein 36af840552 merge 2019-12-08 11:58:19 -08:00
Ori Bernstein 02e6003fc8 fix filetype detecton by suffix so that multiple dots dont confuse it. (thanks kvik) 2019-12-08 11:54:59 -08:00
cinap_lenrek 13785bbbef pc: replace duplicated and broken mmu flush code in vunmap()
comparing m with MACHP() is wrong as m is a constant on 386.

add procflushothers(), which flushes all processes except up
using common procflushmmu() routine.
2019-12-07 02:19:14 +01:00
cinap_lenrek 28836f3ff5 kernel: avoid useless mmu flushes, implement better wait condition for procflushmmu()
procflushmmu() returns once all *OTHER* processors that had
matching processes running on them flushed ther tlb/mmu state.
the caller of procflush...() takes care of flushing "up" by
calling flushmmu() later.

if the current process matched, then that means m->flushmmu
would be set, and hzclock() would call flushmmu() again.

to avoid this, we now check up->newtlb in addition to m->flushmmu
in hzclock() before calling flushmmu().

we also maintain information on which process on what processor
to wait for locally, which helps making progress when multiple
procflushmmu()'s are running concurrently.

in addition, this makes the wait condition for procflushmmu()
more sophisticated, by validating if the processor still runs
the selected process and only if it matchatches, considers
the MACHP(nm)->flushmmu flag.
2019-12-07 02:13:51 +01:00
Ori Bernstein 480d7b8f5f fix some acme memory leaks
(imported from plan9port 7ca1c90109e17dced4b38fbaadea9d2cf39871b7,
some tag restoration lines not relevant.)
2019-12-06 12:08:00 -08:00
Ori Bernstein 450ec696ee hoc: don't nest calls to follow() when lexing ++/+= and --/-= (#287)
The code had a nested use of the follow() function that could cause +=+
and -=- to register as ++ and --.  The first follow() to execute could
consume a character and match and then the second follow() could consume
another character and match.  For example i-=-10 would result in a syntax
error and i-=- would decrement i.

(imported from plan9port commit f1dd3f065a97f57bf59db2e3284868e181734159)
2019-12-06 11:53:44 -08:00
Ori Bernstein 4ff82fe7a8 delete obsolete comments (replies are flagged elsewhere) 2019-12-05 00:16:15 -08:00
cinap_lenrek f9f13bbd0e merge 2019-12-04 22:04:12 +01:00
cinap_lenrek f48f1a324a bcm: use extended small pages so XN bit can work
the change to support no-execute bits broke the original
raspberry pi1, as it uses backwards compatible page table
format.

to use the XN bit, subpage AP bits have to be disabled
using the XP bit in CP15 Control Register c1 Bit 23.
2019-12-04 22:02:51 +01:00
cinap_lenrek c9570c14af 9/boot/net.rc: suppress error from grep if ethernet ifstats file is not found
this can happen with nusb/ether, which does not implement ifstats file.
2019-12-04 21:56:13 +01:00
Ori Bernstein 7c55ca5fff acme: Apply each -/+ only once (#156)
When plumbing an address like `3-`, Acme selects line 1,
and similarly `3+` selects line 5.
The same problem can be observed for character addresses (`#123+`)
but _not_ for ones like `+`, `.+` or `/foo/+`:
The problem only occurs when a number is followed by a direction (`-`/`+`).

Following along with the example `3-` through `address` (in addr.c):
We read `3` into `c` and match the `case` on line 239.
The `while` loop on line 242ff reads additional digits into `c`
and puts the first non-digit back by decrementing the index `q`.
Then we find the range for line 3 on line 251 and continue.

On the next iteration, we set `prevc` to the last `c`,
but since that part read ahead _into `c`_,
`c` is currently the _next_ character we will read, `-`,
and now `prevc` is too.

Then in the case block (line 210) the condition on line 211 holds
and Acme believes that it has read two `-` in sequence
and modifies the range to account for the “first” `-`.
The “second” `-` gets applied after the loop is done, on line 292.

So the general problem is:
While reading numbers, Acme reads the next character after the number into `c`.
It decrements the counter to ensure it will read it again on the next iteration,
but it still uses it to update `prevc`.

This change solves the problem by reading digits into `nc` instead.
This variable is used to similar effect in the block for directions (line 212)
and fills the role of “local `c` that we can safely use to read ahead” nicely.

(imported from plan9front a82a8b6368274d77d42f526e379b74e79c137e26)
2019-12-04 12:55:03 -08:00
Ori Bernstein 2b5db0d9d4 acme: avoid division by zero when resizing col (#189)
To reproduce, create a column with at least two windows and resize
acme to have almost zero height.

(imported from plan9port commit 76b9347a5fa3a0970527c6ee1b97ef1c714f636b)
2019-12-04 12:37:07 -08:00
Ori Bernstein a181f3dd3e acme, sam: handle >1GB files correctly
imported from plan9port, edfe3c016fe6ef10c55f7a17aab668214ec21efc
2019-12-04 11:46:42 -08:00
cinap_lenrek f7db45e628 merge 2019-12-03 20:57:01 +01:00
cinap_lenrek a23b88dc26 cmd(3): fix typo, Close -> Closed (thanks kivik) 2019-12-03 20:55:57 +01:00
Alex Musolino a733f4caa3 rio(4): fix bad cross-reference format 2019-12-03 18:32:30 +10:30
Alex Musolino aa9b6d3597 seconds(1): add SOURCE section 2019-12-03 18:25:24 +10:30
cinap_lenrek 1eca33b48c always zero initialize Tm structure for tm2sec() 2019-12-03 08:22:02 +01:00
Ori Bernstein e624b7ffb8 Remove reply print. 2019-12-02 14:50:53 -08:00
cinap_lenrek 8a0cefb237 merge 2019-12-02 23:33:29 +01:00
cinap_lenrek 5d59a44c21 pc, pc64: clear debug watchpoint registers on exec and exit
when a process does an exec syscall, procsetup() is called and
we have to disable the debug watchpoint registers. just clearing
p->dr is not enougth as we are not going thru a procsave() and
procrestore() cycle which would disable and reload the saved
debug registers.

instead of clearing debug registers in procfork(), we should
clear the saved debug registers before a process goes to die
(pexit() calls sched() with up->state = Moribund) as the Proc
structure can get reused for kernel processes (kproc) which
never call procfork() and would therefore have debug registers
loaded.
2019-12-02 23:32:24 +01:00
Ori Bernstein 6a3f1f1bca remove debug print 2019-12-02 13:56:15 -08:00
Ori Bernstein b2526c7d90 simplify flag parsing.
we've only got a few flags, a linear search is good enough,
and is obviously correct; the old search wasn't.
2019-12-02 13:53:57 -08:00
Sigrid b62fda7bd1 os(1): fix a typo 2019-12-02 17:55:53 +02:00
cinap_lenrek a815273960 merge 2019-12-02 08:27:49 +01:00
cinap_lenrek d80826d6e5 vgai81x: remove unused mach0 variable 2019-12-02 08:26:34 +01:00
cinap_lenrek a9be1374a0 pc: fix ldt memory leak in procsetup() 2019-12-02 07:43:45 +01:00
cinap_lenrek 70498378cf kernel: add missing FPillegal definition for kw and omap kernels 2019-12-02 07:35:25 +01:00
Ori Bernstein 3681c836ca fix typo: we don't have cache insurance. 2019-12-01 17:24:02 -08:00
Ori Bernstein 3889b249d4 show and update flags in acme mail
now, it's possible to tell whether you've read or replied
to a message.
2019-12-01 17:14:13 -08:00
Ori Bernstein 84c4c81cee upas/fs imap fixes and improvements
do incremental imap fetches after startup, fixes validity handling,
record flags correctly when we aren't in the process of directly
updating a message, fixes off by one in flag parsing, fixes
mis-indexing messages in sync when we get an unsolicited fetch
response.
2019-12-01 17:12:19 -08:00
cinap_lenrek 08d6b0f043 kernel: improve diagnostics by reversing the roles of Proc.parentpid and Proc.parent
for better system diagnostics, we *ALWAYS* want to record the parent
pid of a user process, regardless of if the child will post a wait
record on exit or not.

for that, we reverse the roles of Proc.parent and Proc.parentpid so
Proc.parentpid will always be set on rfork() and the Proc.parent
pointer will point to the parent's Proc structure or is set to nil
when no wait record should be posted on exit (RFNOWAIT flag).

this means that we can get the pid of the original parent process
from /proc, regardless of the the child having rforked with the
RFNOWAIT flag. this improves the output of pstree(1) somewhat if
the parent is still alive. note that theres no guarantee that the
parent pid is still valid.

the conditions are unchanged:

a user process that will post wait record has:

up->kp == 0 && up->parent != nil && up->parent->pid == up->parentpid

the boot process is:

up->kp == 0 && up->parent == nil && up->parentpid == 0

and kproc's have:

up->kp != 0 && up->parent == nil && up->parentpid == 0
2019-12-01 17:57:14 +01:00
cinap_lenrek 21a599743e pc, pc64: merge adjacent e820 map entries of same type
some machines give us over 300 e820 ram entries that are
all adjacent to each other causing us to run out of Map
end Emap entries.

this change adds e820clean() function, which sorts the
current e820 map and discards unusable entries and merges
adjacent entries. e820clean() is called after we parsed
the *e820= boot parameter or when we run out of entries.

an example of such a broken e820 map (thanks mischief):

*e820=1 0000000000000000 0000000000008000 1 0000000000008000 000000000000c000 1 000000000000c000 000000000003f000 1 000000000003f000 0000000000040000 1 0000000000040000 00000000000a0000 1 0000000000100000 0000000001000000 1 0000000001000000 0000000001020000 1 0000000001020000 0000000009d82000 2 0000000009d82000 000000000a000000 1 000000000a000000 000000000a200000 4 000000000a200000 000000000a20b000 1 000000000a20b000 000000000b000000 2 000000000b000000 000000000b020000 1 000000000b020000 0000000010000000 1 0000000010000000 000000001000b000 1 000000001000b000 00000000d9634000 1 00000000d9634000 00000000d96be000 1 00000000d96be000 00000000d96cc000 1 00000000d96cc000 00000000d96db000 1 00000000d96db000 00000000d97df000 1 00000000d97df000 00000000d97ed000 1 00000000d97ed000 00000000d9837000 1 00000000d9837000 00000000d9844000 1 00000000d9844000 00000000d985e000 1 00000000d985e000 00000000d9865000 1 00000000d9865000 00000000d9897000 1 00000000d9897000 00000000d98d7000 1 00000000d98d7000 00000000d98db000 1 00000000d98db000 00000000d98dd000 1 00000000d98dd000 00000000d999d000 1 00000000d999d000 00000000d9a8e000 1 00000000d9a8e000 00000000d9add000 1 00000000d9add000 00000000d9ae2000 1 00000000d9ae2000 00000000d9af3000 1 00000000d9af3000 00000000d9af4000 1 00000000d9af4000 00000000d9af6000 1 00000000d9af6000 00000000d9af7000 1 00000000d9af7000 00000000d9af8000 1 00000000d9af8000 00000000d9af9000 1 00000000d9af9000 00000000d9b5e000 1 00000000d9b5e000 00000000d9b60000 1 00000000d9b60000 00000000d9b8c000 1 00000000d9b8c000 00000000d9b8d000 1 00000000d9b8d000 00000000d9c85000 1 00000000d9c85000 00000000d9c8a000 1 00000000d9c8a000 00000000d9caf000 1 00000000d9caf000 00000000d9cb5000 1 00000000d9cb5000 00000000d9cc1000 1 00000000d9cc1000 00000000d9cc2000 1 00000000d9cc2000 00000000da986000 1 00000000da986000 00000000daeb6000 1 00000000daeb6000 00000000daed7000 1 00000000daed7000 00000000daed8000 1 00000000daed8000 00000000daf61000 1 00000000daf61000 00000000daf7c000 1 00000000daf7c000 00000000db3e6000 1 00000000db3e6000 00000000db4ea000 1 00000000db4ea000 00000000db57d000 1 00000000db57d000 00000000db587000 1 00000000db587000 00000000db58a000 1 00000000db58a000 00000000db58b000 1 00000000db58b000 00000000db591000 1 00000000db591000 00000000db5a7000 1 00000000db5a7000 00000000db5b2000 1 00000000db5b2000 00000000db5ba000 1 00000000db5ba000 00000000db5bb000 1 00000000db5bb000 00000000db5c6000 1 00000000db5c6000 00000000db5c7000 1 00000000db5c7000 00000000db5c8000 1 00000000db5c8000 00000000db5c9000 1 00000000db5c9000 00000000db5cb000 1 00000000db5cb000 00000000db5d0000 1 00000000db5d0000 00000000db5e8000 1 00000000db5e8000 00000000db5ea000 1 00000000db5ea000 00000000db5eb000 1 00000000db5eb000 00000000db5ee000 1 00000000db5ee000 00000000db601000 1 00000000db601000 00000000db602000 1 00000000db602000 00000000db60e000 1 00000000db60e000 00000000db610000 1 00000000db610000 00000000db612000 1 00000000db612000 00000000db614000 1 00000000db614000 00000000db61d000 1 00000000db61d000 00000000db645000 1 00000000db645000 00000000db64c000 1 00000000db64c000 00000000db650000 1 00000000db650000 00000000db651000 1 00000000db651000 00000000db653000 1 00000000db653000 00000000db658000 1 00000000db658000 00000000db659000 1 00000000db659000 00000000db661000 1 00000000db661000 00000000db662000 1 00000000db662000 00000000db665000 1 00000000db665000 00000000db677000 1 00000000db677000 00000000db69d000 1 00000000db69d000 00000000db6a0000 1 00000000db6a0000 00000000db6a8000 1 00000000db6a8000 00000000db6ae000 1 00000000db6ae000 00000000db6c2000 1 00000000db6c2000 00000000db6d4000 1 00000000db6d4000 00000000db6de000 1 00000000db6de000 00000000db6e0000 1 00000000db6e0000 00000000db6e2000 1 00000000db6e2000 00000000db6ef000 1 00000000db6ef000 00000000db6f0000 1 00000000db6f0000 00000000db6f2000 1 00000000db6f2000 00000000db6f3000 1 00000000db6f3000 00000000db810000 1 00000000db810000 00000000db815000 1 00000000db815000 00000000db81f000 1 00000000db81f000 00000000db821000 1 00000000db821000 00000000db85d000 1 00000000db85d000 00000000db869000 1 00000000db869000 00000000db881000 1 00000000db881000 00000000db889000 1 00000000db889000 00000000db88e000 1 00000000db88e000 00000000db88f000 1 00000000db88f000 00000000db891000 1 00000000db891000 00000000db899000 1 00000000db899000 00000000db8a9000 1 00000000db8a9000 00000000db8ab000 1 00000000db8ab000 00000000db8af000 1 00000000db8af000 00000000db8b1000 1 00000000db8b1000 00000000db8b5000 1 00000000db8b5000 00000000db8b7000 1 00000000db8b7000 00000000db8be000 1 00000000db8be000 00000000db8c2000 1 00000000db8c2000 00000000db8c7000 1 00000000db8c7000 00000000db8cf000 1 00000000db8cf000 00000000db8e0000 1 00000000db8e0000 00000000db8e1000 1 00000000db8e1000 00000000db8e2000 1 00000000db8e2000 00000000db8e6000 1 00000000db8e6000 00000000db8e8000 1 00000000db8e8000 00000000db8f4000 1 00000000db8f4000 00000000db904000 1 00000000db904000 00000000db90c000 1 00000000db90c000 00000000db91c000 1 00000000db91c000 00000000db91d000 1 00000000db91d000 00000000db922000 1 00000000db922000 00000000db923000 1 00000000db923000 00000000db929000 1 00000000db929000 00000000db92b000 1 00000000db92b000 00000000db92d000 1 00000000db92d000 00000000db92f000 1 00000000db92f000 00000000db933000 1 00000000db933000 00000000db934000 1 00000000db934000 00000000db936000 1 00000000db936000 00000000db937000 1 00000000db937000 00000000db952000 1 00000000db952000 00000000db96b000 1 00000000db96b000 00000000db998000 1 00000000db998000 00000000db9a1000 1 00000000db9a1000 00000000db9a2000 1 00000000db9a2000 00000000db9a3000 1 00000000db9a3000 00000000db9a4000 1 00000000db9a4000 00000000db9a5000 1 00000000db9a5000 00000000db9a7000 1 00000000db9a7000 00000000db9a8000 1 00000000db9a8000 00000000db9aa000 1 00000000db9aa000 00000000db9ba000 1 00000000db9ba000 00000000db9da000 1 00000000db9da000 00000000db9f7000 1 00000000db9f7000 00000000dba00000 1 00000000dba00000 00000000dba0a000 1 00000000dba0a000 00000000dba11000 1 00000000dba11000 00000000dba12000 1 00000000dba12000 00000000dba51000 1 00000000dba51000 00000000dba5d000 1 00000000dba5d000 00000000dba6c000 1 00000000dba6c000 00000000dba88000 1 00000000dba88000 00000000dba92000 1 00000000dba92000 00000000dba94000 1 00000000dba94000 00000000dbac0000 1 00000000dbac0000 00000000dbac6000 1 00000000dbac6000 00000000dbad2000 1 00000000dbad2000 00000000dbad9000 1 00000000dbad9000 00000000dbae0000 1 00000000dbae0000 00000000dbaeb000 1 00000000dbaeb000 00000000dbaf6000 1 00000000dbaf6000 00000000dbb01000 1 00000000dbb01000 00000000dbb17000 1 00000000dbb17000 00000000dbb1f000 1 00000000dbb1f000 00000000dbb20000 1 00000000dbb20000 00000000dbb23000 1 00000000dbb23000 00000000dbb24000 1 00000000dbb24000 00000000dbb25000 1 00000000dbb25000 00000000dbb3a000 1 00000000dbb3a000 00000000dbb3d000 1 00000000dbb3d000 00000000dbb43000 1 00000000dbb43000 00000000dbb45000 1 00000000dbb45000 00000000dbb49000 1 00000000dbb49000 00000000dbb4c000 1 00000000dbb4c000 00000000dbb4e000 1 00000000dbb4e000 00000000dbb51000 1 00000000dbb51000 00000000dbb54000 1 00000000dbb54000 00000000dbb5a000 1 00000000dbb5a000 00000000dbb5e000 1 00000000dbb5e000 00000000dbb62000 1 00000000dbb62000 00000000dbb67000 1 00000000dbb67000 00000000dbb91000 1 00000000dbb91000 00000000dbb93000 1 00000000dbb93000 00000000dbb94000 1 00000000dbb94000 00000000dbb9d000 1 00000000dbb9d000 00000000dbb9f000 1 00000000dbb9f000 00000000dbbcf000 1 00000000dbbcf000 00000000dbbd0000 1 00000000dbbd0000 00000000dbbd1000 1 00000000dbbd1000 00000000dbbd5000 1 00000000dbbd5000 00000000dbbd6000 1 00000000dbbd6000 00000000dbbd7000 1 00000000dbbd7000 00000000dbbd8000 1 00000000dbbd8000 00000000dbbd9000 1 00000000dbbd9000 00000000dbbdd000 1 00000000dbbdd000 00000000dbbdf000 1 00000000dbbdf000 00000000dbbe1000 1 00000000dbbe1000 00000000dbbeb000 1 00000000dbbeb000 00000000dbbec000 1 00000000dbbec000 00000000dbbef000 1 00000000dbbef000 00000000dbbff000 1 00000000dbbff000 00000000dbc01000 1 00000000dbc01000 00000000dbc05000 1 00000000dbc05000 00000000dbc0f000 1 00000000dbc0f000 00000000dbc11000 1 00000000dbc11000 00000000dbc12000 1 00000000dbc12000 00000000dbc14000 1 00000000dbc14000 00000000dbc15000 1 00000000dbc15000 00000000dbc20000 1 00000000dbc20000 00000000dbc21000 1 00000000dbc21000 00000000dbc22000 1 00000000dbc22000 00000000dbc2a000 1 00000000dbc2a000 00000000dbc2c000 1 00000000dbc2c000 00000000dbc2d000 1 00000000dbc2d000 00000000dbc2f000 1 00000000dbc2f000 00000000dbc30000 1 00000000dbc30000 00000000dbc42000 1 00000000dbc42000 00000000dbc44000 1 00000000dbc44000 00000000dbc54000 1 00000000dbc54000 00000000dbc5c000 1 00000000dbc5c000 00000000dbc5e000 1 00000000dbc5e000 00000000dbc60000 1 00000000dbc60000 00000000dbc64000 1 00000000dbc64000 00000000dbc6d000 1 00000000dbc6d000 00000000dbc7f000 1 00000000dbc7f000 00000000dbc85000 1 00000000dbc85000 00000000dbca3000 1 00000000dbca3000 00000000dbca6000 1 00000000dbca6000 00000000dbcb9000 1 00000000dbcb9000 00000000dbcba000 1 00000000dbcba000 00000000dbcbb000 1 00000000dbcbb000 00000000dbcbc000 1 00000000dbcbc000 00000000dbcbd000 1 00000000dbcbd000 00000000dbcd5000 1 00000000dbcd5000 00000000dbcd8000 1 00000000dbcd8000 00000000dbcd9000 1 00000000dbcd9000 00000000dbcda000 1 00000000dbcda000 00000000dbce1000 1 00000000dbce1000 00000000dbce3000 1 00000000dbce3000 00000000dbce4000 1 00000000dbce4000 00000000dbd06000 1 00000000dbd06000 00000000dbd07000 1 00000000dbd07000 00000000dbd0a000 1 00000000dbd0a000 00000000dbd0b000 1 00000000dbd0b000 00000000dbd0c000 1 00000000dbd0c000 00000000dbd0e000 1 00000000dbd0e000 00000000dbd10000 1 00000000dbd10000 00000000dbd12000 1 00000000dbd12000 00000000dbd15000 1 00000000dbd15000 00000000dbd17000 1 00000000dbd17000 00000000dbd19000 1 00000000dbd19000 00000000dbd1b000 1 00000000dbd1b000 00000000dbd44000 1 00000000dbd44000 00000000dbd46000 1 00000000dbd46000 00000000dbd60000 1 00000000dbd60000 00000000dbd70000 1 00000000dbd70000 00000000dbd79000 1 00000000dbd79000 00000000dbd7a000 1 00000000dbd7a000 00000000dbd7c000 1 00000000dbd7c000 00000000dbd7d000 1 00000000dbd7d000 00000000dbd90000 1 00000000dbd90000 00000000dbd93000 1 00000000dbd93000 00000000dbd97000 1 00000000dbd97000 00000000dbd9a000 1 00000000dbd9a000 00000000dbd9b000 1 00000000dbd9b000 00000000dbd9e000 1 00000000dbd9e000 00000000dbda1000 1 00000000dbda1000 00000000dbda5000 1 00000000dbda5000 00000000dbda9000 1 00000000dbda9000 00000000dbdaf000 1 00000000dbdaf000 00000000dbdb3000 1 00000000dbdb3000 00000000dbdb4000 1 00000000dbdb4000 00000000dbdbe000 1 00000000dbdbe000 00000000dbdbf000 1 00000000dbdbf000 00000000dbdc0000 1 00000000dbdc0000 00000000dbdc1000 1 00000000dbdc1000 00000000dbdc2000 1 00000000dbdc2000 00000000dbdc5000 1 00000000dbdc5000 00000000dbdc6000 1 00000000dbdc6000 00000000dbdc7000 1 00000000dbdc7000 00000000dbdcb000 1 00000000dbdcb000 00000000dbdcf000 1 00000000dbdcf000 00000000dbdd5000 1 00000000dbdd5000 00000000dbdd8000 1 00000000dbdd8000 00000000dbddf000 1 00000000dbddf000 00000000dbde1000 1 00000000dbde1000 00000000dbde5000 1 00000000dbde5000 00000000dbde8000 1 00000000dbde8000 00000000dbded000 1 00000000dbded000 00000000dbdf0000 1 00000000dbdf0000 00000000dbdf4000 1 00000000dbdf4000 00000000dbdf7000 1 00000000dbdf7000 00000000dbdfb000 1 00000000dbdfb000 00000000dbe1e000 1 00000000dbe1e000 00000000dbe20000 1 00000000dbe20000 00000000dbe23000 1 00000000dbe23000 00000000dbe27000 1 00000000dbe27000 00000000dbe28000 1 00000000dbe28000 00000000dbe2a000 1 00000000dbe2a000 00000000dbe2b000 1 00000000dbe2b000 00000000dc24d000 1 00000000dc24d000 00000000dc25c000 1 00000000dc25c000 00000000dc25d000 1 00000000dc25d000 00000000dc25e000 1 00000000dc25e000 00000000dc273000 1 00000000dc273000 00000000dc274000 1 00000000dc274000 00000000dc275000 1 00000000dc275000 00000000dc276000 1 00000000dc276000 00000000dc27a000 1 00000000dc27a000 00000000dc27e000 1 00000000dc27e000 00000000dc283000 1 00000000dc283000 00000000dc284000 1 00000000dc284000 00000000dc2a2000 1 00000000dc2a2000 00000000dc2a6000 1 00000000dc2a6000 00000000dd163000 2 00000000dd163000 00000000dd2a8000 1 00000000dd2a8000 00000000dd42a000 4 00000000dd42a000 00000000dd83e000 1 00000000dd83e000 00000000de38b000 1 00000000de38b000 00000000de430000 1 00000000de430000 00000000de733000 1 00000000de733000 00000000de74f000 1 00000000de74f000 00000000de770000 1 00000000de770000 00000000de77d000 1 00000000de77d000 00000000de783000 1 00000000de783000 00000000de78b000 1 00000000de78b000 00000000de7a4000 1 00000000de7a4000 00000000de7b4000 1 00000000de7b4000 00000000de7c9000 1 00000000de7c9000 00000000de7e0000 1 00000000de7e0000 00000000deff9000 1 00000000deff9000 00000000df000000 1 0000000100000000 000000021f380000 2 00000000000a0000 0000000000100000 2 00000000df000000 00000000e0000000 2 00000000f8000000 00000000fc000000 2 00000000fd000000 0000000100000000
2019-12-01 14:06:30 +01:00
cinap_lenrek 2359389570 os(1): add c implementation of inferno os command and cmd(3) device manpages
this is a reimplementation of infernos os(1) command, which
allows running commands in the underhying host operating
system when inferno runs in hosted mode (emu). but unlike
inferno, we want to use it to run commands on the client
side of a inferno or drawterm session from the plan9 cpu
server, so it defaults to /mnt/term/cmd for the mountpoint.
2019-11-30 20:10:08 +01:00
cinap_lenrek d32e5d130c sd53c8xx: fix the driver for amd64, fix alignment/padding issues, fix freechain handling 2019-11-24 21:56:54 +01:00
cinap_lenrek 87c8fa5415 upas/fs: remove useless loop in rf822() 2019-11-24 03:46:53 +01:00
Ori Bernstein 6c2017f6a6 fix ref822 again: remove uniqarray(), fix case with many entries in 'n'. 2019-11-23 08:23:21 -08:00
Alex Musolino cac853084c upas/marshal: fix printinreplyto function
According to RFC822, the message identifier (msg-id) in a
"In-Reply-To" header must start with a '<' and end with a '>'.
2019-11-22 17:29:35 +10:30
Ori Bernstein 543c35deba fix ref882 reference parsing.
we were getting nils in the list when there were many references.
this fixes and simplifies the copying loop and makes the code rhyme.
2019-11-21 17:17:54 -08:00
Ori Bernstein 4cef9b12fd show urls in html messages.
sometimes, I get phishing emails with links that I have an unstoppable
urge to click.
2019-11-21 10:48:13 -08:00
BurnZeZ 29b6ad3330 grep: error if sbrk fails 2019-11-21 16:44:41 +00:00
Ori Bernstein 5510488879 merge 2019-11-20 16:12:21 -08:00
Ori Bernstein 0ff4099a60 improve language in delay(9)
give the reader enough context to know when to use and not
use the delay family of functions.
2019-11-20 16:05:52 -08:00
cinap_lenrek 07e3d1c254 merge 2019-11-21 00:40:15 +01:00
cinap_lenrek 8e20bc7515 vac(1): assimilate manpage additions from plan9port and complete usage lines (thanks joe9)
the usage lines in vac where out of sync with the implementation
and the manpages.

document the -a and -x options, from:

https://github.com/9fans/plan9port/blob/master/man/man1/vac.1
2019-11-21 00:39:07 +01:00
Alex Musolino 48a804e3fd mail(1): fix typo 2019-11-20 17:46:29 +10:30
Ori Bernstein eca7cac908 merge 2019-11-19 12:31:42 -08:00
Ori Bernstein 0b6f0c70db add start of section 9 manpages (thanks rgl)
this change adds some of the kernel manpages from 9legacy,
fixed and updated to match the changes in 9front.
2019-11-19 12:30:40 -08:00
cinap_lenrek 2c9e3861a5 rio: fix cons read breakage from previous commit 2019-11-19 09:03:45 +01:00
Alex Musolino 37d6ddd8f3 rio(4): update description of wctl file format
State strings are now padded to 12-characters.  Remove ambiguous
reference to "12-character style", instead referring the reader to
image(6).
2019-11-19 12:43:53 +10:30
Alex Musolino 59115ba407 rio: pad window status strings in wctl files
This makes it possible to read the entire initial contents of the wctl
files without blocking.
2019-11-19 12:40:53 +10:30
Alex Musolino 4d4107b385 rio: fix bug causing short reads of wctl files
Previously, reads of wctl files would return one byte less than
requested as the returned string must be null terminated.  Now we pass
the actual size of the allocated buffer to the handler, which is large
enough to accommodate a trailing partial rune and terminating null
byte.
2019-11-19 12:38:13 +10:30
Ori Bernstein f32148b290 document 'T' flag misbehavior (thanks rgl) 2019-11-18 01:06:02 -08:00
Ori Bernstein b2e29cf315 Specifiy the restrictions on 9boot file names more clearly. 2019-11-17 16:17:15 -08:00
Ori Bernstein 3e1a75d08f Document 9bootfat limitation. 2019-11-17 16:08:48 -08:00
cinap_lenrek 44615fba43 sdiahci: implement reset timeout for ahciencreset(), make blink() never block, fix map[] access in ledkproc()
Ori_B reports that his controller gets stuck in the ahciencreset()
wait loop. so we implement a 1000 ms timeout. we replace delay()
with esleep() as we are always called from the ledkproc().

blink() could enter infinite delay loop as well, so instead of
waiting for the message to get transmitted we exit making it
non-blocking (we will get called again anyway).

the access to the controller map[] was wrong in ledkproc(). the
index is the controller number, not the drive number!
2019-11-17 21:19:55 +01:00
cinap_lenrek 521a0b336c bootrc: for wireless netbooting, set the WPA/WPA2 preshard key with wpapsk=password boot parameter
this allows automatic netbooting without password prompt
for the wirelss network.
2019-11-17 19:04:38 +01:00
Ori Bernstein b31e965ea3 Parse global pax header in the right place. 2019-11-15 13:26:25 -08:00
Ori Bernstein a68bee44d3 Add pax extended header support to tar.
Support for 'path=', 'uname=', 'gname=', 'size=', and 'atime=' pax
headers is useful.  Others are ignored, possibly with a warning.

We were running into missing support with the 'go' extraction.

At the same time, this cleans up the way that we handle paths,
getting rid of static buffers with hidden space at the front.
2019-11-14 13:52:41 -08:00
Ori Bernstein 4dab28b14f thread(2): fix manpage typos (thanks rgl) 2019-11-12 13:01:38 -08:00
Ori Bernstein 52e92163a6 draw(2): fix manpage typo (thanks rgl) 2019-11-11 13:35:47 -08:00
cinap_lenrek b638c7753d devip: use the routing table for local source ip address selection
when making outgoing connections, the source ip was selected
by just iterating from the first to the last interface and
trying each local address until a route was found. the result
was kind of hard to predict as it depends on the interface
order.

this change replaces the algorithm with the route lookup algorithm
that we already have which takes more specific desination and
source prefixes into account. so the order of interfaces does
not matter anymore.
2019-11-10 19:50:46 +01:00
Ori Bernstein d72a404399 Fix directory heuristic for long file names.
Tar specifies that a filename ending with '/' is a directory. We were
incorrectly looking at the short name. This meant that when we have long
filenames with a '/' at the 100th character, we would decide it was a
directory.

This change uses the long name when deciding the size for extraction,
and trusts the header size when just skipping forward in the stream.
2019-11-05 10:48:51 -08:00
cinap_lenrek 8b79ad59f1 games/turtle: do exit instead of crash in redraw() when there where no lines drawn 2019-11-03 15:20:57 +01:00
aiju 528936156f add games/linden and turtle to mkfile 2019-11-03 13:54:26 +00:00
aiju ae61eb9381 add games/linden and games/turtle 2019-11-03 13:49:23 +00:00
cinap_lenrek 37827f533b tar: fix memory corruption in extract1 (thanks petter)
extract1() expects two extra bytes to be avilabe before
fname buffer so it can prepend ./ before the name. this
used to be the case with name(), but was violated when
long name support was added and getname() was used in
place of name() which did not reserve the 2 extra bytes.

this change reserves two extra bytes in the getname()'s
static buffer and also removes the extra copy as name()
already makes a copy.
2019-11-02 14:17:34 +01:00
cinap_lenrek 638f860791 upasfs(4): fix manpage typo (thanks rgl) 2019-11-02 12:52:39 +01:00
Alex Musolino 7fbd3fd4fe file: add (very) basic support for detecting mpeg4 formats 2019-11-01 12:05:11 +10:30
Alex Musolino 06786f2a71 upas/fs: fix handling of numeric timezone offsets in strtotm
Since numeric timezone offsets are relative to GMT, initialise zone to
GMT so tm2sec(2) does not assume local time.

Note that if strtotm encounters a timezone *string* and consequently
overwrites zone then we will end up in the same mess since tm2sec(2)
only deals with GMT or local time.
2019-10-31 09:41:03 +10:30
Ori Bernstein 6c43477492 Check if 'm' is null when updating messages. 2019-10-28 14:12:44 -07:00
cinap_lenrek 82d04a4e63 bcm: fix software cursor avoidance for loadimage() case (thanks bitmapper) 2019-10-27 23:51:11 +01:00
cinap_lenrek ff44b92c96 ip/dhcpd: prevent client from increasing max reply size beyond the reply buffer capacity 2019-10-22 06:53:50 +02:00
Ori Bernstein 9314883aff Make ctrl+g focus text windows and cycle zeroxed copies (thanks kvik) 2019-10-21 15:29:07 -07:00
Alex Musolino 7682a24bc5 /sys/lib/plumb/basic: open nedmail windows with -noscroll
This preserves the desired behaviour of *not* scrolling to the bottom
of plumbed messages even when rio(1) is invoked with the -s flag.
2019-10-22 08:18:20 +10:30
cinap_lenrek e168ea045f ndb/dns: handle empty $DNSSERVER
when $DNSSERVER is empty, query ndb for local dns servers
instead of not using any at all.
2019-10-13 09:02:04 +02:00
Roberto E. Vargas Caballero c0280c607f backup: Set execution bits in backup scripts 2019-10-13 10:20:10 +02:00
cinap_lenrek e38f75fc45 ether82563: fix multicast for i210
MTA has 128 entries, according to section 8.10.15 in the datasheet.
this fixes ipv6 in apu2 which has 3x i210 (8086/157b).
2019-10-11 21:38:12 +02:00
Ori Bernstein 7367b8d2e7 Fetch IMAP flags from server. This makes us sync read/answered/... flags with unix. 2019-10-10 11:52:22 -07:00
Ori Bernstein e3a43c4f2b awk: make empty FS unicodely-correct. 2019-10-09 17:36:02 -07:00
cinap_lenrek db911d4fef sdiahci: force Hudson SATA Controller to AHCI mode 2019-10-08 13:53:57 +02:00
cinap_lenrek 6716e9ba20 sshfs: fix dir2attrib() memory leak in wstat error case (thanks BurnZeZ) 2019-10-07 12:51:21 +02:00
cinap_lenrek f763dc1640 sshfs: fix race condition between sendproc() and recvproc()
there was a race between the sendproc putting the request on
the sreqrd[] id and the recvproc handling the response, and
potentially freeing the request before the sendproc() was
finished with the request (or the fid).

so we defer allocating a request id and putting it on the
sreqrd[] stage after we have completely generated the
request in vpack(). this prevents the handling of the request
before it is even sent.

this also means that the SReq should not be touched after
calling sendpkt(), submitreq(), submitsreq().

secondly, putsfid() needs to acquire the RWLock to make sure
sendproc() is finished with the request. the scenario is that
recvproc() can call respond() on the request before sendproc()
has unlocked the SFid.
2019-10-07 11:52:14 +02:00
cinap_lenrek af23bb343a cwfs: fix listen filedescriptor leaks 2019-10-04 18:54:01 +02:00
cinap_lenrek dea2905783 lib9p: fix listensrv() filedescriptor leaks 2019-10-04 18:52:53 +02:00
cinap_lenrek 2401794cff sshfs: use threadexits() instead of exits() 2019-10-04 18:51:44 +02:00
cinap_lenrek ff16079e49 upas/fs: speedup mtree and henter()
move digest pointer into Mtree structrue and embed it into Idx struct
(which is embedded in Message) to avoid one level of indirection
during mtreecmp().

get rid of mtreeisdup(). instead we have mtreeadd() return the old
message in case of a collision. this avoids double lookup.

increase the hash table size for henter() and make it a prime.
2019-10-03 15:49:53 +02:00
cinap_lenrek c0f464b98f pc: move low-level allocation details out of mmu.c into memory.c rampage() function 2019-10-02 01:01:34 +02:00
cinap_lenrek 0ee738ef8c vgai81x: use vmap() for uncached access to cursor data instead of manipulating kernel page table
on 386, the kernel memory region is mapped using huge 4MB pages
(when supported by the cpu). so the uncached pte manipulation
does not work to map the cursor data with uncached attribute.

instead, we allocate a memory page using newpage() and map
it globally using vmap(), which maps it uncached.
2019-10-02 00:58:46 +02:00
cinap_lenrek d15008fdef ape/cc: add spim 2019-09-22 20:35:16 +02:00
cinap_lenrek d559cd005c 2c(1): document 7c (arm64) 2019-09-22 19:09:25 +02:00
cinap_lenrek 490c3d87cb usbxhci: fix endpoint stall recovery, handle Ep.clrhalt flag
after issuing CR_RESETEP command, we have to invalidate
the endpoints output context buffer so that the halted/error
status reflects the new state. not doing so resulted in
the halted state to be stuck and we continued issuing
endpoint reset commands when we where already recovered.

handle the devusb Ep.clrhalt flag from devusb that userspace
uses to force a endpoint reset on the next transaction.
2019-09-22 18:51:41 +02:00
cinap_lenrek 71a1d11a81 cmd/ip/*: chown the network connection after authentication
for servers that handle incoming network connections and authentication,
change the owner of the network connection file to the authenticated user
after successfull authentication.

note that we set the permissions as well to 0660 because old devip used
to unconditionally set the bits.
2019-09-21 23:36:44 +02:00
cinap_lenrek 5993760e14 devip: fix permission checking
permission checking had the "other" and "owner" bits swapped plus incoming
connections where always owned by "network" instead of the owner of
the listening connection. also, ipwstat() was not effective as the uid
strings where not parsed.

this fixes the permission checks for data/ctl/err file and makes incoming
connections inherit the owner from the listening connection.

we also allow ipwstat() to change ownership to the commonuser() or anyone
if we are eve.

we might have to add additional restrictions for none at a later point...
2019-09-21 23:28:37 +02:00
cinap_lenrek b56909157f bootrc: unmount devip *before* starting factotum
we want devip to get reattached after hostowner has been written. factotum
already handles this with a private authdial() routine that mounts devip
when it is not present. so we detach devmnt before starting factotum,
and attach once factotum finishes.
2019-09-21 18:48:14 +02:00
cinap_lenrek 5b7d8e1f6f bootrc: remount devip after /dev/hostowner has been written by factotum
devip remembers the attach uname so after we set hostowner we
remount devip so future connections have the right owner.
2019-09-21 18:11:52 +02:00
cinap_lenrek 12fa017f3f devproc: fix fishy locking in proctext(), check proc validity, static functions
the locking in proctext() is wrong. we have to acquire Proc.seglock
when reading segments from Proc.seg[] as segments do not
have a private freelist and can therefore be reused for other
data structures.

once we have Proc.seglock acquired, check that the process pid
is still valid so we wont accidentally read some other processes
segments. (for both proctext() and procctlmemio()). this also
should give better error message to distinguish the case when
the process did segdetach() the segment in question before we
could acquire Proc.seglock.

declare private functions as static.
2019-09-21 16:36:40 +02:00
cinap_lenrek c45458b929 devproc: move proctab() call after Qnotepg special case in procwrite() 2019-09-19 02:24:23 +02:00
cinap_lenrek 24d1fbde27 kernel: simplify pgrpnote(); moving the note string copying to procwrite()
keeps handling of devproc's note and notepg files similar and in the
same place and reduces stack usage.
2019-09-19 02:07:46 +02:00
cinap_lenrek f8de863602 ape: don't hardcode list of ape library directories in /sys/src/ape/lib/mkfile
this change allows one to drop library directories (like
freetype) into /sys/src/ape/lib/ and have them built without
having to change the mkfile.
2019-09-16 16:21:40 +02:00
cinap_lenrek fc4bfd57d2 bcm64: add addarchfile() prototype to fns.h (for qeed) 2019-09-15 04:53:45 +02:00
cinap_lenrek acab8881bc bcm64: enter page tables in mmutop *AFTER* switching asid in mmuswitch()
there was a small window between modifying mmutop and switching the
asid where the core could bring in the new entries under the old asid
into the tlb due to speculation / prefetching.

this change moves the entering of the page tables into mmutop after
setttbr() to prevent this scenario.

due to us switching to the resereved asid 0 on procsave()->putasid(),
the only asid that could have potentially been poisoned would be asid 0
which does not have any user mappings. so this did not show any noticable
effect.
2019-09-14 14:02:34 +02:00
cinap_lenrek ca2f1c07f2 acid/kernel: for stacktraces, try to use context from error stack when process is not sleeping
when a process state has not been saved (Proc.mach != nil)
then the contents of Proc.sched should be considered invalid.

to approximate a stacktrace in this case, we use the error
stack and get a stacktrace from the last waserror() call.
2019-09-12 15:28:04 +02:00
cinap_lenrek fbf29fc695 ip/cifsd: dont return garbage in upper 32 bit of unix extension stat fields 2019-09-11 15:41:14 +02:00
cinap_lenrek 88b386a4a1 ip/cifsd: add basic support for UNIX extensions 2019-09-10 21:19:34 +02:00
cinap_lenrek 67edb3bd01 ip/cifsd: exit to close connection when we get malformed smb header (fixes linux mount hang) 2019-09-10 21:17:23 +02:00
cinap_lenrek 481a4c75fd usbehci: silence "param declared but not used" compiler warning in itdinit()/sitdinit() 2019-09-09 16:58:45 +02:00
cinap_lenrek 7de7444c6e sdide: silence compiler warning in atadebug() 2019-09-09 16:56:01 +02:00
Roberto E. Vargas Caballero 42240127a7 ape: Add mkstemp to /sys/src/ape/lib/ap/gen/mkfile 2019-09-09 17:27:57 +01:00
Roberto E. Vargas Caballero 5e9d8a7b18 Add toascii() to ape 2019-09-09 16:00:06 +01:00
Roberto E. Vargas Caballero e0720a48b0 Add mkstemp to stdlib.h
q
2019-09-09 15:58:39 +01:00
cinap_lenrek 662fd71e11 merge 2019-09-08 19:04:55 +02:00
cinap_lenrek 62eec43340 kernel: clear FPillegal in pexit() and before pprint()
pexit() and pprint() can get called outside of a syscall
(from procctl()) with a process that is in active note
handling and require floating point in the kernel on amd64
for aesni (devtls).
2019-09-08 19:02:01 +02:00
cinap_lenrek 6ad06b36b2 devproc: restore psstate info string in procstopwait() 2019-09-08 18:53:12 +02:00
Ori Bernstein 71939a82cc Allow address expressions in ?c after int casts.
This fixes ocaml on non-x86 architectures, where we have code
that looks like:

	#define Fl_head ((uintptr_t)(&sentinel.first_field))

Without this change, we get an error about a non-constant
initializer. This change takes the checks for pointers and
makes them apply to all expressions. It also makes the checks
stricter, preventing the following from compiling to junk:

	int x;
	int y = 42;
	int *p = &x + y
2019-09-07 18:25:04 -07:00
Ori Bernstein 2917cb1d17 merge 2019-09-07 12:46:44 -07:00
Ori Bernstein ba8e5c774a Libflac: Tell it that we have stdint.h so it finds SIZE_MAX 2019-09-07 12:37:33 -07:00
Ori Bernstein ff9ce8210a Include integer limits from generic stdint.h in system-specific stdint.h 2019-09-06 18:01:52 -07:00
cinap_lenrek 971e14663a merge 2019-09-07 02:13:35 +02:00
cinap_lenrek 766a641d25 cc: fix void cast crash
the following code reproduces the crash:

void
foo(void)
{
}

void
main(int argc, char **argv)
{
	(void)(1 ? (void)0 : foo());
}

the problem is that side() gives a false positive on the OCOND
with later constant folding eleminating the acutal side effect
and OCAST ending up with two nested OCATS with the nested one
being zapped (type == T).
2019-09-07 02:11:18 +02:00
Ori Bernstein c09546ccea Add missing UINTsz_MIN defines to ape stdint.h 2019-09-06 16:33:11 -07:00
Ori Bernstein d1204d9b80 merge 2019-09-06 11:57:08 -07:00
David du Colombier 27824a6c0b sys/src/libventi: define VtEntryNoArchive constant 2019-09-06 11:55:35 -07:00
David du Colombier cb091e7539 sys/src/libventi: implement vtsha1 and vtsha1check functions 2019-09-06 11:55:18 -07:00
David du Colombier 63ae9ed53a sys/src/libventi: implement vtreconn and vtredial functions 2019-09-06 11:54:44 -07:00
cinap_lenrek 98e2ea45fb ip/ipconfig: don't leave behind null address when dhcp gets interrupted
cleanup the null address (::) when the command gets interrupted.
2019-09-06 18:48:35 +02:00
Ori Bernstein 8cbe3772c4 Add RFC2822 (email style) formatted dates to to date(1). 2019-09-06 08:25:21 -07:00
cinap_lenrek 0cb4115b82 kernel: get rid of tmperrbuf and use syserrstr swapping instead in namec() 2019-09-04 02:44:39 +02:00
cinap_lenrek 4088f72903 rune(2): complete source references 2019-09-04 02:41:22 +02:00
cinap_lenrek 6aa7ebcf49 kernel: make exec clear errstr, stop side-channels and truncate on utf8 boundary
make exec() clear the per process error string
to avoid spurious errors and confusion.

the errstr() syscall used to always swap the
maximum buffer size with memmove(), which is
problematic as this gives access to the garbage
beyond the NUL byte. worse, newproc(), werrstr()
and rerrstr() only clear the first byte of the
input buffer. so random stack rubble could be
leaked across processes.

we change the errstr() syscall to not copy
beyond the NUL byte.

the manpage also documents that errstr() should
truncate on a utf8 boundary so we use utfecpy()
to ensure proper NUL termination.
2019-09-04 02:40:41 +02:00
cinap_lenrek e4a57c8b8a bcm64: enable devgpio in kernel configuration (thanks qeed) 2019-09-02 19:38:44 +02:00
cinap_lenrek 4b9ccb2de0 ndb/dnsquery, ndb/csquery: write ">" prompt to stderr (thanks kvik)
kvik writes:

dnsquery(8) prints the interactive prompt on stdout together with
query results, making scripted usage unnecessarily difficult.

A straightforward solution is prompting on stderr instead: as
practiced by rc(1), among many others -- promptly taking care of
the issue:

	; echo 9front.org mx | ndb/dnsquery >[2]/dev/null
2019-08-30 20:17:19 +02:00
cinap_lenrek a6fde3edc5 rsa(2): document asn1encodeRSApriv() and asn1encodeRSApub() functions 2019-08-30 07:35:54 +02:00
cinap_lenrek 85216d3d95 auth/rsa2asn1: implement private key export with -a flag (thanks kvik)
kvik writes:

I needed to convert the RSA private key that was laying around in
secstore into a format understood by UNIX® tools like SSH.

With asn12rsa(8) we can go from the ASN.1/DER to Plan 9 format, but not
back - so I wrote the libsec function asn1encodeRSApriv(2) and used it in
rsa2asn1(8) by adding the -a flag which causes the full private key to be
encoded and output.
2019-08-30 07:34:35 +02:00
cinap_lenrek 7bb1a9a185 pc64: map kernel text readonly and everything else no-execute
the idea is to catch bugs and make kernel exploitation
harder by mapping the kernel text section readonly
and everything else no-execute.

l.s maps the KZERO address space using 2MB pages so
to get the 4K granularity for the text section we use
the new ptesplit() function to split that mapping up.

we need to set EFER no-execute enable bit early
in apbootstrap so secondary application processors
will understand the NX bit in our shared kernel page
tables. also APBOOTSTRAP needs to be kept executable.

rebootjump() needs to mark REBOOTADDR page executable.
2019-08-29 07:35:22 +02:00
cinap_lenrek e988d56a2f 8l, 6l: fix "unknown relation: TEXT" xfol() bug (thanks mischief)
mischief reports:

this assembler input assembles with 6a but makes 6l crash.

 // 6a l.s
 // 6l l.6
 // _intrr: unknown relation: TEXT in _intrr
 // 6l 511: suicide: sys: trap: fault write addr=0x18 pc=0x20789c

 TEXT noteret(SB), 1, $-4
         CLI
         JMP _intrestore // works when commented

 TEXT _intrr(SB), 1, $-4
 _intrestore:
         RET

 TEXT _main(SB), 1, $-4
         RET
2019-08-28 21:01:16 +02:00
cinap_lenrek d9fec3c70a kernel: prohibit changing cache attributes (SG_CACHED|SG_DEVICE) in segattach(), set SG_RONLY in data2txt()
the user should not be able to change the cache
attributes for a segment in segattach() as this
can cause the same memory to be mapped with
conflicting attributes in the cache.

SG_TEXT should always be mapped with SG_RONLY
attribute. so fix data2txt() to follow the rules.
2019-08-27 06:16:20 +02:00
cinap_lenrek d25ca13ed8 kernel: make user stack segment non-executable 2019-08-27 04:04:46 +02:00
cinap_lenrek 1e773c97e7 pc64: implement NX bit discovery, map kernel mappings no-execute 2019-08-27 03:55:12 +02:00
cinap_lenrek 49411b2ca1 kernel: catch execution read fault on SG_NOEXEC segment (for mips) 2019-08-27 03:48:51 +02:00
cinap_lenrek 2149600d12 kernel: catch execution read fault on SG_NOEXEC segment
fault() now has an additional pc argument that is
used to detect fault on a non-executable segment.
that is, we check on read fault if the segment
has the SG_NOEXEC attribute and the program counter
is within faulting page.
2019-08-27 03:47:18 +02:00
cinap_lenrek 128ea44a89 kernel: expose no execute bit to portable mmu code as SG_NOEXEC / PTENOEXEC, add PTECACHED bits
a portable SG_NOEXEC segment attribute was added to allow
non-executable (physical) segments. which will set the
PTENOEXEC bits for putmmu().

in the future, this can be used to make non-executable
stack / bss segments.

the SG_DEVICE attribute was added to distinguish between
mmio regions and uncached memory. only matterns on arm64.

on arm, theres the issue that PTEUNCACHED would have
no bits set when using the hardware bit definitions.
this is the reason bcm, kw, teg2 and omap kernels use
arteficial PTE constants. on zynq, the XN bit was used
as a hack to give PTEUNCACHED a non-zero value and when
the bit is clear then cache attributes where added to
the pte.

to fix this, PTECACHED constant was added.

the portable mmu code in fault.c will now explicitely set
PTECACHED bits for cached memory and PTEUNCACHED for
uncached memory. that way the hardware bit definitions
can be used everywhere.
2019-08-26 22:34:38 +02:00
qwx 91a8d03040 vncv: fix snarf buffer realloc memory corruption
fix never updating p when snarf is reallocated,
resulting in memory corruption.
2019-08-26 17:02:58 +02:00
cinap_lenrek 51cfe763a4 emmc: 50MHz highspeed support (from richard miller) 2019-08-25 20:02:53 +02:00
cinap_lenrek a8c50a7943 bcm64: replace emmc2 driver with richard millers sdhc driver
the new driver supports 50MHz highspeed bus mode
and uses ADMA instead of SDMA.
2019-08-25 18:45:29 +02:00
cinap_lenrek 60ec886191 /sys/lib/dist/mkfile: adjust 2GB for pi3 and zynq img 2019-08-24 16:35:03 +02:00
cinap_lenrek f6ef250871 /sys/lib/dist/mkfile: storage vendors idea of 2GB is deflating 2019-08-24 16:29:00 +02:00
cinap_lenrek bcf988aff1 bcm64: deal with discontinuous memory regions, avoid virtual memory aliasing, implement vmap() proper
on the 2GB and 4GB raspberry pi 4 variants, there are two
memory regions for ram:

[0x00000000..0x3e600000)
[0x40000000..0xfc000000)

the framebuffer is somewhere at the end of the first
GB of memory.

to handle these, we append the region base and limit
of the second region to *maxmem= like:

*maxmem=0x3e600000 0x40000000 0xfc000000

the mmu code has been changed to have non-existing
ram unmapped and mmukmap() now uses small 64K pages
instead of 512GB pages to avoid aliasing (framebuffer).

the VIRTPCI mapping has been removed as we now have
a proper vmap() implementation which assigns vritual
addresses automatically.
2019-08-23 21:39:20 +02:00
cinap_lenrek e6d22570a8 bcm: invalidate cache on Fbinfo after firmware completion 2019-08-22 02:54:06 +02:00
cinap_lenrek aca0293f0b bcm: flush out early boot messages on uart and screen initialization
make early boot messages available by writing out
kmesg.buf after uart and screen initialization.
2019-08-22 02:52:21 +02:00
cinap_lenrek a70b93a356 /sys/lib/acid/kernel: fix procstk() for arm64, set kdir for arm/arm64 to bcm/bcm64 2019-08-21 19:34:24 +02:00
cinap_lenrek b4cb19235e bcm: set XN bits for kernel device mappings 2019-08-21 18:28:01 +02:00
cinap_lenrek 6280c0f17b bcm64: do not use OTP_BOOTMODE_REG to determine OSC frequency (thanks richard miller)
the register does not seem to be accessible on the Rpi 3b.
so instead hardcode oscfreq in the Soc structure.
2019-08-19 16:42:20 +02:00
cinap_lenrek a611fe20e1 disk/format: implement long name support 2019-08-19 01:09:24 +02:00
cinap_lenrek ac98922f44 add missing device tree file for raspberry pi 4 2019-08-18 22:19:29 +02:00
cinap_lenrek 534be5aeb3 add raspberry pi 4 kernel and bootloader to pi3.img target 2019-08-18 21:43:04 +02:00
cinap_lenrek f35d5ee5b0 bcm64: add support for more than 1GB of ram (untested)
this adds a 4GB KMAP window into the kernel address space
so we can access all physical ram on raspberry pi 4 for
user pages.

note that kernel memory above KZERO is still limited
to 1GB because of DMA restrictions.
2019-08-18 21:16:30 +02:00
cinap_lenrek 3fc8d1bdae bcm64: add driver for emmc2 controller 2019-08-18 18:50:24 +02:00
cinap_lenrek bc8c31dbd5 bcm: fix typo in gpio.c on unused AFedge0 constant 2019-08-16 19:35:46 +02:00
cinap_lenrek 031f5756ab bcm64: poll gisb arbiter for asynchronous bus errors 2019-08-16 19:24:00 +02:00
cinap_lenrek 54becb8466 ethergenet: remove debugging
the hangs where caused by missing NX bits on the mmio mappings,
so the debug code is not needed anymore.
2019-08-16 19:22:28 +02:00
cinap_lenrek 3bf49f1814 bcm64: set XN bits for kernel device mappings 2019-08-16 19:05:04 +02:00
cinap_lenrek ffd99348f3 cc: use 7 octal digits for 21 bit runes 2019-08-12 19:15:02 +02:00
cinap_lenrek 675870f9b1 libauth: do not set errstr in auth_rpc() for ARdone result (thanks majiru) 2019-08-02 19:06:23 +02:00
cinap_lenrek 05f9a66fd4 bcm, bcm64: add vcore support for raspberry pi 3 GPIO expander 2019-07-28 11:39:57 +02:00
cinap_lenrek 8630bd35a6 bcm, bcm64: add BCM2711 support for gpiopull(), fix gpiomeminit(), cleanup
according to the following linux change, BCM2711 uses a different
method for changing pullup/down mode:

abcfd09286 (diff-cf078559c38543ac72c5db99323e236d)

gpiomeminit() was broken, using virtual address for the gpio physseg
instead of the physical one.

cleanup the code, avoid repetition by declaring static u32int *regs
variable. make local variable names consistent.
2019-07-27 20:00:53 +02:00
cinap_lenrek ea2a5a33ca bcm64: fix wrong prescaler for generic timer on rpi4
the raspberry pi 4 uses 54 instead of 19.2 MHz crystal.
detect which frequency is used by reading OTP bootmode
register:

https://www.raspberrypi.org/documentation/hardware/raspberrypi/otpbits.md

Bit 1: sets the oscillator frequency to 19.2MHz
2019-07-27 17:59:25 +02:00
cinap_lenrek 834f670349 ethergenet: fix flow control negotiation 2019-07-25 17:44:47 +02:00
cinap_lenrek 1717368f64 bcm, bcm64: clean dma destination buffer before issuing dma in case of non cache-line-size aligned buffer 2019-07-25 13:55:17 +02:00
cinap_lenrek 706926f818 bcm64: add config for raspberry pi 4 2019-07-25 09:12:40 +02:00
cinap_lenrek 3bc4e5a6d5 bcm64: work in progress genet ethernet driver for raspberry pi 4 2019-07-25 09:11:53 +02:00
cinap_lenrek 2a4c767c41 bcm64: reorganize virtual memory map for rapberry pi4 2019-07-25 09:10:07 +02:00
cinap_lenrek 4200778861 bcm64: update io.h for pci express and raspberry pi 4 2019-07-25 09:08:35 +02:00
cinap_lenrek 6d9edeeb67 bcm64: add pci express driver for raspberry pi 4 2019-07-25 09:04:50 +02:00
cinap_lenrek 676ef0ca0b bcm64: add gic interrupt controller driver for raspberry pi 4 2019-07-25 09:02:47 +02:00
cinap_lenrek 10b456ff44 bcm64: add gisb arbiter driver to catch bus timeouts 2019-07-25 09:01:44 +02:00
cinap_lenrek 811b80cae1 bcm, bcm64: make irq.$O optional and add intrdisable(), use intrenable()
the raspberry pi 4 has a new interrupt controller and
pci support, so get rid of intrenable() macro and
properly make intrenable function with tbdf argument.
2019-07-25 08:58:58 +02:00
cinap_lenrek dfea95b3c2 bcm64: strip debug symbols to make sure .img file is multiple of 4 bytes
the raspberry pi4 firmware refuses to enable the GIC interrup controller
for arm64 when the .img file is not a multiple of 4 bytes. yes, this
is insane and nowhere documented.
2019-07-25 08:52:46 +02:00
cinap_lenrek 5a0c2e2d17 bcm, bcm64: add dmaflush() function and make virtio size and virtual address configurable in Soc.virtio and Soc.iosize 2019-07-25 08:41:37 +02:00
cinap_lenrek 4983adfa2c bcm, bcm64: add support for device tree parameter passing
the new raspberry pi 4 firmware for arm64 seems to have
broken atag support. so we now parse the device tree
structure to get the bootargs and memory configuration.
2019-07-25 08:19:12 +02:00
cinap_lenrek a6a1806c17 usbxhci: implement portable dma flush operations and move to port/ 2019-07-17 10:30:06 +02:00
cinap_lenrek 19a883ce7a usbehci: introduce dmaflush() function to handle portable cache invalidation for device drivers 2019-07-17 10:24:50 +02:00
cinap_lenrek a4688b0322 merge 2019-07-11 07:49:52 +02:00
cinap_lenrek a1a6f26110 kernel: move common ethermii to port/ 2019-07-11 07:47:39 +02:00
cinap_lenrek 7111de631c devuart: make sure uart is enabled in uartkick() 2019-07-11 07:45:34 +02:00
Alex Musolino 51550ba3d2 walk(1): add history section 2019-07-02 23:34:31 +09:30
Alex Musolino 32a2737823 tinc(8): add history section 2019-07-02 22:24:10 +09:30
cinap_lenrek 54f9b36720 usbxhci: fix mysterious ENABLESLOT failures (update to XHCI spec revision 1.2 (2019))
Ori Bernstein had Sunrise Point-H USB 3.0 xHCI Controller that would mysteriously
crash on the 5th ENABLESLOT command. This was reproducable by even just allocating
slots in a loop right after init.

It turns out, the 1.2 spec extended the Max Scratchpad Buffers in HCSPARAMS2 so our
driver would not allocate enougth scratchpad buffers and controller firmware would
crash once it went beyond our allocated scratchpad buffer array.

This change also fixes:

- ignore bits 16:31 in PAGESIZE register
- preserve bits 10:31 in the CONFIG register
- handle ADDESSDEV command failure (so it can be retried)
2019-07-02 05:34:13 +02:00
cinap_lenrek b2c7a8d84a pc64: preallocate mmupool page tables
preallocate 2% of user pages for page tables and MMU structures
and keep them mapped in the VMAP range. this leaves more space
in the KZERO window and avoids running out of kernel memory on
machines with large amounts of memory.
2019-06-28 18:12:13 +02:00
cinap_lenrek 6118d77858 ape: reimplement rename() - fixing compiler warnings and handling more error cases
handle empty filename, dot and dotdot. handle mismatching from/to directory/file
type. cleanup destination file on error. error when attempting to copy non-empty
directories.

little test program:

#include <unistd.h>
#include <stdio.h>

int
main(int argc, char *argv[])
{
	if(argc != 3){
		fprintf(stderr, "usage: %s old new\n", argv[0]);
		return 1;
	}
	if(rename(argv[1], argv[2])){
		perror("rename");
		return 1;
	}
	return 0;
}
2019-06-24 20:09:04 +02:00
cinap_lenrek 4cffc04364 8c, 6c: LEA x, R; MOV (R), R -> MOV x, R 2019-06-24 19:38:46 +02:00
cinap_lenrek 345714dd56 8c, 6c: avoid allocating index registers when we don't have to
when a operation receives a chain of OINDEX nodes as its operands,
each indexing step used to allocate a new index register. this
is wastefull an can result in running out of fixed registers on 386
for code such as: x = a[a[a[a[i]]]].

instead we attempt to reuse the destination register of the operation
as the index register if it is not otherwise referenced. this results
in the index chain to use a single register for index and result and
leaves registers free to be used for something usefull instead.

for 6c, try to avoid R13 as well as BP index base register.
2019-06-24 19:36:01 +02:00
cinap_lenrek 9f6967ed7e 8c: skip 64-bit regpair allocation for OINDEX nodes in cgen64()
OINDEX can only return TLONG result on 386 so give it
a register instead of a regpair and let gmove() handle
the conversion.
2019-06-24 19:25:13 +02:00