int env_parse(const char *env, const char *fmt, int field, long *param, long min,
long max);
-void env_panic(const char *env);
+void __dead env_panic(const char *env);
int env_prefix(char *env, char *prefix);
int sef_receive_status(endpoint_t src, message *m_ptr, int *status_ptr);
endpoint_t sef_self(void);
void sef_cancel(void);
-void sef_exit(int status);
+void __dead sef_exit(int status);
#define sef_receive(src, m_ptr) sef_receive_status(src, m_ptr, NULL)
/* SEF Debug. */
-NOGCCERROR=yes
-NOCLANGERROR=yes
-
# Makefile for libsys
.include <bsd.own.mk>
+NOGCCERROR=yes
+
CPPFLAGS+= -D_MINIX_SYSTEM -D_SYSTEM
LIB= sys
sys_voutb.c \
sys_voutl.c \
sys_voutw.c \
- timing.c \
tsc_util.c \
vbox.c
m.m_lsys_krn_readbios.size = size;
m.m_lsys_krn_readbios.addr = address;
- m.m_lsys_krn_readbios.buf = buf;
+ m.m_lsys_krn_readbios.buf = (vir_bytes)buf;
return(_kernel_call(SYS_READBIOS, &m));
}
m_io.m_lsys_krn_sys_sdevio.request = req;
m_io.m_lsys_krn_sys_sdevio.port = port;
m_io.m_lsys_krn_sys_sdevio.vec_endpt = proc_nr;
- m_io.m_lsys_krn_sys_sdevio.vec_addr = buffer;
+ m_io.m_lsys_krn_sys_sdevio.vec_addr = (vir_bytes)buffer;
m_io.m_lsys_krn_sys_sdevio.vec_size = count;
m_io.m_lsys_krn_sys_sdevio.offset = offset;
+++ /dev/null
-
-#include <minix/sysutil.h>
-#include <minix/syslib.h>
-#include <minix/config.h>
-#include <minix/const.h>
-#include <minix/minlib.h>
-
-#define HIGHCOUNT 0
-#define LOWCOUNT 1
-
-#define START 0
-#define END 1
-
-void util_timer_start(util_timingdata_t *timingdata, char *name)
-{
- size_t i;
-
- if(timingdata->names[0] == '\0') {
- for(i = 0; i < sizeof(timingdata->names) && *name; i++)
- timingdata->names[i] = *name++;
- timingdata->names[sizeof(timingdata->names)-1] = '\0';
- }
-
- if (timingdata->starttimes[HIGHCOUNT]) {
- panic("restart timer?");
- return;
- }
-
- read_tsc((u32_t *) &timingdata->starttimes[HIGHCOUNT],
- (u32_t *) &timingdata->starttimes[LOWCOUNT]);
-}
-
-void util_timer_end(util_timingdata_t *timingdata)
-{
- unsigned long h, l, d = 0;
- int bin;
-
- read_tsc((u32_t *) &h, (u32_t *) &l);
- if (!timingdata->starttimes[HIGHCOUNT]) {
- panic("timer stopped but not started");
- return;
- }
- if (timingdata->starttimes[HIGHCOUNT] == h) {
- d = (l - timingdata->starttimes[LOWCOUNT]);
- } else if (timingdata->starttimes[HIGHCOUNT] == h-1 &&
- timingdata->starttimes[LOWCOUNT] > l) {
- d = ((ULONG_MAX - timingdata->starttimes[LOWCOUNT]) + l);
- } else {
- timingdata->misses++;
- return;
- }
- timingdata->starttimes[HIGHCOUNT] = 0;
- if (!timingdata->lock_timings_range[START] ||
- d < timingdata->lock_timings_range[START] ||
- d > timingdata->lock_timings_range[END]) {
- int t;
- if (!timingdata->lock_timings_range[START] ||
- d < timingdata->lock_timings_range[START])
- timingdata->lock_timings_range[START] = d;
- if (!timingdata->lock_timings_range[END] ||
- d > timingdata->lock_timings_range[END])
- timingdata->lock_timings_range[END] = d;
- for(t = 0; t < TIMING_POINTS; t++)
- timingdata->lock_timings[t] = 0;
- timingdata->binsize =
- (timingdata->lock_timings_range[END] -
- timingdata->lock_timings_range[START])/(TIMING_POINTS+1);
- if (timingdata->binsize < 1)
- timingdata->binsize = 1;
- timingdata->resets++;
- }
- bin = (d-timingdata->lock_timings_range[START]) /
- timingdata->binsize;
- if (bin < 0 || bin >= TIMING_POINTS) {
- /* not serious, but can't happen, so shouldn't */
- panic("bin out of range: %d", bin);
- } else {
- timingdata->lock_timings[bin]++;
- timingdata->measurements++;
- }
-
- return;
-}
m.m_lsys_krn_sys_getinfo.request = GET_MONPARAMS;
m.m_lsys_krn_sys_getinfo.endpt = SELF;
m.m_lsys_krn_sys_getinfo.val_len = sizeof(mon_params);
- m.m_lsys_krn_sys_getinfo.val_ptr = mon_params;
+ m.m_lsys_krn_sys_getinfo.val_ptr = (vir_bytes)mon_params;
if ((s=_kernel_call(SYS_GETINFO, &m)) != OK) {
printf("SYS_GETINFO: %d (size %u)\n", s, sizeof(mon_params));
return(s);
#include "sysutil.h"
#include <string.h>
+#include <env.h>
/*=========================================================================*
* env_panic *
memset(&m, 0, sizeof(m));
m.m_lsys_getsysinfo.what = what;
- m.m_lsys_getsysinfo.where = where;
+ m.m_lsys_getsysinfo.where = (vir_bytes)where;
m.m_lsys_getsysinfo.size = size;
return _taskcall(who, call_nr, &m);
}
#include <assert.h>
#include <machine/archtypes.h>
#include <minix/timers.h>
+#include <minix/sched.h>
#include <string.h>
-#include "kernel/config.h"
-#include "kernel/const.h"
-#include "kernel/type.h"
-#include "kernel/proc.h"
-
/*===========================================================================*
* sched_inherit *
*===========================================================================*/
#include "syslib.h"
#include <assert.h>
#include <string.h>
+#include <minix/sched.h>
/*===========================================================================*
* sched_stop *
/* Debug. */
#if SEF_INIT_DEBUG || SEF_LU_DEBUG || SEF_PING_DEBUG || SEF_SIGNAL_DEBUG
#define SEF_DEBUG_HEADER_MAXLEN 32
+static int sef_debug_init = 0;
static time_t sef_debug_boottime = 0;
static u32_t sef_debug_system_hz = 0;
static time_t sef_debug_time_sec = 0;
/* System services use a special version of exit() that generates a
* self-termination signal.
*/
- message m;
/* Ask the kernel to exit. */
sys_exit();
{
/* Refresh SEF debug params. */
clock_t uptime;
- int r;
- /* Get boottime the first time. */
- if(!sef_debug_boottime) {
- r = sys_times(NONE, NULL, NULL, NULL, &sef_debug_boottime);
- if ( r != OK) {
- sef_debug_boottime = -1;
- }
- }
-
- /* Get system hz the first time. */
- if(!sef_debug_system_hz) {
- r = sys_getinfo(GET_HZ, &sef_debug_system_hz,
- sizeof(sef_debug_system_hz), 0, 0);
- if ( r != OK) {
- sef_debug_system_hz = -1;
- }
+ /* Get boottime and system hz the first time. */
+ if(!sef_debug_init) {
+ if (sys_times(NONE, NULL, NULL, NULL, &sef_debug_boottime) != OK)
+ sef_debug_init = -1;
+ else if (sys_getinfo(GET_HZ, &sef_debug_system_hz,
+ sizeof(sef_debug_system_hz), 0, 0) != OK)
+ sef_debug_init = -1;
+ else
+ sef_debug_init = 1;
}
/* Get uptime. */
uptime = -1;
- if(sef_debug_boottime!=-1 && sef_debug_system_hz!=-1) {
- r = sys_times(NONE, NULL, NULL, &uptime, NULL);
- if ( r != OK) {
- uptime = -1;
- }
- }
-
- /* Compute current time. */
- if(sef_debug_boottime==-1 || sef_debug_system_hz==-1 || uptime==-1) {
+ if (sef_debug_init < 1 || sys_times(NONE, NULL, NULL, &uptime, NULL) != OK) {
sef_debug_time_sec = 0;
sef_debug_time_us = 0;
}
else {
+ /* Compute current time. */
sef_debug_time_sec = (time_t) (sef_debug_boottime
+ (uptime/sef_debug_system_hz));
sef_debug_time_us = (uptime%sef_debug_system_hz)
EXTERN __attribute__((weak)) int edfi_ctl_process_request(void *ctl_request);
+EXTERN int do_sef_fi_request(message *m_ptr);
+
/*===========================================================================*
* do_sef_fi_request *
*===========================================================================*/
#include <stdio.h>
#include <string.h>
+#include <minix/sysutil.h>
typedef unsigned int reg_t;
m.m_lsys_krn_sys_getinfo.request = request;
m.m_lsys_krn_sys_getinfo.endpt = SELF; /* always store values at caller */
- m.m_lsys_krn_sys_getinfo.val_ptr = ptr;
+ m.m_lsys_krn_sys_getinfo.val_ptr = (vir_bytes)ptr;
m.m_lsys_krn_sys_getinfo.val_len = len;
- m.m_lsys_krn_sys_getinfo.val_ptr2 = ptr2;
+ m.m_lsys_krn_sys_getinfo.val_ptr2 = (vir_bytes)ptr2;
m.m_lsys_krn_sys_getinfo.val_len2_e = len2;
return(_kernel_call(SYS_GETINFO, &m));
copy_mess.m_lsys_kern_safecopy.from_to = src_e;
copy_mess.m_lsys_kern_safecopy.gid = gr_id;
copy_mess.m_lsys_kern_safecopy.offset = offset;
- copy_mess.m_lsys_kern_safecopy.address = address;
+ copy_mess.m_lsys_kern_safecopy.address = (void *)address;
copy_mess.m_lsys_kern_safecopy.bytes = bytes;
return(_kernel_call(SYS_SAFECOPYFROM, ©_mess));
copy_mess.m_lsys_kern_safecopy.from_to = dst_e;
copy_mess.m_lsys_kern_safecopy.gid = gr_id;
copy_mess.m_lsys_kern_safecopy.offset = offset;
- copy_mess.m_lsys_kern_safecopy.address = address;
+ copy_mess.m_lsys_kern_safecopy.address = (void *)address;
copy_mess.m_lsys_kern_safecopy.bytes = bytes;
return(_kernel_call(SYS_SAFECOPYTO, ©_mess));
#include "syslib.h"
+#include <string.h>
int sys_vircopy(src_proc, src_vir,
dst_proc, dst_vir, bytes, flags)
/* sysutil.h - System library utilities. */
-#define _SYSTEM
-
#include <lib.h> /* common to all libraries */
#include <minix/com.h> /* need task numbers + message types */
#include <minix/syslib.h> /* need ipc_sendrec, _taskcall, etc */
#include <machine/param.h>
#include <machine/vmparam.h>
-int vm_cachecall(message *m, int call, void *addr, dev_t dev, off_t dev_offset,
- ino_t ino, off_t ino_offset, u32_t *flags, int blocksize)
+static int vm_cachecall(message *m, int call, void *addr, dev_t dev,
+ off_t dev_offset, ino_t ino, off_t ino_offset, u32_t *flags,
+ int blocksize)
{
if(blocksize % PAGE_SIZE)
panic("blocksize %d should be a multiple of pagesize %d\n",
memset(&m, 0, sizeof(m));
m.m_lsys_vm_map_phys.ep = who;
- m.m_lsys_vm_map_phys.phaddr = phaddr;
+ m.m_lsys_vm_map_phys.phaddr = (phys_bytes)phaddr;
m.m_lsys_vm_map_phys.len = len;
r = _taskcall(VM_PROC_NR, VM_MAP_PHYS, &m);