Various updates.
* Removed some variants of the SYS_GETINFO calls from the kernel; replaced them with new PM and utils libary functionality. Fixed bugs in utils library that used old get_kenv() variant. * Implemented a buffer in the kernel to gather random data. Memory driver periodically checks this for /dev/random. A better random algorithm can now be implemented in the driver. Removed SYS_RANDOM; the SYS_GETINFO call is used instead. * Remove SYS_KMALLOC from the kernel. Memory allocation can now be done at the process manager with new 'other' library functions.
This commit is contained in:
@@ -10,6 +10,8 @@ LIBRARY = ../libc.a
|
||||
all: $(LIBRARY)
|
||||
|
||||
OBJECTS = \
|
||||
$(LIBRARY)(_allocmem.o) \
|
||||
$(LIBRARY)(_freemem.o) \
|
||||
$(LIBRARY)(_brk.o) \
|
||||
$(LIBRARY)(_reboot.o) \
|
||||
$(LIBRARY)(_seekdir.o) \
|
||||
@@ -64,6 +66,12 @@ $(LIBRARY): $(OBJECTS)
|
||||
aal cr $@ *.o
|
||||
rm *.o
|
||||
|
||||
$(LIBRARY)(_allocmem.o): _allocmem.c
|
||||
$(CC1) _allocmem.c
|
||||
|
||||
$(LIBRARY)(_freemem.o): _freemem.c
|
||||
$(CC1) _freemem.c
|
||||
|
||||
$(LIBRARY)(_brk.o): _brk.c
|
||||
$(CC1) _brk.c
|
||||
|
||||
|
||||
16
lib/other/_allocmem.c
Normal file
16
lib/other/_allocmem.c
Normal file
@@ -0,0 +1,16 @@
|
||||
#include <lib.h>
|
||||
#define allocmem _allocmem
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
PUBLIC int allocmem(size, base)
|
||||
phys_bytes size; /* size of mem chunk requested */
|
||||
phys_bytes *base; /* return base address */
|
||||
{
|
||||
message m;
|
||||
m.m4_l1 = size;
|
||||
if (_syscall(MM, ALLOCMEM, &m) < 0) return(-1);
|
||||
*base = m.m4_l2;
|
||||
return(0);
|
||||
}
|
||||
|
||||
16
lib/other/_freemem.c
Normal file
16
lib/other/_freemem.c
Normal file
@@ -0,0 +1,16 @@
|
||||
#include <lib.h>
|
||||
#define freemem _freemem
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
PUBLIC int freemem(size, base)
|
||||
phys_bytes size; /* size of mem chunk requested */
|
||||
phys_bytes base; /* base address of mem chunk */
|
||||
{
|
||||
message m;
|
||||
m.m4_l1 = size;
|
||||
m.m4_l2 = base;
|
||||
if (_syscall(MM, FREEMEM, &m) < 0) return(-1);
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ OBJECTS = \
|
||||
$(LIBRARY)(_exit.o) \
|
||||
$(LIBRARY)(access.o) \
|
||||
$(LIBRARY)(alarm.o) \
|
||||
$(LIBRARY)(allocmem.o) \
|
||||
$(LIBRARY)(freemem.o) \
|
||||
$(LIBRARY)(brk.o) \
|
||||
$(LIBRARY)(cfgetispeed.o) \
|
||||
$(LIBRARY)(cfgetospeed.o) \
|
||||
@@ -117,6 +119,12 @@ $(LIBRARY)(access.o): access.s
|
||||
$(LIBRARY)(alarm.o): alarm.s
|
||||
$(CC1) alarm.s
|
||||
|
||||
$(LIBRARY)(allocmem.o): allocmem.s
|
||||
$(CC1) allocmem.s
|
||||
|
||||
$(LIBRARY)(freemem.o): freemem.s
|
||||
$(CC1) freemem.s
|
||||
|
||||
$(LIBRARY)(brk.o): brk.s
|
||||
$(CC1) brk.s
|
||||
|
||||
|
||||
7
lib/syscall/allocmem.s
Normal file
7
lib/syscall/allocmem.s
Normal file
@@ -0,0 +1,7 @@
|
||||
.sect .text
|
||||
.extern __allocmem
|
||||
.define _allocmem
|
||||
.align 2
|
||||
|
||||
_allocmem:
|
||||
jmp __allocmem
|
||||
7
lib/syscall/freemem.s
Normal file
7
lib/syscall/freemem.s
Normal file
@@ -0,0 +1,7 @@
|
||||
.sect .text
|
||||
.extern __freemem
|
||||
.define _freemem
|
||||
.align 2
|
||||
|
||||
_freemem:
|
||||
jmp __freemem
|
||||
@@ -26,7 +26,6 @@ OBJECTS = \
|
||||
$(LIBSYS)(sys_xit.o) \
|
||||
$(LIBSYS)(sys_sdevio.o) \
|
||||
$(LIBSYS)(sys_getinfo.o) \
|
||||
$(LIBSYS)(sys_kmalloc.o) \
|
||||
$(LIBSYS)(sys_irqctl.o) \
|
||||
$(LIBSYS)(sys_eniop.o) \
|
||||
$(LIBSYS)(sys_segctl.o) \
|
||||
@@ -96,9 +95,6 @@ $(LIBSYS)(sys_sdevio.o): sys_sdevio.c
|
||||
$(LIBSYS)(sys_getinfo.o): sys_getinfo.c
|
||||
$(CC1) sys_getinfo.c
|
||||
|
||||
$(LIBSYS)(sys_kmalloc.o): sys_kmalloc.c
|
||||
$(CC1) sys_kmalloc.c
|
||||
|
||||
$(LIBSYS)(sys_irqctl.o): sys_irqctl.c
|
||||
$(CC1) sys_irqctl.c
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* printf() - kernel printf() Author: Kees J. Bot
|
||||
/* printf() - system services printf() Author: Kees J. Bot
|
||||
* 15 Jan 1994
|
||||
*/
|
||||
#define nil 0
|
||||
|
||||
@@ -34,7 +34,7 @@ int c;
|
||||
m.DIAG_PRINT_BUF = print_buf;
|
||||
m.DIAG_PROC_NR = SELF;
|
||||
m.m_type = DIAGNOSTICS;
|
||||
if (_sendrec(TTY, &m) != 0) {
|
||||
if (_sendrec(IS_PROC_NR, &m) != 0) {
|
||||
m.m1_i1 = 2;
|
||||
m.m1_i2 = buf_count;
|
||||
m.m1_p1 = print_buf;
|
||||
|
||||
@@ -9,9 +9,9 @@ char *key; /* environment variable whose value is bogus */
|
||||
{
|
||||
static char value[EP_BUF_SIZE] = "<unknown>";
|
||||
int s;
|
||||
if ((s=sys_getkenv(key, strlen(key), value, sizeof(value))) == 0) {
|
||||
if ((s=get_mon_param(key, value, sizeof(value))) == 0) {
|
||||
if (s != ESRCH) /* only error allowed */
|
||||
printf("WARNING: sys_getkenv() failed in env_panic(): %d\n", s);
|
||||
printf("WARNING: get_mon_param() failed in env_panic(): %d\n", s);
|
||||
}
|
||||
printf("Bad environment setting: '%s = %s'\n", key, value);
|
||||
panic("","", NO_NUM);
|
||||
|
||||
@@ -33,7 +33,7 @@ long min, max; /* minimum and maximum values for the parameter */
|
||||
|
||||
if ((s=get_mon_param(env, value, sizeof(value))) != 0) {
|
||||
if (s == ESRCH) return(EP_UNSET); /* only error allowed */
|
||||
printf("WARNING: sys_getkenv() failed in env_parse(): %d\n",s);
|
||||
printf("WARNING: get_mon_param() failed in env_parse(): %d\n",s);
|
||||
return(EP_EGETKENV);
|
||||
}
|
||||
val = value;
|
||||
|
||||
@@ -17,9 +17,9 @@ char *prefix; /* prefix to test for */
|
||||
int s;
|
||||
size_t n;
|
||||
|
||||
if ((s = sys_getkenv(env, strlen(env), value, sizeof(value))) != 0) {
|
||||
if ((s = get_mon_param(env, value, sizeof(value))) != 0) {
|
||||
if (s != ESRCH) /* only error allowed */
|
||||
printf("WARNING: sys_getkenv() failed in env_prefix(): %d\n", s);
|
||||
printf("WARNING: get_mon_param() failed in env_prefix(): %d\n", s);
|
||||
}
|
||||
n = strlen(prefix);
|
||||
return(value != NULL
|
||||
|
||||
Reference in New Issue
Block a user