Age | Commit message (Collapse) | Author |
|
|
|
This is intended for the secrmem pool in the kernel,
but could also be used for temporary pools to
recover the memory used by the arenas.
|
|
While a previous commit attempted to address the issues of a
; cd /sys/src/ && mk nuke && mk install
it seems that any kind of automatic detection for when to
rebuild will blow up in someones face. I am moving this to
an explicit virtual rule, the generated files are expected
to be there.
|
|
While mkfiles will properly build them, if a user does
; cd /sys/src && mk nuke && mk install
without libc there, you will not be able to build
mkrunetype.c in order to generate these data files.
Let's not make this more complicated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
adventuresin9 wrote:
I finally found the time to get the kernel working for the Mediatek
mt7688. Just the uart works now, so I still need to do the ethernet
and hopefully wifi and other stuff. But it boots all the way to the
bootargs ask, and then running !rc lets you run rc in paqfs.
https://github.com/adventuresin9/9front-mt7688
I had a heck of a time getting it to work at first, till I tracked
down an issue in strlen, that comes from the strchr code. Lots of
stuff broke, and this bug also meant error messages wouldn't print
properly.
running this on the mt7688;
int n1, n2, n3, n4, n5, n6;
char *a1, *a2, *a3, *a4, *a5, *a6;
a1 = "\0";
a2 = "A";
a3 = "AA";
a4 = "AAA";
a5 = "AAAA";
a6 = "AAAAA";
n1 = strlen(a1);
n2 = strlen(a2);
n3 = strlen(a3);
n4 = strlen(a4);
n5 = strlen(a5);
n6 = strlen(a6);
iprint("STRLEN %d %d %d %d %d %d\n", n1, n2, n3, n4, n5, n6);
would get ;
STRLEN 0 1 1 2 1 6
and now it gets;
STRLEN 0 1 2 3 4 5
|
|
9front has several tests scattered throughout the source,
as well as more tests in an external 'regress' repository.
Many of these tests are broken, because there is no easy
way to build and track all of them.
This pulls in several tests from different sources, deletes
the broken tests, tests with missing data, and adds a single
command that can be run from the root of the src directory
to test our system.
The hope is that as we develop new code, we add more tests,
and eventually start running the tests on every commit.
Please enter the commit message for your changes. Lines starting
|
|
|
|
Cosa wrote:
While trying to run kvik's lu9 on ARM, I found that when converting
LLONG_MIN to a double on 32bit systems, the result is wrong (positive
instead of negative).
Given the following test program:
void main() {
vlong min = LLONG_MIN;
double dmin = min;
print("minint %lld\n", min);
print("minint as double %f\n", dmin);
if (dmin > 0.0) {
exits("int min as double turned positive");
}
exits(0);
}
The output on x86_64 will be:
minint -9223372036854775808
minint as double -9223372036854776400.000000
But on arm or 386 (and I expect also spim, 68000, mips, 68020, sparc,
power, since they all use the same _v2d):
minint -9223372036854775808
minint as double 9223372036854776400.000000
And the value turned positive in the conversion.
The function used for the cast to double is (in /sys/src/libc/arm/vlrt.c):
double
_v2d(Vlong x)
{
if(x.hi & SIGN(32)) {
if(x.lo) {
x.lo = -x.lo;
x.hi = ~x.hi;
} else
x.hi = -x.hi;
return -((long)x.hi*4294967296. + x.lo);
}
return (long)x.hi*4294967296. + x.lo;
}
If I understand correctly, the issue is that where it tries to flip the
sign for x.hi (x.hi = -x.hi), 0x80000000 has no positive, thus stays the
same (it stays negative). Then when we get to the negative return, we
get a positive out.
What came to my mind then, is that in the case that there is no x.lo, we
can keep the x.hi sign and cast directly, thus:
double
_v2d(Vlong x)
{
if(!x.lo) {
return (long)x.hi*4294967296.;
}
if(x.hi & SIGN(32)) {
x.lo = -x.lo;
x.hi = ~x.hi;
return -((long)x.hi*4294967296. + x.lo);
}
return (long)x.hi*4294967296. + x.lo;
}
This looks correct to me, but I don't trust myself to not make mistakes
in such critical code, so I would like some feedback on the change.
Happy new year in advance,
cosa
|
|
Namespace files have been updated and the tls device
is now available under /net.
|
|
|
|
|
|
it's often not obvious what date component caused an error
when eyeballing a date format string and date; make the
error message contain this information.
|
|
|
|
Checking the range of c|0x60 incorrectly classifies many characters
as alphabetic (digits, control characters 0x01-0x20, and punctuation
characters '!'-':'). This prevents tmparse from parsing dates with
a timezone bounded by those characters (for example, "12:11:56 (PDT)").
Instead, just reuse the isalpha macro provided by ctype.h.
|
|
The new rc's exit status will be '' for a successfull
pipeline execution instead of '|'.
This is a bit too tightly coupled, so just use if()
statement instead, handling this in a portable way.
|
|
SSL is implemented by devssl. It's extremely
obsolete by now, and is not used anywhere but
cpu, import, and oexportfs.
This change strips out the devssl bits, but
does not (yet) remove the code from libsec.
|
|
|
|
If the source string has a run of more than 256 runes without
a "." dot, we'd overflow the runebuffer in idn2utf().
The utf2idn() routine had a check in the while loop, but that
is actually wrong too, as it would insert a dot and restart
the loop in the middle of a domain component. Just error
out if a domain component is too long.
|
|
As part of the transition to 64 bit userspace
APIs, we need to make our libc functions which
take arrays all accept and deal with large sizes.
This does the work for qsort.
|
|
|
|
use usize
|
|
We used to use performance cycle counter for cycles(),
but it is kind of useless in userspace as each core
has its own counter and hence not comparable between
cores. Also, the cycle counter stops counting when
the cores are idle.
Most callers expect cycles() to return a high resolution
timestamp instead, so do the best we can do here
and enable the userspace generic timer virtual counter.
|
|
There are a number of alphabets in common use for base32
and base64 encoding, such as url-safe encodings.
This adds support for passing a function to encode into
arbitary alphabets.
|
|
|
|
The idea is to avoid the magic files that contain
per process information in devcons when possible.
It will make it easier to deprecate them in the future.
|
|
The devcons driver is really the wrong place to
serve per process information.
|
|
Opening a /srv file sets the close-on-exec flag on the
shared channel breaking the exportfs openmount() hack.
The devsrv tries to prevent posting a channel with the
close-on-exec or remove-on-close flags. but nothing
currently prevents this poisoning on open.
Until this gets fixed in eigther exportfs or devsrv,
i'll back out the changes that could have potential side
effects like this.
|
|
|
|
Our qsort has an optimization to recurse on one
half of the array, and do a tail call on the other
half. Unfortunately, the condition deciding which
half of the array to recurse on was wrong, so we
were recursing on the larger half of the array and
iterating on the smaller half.
This meant that if we picked the partition poorly,
we were pessimizing our stack usage instead of
optimizing it.
This change reduces our stack usage from O(n)
to O(log(n)) for poorly chosen pivots.
|
|
Ignoring '?' when formatting date strings allows
the format strings to be reused for parsing. This
is convenient, since we don't need to duplicate
the format strings.
|
|
Tm.yday is docuemnted as being 0-based, and our new api
should respect that. Fix the code so that this is true.
|
|
Ctime is defined as printing a 3-character timezone
name. The timezone name is ambiguous. For example,
EST refers to both Australian and American eastern
time. On top of that, we don't want to make the
tzabbrev table exhaustive. So, we put in this hack:
Before we consult the well known table of timezones,
we check if the local time matches the timezone name.
On top of that, tm2sec
If you want unambiguous timezone parsing, use numeric
timezone offsets (Z, ZZ formats).
|
|
|
|
We almost always want to skip leading whitespace in time
formats, so make tmparse just do it. This fixes upas mbox
parsing, which leaves a leading whitespace at the start of
the date.
|
|
Old users of the time APIs would hand-craft
time structs without first zeroing all the
members. When this got into tmnorm(), we
would try to access the new members, and
things would go off the rails.
This makes tm2sec() clear the new fields
before passing them to the new APIs, so
that the hand-crafted structs remain
valid.
|
|
The current date and time APIs on Plan 9 are not good. They're
inflexible, non-threadsafe, and don't expose timezone information.
This commit adds new time APIs that allow parsing arbitrary
dates, work from multiple threads, and can handle timezones
effectively.
|
|
this breaks the sample from the seconds manpage, and overall
produces funky results. this needs alot more testing.
term% seconds '23 may 2011'
seconds: tmparse: invalid date 23 may 2011 near 'may 2011'
term% seconds '2019-01-01 00:00:00'
-118370073600
|
|
Redo date handling in libc almost entirely. This allows
handling dates and times from outside your timezones,
fixes timezone loading in multithreaded applications,
and allows parsing and formatting using custom format
strings.
As a test of the APIs, we replace the formatting code in
seconds(1), shrinking it massively.
The last commit missed a few removals, and made it
unnecessarily hard to do an update.
|
|
|
|
Redo date handling in libc almost entirely. This allows
handling dates and times from outside your timezones,
fixes timezone loading in multithreaded applications,
and allows parsing and formatting using custom format
strings.
As a test of the APIs, we replace the formatting code in
seconds(1), shrinking it massively.
|
|
at the _cas0 label, the linker would generate spurious stack
adjustment before the return:
atexitdont+0x84 0x000000000003614c CLREX $0xf
atexitdont+0x88 0x0000000000036150 MOVW R31,R0
atexitdont+0x8c 0x0000000000036154 MOV (SP)16!,R30 <- ????????????
atexitdont+0x90 0x0000000000036158 RETURN
the work arround is to move the code into its own cas0
text symbol.
this fixes impossible cwfs crashes in srvi().
|
|
|
|
We're not a posix system, but the posix spec is a good reference
for what we should do.
Thanks Geoff for the inspiration for this patch.
|