* Fixed bug relating to nested locking in interrupt handlers. The nested lock

caused interrupts to be reenabled (due to unlock), which caused a race. The
problems were especially visible on slower machines.
* Relocated free memory parsing to process manager. This saved quite some
code at the kernel level. Text size was reduced by about 650 bytes.
* Removed locks for updating the realtime in the clock's main loop and the
get_uptime function. Interrupts are no longer reentrant, so realtime is
immediately updated.
This commit is contained in:
Jorrit Herder
2005-06-17 09:09:54 +00:00
parent 90b80ad31e
commit e0a98a4d65
13 changed files with 76 additions and 206 deletions
+1 -44
View File
@@ -11,7 +11,6 @@
* kstrcmp: lexicographical comparison of two strings
* kstrlen: get number of non-null characters in string
* kstrncpy: copy string and pad or copy up to n chars
* kstrtoulb: convert string to unsigned long value
*
* This file contains the routines that take care of kernel messages, i.e.,
* diagnostic output within the kernel. Kernel messages are not directly
@@ -152,7 +151,7 @@ PRIVATE void kputc(c)
int c; /* character to append */
{
/* Accumulate a single character for a kernel message. Send a notification
* the to TTY driver if the buffer if a END_OF_KMESS is encountered.
* the to TTY driver if an END_OF_KMESS is encountered.
*/
message m;
if (c != END_OF_KMESS) {
@@ -225,45 +224,3 @@ PUBLIC char *kstrncpy(char *ret, register const char *s2, register size_t n)
}
/*=========================================================================*
* kstrtoul *
*=========================================================================*/
PUBLIC unsigned long kstrtoul(strptr, endptr, base)
const char *strptr; /* pointer to string to be parsed */
char ** const endptr; /* store pointer to end here */
int base;
{
/* A simplified version of strtoul() for the kernel to prevent including the
* one in the ASNI library. No whitespaces are skipped, the numeric value is
* expected at the start of 'string'.
*/
register unsigned long val = 0;
register int c;
register unsigned int v;
int overflow = 0;
/* Get rid of 0x or 0X for hexidecimal values. */
if (base==16 && *strptr=='0' && (*++strptr=='x' || *strptr=='X'))
strptr++;
/* Now parse the actual unsigned long number. */
for (;;) {
c = *strptr;
if ('0' <= c && c <= '9') v = c - '0';
else if ('a' <= c && c <= 'z') v = c - 'a' + 0xa;
else if ('A' <= c && c <= 'Z') v = c - 'A' + 0xA;
else break; /* end of number */
if (v >= base) break; /* end of number */
if (val > (ULONG_MAX - v) / base) overflow = 1;
val = (val*base) + v;
strptr++;
}
/* Tell caller where parsing ended unless a NULL pointer was passed. */
if (endptr) *endptr = (char *) strptr;
/* Done, return parsed value or maximum value on overflow. */
return (overflow) ? ULONG_MAX : val;
}