Commit graph

2885 commits

Author SHA1 Message Date
cinap_lenrek de356dd855 acid: update acid libraries for amd64 2014-02-10 23:07:37 +01:00
cinap_lenrek 16acf605e2 acid: make 'a' and 'A' format to have the same size as mach->szaddr
to make it easier to write portable acid code, we
introduce 'A' format in the same meaning as in db(1):

A    Print the value of dot in hexadecimal.  Dot is
     unaffected.

both 'a' (symbolic) and 'A' will both have 64 or 32 bit
size depending on the mach, so pointer array indexing
works the same.
2014-02-09 22:43:09 +01:00
cinap_lenrek 9bdf602ebb pc64: pass Ureg* argument in BP to userspace note handler 2014-02-09 02:23:33 +01:00
cinap_lenrek 9d8f5a1466 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.
2014-02-09 01:37:05 +01:00
cinap_lenrek 6b146c70c2 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.
2014-02-08 03:50:41 +01:00
cinap_lenrek 43212f6432 mtrr: fix mistake 2014-02-08 03:40:17 +01:00
cinap_lenrek 7af85b9e74 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.
2014-02-08 02:33:29 +01:00
cinap_lenrek b3df8945bd reuse mtrr slots with default memory type 2014-02-08 01:01:26 +01:00
cinap_lenrek 9c99675c1c aux/vga: fix format string error with 6c 2014-02-08 00:29:06 +01:00
cinap_lenrek eaafcf2187 pc64: bump segment limit to 64GB 2014-02-08 00:23:18 +01:00
cinap_lenrek 2b4706b662 pc64: dont reuse mtrr slots that are above 4GB
we used to override/reuse mtrr slots over 4GB as the
kernel wasnt able to use that memory. pc64 can.
2014-02-07 20:04:19 +01:00
mischief fc7f6f8e99 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.
2014-02-06 18:03:17 -08:00
cinap_lenrek 0fdb1578ef pc64: fix devcons format strings for memory sizes 2014-02-07 23:35:27 +01:00
cinap_lenrek 88cc09a580 cwfs: limit memsize() to 1GB until pool can handle huge allocations 2014-02-07 23:33:34 +01:00
cinap_lenrek c3917ec566 pc64: fix poolsummary() string format 2014-02-07 23:02:56 +01:00
cinap_lenrek e836796365 pool: use uintptr for pool size
note, arenas and blocks still use ulong for sizes. so
we have to check for overflow when attempting to merge
arenas.
2014-02-06 22:47:05 +01:00
cinap_lenrek c065eadb53 pc64: fix note handling 2014-02-06 22:43:33 +01:00
cinap_lenrek bfbc5ab197 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.
2014-02-06 22:41:42 +01:00
cinap_lenrek f029ea1694 have to use NULL instead of nil for ape programs... 2014-02-05 19:52:09 +01:00
cinap_lenrek 868a262bb8 pc64: dont 4 byte align stack pointer for amd64 in sysexec() 2014-02-05 19:48:36 +01:00
cinap_lenrek c76243e7e5 fix wrong type for terminating nil argument for execl()
we have to use (void*)0 instead of (int)0 otherwise the
upper bits are uninitialized on amd64.
2014-02-05 19:25:24 +01:00
mischief 492958f08e libpanel: remove pointless pointer casts 2014-02-04 00:16:36 -08:00
cinap_lenrek 8c4a02a29b merge 2014-02-05 08:58:53 +01:00
cinap_lenrek 9f99edda55 mothra: better handling of malformed search regex 2014-02-05 08:43:31 +01:00
mischief ffcac11a5a libpanel: fix pointer casts and format strings 2014-02-04 23:34:19 -08:00
cinap_lenrek 0b1c655160 mothra: dont panic on invalid regular expression in searchbox 2014-02-05 08:25:01 +01:00
mischief 1eef373152 pc64: fix up pointer calculations and enable sdvirtio disk driver 2014-02-03 01:22:26 -08:00
cinap_lenrek 34f7e4ef9a pc64: remove cinaps cga screen interrupt debugger, was experiment... 2014-02-04 02:08:26 +01:00
cinap_lenrek de0712c0b5 pc64: dont dump user registers on exception, was experiment... 2014-02-04 02:06:11 +01:00
cinap_lenrek b7be695d5c hjfs: fix wrong channel size for syncb (fixes amd64 crash) 2014-02-04 01:58:17 +01:00
cinap_lenrek 3f522c745a doom: port to amd64 2014-02-04 01:09:46 +01:00
cinap_lenrek 88505bff06 realemu: cleanup opidiv
no need for switch here, just calculate the values. also fixes
6l warning about uninitialized min/max (compiler assumes none
of the case statements could match).
2014-02-03 22:55:45 +01:00
cinap_lenrek fefc7b526d libmach: change mach pgsize back from 4K to 2MB for amd64
the Mach page size is used to calculate segment alignment. its
not the real effective page size used by the kernel.

this fixes acid.
2014-02-03 22:39:07 +01:00
cinap_lenrek bfbb68a712 ipmux: fix 6c complaints 2014-02-03 20:14:19 +01:00
cinap_lenrek 94282847ec merge 2014-02-03 20:06:12 +01:00
cinap_lenrek ccfb6168c8 kernel: dont double ptemap size in newseg()
this doubling affects all segment types, not just bss.
(tho text/data are usually small...)

and theres no telling if the segment will actually
grow in the future justifying the reduction of memmove
overhead in ibrk().

some ape programs are approaching the 16mb ssegmap size
so that code might trigger.

removing the smarts...
2014-02-03 20:04:43 +01:00
cinap_lenrek 6a55790197 pc/pc64: move common code to pc/devarch.c 2014-02-03 06:24:31 +01:00
cinap_lenrek c3028fb924 pc64: implement shutdown and idlehands
just copies from pc kernel. should refactor into common
pc code.
2014-02-03 05:29:53 +01:00
mischief 35d19fc6fb merge 2014-02-02 07:41:56 -08:00
mischief d082e3a5ae pc64: enable sdide driver 2014-02-02 07:34:54 -08:00
mischief ddd51650d8 acid: fix memory leak in fundefs (from 9atom) 2014-02-02 03:17:48 -08:00
cinap_lenrek b5d47d6deb libdraw: fix typo: 0xfffff -> 0xffff 2014-02-03 03:56:01 +01:00
cinap_lenrek 5fd52f6241 libdraw: work arround devdraw truncating screenid as 16bit 2014-02-03 03:53:18 +01:00
cinap_lenrek f556fd2437 devdraw: screenid is BGLONG, not BGSHORT 2014-02-03 03:52:27 +01:00
cinap_lenrek bfee76e5d3 pc64: track per process kmap page tables in separate MMU list.
we have to keep kmap page tables in ther own list
because user tables are subject to (virtual) tlb flushing.

we never free kmap page tables except in mmurelease()
where we just link the kmap mmu list in front of the user
mmus and call mmufree() which will free all the mmu's
of the process.
2014-02-02 18:01:13 +01:00
cinap_lenrek b7b3406657 malloctag: only store lower 32bit of malloc tag, fix getrealloctag
as erik quanstro suggests, theres not much of a point in
storing the full 64bit pc as one cannot get a code segment
bigger than 4G and amd64 makes it hard to use a pc that
isnt 64bit sign extension of 32bit.

instead, we only store ulong (as originally), but sign
extend back when returning in getmalloctag() and
getrealloctag().

getrealloctag() used to be broken. its now fixed.
2014-02-02 16:03:59 +01:00
cinap_lenrek 0cdb32cc18 kernel: fix bogus free in sysexec.
we free the wrong pointer in the waserror() block.
2014-02-02 15:11:19 +01:00
cinap_lenrek 269788514c newuser: dont bark when we cannot bind $home/bin/$objtype after /bin, create $home/bin/amd64 2014-02-02 10:59:05 +01:00
cinap_lenrek 29eea45931 kernel: do not pass user address of fd[2] array to newfd2()
access to user memory can pagefault and newfd2() holds
fgrp spinlock while writing to it. make temporary copy
on the stack in syspipe().
2014-02-02 10:41:51 +01:00
cinap_lenrek 0b95485db7 kernel: use uintptr when appropriate in syssegflush() 2014-02-02 09:59:54 +01:00