cinap_lenrek [Mon, 24 Feb 2014 21:42:22 +0000 (22:42 +0100)]
kernel: keep cached pages continuous at the end of the page list on imagereclaim()
imagereclaim() sabotaged itself by breaking the invariant
that cached pages are kept at the end of the page list.
once we made a hole of uncached pages, we would stop
reclaiming cached pages before it as the loop breaks
once it hits a uncached page. (we iterate backwards from
the tail to the head of the pagelist until pages have been
reclaimed or we hit a uncached page).
the solution is to move pages to the head of the pagelist
after removing them from the image cache.
cinap_lenrek [Fri, 21 Feb 2014 04:29:43 +0000 (05:29 +0100)]
aux/listen: rfork with RFREND
child processes handling the connection should be all
independent of each another and not share rendezvous
group. the rendezvous group sharing caused a bug in
exportfs when we switched from using pid to memory
address as rendezvous tag.
cinap_lenrek [Fri, 21 Feb 2014 04:23:21 +0000 (05:23 +0100)]
exportfs: bring back the changes, bug was due to rendezvous group being shared by listen
exportfs used pid of slave proc as rendezvous tag. when we
changed it to use Proc* memory address, there where tag
collisions because listen didnt fork the rendezvous group (bug!).
for now, just do rfork(RFREND) in main just in case.
cinap_lenrek [Thu, 20 Feb 2014 17:32:47 +0000 (18:32 +0100)]
fix blowfish endianess confusion (thanks erik)
from /n/sources/patch/blowfish/readme:
Blowfish is broken. The order of the bytes in the ciphertext
is wrong. The problem is the conversion from the ciphertext
plaintext block to the array of u32int used by the core funcions
and vice versa.
This code has been tested on big endian and little endian
machines.
A test program is also included, bftets.c. It uses the
test vectors of blowfish available at
https://www.schneier.com/code/vectors.txt
cinap_lenrek [Mon, 17 Feb 2014 12:25:24 +0000 (13:25 +0100)]
prof: properly save and restore RARG for amd64
amd64 passes first argument in RARG (BP) register
which has the be preserved duing _profin() and
_profout() calls. to handle this we introduce
_saveret() and _savearg(). _saveret() returns
AX, _savearg() returns RARG (BP). for archs other
and amd64, _saveret() and _savearg() are the
same function, doing nothing.
cinap_lenrek [Sun, 16 Feb 2014 17:50:30 +0000 (18:50 +0100)]
mothra: fix unicode rendering for plaintext
we did the utf-8 to unicode conversion in pl_nextc(),
but the plaintext handler uses pl_readc() which only
translates newlines but otherwise returns bytes.
cinap_lenrek [Sat, 15 Feb 2014 05:17:05 +0000 (06:17 +0100)]
pc64: move VMAP into its own PDP (for vmware)
modifying the kernel pdp (CPU0PDP) hangs vmware. so
we initialize the pdp with KZERO and KZERO+1GB map
in l.s and never change it. (except when removing
the zero double map which seems to work).
VMAP has its own pdp now allowing to map 512GB of
physical address space. this simplifies the code
a bit and gives nice virtual addresses.
Matthew Veety [Sat, 15 Feb 2014 03:05:25 +0000 (22:05 -0500)]
added in a way to make net.rc wait for the network hardware to come up before running ip/ipconfig. This fixes the issue with the Raspberry Pi where ip/ipconfig tried running prior to /net/etherU3 exists
Matthew Veety [Fri, 14 Feb 2014 05:11:11 +0000 (00:11 -0500)]
similar to my last commit, but combined the two waits for the usb devices. still configurable, but with usbwait. If usbwait is not defined then it defaults to the original 2 seconds.
cinap_lenrek [Sun, 9 Feb 2014 00:37:05 +0000 (01:37 +0100)]
acid: fix memory corruption due to gc
we cannot call gc() in execute() because it will gc
anonyous intermediate results which happens when we
construct a list and the elements are calculated by
calling a function thru ocall() which calls execute().
also, the _thiscmd symbol; which is used to keep
a reference to a statement so it wont get garbage
collected; does not work as yyparse() is recursive
(include statements).
we add execrec() function which *only* gets called from
yyparse() when evaluating a statement. it will
keep a stack on the _thiscmd symbol handling the yyparse()
recursion.
we also only call gc() in execrec() before calling
execute(). so execute() will never gc() while evaluating
a statement which prevents the intermediate results
from getting collected.
cinap_lenrek [Sat, 8 Feb 2014 02:50:41 +0000 (03:50 +0100)]
pc64: handle negative file offsets when accessing kernel memory with devproc
file offset is 64 bit signed integer, negative offsets
are invalid and rejected by the kernel. to still access
kernel memory on amd64, we unconditionally clear the sign
bit of the 64 bit offset in libmach and devproc sign
extends the offset back to a 64 bit address.
cinap_lenrek [Sat, 8 Feb 2014 01:33:29 +0000 (02:33 +0100)]
jpg: center image in screen
when using the jpg(1) programs interactively, draw the
image in the center of it. this avoids wasting space
with always on borders on small windows and looks better
when used in fullscreen.
mischief [Fri, 7 Feb 2014 02:03:17 +0000 (18:03 -0800)]
pc64: ensure user pc is never set to a non-canonical address through setregisters
on intel processors, a general protection exception is fired if a non-canonical address is loaded into PC during SYSRET. this will cause the kernel to panic.
see http://www.kb.cert.org/vuls/id/649219 and the intel software developer manual for more information.
cinap_lenrek [Thu, 6 Feb 2014 21:41:42 +0000 (22:41 +0100)]
pc64: fix kmap()
kmapindex has to be per process, not per mach, as the process
can be switched to another processor while the mapping is
established.
to bootstrap the first process, we have to temporarily set up
so the kmap MMU's can be attached to the process. previously
we assumed that the first two pages for the initial process
where below 2GB and could be accessed with KADDR() directly.
with 16GB machine, all the 2GB above KZERO are dedicated to
the kernel so the user pages returned by newpage() need to
be mapped.