#include <minix/com.h>
#include <minix/ds.h>
#include <minix/syslib.h>
+#include <minix/param.h>
#include "pci.h"
#include <machine/pci_amd.h>
INCSDIR= /usr/include/minix
-INCS+= dirent.h paths.h types.h
+INCS+= dirent.h paths.h types.h param.h
.include "${NETBSDSRCDIR}/common/include/sys/Makefile.mount.inc"
.include "${NETBSDSRCDIR}/common/include/Makefile.termios.inc"
#define FUTURE_CODE 0 /* new code to be activated + tested later */
#define TEMP_CODE 1 /* active code to be removed later */
-/* Number of processes contained in the system image. */
-#define NR_BOOT_PROCS (NR_TASKS + LAST_SPECIAL_PROC_NR + 1)
-
-/* Process name length in the PM process table, including '\0'. */
-#define PROC_NAME_LEN 16
-
/* Miscellaneous */
#define BYTE 0377 /* mask for 8 bits */
#define READING 0 /* copy data to user */
--- /dev/null
+
+#ifndef _MINIX_PARAM_H
+#define _MINIX_PARAM_H 1
+
+#include <minix/com.h>
+#include <minix/const.h>
+
+/* Number of processes contained in the system image. */
+#define NR_BOOT_PROCS (NR_TASKS + LAST_SPECIAL_PROC_NR + 1)
+
+/* This is used to obtain system information through SYS_GETINFO. */
+#define MAXMEMMAP 40
+typedef struct kinfo {
+ /* Straight multiboot-provided info */
+ multiboot_info_t mbi;
+ multiboot_module_t module_list[MULTIBOOT_MAX_MODS];
+ multiboot_memory_map_t memmap[MAXMEMMAP]; /* free mem list */
+ phys_bytes mem_high_phys;
+ int mmap_size;
+
+ /* Multiboot-derived */
+ int mods_with_kernel; /* no. of mods incl kernel */
+ int kern_mod; /* which one is kernel */
+
+ /* Minix stuff, started at bootstrap phase */
+ int freepde_start; /* lowest pde unused kernel pde */
+ char param_buf[MULTIBOOT_PARAM_BUF_SIZE];
+
+ /* Minix stuff */
+ struct kmessages *kmess;
+ int do_serial_debug; /* system serial output */
+ int serial_debug_baud; /* serial baud rate */
+ int minix_panicing; /* are we panicing? */
+ vir_bytes user_sp; /* where does kernel want stack set */
+ vir_bytes user_end; /* upper proc limit */
+ vir_bytes vir_kern_start; /* kernel addrspace starts */
+ vir_bytes bootstrap_start, bootstrap_len;
+ struct boot_image boot_procs[NR_BOOT_PROCS];
+ int nr_procs; /* number of user processes */
+ int nr_tasks; /* number of kernel tasks */
+ char release[6]; /* kernel release number */
+ char version[6]; /* kernel version number */
+} kinfo_t;
+
+#endif
#include <minix/types.h>
#endif
-#include <minix/const.h>
-#include <minix/com.h>
-
#include <stdint.h>
/* Type definitions. */
phys_bytes mr_limit; /* Highest memory address in range */
};
+#define PROC_NAME_LEN 16
+
/* List of boot-time processes set in kernel/table.c. */
struct boot_image {
int proc_nr; /* process number to use */
phys_bytes size;
};
-/* This is used to obtain system information through SYS_GETINFO. */
-#define MAXMEMMAP 40
-typedef struct kinfo {
- /* Straight multiboot-provided info */
- multiboot_info_t mbi;
- multiboot_module_t module_list[MULTIBOOT_MAX_MODS];
- multiboot_memory_map_t memmap[MAXMEMMAP]; /* free mem list */
- phys_bytes mem_high_phys;
- int mmap_size;
-
- /* Multiboot-derived */
- int mods_with_kernel; /* no. of mods incl kernel */
- int kern_mod; /* which one is kernel */
-
- /* Minix stuff, started at bootstrap phase */
- int freepde_start; /* lowest pde unused kernel pde */
- char param_buf[MULTIBOOT_PARAM_BUF_SIZE];
-
- /* Minix stuff */
- struct kmessages *kmess;
- int do_serial_debug; /* system serial output */
- int serial_debug_baud; /* serial baud rate */
- int minix_panicing; /* are we panicing? */
- vir_bytes user_sp; /* where does kernel want stack set */
- vir_bytes user_end; /* upper proc limit */
- vir_bytes vir_kern_start; /* kernel addrspace starts */
- vir_bytes bootstrap_start, bootstrap_len;
- struct boot_image boot_procs[NR_BOOT_PROCS];
- int nr_procs; /* number of user processes */
- int nr_tasks; /* number of kernel tasks */
- char release[6]; /* kernel release number */
- char version[6]; /* kernel version number */
-} kinfo_t;
-
#define STATICINIT(v, n) \
if(!(v)) { \
if(!((v) = alloc_contig(sizeof(*(v)) * (n), 0, NULL))) { \
void arch_proc_init(struct proc *pr, const u32_t ip, const u32_t sp, char *name)
{
arch_proc_reset(pr);
- strcpy(pr->p_name, name);
+ strlcpy(pr->p_name, name, sizeof(pr->p_name));
/* set custom state we know */
pr->p_reg.pc = ip;
#include <minix/cpufeature.h>
-#include <minix/type.h>
-#include <libexec.h>
#include <assert.h>
#include "kernel.h"
+#include <libexec.h>
#include "arch_proto.h"
#include <string.h>
#include <libexec.h>
-#include <minix/type.h>
/* These are set/computed in kernel.lds. */
extern char _kern_vir_base, _kern_phys_base, _kern_size;
for(i = 0; i < I386_VM_DIR_ENTRIES; i++) {
u32_t flags = I386_VM_PRESENT | I386_VM_BIGPAGE |
I386_VM_USER | I386_VM_WRITE;
+ phys = i * I386_BIG_PAGE_SIZE;
if((cbi->mem_high_phys & I386_VM_ADDR_MASK_4MB)
<= (phys & I386_VM_ADDR_MASK_4MB)) {
flags |= I386_VM_PWT | I386_VM_PCD;
}
- phys = i * I386_BIG_PAGE_SIZE;
pagedir[i] = phys | flags;
}
}
execi.proc_e = ip->endpoint;
execi.hdr = (char *) mod->mod_start; /* phys mem direct */
execi.hdr_len = mod->mod_end - mod->mod_start;
- strcpy(execi.progname, ip->proc_name);
+ strlcpy(execi.progname, ip->proc_name, sizeof(execi.progname));
execi.frame_len = 0;
/* callbacks for use in the kernel */
#include <timers.h> /* watchdog timer management */
#include <errno.h> /* return codes and error numbers */
#include <sys/param.h>
+#include <minix/param.h>
/* Important kernel header files. */
#include "config.h" /* configuration, MUST be first */
kcalls = TSK_KC; /* allowed kernel calls */
}
/* Priviliges for the root system process. */
- else if(isrootsysn(proc_nr)) {
+ else {
+ assert(isrootsysn(proc_nr));
priv(rp)->s_flags= RSYS_F; /* privilege flags */
priv(rp)->s_trap_mask= SRV_T; /* allowed traps */
ipc_to_m = SRV_M; /* allowed targets */
rp->p_priority = SRV_Q; /* priority queue */
rp->p_quantum_size_ms = SRV_QT; /* quantum size */
}
- /* Priviliges for ordinary process. */
- else {
- NOT_REACHABLE;
- }
/* Fill in target mask. */
memset(&map, 0, sizeof(map));
/* Record miscellaneous information for user-space servers. */
kinfo.nr_procs = NR_PROCS;
kinfo.nr_tasks = NR_TASKS;
- strncpy(kinfo.release, OS_RELEASE, sizeof(kinfo.release));
- kinfo.release[sizeof(kinfo.release)-1] = '\0';
- strncpy(kinfo.version, OS_VERSION, sizeof(kinfo.version));
- kinfo.version[sizeof(kinfo.version)-1] = '\0';
+ strlcpy(kinfo.release, OS_RELEASE, sizeof(kinfo.release));
+ strlcpy(kinfo.version, OS_VERSION, sizeof(kinfo.version));
/* Load average data initialization. */
kloadinfo.proc_last_slot = 0;
*/
#include <minix/com.h>
-#include <minix/endpoint.h>
#include <minix/ipcconst.h>
#include <stddef.h>
#include <signal.h>
-#include <minix/syslib.h>
#include <assert.h>
#include "debug.h"
#include "arch_proto.h"
+#include <minix/syslib.h>
+
/* Scheduling and message passing functions */
static void idle(void);
/**
#include <minix/config.h>
-#include <minix/profile.h>
-#include <minix/portio.h>
#include "kernel.h"
#include "profile.h"
#include "proc.h"
+#include <minix/profile.h>
+#include <minix/portio.h>
+
#if SPROFILE
#include <string.h>
*/
#include <string.h>
-#include <minix/endpoint.h>
#include "kernel/system.h"
*/
#include <assert.h>
-#include <minix/type.h>
-#include <minix/safecopies.h>
#include "kernel/system.h"
+#include "kernel.h"
#define MAX_INDIRECT_DEPTH 5 /* up to how many indirect grants to follow? */
#include <assert.h>
-#include <minix/type.h>
-#include <minix/type.h>
-#include <minix/safecopies.h>
-
#include "kernel/system.h"
+#include "kernel.h"
+
+#include <minix/safecopies.h>
#include <signal.h>
endpoint_t end_s, vir_bytes off_s,
size_t size, int flag)
{
- struct proc *src, *dst;
+ struct proc *dst;
- src = endpoint_lookup(end_s);
dst = endpoint_lookup(end_d);
/* Make sure the linear addresses are both page aligned. */
#include <stdlib.h>
#include <env.h>
#include <string.h>
+#include <minix/param.h>
/*=========================================================================*
int maxchunks; /* how many were found */
{
static kinfo_t kinfo;
- int mm;
+ int mm, r;
- sys_getkinfo(&kinfo);
+ if((r=sys_getkinfo(&kinfo)) != OK) return r;
/* Initialize everything to zero. */
memset(mem_chunks, 0, maxchunks*sizeof(*mem_chunks));
#include <minix/config.h>
#include <minix/ds.h>
#include <minix/bitmap.h>
+#include <minix/param.h>
#include <regex.h>
#define NR_DS_KEYS (2*NR_SYS_PROCS) /* number of entries */
/* Global variables. */
+#include <minix/param.h>
+
/* Parameters needed to keep diagnostics at IS. */
#define DIAG_BUF_SIZE 1024
extern char diag_buf[DIAG_BUF_SIZE]; /* buffer for messages */
/* Set process details found in the image table. */
rmp = &mproc[ip->proc_nr];
- strncpy(rmp->mp_name, ip->proc_name, PROC_NAME_LEN);
+ strlcpy(rmp->mp_name, ip->proc_name, PROC_NAME_LEN);
(void) sigemptyset(&rmp->mp_ignore);
(void) sigemptyset(&rmp->mp_sigmask);
(void) sigemptyset(&rmp->mp_catch);
#include <minix/syslib.h>
#include <minix/sysutil.h>
#include <minix/timers.h>
+#include <minix/param.h>
#include <limits.h>
#include <errno.h>
#ifndef _PROCFS_GLO_H
#define _PROCFS_GLO_H
+#include <minix/param.h>
+
/* pid.c */
extern struct file pid_files[];
#define EXTERN
#endif
+#include <minix/param.h>
+
/* The boot image priv table. This table has entries for all system
* services in the boot image.
*/
#define EXTERN
#endif
+#include <minix/param.h>
+
/* File System global variables */
EXTERN struct fproc *fp; /* pointer to caller's fproc struct */
EXTERN int susp_count; /* number of procs suspended on pipe */
end = end ? end : VM_DATATOP;
assert(start % I386_PAGE_SIZE == 0);
assert(end % I386_PAGE_SIZE == 0);
- assert(I386_VM_PDE(start) >= 0 && start <= end);
+ assert(start <= end);
assert(I386_VM_PDE(end) < I386_VM_DIR_ENTRIES);
#if LU_DEBUG
#include <minix/sys_config.h>
#include <minix/type.h>
+#include <minix/param.h>
#include <sys/stat.h>
#include <a.out.h>
#include <tools.h>
execi->proc_e = vmp->vm_endpoint;
execi->hdr = hdr;
execi->hdr_len = sizeof(hdr);
- strcpy(execi->progname, ip->proc_name);
+ strlcpy(execi->progname, ip->proc_name, sizeof(execi->progname));
execi->frame_len = 0;
execi->opaque = &vmexeci;
}
/* Set up table of calls. */
-#define CALLMAP(code, func) { int i; \
- if((i=CALLNUMBER(code)) < 0) { panic(#code " invalid: %d", (code)); } \
- if(i >= NR_VM_CALLS) { panic(#code " invalid: %d", (code)); } \
+#define CALLMAP(code, func) { int i; \
+ i=CALLNUMBER(code); \
+ assert(i >= 0); \
+ assert(i < NR_VM_CALLS); \
vm_calls[i].vmc_func = (func); \
vm_calls[i].vmc_name = #code; \
}