General cleanup:

- clean up kernel section of minix/com.h somewhat
- remove ALLOCMEM and VM_ALLOCMEM calls
- remove non-safecopy and minix-vmd support from Inet
- remove SYS_VIRVCOPY and SYS_PHYSVCOPY calls
- remove obsolete segment encoding in SYS_SAFECOPY*
- remove DEVCTL call, svrctl(FSDEVUNMAP), map_driverX
- remove declarations of unimplemented svrctl requests
- remove everything related to swapping to disk
- remove floppysetup.sh
- remove traces of rescue device
- update DESCRIBE.sh with new devices
- some other small changes
This commit is contained in:
David van Moolenbroek 2010-01-05 19:39:27 +00:00
parent be992434e7
commit ac9ab099c8
75 changed files with 388 additions and 2178 deletions

View file

@ -12,6 +12,7 @@ esac
ls -l$flag $* | \
sed -e '/^total/d' \
-e '/^l/d' \
-e '/^[^bc]/s/.* /BAD BAD /' \
-e '/^[bc]/s/.* \([0-9][0-9]*\), *\([0-9][0-9]*\).* /\1 \2 /' \
| {
@ -42,6 +43,16 @@ do
;;
1,3) des="null device, data sink" dev=null
;;
1,4) des="boot device loaded from boot image" dev=boot
;;
1,5) des="null byte stream generator" dev=zero
;;
1,6) des="boot image RAM disk" dev=imgrd
;;
1,[789]|1,1[012])
ramdisk=`expr $minor - 7`
des="RAM disk $ramdisk" dev=ram$ramdisk
;;
2,*) drive=`expr $minor % 4`
case `expr $minor - $drive` in
0) des='auto density' dev="fd$drive"
@ -113,6 +124,12 @@ do
line=`expr $minor - 16`
des="serial line $line" dev=tty0$line
;;
4,125) des="video output" dev=video
;;
4,126) des="auxiliary input" dev=kbdaux
;;
4,127) des="keyboard input" dev=kbd
;;
4,12[89]|4,1[3-8]?|4,19[01])
p=`expr \\( $minor - 128 \\) / 16 | tr '0123' 'pqrs'`
n=`expr $minor % 16`
@ -133,18 +150,20 @@ do
d=`expr $minor % 8`
n=`expr $minor / 8`
case $d in
0) case $name in
0) des="IP stat" dev=ipstat
;;
1) case $name in
psip*)
des="Pseudo IP #$n" dev=psip
;;
*) des="raw ethernet #$n" dev=eth
esac
;;
1) des="raw IP #$n" dev=ip
2) des="raw IP #$n" dev=ip
;;
2) des="TCP/IP #$n" dev=tcp
3) des="TCP/IP #$n" dev=tcp
;;
3) des="UDP #$n" dev=udp
4) des="UDP #$n" dev=udp
esac
case $d in
[0123])
@ -156,12 +175,21 @@ do
fi
esac
;;
11,0)
des="block filter" dev=filter
;;
13,0)
des="audio" dev=audio
;;
14,0)
des="audio mixer" dev=mixer
;;
15,0)
des="kernel log" dev=klog
;;
16,0)
des="pseudo random number generator" dev=urandom
;;
BAD,BAD)
des= dev=
;;

View file

@ -23,7 +23,7 @@ case $#:$1 in
ttypa ttypb ttypc ttypd ttype ttypf \
ttyq0 ttyq1 ttyq2 ttyq3 ttyq4 ttyq5 ttyq6 ttyq7 ttyq8 ttyq9 \
ttyqa ttyqb ttyqc ttyqd ttyqe ttyqf \
eth klog random rescue filter
eth klog random filter
;;
0:|1:-\?)
cat >&2 <<EOF
@ -47,7 +47,6 @@ Where key is one of the following:
random # Make /dev/random, /dev/urandom
kbd # Make /dev/kbd
kbdaux # Make /dev/kbdaux
rescue # Make /dev/rescue
filter # Make /dev/filter
video # Make /dev/video
std # All standard devices
@ -250,11 +249,6 @@ do
$e mknod urandom c 16 0; $e chmod 644 urandom
$e chgrp operator random urandom
;;
rescue)
# rescue device
$e mknod rescue b 9 0
$e chmod 644 rescue
;;
klog)
# logging device.
$e mknod klog c 15 0

View file

@ -44,7 +44,6 @@ usr: \
/usr/bin/binsizes \
/usr/bin/datasizes \
/usr/bin/rotate \
/usr/bin/floppysetup \
/usr/bin/packit \
/usr/bin/packman \
/usr/bin/poweroff \
@ -132,9 +131,6 @@ clean:
/usr/bin/mkdist: mkdist.sh
install -m 755 -c -o bin $? $@
/usr/bin/floppysetup: floppysetup.sh
install -m 755 -c -o bin $? $@
/usr/bin/rotate: rotate.sh
install -m 755 -c -o bin $? $@

View file

@ -1,408 +0,0 @@
#!/bin/sh
#
# setup 4.1 - install a Minix distribution Author: Kees J. Bot
# 20 Dec 1994
PATH=/bin:/usr/bin
export PATH
usage()
{
cat >&2 <<'EOF'
Usage: setup # Install a skeleton system on the hard disk.
setup /usr # Install the rest of the system (binaries or sources).
# To install from other things then floppies:
urlget http://... | setup /usr # Read from a web site.
urlget ftp://... | setup /usr # Read from an FTP site.
mtools copy c0d0p0:... - | setup /usr # Read from the C: drive.
dosread c0d0p0 ... | setup /usr # Likewise if no mtools.
EOF
exit 1
}
# No options.
while getopts '' opt; do usage; done
shift `expr $OPTIND - 1`
# Installing a floppy set?
case $# in
0) # No, we're installing a skeleton system on the hard disk.
;;
1)
cd "$1" || exit
# Annoying message still there?
grep "'setup /usr'" /etc/issue >/dev/null 2>&1 && rm -f /etc/issue
if [ -t 0 ]
then
size=bad
while [ "$size" = bad ]
do
echo -n "\
What is the size of the images on the diskettes? [all] "; read size
case $size in
''|360|720|1200|1440)
;;
*) echo "Sorry, I don't believe \"$size\", try again." >&2
size=bad
esac
done
drive=
while [ -z "$drive" ]
do
echo -n "What floppy drive to use? [0] "; read drive
case $drive in
'') drive=0
;;
[01])
;;
*) echo "It must be 0 or 1, not \"$drive\"."
drive=
esac
done
vol -r $size /dev/fd$drive | uncompress | tar xvfp -
else
# Standard input is where we can get our files from.
uncompress | tar xvfp -
fi
echo Done.
exit
;;
*)
usage
esac
# Installing Minix on the hard disk.
# Must be in / or we can't mount or umount.
if [ ! -f /CD ]
then
case "`pwd`" in
/?*)
echo "Please type 'cd /' first, you are locking up `pwd`" >&2
exit 1
esac
fi
case "$0" in
/tmp/*)
rm -f "$0"
;;
*) cp -p "$0" /tmp/setup
exec /tmp/setup
esac
# Find out what we are running from.
exec 9<&0 </etc/mtab # Mounted file table.
read thisroot rest # Current root (/dev/ram or /dev/fd?)
read fdusr rest # USR (/dev/fd? or /dev/fd?p2)
exec 0<&9 9<&-
# What do we know about ROOT?
case $thisroot:$fdusr in
/dev/ram:/dev/fd0p2) fdroot=/dev/fd0 # Combined ROOT+USR in drive 0
;;
/dev/ram:/dev/fd1p2) fdroot=/dev/fd1 # Combined ROOT+USR in drive 1
;;
/dev/ram:/dev/fd*) fdroot=unknown # ROOT is some other floppy
;;
/dev/fd*:/dev/fd*) fdroot=$thisroot # ROOT is mounted directly
;;
*) fdroot=$thisroot # ?
if [ -f /CD ]
then
:
else
echo -n "\
It looks like Minix has been installed on disk already. Are you sure you
know what you are doing? [n] "
read yn
case "$yn" in
[yY]*|sure) ;;
*) exit
esac
fi
esac
echo -n "\
This is the Minix installation script.
Note 1: If the screen blanks suddenly then hit CTRL+F3 to select \"software
scrolling\".
Note 2: If things go wrong then hit DEL and start over.
Note 3: The installation procedure is described in the manual page
usage(8). It will be hard without it.
Note 4: Some questions have default answers, like this: [y]
Simply hit RETURN (or ENTER) if you want to choose that answer.
Note 5: If you see a colon (:) then you should hit RETURN to continue.
:"
read ret
echo "
What type of keyboard do you have? You can choose one of:
"
ls -C /usr/lib/keymaps | sed -e 's/\.map//g' -e 's/^/ /'
echo -n "
Keyboard type? [us-std] "; read keymap
test -n "$keymap" && loadkeys "/usr/lib/keymaps/$keymap.map"
echo -n "
Minix needs one primary partition of at about 210 MB for a full install
with sources. (The full install also fits in about 180 MB, but it
needs more if fully recompiled. Add more space to taste.)
* Minix currently only understands filesystems up to 4GB, so don't make
it bigger.
If there is no free space on your disk then you have to back up one of the
other partitions, shrink, and reinstall. See the appropriate manuals of the
the operating systems currently installed. Restart your Minix installation
after you have made space.
To make this partition you will be put in the editor \"part\". Follow the
advice under the '!' key to make a new partition of type MINIX. Do not
touch an existing partition unless you know precisely what you are doing!
Please note the name of the partition (e.g. c0d0p1, c0d1p3, c1d1p0) you
make. (See the devices section in usage(8) on Minix device names.)
:"
read ret
primary=
while [ -z "$primary" ]
do
part || exit
echo -n "
Please finish the name of the primary partition you have created:
(Just type RETURN if you want to rerun \"part\") /dev/"
read primary
done
root=${primary}s0
swap=${primary}s1
usr=${primary}s2
hex2int()
{
# Translate hexadecimal to integer.
local h d i
h=$1
i=0
while [ -n "$h" ]
do
d=$(expr $h : '\(.\)')
h=$(expr $h : '.\(.*\)')
d=$(expr \( 0123456789ABCDEF : ".*$d" \) - 1)
i=$(expr $i \* 16 + $d)
done
echo $i
}
# Ask user about networking
echo ""
echo "Minix currently supports the Intel Pro/100 and RealTek 8139 "
echo "Ethernet cards. Please choose: "
echo ""
echo "0. No Ethernet card (no networking)"
echo "1. An Intel Pro/100 Ethernet card is installed"
echo "2. A Realtek 8139 Ethernet card is installed"
echo "3. A different Ethernet card is installed (no networking)"
echo ""
echo "You can always change your mind after the install."
echo ""
echo "Choice? "
read eth
driver=""
inetparams=""
case "$eth" in
1) driver=FXP; inetparams="servers=inet;" ;;
2) driver=RTL8139; inetparams="servers=inet;" ;;
esac
# Compute the amount of memory available to Minix.
memsize=0
ifs="$IFS"
IFS=','
set -- $(sysenv memory)
IFS="$ifs"
for mem
do
mem=$(expr $mem : '.*:\(.*\)')
memsize=$(expr $memsize + $(hex2int $mem) / 1024)
done
# Compute an advised swap size.
swapadv=0
case `arch` in
i86)
test $memsize -lt 4096 && swapadv=$(expr 4096 - $memsize)
;;
*) test $memsize -lt 6144 && swapadv=$(expr 6144 - $memsize)
esac
echo -n "
How much swap space would you like? Swapspace is only needed if this
system is memory starved, like a 16-bit system with less then 2M, or a
32-bit system with less then 4M. Minix swapping isn't very good yet, so
there is no need for it otherwise.
Size in kilobytes? [$swapadv] "
swapsize=
read swapsize
test -z "$swapsize" && swapsize=$swapadv
echo -n "
You have created a partition named: /dev/$primary
The following subpartitions are about to be created on /dev/$primary:
Root subpartition: /dev/$root 16 MB
Swap subpartition: /dev/$swap $swapsize kb
/usr subpartition: /dev/$usr rest of $primary
Hit return if everything looks fine, or hit DEL to bail out if you want to
think it over. The next step will destroy /dev/$primary.
:"
read ret
# Secondary master bootstrap.
installboot -m /dev/$primary /usr/mdec/masterboot >/dev/null || exit
# Partition the primary.
p3=0:0
test "$swapsize" -gt 0 && p3=81:`expr $swapsize \* 2`
partition /dev/$primary 1 81:32768* $p3 81:0+ || exit
if [ "$swapsize" -gt 0 ]
then
# We must have that swap, now!
mkswap -f /dev/$swap || exit
mount -s /dev/$swap || exit
else
# Forget about swap.
swap=
fi
echo "
Migrating to disk...
"
mkfs /dev/$usr
echo "\
Scanning /dev/$usr for bad blocks. (Hit DEL to stop the scan if you are
absolutely sure that there can not be any bad blocks. Otherwise just wait.)"
trap ': nothing' 2
readall -b /dev/$usr | sh
sleep 2
trap 2
mount /dev/$usr /mnt || exit # Mount the intended /usr.
cpdir -v /usr /mnt || exit # Copy the usr floppy.
umount /dev/$usr || exit # Unmount the intended /usr.
umount $fdusr # Unmount the /usr floppy.
mount /dev/$usr /usr || exit # A new /usr
if [ $fdroot = unknown ]
then
echo "
By now the floppy USR has been copied to /dev/$usr, and it is now in use as
/usr. Please insert the installation ROOT floppy in a floppy drive."
drive=
while [ -z "$drive" ]
do
echo -n "What floppy drive is it in? [0] "; read drive
case $drive in
'') drive=0
;;
[01])
;;
*) echo "It must be 0 or 1, not \"$drive\"."
drive=
esac
done
fdroot=/dev/fd$drive
fi
echo "
Copying $fdroot to /dev/$root
"
mkfs /dev/$root || exit
mount /dev/$root /mnt || exit
if [ -d /boot ]
then
# Running from the floppy itself (or installation CD).
cpdir -vx / /mnt || exit
chmod 555 /mnt/usr
else
# Running from the RAM disk, root image is on a floppy.
mount $fdroot /root || exit
cpdir -v /root /mnt || exit
umount $fdroot || exit
cpdir -f /dev /mnt/dev # Copy any extra MAKEDEV'd devices
fi
# CD remnants that aren't for the installed system
rm /mnt/etc/issue /mnt/CD 2>/dev/null
# Change /etc/fstab.
echo >/mnt/etc/fstab "\
# Poor man's File System Table.
root=/dev/$root
${swap:+swap=/dev/$swap}
usr=/dev/$usr"
# National keyboard map.
test -n "$keymap" && cp -p "/usr/lib/keymaps/$keymap.map" /mnt/etc/keymap
# Set inet.conf to correct driver
if [ -n "$driver" ]
then echo "eth0 $driver 0 { default; };" >/mnt/etc/inet.conf
fi
umount /dev/$root || exit # Unmount the new root.
# Compute size of the second level file block cache.
case `arch` in
i86)
cache=`expr "0$memsize" - 1024`
test $cache -lt 32 && cache=0
test $cache -gt 512 && cache=512
;;
*)
cache=`expr "0$memsize" - 2560`
test $cache -lt 64 && cache=0
test $cache -gt 1024 && cache=1024
esac
echo "Second level file system block cache set to $cache kb."
if [ $cache -eq 0 ]; then cache=; else cache="ramsize=$cache"; fi
# Make bootable.
installboot -d /dev/$root /usr/mdec/bootblock /boot/boot >/dev/null || exit
edparams /dev/$root "rootdev=$root; ramimagedev=$root; $cache; $inetparams; save" || exit
pfile="/usr/src/tools/fdbootparams"
echo "Remembering boot parameters in ${pfile}."
echo "rootdev=$root; ramimagedev=$root; $cache; save" >$pfile || exit
sync
echo "
Please type 'halt' to exit Minix.
You can type 'boot $primary' to try the newly installed Minix system. See
\"TESTING\" in the usage manual."

View file

@ -68,7 +68,6 @@ bin/mined
bin/mkdir
bin/mkfs
bin/mknod
bin/mkswap
bin/mv
bin/od
bin/part

View file

@ -487,8 +487,6 @@ ln -s /usr/log /mnt/var/log
# CD remnants that aren't for the installed system
rm /mnt/etc/issue /mnt/CD /mnt/.* 2>/dev/null
# Change /etc/fstab. (No swap.)
# ${swap:+swap=/dev/$swap}
echo >/mnt/etc/fstab "\
# Poor man's File System Table.

View file

@ -128,7 +128,6 @@ ALL = \
mkfs \
mknod \
mkproto \
mkswap \
modem \
mount \
mt \
@ -569,10 +568,6 @@ mkproto: mkproto.c
$(CCLD) -o $@ $<
@install -S 20kw $@
mkswap: mkswap.c
$(CCLD) -I$(SYS) -o $@ $<
@install -S 4kw $@
modem: modem.c
$(CCLD) -o $@ $<
@install -S 4kw $@
@ -1026,7 +1021,6 @@ install: \
/usr/bin/mkfs \
/usr/bin/mknod \
/usr/bin/mkproto \
/usr/bin/mkswap \
/usr/bin/modem \
/usr/bin/mount \
/usr/bin/mt \
@ -1437,9 +1431,6 @@ install: \
/usr/bin/mkproto: mkproto
install -cs -o bin $< $@
/usr/bin/mkswap: mkswap
install -cs -o bin $< $@
/usr/bin/modem: modem
install -cs -o bin $< $@

View file

@ -1,197 +0,0 @@
/* mkswap 1.0 - Initialize a swap partition or file
* Author: Kees J. Bot
* 6 Jan 2001
*/
#define nil ((void*)0)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <dirent.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <minix/config.h>
#include <minix/const.h>
#include <minix/type.h>
#include <minix/u64.h>
#include <minix/partition.h>
#include <minix/swap.h>
#include <servers/mfs/const.h>
#include <servers/mfs/type.h>
#include <servers/mfs/super.h>
static void usage(void)
{
fprintf(stderr, "Usage: mkswap [-f] device-or-file [size[km]]\n");
exit(1);
}
int main(int argc, char **argv)
{
int first;
int i;
char *file;
unsigned long offset, size, devsize;
int fd;
struct stat st;
ssize_t r;
struct super_block super;
swap_hdr_t swap_hdr;
static u8_t block[_MAX_BLOCK_SIZE];
first= 0;
i= 1;
while (i < argc && argv[i][0] == '-') {
char *opt= argv[i++]+1;
if (opt[0] == '-' && opt[1] == 0) break; /* -- */
while (*opt != 0) switch (*opt++) {
case 'f': first= 1; break;
default: usage();
}
}
if (i == argc) usage();
file= argv[i++];
size= 0;
if (i < argc) {
char *end;
unsigned long m;
size= strtoul(argv[i], &end, 10);
if (end == argv[i]) usage();
m= 1024;
if (*end != 0) {
switch (*end) {
case 'm': case 'M': m *= 1024; /*FALL THROUGH*/
case 'k': case 'K': end++; break;
}
}
if (*end != 0 || size == -1
|| (size * m) / m != size || (size *= m) <= SWAP_OFFSET
) {
fprintf(stderr, "mkswap: %s: Bad size\n", argv[i]);
exit(1);
}
i++;
}
if (i != argc) usage();
/* Open the device or file. */
if ((fd= open(file, O_RDWR | O_CREAT | O_TRUNC, 0600)) < 0) {
fprintf(stderr, "mkswap: Can't open %s: %s\n", file, strerror(errno));
exit(1);
}
/* File or device? */
(void) fstat(fd, &st);
if (S_ISBLK(st.st_mode) || S_ISCHR(st.st_mode)) {
struct partition part;
/* How big is the partition? */
if (ioctl(fd, DIOCGETP, &part) < 0) {
fprintf(stderr, "mkswap: Can't determine the size of %s: %s\n",
file, strerror(errno));
exit(1);
}
devsize= cv64ul(part.size);
offset= 0;
if (!first) {
/* Is there a file system? */
r= -1;
if (lseek(fd, SUPER_BLOCK_BYTES, SEEK_SET) == -1
|| (r= read(fd, block, _STATIC_BLOCK_SIZE)) < _STATIC_BLOCK_SIZE
) {
fprintf(stderr, "mkswap: %s: %s\n",
file, r >= 0 ? "End of file" : strerror(errno));
exit(1);
}
memcpy(&super, block, sizeof(super));
if (super.s_magic == SUPER_MAGIC) {
offset= (unsigned long) super.s_nzones * _STATIC_BLOCK_SIZE;
} else
if (super.s_magic == SUPER_V2) {
offset= (unsigned long) super.s_zones * _STATIC_BLOCK_SIZE;
} else if (super.s_magic == SUPER_V3) {
offset= (unsigned long) super.s_zones * super.s_block_size;
} else {
first= 1;
}
}
if (size == 0) size= devsize - offset;
if (size == 0 || offset + size > devsize) {
fprintf(stderr, "mkswap: There is no room on %s for ", file);
if (size > 0) fprintf(stderr, "%lu kilobytes of ", size/1024);
fprintf(stderr, "swapspace\n");
if (offset > 0) {
fprintf(stderr, "(Use the -f flag to wipe the file system)\n");
}
exit(1);
}
} else
if (S_ISREG(st.st_mode)) {
/* Write to the swap file to guarantee space for MM. */
unsigned long n;
if (size == 0) {
fprintf(stderr, "mkswap: No size specified for %s\n", file);
usage();
}
memset(block, 0, sizeof(block));
for (n= 0; n < size; n += r) {
r= size > sizeof(block) ? sizeof(block) : size;
if ((r= write(fd, block, r)) <= 0) {
fprintf(stderr, "mkswap: %s: %s\n",
file, r == 0 ? "End of file" : strerror(errno));
exit(1);
}
}
first= 1;
} else {
fprintf(stderr, "mkswap: %s is not a device or a file\n", file);
exit(1);
}
if (offset < SWAP_OFFSET) {
offset += SWAP_OFFSET;
if (size < SWAP_OFFSET) size= 0; else size -= SWAP_OFFSET;
}
swap_hdr.sh_magic[0]= SWAP_MAGIC0;
swap_hdr.sh_magic[1]= SWAP_MAGIC1;
swap_hdr.sh_magic[2]= SWAP_MAGIC2;
swap_hdr.sh_magic[3]= SWAP_MAGIC3;
swap_hdr.sh_version= SH_VERSION;
swap_hdr.sh_priority= 0;
swap_hdr.sh_offset= offset;
swap_hdr.sh_swapsize= size;
r= -1;
if (lseek(fd, SWAP_BOOTOFF, SEEK_SET) == -1
|| (r= read(fd, block, sizeof(block))) < sizeof(block)
) {
fprintf(stderr, "mkswap: %s: %s\n", file,
file, r >= 0 ? "End of file" : strerror(errno));
exit(1);
}
r= (first ? SWAP_BOOTOFF : OPTSWAP_BOOTOFF) - SWAP_BOOTOFF;
memcpy(block + r, &swap_hdr, sizeof(swap_hdr));
r= -1;
if (lseek(fd, SWAP_BOOTOFF, SEEK_SET) == -1
|| (r= write(fd, block, sizeof(block))) < sizeof(block)
) {
fprintf(stderr, "mkswap: %s: %s\n", file,
file, r >= 0 ? "End of file" : strerror(errno));
exit(1);
}
printf("%s: swapspace at offset %lu, size %lu kilobytes\n",
file, offset / 1024, size / 1024);
return 0;
}

View file

@ -12,7 +12,6 @@
#include <minix/config.h>
#include <minix/const.h>
#include <minix/minlib.h>
#include <minix/swap.h>
#include <sys/svrctl.h>
#include <stdio.h>
#include "../../servers/mfs/const.h"
@ -23,21 +22,17 @@ _PROTOTYPE(int main, (int argc, char **argv));
_PROTOTYPE(void list, (void));
_PROTOTYPE(void usage, (void));
_PROTOTYPE(void tell, (char *this));
_PROTOTYPE(void swapon, (char *file));
static u8_t MAGIC[] = { SWAP_MAGIC0, SWAP_MAGIC1, SWAP_MAGIC2, SWAP_MAGIC3 };
int main(argc, argv)
int argc;
char *argv[];
{
int i, swap, n, v, mountflags;
int i, n, v, mountflags;
char **ap, *vs, *opt, *err, *type, *args;
char special[PATH_MAX+1], mounted_on[PATH_MAX+1], version[10], rw_flag[10];
if (argc == 1) list(); /* just list /etc/mtab */
mountflags = 0;
swap = 0;
type = NULL;
args = NULL;
ap = argv+1;
@ -46,7 +41,6 @@ char *argv[];
opt = argv[i]+1;
while (*opt != 0) switch (*opt++) {
case 'r': mountflags |= MS_RDONLY; break;
case 's': swap = 1; break;
case 't': if (++i == argc) usage();
type = argv[i];
break;
@ -63,34 +57,25 @@ char *argv[];
*ap = NULL;
argc = (ap - argv);
if (mountflags & MS_RDONLY && swap) usage();
if (swap) {
if (argc != 2) usage();
swapon(argv[1]);
tell(argv[1]);
tell(" is swapspace\n");
} else {
if (argc != 3) usage();
if (mount(argv[1], argv[2], mountflags, type, args) < 0) {
err = strerror(errno);
std_err("mount: Can't mount ");
std_err(argv[1]);
std_err(" on ");
std_err(argv[2]);
std_err(": ");
std_err(err);
std_err("\n");
exit(1);
}
/* The mount has completed successfully. Tell the user. */
tell(argv[1]);
tell(" is read-");
tell(mountflags & MS_RDONLY ? "only" : "write");
tell(" mounted on ");
tell(argv[2]);
tell("\n");
if (argc != 3) usage();
if (mount(argv[1], argv[2], mountflags, type, args) < 0) {
err = strerror(errno);
std_err("mount: Can't mount ");
std_err(argv[1]);
std_err(" on ");
std_err(argv[2]);
std_err(": ");
std_err(err);
std_err("\n");
exit(1);
}
/* The mount has completed successfully. Tell the user. */
tell(argv[1]);
tell(" is read-");
tell(mountflags & MS_RDONLY ? "only" : "write");
tell(" mounted on ");
tell(argv[2]);
tell("\n");
/* Update /etc/mtab. */
n = load_mtab("mount");
@ -106,29 +91,25 @@ char *argv[];
exit(1);
}
}
if (swap) {
vs = "swap";
/* For MFS, use a version number. Otherwise, use the FS type name. */
if (type == NULL || !strcmp(type, MINIX_FS_TYPE)) {
v = fsversion(argv[1], "mount");
if (v == 1)
vs = "1";
else if (v == 2)
vs = "2";
else if (v == 3)
vs = "3";
else
vs = "0";
} else {
/* For MFS, use a version number. Otherwise, use the FS type name. */
if (type == NULL || !strcmp(type, MINIX_FS_TYPE)) {
v = fsversion(argv[1], "mount");
if (v == 1)
vs = "1";
else if (v == 2)
vs = "2";
else if (v == 3)
vs = "3";
else
vs = "0";
} else {
/* Keep the version field sufficiently short. */
if (strlen(type) < sizeof(version))
vs = type;
else
vs = "-";
}
/* Keep the version field sufficiently short. */
if (strlen(type) < sizeof(version))
vs = type;
else
vs = "-";
}
n = put_mtab_entry(argv[1], swap ? "swap" : argv[2], vs,
n = put_mtab_entry(argv[1], argv[2], vs,
(mountflags & MS_RDONLY ? "ro" : "rw") );
if (n < 0) {
std_err("mount: /etc/mtab has grown too large\n");
@ -153,15 +134,11 @@ void list()
n = get_mtab_entry(special, mounted_on, version, rw_flag);
if (n < 0) break;
write(1, special, strlen(special));
if (strcmp(version, "swap") == 0) {
tell(" is swapspace\n");
} else {
tell(" is read-");
tell(strcmp(rw_flag, "rw") == 0 ? "write" : "only");
tell(" mounted on ");
tell(mounted_on);
tell("\n");
}
tell(" is read-");
tell(strcmp(rw_flag, "rw") == 0 ? "write" : "only");
tell(" mounted on ");
tell(mounted_on);
tell("\n");
}
exit(0);
}
@ -169,8 +146,7 @@ void list()
void usage()
{
std_err("Usage: mount [-r] [-t type] [-o options] special name\n"
" mount -s special\n");
std_err("Usage: mount [-r] [-t type] [-o options] special name\n");
exit(1);
}
@ -180,50 +156,3 @@ char *this;
{
write(1, this, strlen(this));
}
void swapon(file)
char *file;
{
u32_t super[2][_MAX_BLOCK_SIZE / 2 / sizeof(u32_t)];
swap_hdr_t *sp;
struct mmswapon mmswapon;
int fd, r;
char *err;
if ((fd = open(file, O_RDWR)) < 0
|| lseek(fd, SUPER_BLOCK_BYTES, SEEK_SET) == -1
|| (r = read(fd, super, _STATIC_BLOCK_SIZE)) < 0
) {
err = strerror(errno);
std_err("mount: ");
std_err(file);
std_err(": ");
std_err(err);
std_err("\n");
exit(1);
}
sp = (swap_hdr_t *) &super[0];
if (memcmp(sp->sh_magic, MAGIC, sizeof(MAGIC)) != 0)
sp = (swap_hdr_t *) &super[1];
if (r == _STATIC_BLOCK_SIZE && memcmp(sp->sh_magic, MAGIC, sizeof(MAGIC)) != 0
|| sp->sh_version > SH_VERSION) {
std_err("mount: ");
std_err(file);
std_err(" is not swapspace\n");
exit(1);
}
close(fd);
mmswapon.offset = sp->sh_offset;
mmswapon.size = sp->sh_swapsize;
strncpy(mmswapon.file, file, sizeof(mmswapon.file));
mmswapon.file[sizeof(mmswapon.file)-1] = 0;
if (svrctl(MMSWAPON, &mmswapon) < 0) {
err = strerror(errno);
std_err("mount: ");
std_err(file);
std_err(": ");
std_err(err);
std_err("\n");
exit(1);
}
}

View file

@ -22,7 +22,7 @@ LIBS = -ldriver -lsys
IMGRD=imgrd_s.o
#IMGRD=imgrd.c
OBJ = memory.o allocmem.o $(IMGRD)
OBJ = memory.o $(IMGRD)
# build local binary
all build: $(DRIVER)

View file

@ -1,14 +0,0 @@
#include <lib.h>
#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);
}

View file

@ -6,6 +6,7 @@
* /dev/null - null device (data sink)
* /dev/boot - boot device loaded from boot image
* /dev/zero - null byte stream generator
* /dev/imgrd - boot image RAM disk
*
* Changes:
* Apr 29, 2005 added null byte generator (Jorrit N. Herder)

View file

@ -151,21 +151,6 @@ int main(int argc, char **argv)
}
if (Wflag) wflag = 1; /* -W implies -w */
#if 0
/* The hardware clock may run in a different time zone, likely GMT or
* winter time. Select that time zone.
*/
strcpy(clocktz, "TZ=");
sysgetenv.key = "TZ";
sysgetenv.keylen = 2+1;
sysgetenv.val = clocktz+3;
sysgetenv.vallen = sizeof(clocktz)-3;
if (svrctl(SYSGETENV, &sysgetenv) == 0) {
putenv(clocktz);
tzset();
}
#endif
/* Read the CMOS real time clock. */
for (i = 0; i < 10; i++) {
get_time(&time1);

View file

@ -3,8 +3,8 @@ ETC=/etc/
USRETC=/usr/etc/
FILES1=fstab group hostname.file inet.conf motd.install mtab passwd profile \
protocols rc services termcap ttytab utmp rc.cd binary_sizes \
binary_sizes.big binary_sizes.xxl rc.rescue syslog.conf \
rc.daemons.dist rs.inet rs.single make.conf system.conf
binary_sizes.big binary_sizes.xxl syslog.conf rc.daemons.dist \
rs.inet rs.single make.conf system.conf
FILES2=shadow
FILES3=daily dhcptags.conf rc

View file

@ -8,7 +8,6 @@
755 root operator /lib/i386
755 root operator /boot
755 root operator /boot/image
755 root operator /boot/rescue
555 root operator /mnt
700 root operator /root
1777 root operator /tmp

8
etc/rc
View file

@ -73,9 +73,6 @@ start)
# /etc/fstab lists the root, tmp and usr devices.
. /etc/fstab
# Any swapspace on a device?
test "$swap" : '/dev/' && mount -s $swap
# Use MFS binary only from kernel image?
if [ "`sysenv bin_img`" = 1 ]
then
@ -157,10 +154,6 @@ Mount $usr /usr failed -- Single user."
intr sh
fi
# Any swapspace on a file?
test -n "$swap" -a ! "$swap" : '/dev/' && mount -s $swap
case "`printroot -r`":$bootcd in
/dev/ram:)
# Remove boot-only things to make space,
@ -182,7 +175,6 @@ esac
# Further initialization.
test -f /usr/etc/rc && sh /usr/etc/rc $action
test -f /usr/local/etc/rc && sh /usr/local/etc/rc $action
#test -f /etc/rc.rescue && sh /etc/rc.rescue $action
# Any messages?
test "$action" = start -a -f /etc/issue && cat /etc/issue

View file

@ -1,15 +0,0 @@
#!/bin/sh
DRIVERS=/sbin
RESCUE=/boot/rescue
if [ "$1" != start ]
then exit
fi
set -e
service up $DRIVERS/rescue -dev /dev/rescue -args 128 -period 4HZ
mkfs /dev/rescue
mount /dev/rescue $RESCUE
cd $DRIVERS
cp -p at_wini floppy bios_wini $RESCUE
service rescue $RESCUE

View file

@ -95,10 +95,7 @@
#define EXEC_RESTART 102 /* to PM: final part of exec for RS */
#define PROCSTAT 103 /* to PM */
#define GETPROCNR 104 /* to PM */
#define ALLOCMEM 105 /* to PM */
#if 0
#define FREEMEM 106 /* to PM, not used, not implemented */
#endif
#define GETEPINFO 107 /* to PM: get pid/uid/gid of an endpoint */
#define ADDDMA 108 /* to PM: inform PM about a region of memory
* that is used for bus-master DMA
@ -111,7 +108,6 @@
* any longer
*/
#define DEVCTL 120 /* to FS, map or unmap a device */
#define TASK_REPLY 121 /* to FS: reply code from drivers, not
* really a standalone call.
*/

View file

@ -93,7 +93,7 @@
*/
#define NOTIFY_MESSAGE 0x1000
/* FIXME will be is_notify(a) ((a) == NOTIFY_MESSAGE) */
#define is_notify(a) ((a) & NOTIFY_MESSAGE)
#define is_notify(a) ((unsigned) ((a) - NOTIFY_MESSAGE) < 0x100)
#define NOTIFY_FROM(p_nr) (NOTIFY_MESSAGE | ((p_nr) + NR_TASKS))
/* Shorthands for message parameters passed with notifications. */
@ -320,8 +320,6 @@
# define SYS_UMAP (KERNEL_CALL + 14) /* sys_umap() */
# define SYS_VIRCOPY (KERNEL_CALL + 15) /* sys_vircopy() */
# define SYS_PHYSCOPY (KERNEL_CALL + 16) /* sys_physcopy() */
# define SYS_VIRVCOPY (KERNEL_CALL + 17) /* sys_virvcopy() */
# define SYS_PHYSVCOPY (KERNEL_CALL + 18) /* sys_physvcopy() */
# define SYS_IRQCTL (KERNEL_CALL + 19) /* sys_irqctl() */
# define SYS_INT86 (KERNEL_CALL + 20) /* sys_int86() */
@ -344,39 +342,21 @@
# define SYS_CPROF (KERNEL_CALL + 37) /* sys_cprof() */
# define SYS_PROFBUF (KERNEL_CALL + 38) /* sys_profbuf() */
# define SYS_STIME (KERNEL_CALL + 39) /* sys_stime() */
# define SYS_STIME (KERNEL_CALL + 39) /* sys_stime() */
# define SYS_MAPDMA (KERNEL_CALL + 42) /* sys_mapdma() */
# define SYS_VMCTL (KERNEL_CALL + 43) /* sys_vmctl() */
# define SYS_SYSCTL (KERNEL_CALL + 44) /* sys_sysctl() */
# define SYS_MAPDMA (KERNEL_CALL + 42) /* sys_mapdma() */
# define SYS_VMCTL (KERNEL_CALL + 43) /* sys_vmctl() */
# define SYS_SYSCTL (KERNEL_CALL + 44) /* sys_sysctl() */
# define SYS_VTIMER (KERNEL_CALL + 45) /* sys_vtimer() */
# define SYS_RUNCTL (KERNEL_CALL + 46) /* sys_runctl() */
#define NR_SYS_CALLS 47 /* number of system calls */
/* Subfunctions for SYS_PRIVCTL */
#define SYS_PRIV_ALLOW 1 /* Allow process to run */
#define SYS_PRIV_DISALLOW 2 /* Disallow process to run */
#define SYS_PRIV_SET_SYS 3 /* Set a system privilege structure */
#define SYS_PRIV_SET_USER 4 /* Set a user privilege structure */
#define SYS_PRIV_ADD_IO 5 /* Add I/O range (struct io_range) */
#define SYS_PRIV_ADD_MEM 6 /* Add memory range (struct mem_range)
*/
#define SYS_PRIV_ADD_IRQ 7 /* Add IRQ */
#define SYS_PRIV_QUERY_MEM 8 /* Verify memory privilege. */
/* Subfunctions for SYS_SETGRANT */
#define SYS_PARAM_SET_GRANT 1 /* Set address and size of grant table */
/* Field names for SYS_MEMSET, SYS_SEGCTL. */
/* Field names for SYS_MEMSET. */
#define MEM_PTR m2_p1 /* base */
#define MEM_COUNT m2_l1 /* count */
#define MEM_PATTERN m2_l2 /* pattern to write */
#define MEM_CHUNK_BASE m4_l1 /* physical base address */
#define MEM_CHUNK_SIZE m4_l2 /* size of mem chunk */
#define MEM_TOT_SIZE m4_l3 /* total memory size */
#define MEM_CHUNK_TAG m4_l4 /* tag to identify chunk of mem */
/* Field names for SYS_DEVIO, SYS_VDEVIO, SYS_SDEVIO. */
#define DIO_REQUEST m2_i3 /* device in or output */
@ -391,12 +371,16 @@
# define _DIO_SAFEMASK 0xf00
# define DIO_INPUT_BYTE (_DIO_INPUT|_DIO_BYTE)
# define DIO_INPUT_WORD (_DIO_INPUT|_DIO_WORD)
# define DIO_INPUT_LONG (_DIO_INPUT|_DIO_LONG)
# define DIO_OUTPUT_BYTE (_DIO_OUTPUT|_DIO_BYTE)
# define DIO_OUTPUT_WORD (_DIO_OUTPUT|_DIO_WORD)
# define DIO_OUTPUT_LONG (_DIO_OUTPUT|_DIO_LONG)
# define DIO_SAFE_INPUT_BYTE (_DIO_INPUT|_DIO_BYTE|_DIO_SAFE)
# define DIO_SAFE_INPUT_WORD (_DIO_INPUT|_DIO_WORD|_DIO_SAFE)
# define DIO_SAFE_INPUT_LONG (_DIO_INPUT|_DIO_LONG|_DIO_SAFE)
# define DIO_SAFE_OUTPUT_BYTE (_DIO_OUTPUT|_DIO_BYTE|_DIO_SAFE)
# define DIO_SAFE_OUTPUT_WORD (_DIO_OUTPUT|_DIO_WORD|_DIO_SAFE)
# define DIO_SAFE_OUTPUT_LONG (_DIO_OUTPUT|_DIO_LONG|_DIO_SAFE)
#define DIO_PORT m2_l1 /* single port address */
#define DIO_VALUE m2_l2 /* single I/O value */
#define DIO_VEC_ADDR m2_p1 /* address of buffer or (p,v)-pairs */
@ -404,12 +388,10 @@
#define DIO_VEC_ENDPT m2_i2 /* number of process where vector is */
#define DIO_OFFSET m2_i1 /* offset from grant */
/* Field names for SYS_SIGNARLM, SYS_FLAGARLM, SYS_SYNCALRM. */
/* Field names for SYS_SETALARM. */
#define ALRM_EXP_TIME m2_l1 /* expire time for the alarm call */
#define ALRM_ABS_TIME m2_i2 /* set to 1 to use absolute alarm time */
#define ALRM_TIME_LEFT m2_l1 /* how many ticks were remaining */
#define ALRM_ENDPT m2_i1 /* which process wants the alarm? */
#define ALRM_FLAG_PTR m2_p1 /* virtual address of timeout flag */
/* Field names for SYS_IRQCTL. */
#define IRQ_REQUEST m5_c1 /* what to do? */
@ -432,15 +414,6 @@
#define SEG_SIZE m4_l4 /* segment size */
#define SEG_INDEX m4_l5 /* segment index in remote map */
/* Field names for SYS_VIDCOPY. */
#define VID_REQUEST m4_l1 /* what to do? */
# define VID_VID_COPY 1 /* request vid_vid_copy() */
# define MEM_VID_COPY 2 /* request mem_vid_copy() */
#define VID_SRC_ADDR m4_l2 /* virtual address in memory */
#define VID_SRC_OFFSET m4_l3 /* offset in video memory */
#define VID_DST_OFFSET m4_l4 /* offset in video memory */
#define VID_CP_COUNT m4_l5 /* number of words to be copied */
/* Field names for SYS_ABORT. */
#define ABRT_HOW m1_i1 /* RBT_REBOOT, RBT_HALT, etc. */
#define ABRT_MON_ENDPT m1_i2 /* process where monitor params are */
@ -456,11 +429,6 @@
#define CP_DST_ADDR m5_l2 /* address where data go to */
#define CP_NR_BYTES m5_l3 /* number of bytes to copy */
/* Field names for SYS_VCOPY and SYS_VVIRCOPY. */
#define VCP_NR_OK m1_i2 /* number of successfull copies */
#define VCP_VEC_SIZE m1_i3 /* size of copy vector */
#define VCP_VEC_ADDR m1_p1 /* pointer to copy vector */
/* Field names for SYS_GETINFO. */
#define I_REQUEST m7_i3 /* what info to get */
# define GET_KINFO 0 /* get kernel information structure */
@ -485,8 +453,8 @@
# define GET_WHOAMI 19 /* get own name and endpoint */
# define GET_RANDOMNESS_BIN 20 /* get one randomness bin */
# define GET_IDLETSC 21 /* get cumulative idle time stamp counter */
# define GET_AOUTHEADER 22 /* get a.out headers from the boot image */
#define I_ENDPT m7_i4 /* calling process */
# define GET_AOUTHEADER 22 /* get a.out headers from the boot image */
#define I_ENDPT m7_i4 /* calling process (may only be SELF) */
#define I_VAL_PTR m7_p1 /* virtual address at caller */
#define I_VAL_LEN m7_i1 /* max length of value */
#define I_VAL_PTR2 m7_p2 /* second virtual address */
@ -503,15 +471,8 @@
#define T_BOOTTIME m4_l3 /* Boottime in seconds (also for SYS_STIME) */
#define T_BOOT_TICKS m4_l5 /* number of clock ticks since boot time */
/* vm_map */
#define VM_MAP_ENDPT m4_l1
#define VM_MAP_MAPUNMAP m4_l2
#define VM_MAP_BASE m4_l3
#define VM_MAP_SIZE m4_l4
#define VM_MAP_ADDR m4_l5
/* Field names for SYS_TRACE, SYS_PRIVCTL. */
#define CTL_ENDPT m2_i1 /* process number of the caller */
#define CTL_ENDPT m2_i1 /* process number of the caller */
#define CTL_REQUEST m2_i2 /* server control request */
#define CTL_ARG_PTR m2_p1 /* pointer to argument */
#define CTL_ADDRESS m2_l1 /* address at traced process' space */
@ -521,47 +482,50 @@
#define CTL_PHYSSTART m2_l1 /* physical memory start in bytes*/
#define CTL_PHYSLEN m2_l2 /* length in bytes */
/* Subfunctions for SYS_PRIVCTL */
#define SYS_PRIV_ALLOW 1 /* Allow process to run */
#define SYS_PRIV_DISALLOW 2 /* Disallow process to run */
#define SYS_PRIV_SET_SYS 3 /* Set a system privilege structure */
#define SYS_PRIV_SET_USER 4 /* Set a user privilege structure */
#define SYS_PRIV_ADD_IO 5 /* Add I/O range (struct io_range) */
#define SYS_PRIV_ADD_MEM 6 /* Add memory range (struct mem_range)
*/
#define SYS_PRIV_ADD_IRQ 7 /* Add IRQ */
#define SYS_PRIV_QUERY_MEM 8 /* Verify memory privilege. */
/* Field names for SYS_SETGRANT */
#define SG_ADDR m2_p1 /* address */
#define SG_SIZE m2_i2 /* no. of entries */
/* Field names for SYS_KILL, SYS_SIGCTL */
#define SIG_REQUEST m2_l2 /* PM signal control request */
#define S_GETSIG 0 /* get pending kernel signal */
#define S_ENDSIG 1 /* finish a kernel signal */
#define S_SENDSIG 2 /* POSIX style signal handling */
#define S_SIGRETURN 3 /* return from POSIX handling */
#define S_KILL 4 /* servers kills process with signal */
#define SIG_ENDPT m2_i1 /* process number for inform */
/* Field names for SYS_GETKSIG, _ENDKSIG, _KILL, _SIGSEND, _SIGRETURN. */
#define SIG_ENDPT m2_i1 /* process number for inform */
#define SIG_NUMBER m2_i2 /* signal number to send */
#define SIG_FLAGS m2_i3 /* signal flags field */
#define SIG_MAP m2_l1 /* used by kernel to pass signal bit map */
#define SIG_CTXT_PTR m2_p1 /* pointer to info to restore signal context */
/* Field names for SYS_FORK, _EXEC, _EXIT, _NEWMAP. */
#define PR_ENDPT m1_i1 /* indicates a process */
#define PR_PRIORITY m1_i2 /* process priority */
#define PR_SLOT m1_i2 /* indicates a process slot */
#define PR_PID m1_i3 /* process id at process manager */
#define PR_STACK_PTR m1_p1 /* used for stack ptr in sys_exec, sys_getsp */
#define PR_TRACING m1_i3 /* flag to indicate tracing is on/ off */
#define PR_NAME_PTR m1_p2 /* tells where program name is for dmp */
#define PR_IP_PTR m1_p3 /* initial value for ip after exec */
#define PR_MEM_PTR m1_p1 /* tells where memory map is for sys_newmap
#define PR_ENDPT m1_i1 /* indicates a process */
#define PR_PRIORITY m1_i2 /* process priority */
#define PR_SLOT m1_i2 /* indicates a process slot */
#define PR_STACK_PTR m1_p1 /* used for stack ptr in sys_exec, sys_getsp */
#define PR_NAME_PTR m1_p2 /* tells where program name is for dmp */
#define PR_IP_PTR m1_p3 /* initial value for ip after exec */
#define PR_MEM_PTR m1_p1 /* tells where memory map is for sys_newmap
* and sys_fork
*/
#define PR_FORK_FLAGS m1_i3
#define PR_FORK_MSGADDR m1_p1
/* Field names for SYS_INT86 */
#define INT86_REG86 m1_p1 /* pointer to registers */
#define PR_FORK_FLAGS m1_i3 /* optional flags for fork operation */
#define PR_FORK_MSGADDR m1_p1 /* reply message address of forked child */
/* Flags for PR_FORK_FLAGS. */
#define PFF_VMINHIBIT 0x01 /* Don't schedule until release by VM. */
/* Field names for SYS_INT86 */
#define INT86_REG86 m1_p1 /* pointer to registers */
/* Field names for SYS_SAFECOPY* */
#define SCP_FROM_TO m2_i1 /* from/to whom? */
#define SCP_INFO m2_i2 /* byte: DDDDSSSS Dest and Src seg */
#define SCP_SEG m2_i2 /* my own segment */
#define SCP_GID m2_i3 /* grant id */
#define SCP_OFFSET m2_l1 /* offset within grant */
#define SCP_ADDRESS m2_p1 /* my own address */
@ -571,17 +535,6 @@
#define VSCP_VEC_ADDR m2_p1 /* start of vector */
#define VSCP_VEC_SIZE m2_l2 /* elements in vector */
/* For the SCP_INFO field: encoding and decoding. */
#define SCP_MAKEINFO(seg) ((seg) & 0xffff)
#define SCP_INFO2SEG(info) ((info) & 0xffff)
/* Field names for SELECT (FS). */
#define SEL_NFDS m8_i1
#define SEL_READFDS m8_p1
#define SEL_WRITEFDS m8_p2
#define SEL_ERRORFDS m8_p3
#define SEL_TIMEOUT m8_p4
/* Field names for SYS_SPROF, _CPROF, _PROFBUF. */
#define PROF_ACTION m7_i1 /* start/stop/reset/get */
#define PROF_MEM_SIZE m7_i2 /* available memory for data */
@ -590,12 +543,7 @@
#define PROF_CTL_PTR m7_p1 /* location of info struct */
#define PROF_MEM_PTR m7_p2 /* location of profiling data */
/* Field names for GETSYSINFO_UP (PM). */
#define SIU_WHAT m2_i1
#define SIU_LEN m2_i2
#define SIU_WHERE m2_p1
/* Message for SYS_READBIOS */
/* Field names for SYS_READBIOS. */
#define RDB_SIZE m2_i1
#define RDB_ADDR m2_l1
#define RDB_BUF m2_p1
@ -621,14 +569,6 @@
#define VMMF_UNCACHED (1L << 0)
/* Codes and field names for SYS_SYSCTL. */
#define SYSCTL_CODE m1_i1 /* SYSCTL_CODE_* below */
#define SYSCTL_ARG1 m1_p1
#define SYSCTL_ARG2 m1_i2
#define SYSCTL_CODE_DIAG 1 /* Print diagnostics. */
#define SYSCTL_CODE_STACKTRACE 2 /* Print process stack. */
#define DIAG_BUFSIZE (80*25)
/* Values for SVMCTL_PARAM. */
#define VMCTL_I386_SETCR3 10
#define VMCTL_GET_PAGEFAULT 11
@ -647,6 +587,14 @@
#define VMCTL_KERN_PHYSMAP 27
#define VMCTL_KERN_MAP_REPLY 28
/* Codes and field names for SYS_SYSCTL. */
#define SYSCTL_CODE m1_i1 /* SYSCTL_CODE_* below */
#define SYSCTL_ARG1 m1_p1
#define SYSCTL_ARG2 m1_i2
#define SYSCTL_CODE_DIAG 1 /* Print diagnostics. */
#define SYSCTL_CODE_STACKTRACE 2 /* Print process stack. */
#define DIAG_BUFSIZE (80*25)
/* Field names for SYS_VTIMER. */
#define VT_WHICH m2_i1 /* which timer to set/retrieve */
# define VT_VIRTUAL 1 /* the ITIMER_VIRTUAL timer */
@ -747,6 +695,7 @@
#define PM_RS_BASE 0x980
/* Requests from PM to VFS */
#define PM_INIT (PM_RQ_BASE + 0) /* Process table exchange */
#define PM_SETUID (PM_RQ_BASE + 1) /* Set new user ID */
#define PM_SETGID (PM_RQ_BASE + 2) /* Set group ID */
#define PM_SETSID (PM_RQ_BASE + 3) /* Set session leader */
@ -760,34 +709,37 @@
#define PM_SETGROUPS (PM_RQ_BASE + 11) /* Tell VFS about setgroups */
/* Replies from VFS to PM */
#define PM_SETUID_REPLY (PM_RS_BASE + 21)
#define PM_SETGID_REPLY (PM_RS_BASE + 22)
#define PM_SETSID_REPLY (PM_RS_BASE + 23)
#define PM_EXIT_REPLY (PM_RS_BASE + 24)
#define PM_CORE_REPLY (PM_RS_BASE + 25)
#define PM_EXEC_REPLY (PM_RS_BASE + 26)
#define PM_FORK_REPLY (PM_RS_BASE + 27)
#define PM_FORK_NB_REPLY (PM_RS_BASE + 28)
#define PM_UNPAUSE_REPLY (PM_RS_BASE + 29)
#define PM_REBOOT_REPLY (PM_RS_BASE + 30)
#define PM_SETGROUPS_REPLY (PM_RS_BASE + 31)
#define PM_SETUID_REPLY (PM_RS_BASE + 1)
#define PM_SETGID_REPLY (PM_RS_BASE + 2)
#define PM_SETSID_REPLY (PM_RS_BASE + 3)
#define PM_EXIT_REPLY (PM_RS_BASE + 4)
#define PM_CORE_REPLY (PM_RS_BASE + 5)
#define PM_EXEC_REPLY (PM_RS_BASE + 6)
#define PM_FORK_REPLY (PM_RS_BASE + 7)
#define PM_FORK_NB_REPLY (PM_RS_BASE + 8)
#define PM_UNPAUSE_REPLY (PM_RS_BASE + 9)
#define PM_REBOOT_REPLY (PM_RS_BASE + 10)
#define PM_SETGROUPS_REPLY (PM_RS_BASE + 11)
/* Standard parameters for all requests and replies, except PM_REBOOT */
# define PM_PROC m1_i1 /* process */
# define PM_PROC m1_i1 /* process endpoint */
/* Additional parameters for PM_INIT */
# define PM_SLOT m1_i2 /* process slot number */
# define PM_PID m2_i3 /* process pid */
/* Additional parameters for PM_SETUID and PM_SETGID */
# define PM_EID m1_i2 /* effective user/group id */
# define PM_RID m1_i3 /* real user/group id */
/* Additional parameter for PM_SETGROUPS */
#define PM_GROUP_NO m1_i2 /* number of groups */
#define PM_GROUP_ADDR m1_p1 /* struct holding group data */
# define PM_GROUP_NO m1_i2 /* number of groups */
# define PM_GROUP_ADDR m1_p1 /* struct holding group data */
/* Additional parameters for PM_EXEC */
# define PM_PATH m1_p1 /* executable */
# define PM_PATH_LEN m1_i2 /* length of path including
* terminating nul
* terminating null character
*/
# define PM_FRAME m1_p2 /* arguments and environment */
# define PM_FRAME_LEN m1_i3 /* size of frame */
@ -796,7 +748,7 @@
# define PM_STATUS m1_i2 /* OK or failure */
/* Additional parameters for PM_FORK and PM_FORK_NB */
# define PM_PPROC m1_i2 /* parent process */
# define PM_PPROC m1_i2 /* parent process endpoint */
# define PM_CPID m1_i3 /* child pid */
/* Parameters for the EXEC_NEWMEM call */
@ -845,6 +797,10 @@
# define VMVC_FD m1_i1
# define VMVC_ENDPOINT m1_i2
/*===========================================================================*
* Miscellaneous field names *
*===========================================================================*/
/* PM field names */
/* BRK */
#define PMBRK_ADDR m1_p1
@ -855,6 +811,18 @@
#define PM_ENDPT m1_i1
#define PM_PENDPT m1_i2
/* Field names for GETSYSINFO_UP (PM). */
#define SIU_WHAT m2_i1
#define SIU_LEN m2_i2
#define SIU_WHERE m2_p1
/* Field names for SELECT (FS). */
#define SEL_NFDS m8_i1
#define SEL_READFDS m8_p1
#define SEL_WRITEFDS m8_p2
#define SEL_ERRORFDS m8_p3
#define SEL_TIMEOUT m8_p4
/*===========================================================================*
* Messages for VM server *
*===========================================================================*/
@ -939,10 +907,6 @@
# define VMUM_ADDR m1_p1
# define VMUM_LEN m1_i1
#define VM_ALLOCMEM (VM_RQ_BASE+18)
# define VMAM_BYTES m1_p1
# define VMAM_MEMBASE m1_i1
#define VM_MUNMAP_TEXT (VM_RQ_BASE+19)
/* Calls from VFS. */

View file

@ -16,8 +16,6 @@
#define SUPER_USER (uid_t) 0 /* uid_t of superuser */
#define NULL ((void *)0) /* null pointer */
#define CPVEC_NR 16 /* max # of entries in a SYS_VCOPY request */
#define CPVVEC_NR 64 /* max # of entries in a SYS_VCOPY request */
#define SCPVEC_NR 64 /* max # of entries in a SYS_VSAFECOPY* request */
#define NR_IOREQS 64
/* maximum number of entries in an iorequest */

View file

@ -36,8 +36,6 @@ enum dev_style { STYLE_DEV, STYLE_NDEV, STYLE_TTY, STYLE_CLONE };
#define INET_MAJOR 7 /* major device for inet */
#define RESCUE_MAJOR 9 /* major device for rescue */
#define FILTER_MAJOR 11 /* major device for filter driver */
#define LOG_MAJOR 15 /* major device for log driver */

View file

@ -1,48 +0,0 @@
/*
minix/swap.h
Defines the super block of swap partitions and some useful constants.
Created: Aug 2, 1992 by Philip Homburg
*/
#ifndef _MINIX__SWAP_H
#define _MINIX__SWAP_H
/* Two possible layouts for a partition with swapspace:
*
* Sector Swap partition FS+swap partition
*
* 0 - 1 bootblock bootblock
* 2 swap header FS header
* 3 blank swap header
* 4 - m swapspace file system
* m+1 - n - swapspace
*/
#define SWAP_MAGIC0 0x9D
#define SWAP_MAGIC1 0xC3
#define SWAP_MAGIC2 0x01
#define SWAP_MAGIC3 0x82
typedef struct swap_hdr
{
u8_t sh_magic[4];
u8_t sh_version;
u8_t sh_dummy[3];
u32_t sh_offset;
u32_t sh_swapsize;
i32_t sh_priority;
} swap_hdr_t;
#define SWAP_BOOTOFF 1024
#define SWAP_OFFSET 2048
#define OPTSWAP_BOOTOFF (1024+512)
#define SH_VERSION 1
#define SH_PRIORITY 0
#endif /* _MINIX__SWAP_H */
/*
* $PchId: swap.h,v 1.6 1996/04/10 20:25:48 philip Exp $
*/

View file

@ -149,13 +149,6 @@ _PROTOTYPE(int sys_vsafecopy, (struct vscp_vec *copyvec, int elements));
_PROTOTYPE(int sys_memset, (unsigned long pattern,
phys_bytes base, phys_bytes bytes));
/* Vectored virtual / physical copy calls. */
#if DEAD_CODE /* library part not yet implemented */
_PROTOTYPE(int sys_virvcopy, (phys_cp_req *vec_ptr,int vec_size,int *nr_ok));
_PROTOTYPE(int sys_physvcopy, (phys_cp_req *vec_ptr,int vec_size,int *nr_ok));
#endif
_PROTOTYPE(int sys_umap, (endpoint_t proc_ep, int seg, vir_bytes vir_addr,
vir_bytes bytes, phys_bytes *phys_addr));
_PROTOTYPE(int sys_umap_data_fb, (endpoint_t proc_ep, vir_bytes vir_addr,

View file

@ -22,7 +22,6 @@ _PROTOTYPE( int vm_getdma, (endpoint_t req_e, endpoint_t *procp,
_PROTOTYPE( void *vm_map_phys, (endpoint_t who, void *physaddr, size_t len));
_PROTOTYPE( int vm_unmap_phys, (endpoint_t who, void *vaddr, size_t len));
_PROTOTYPE( int vm_allocmem, (phys_clicks memclicks, phys_clicks *retmembase));
_PROTOTYPE( int vm_notify_sig, (endpoint_t ep, endpoint_t ipc_ep));
_PROTOTYPE( int vm_ctl, (int what, int param));
_PROTOTYPE( int vm_set_priv, (int procnr, void *buf));

View file

@ -14,34 +14,12 @@ Created: Feb 15, 1994 by Philip Homburg <philip@cs.vu.nl>
/* Server control commands have the same encoding as the commands for ioctls. */
#include <minix/ioctl.h>
/* MM controls. */
#define MMSIGNON _IO ('M', 4)
#define MMSWAPON _IOW('M', 5, struct mmswapon)
#define MMSWAPOFF _IO ('M', 6)
/* PM controls. */
#define MMGETPARAM _IOW('M', 5, struct sysgetenv)
#define MMSETPARAM _IOR('M', 7, struct sysgetenv)
/* FS controls. */
#define FSSIGNON _IOW('F', 2, struct fssignon)
#define FSDEVUNMAP _IOW('F', 6, struct fsdevunmap)
/* Kernel controls. */
#define SYSSENDMASK _IO ('S', 4)
#define SYSSIGNON _IOR('S', 2, struct systaskinfo)
#define SYSGETENV _IOW('S', 1, struct sysgetenv)
struct mmswapon {
u32_t offset; /* Starting offset within file. */
u32_t size; /* Size of swap area. */
char file[128]; /* Name of swap file/device. */
};
struct svrqueryparam {
char *param; /* Names of parameters to query. */
size_t psize; /* Length of param[]. */
char *value; /* To return values. */
size_t vsize;
};
/* A proper system call must be created later. */
#include <minix/dmap.h>
@ -50,14 +28,6 @@ struct fssignon {
enum dev_style style; /* Management style. */
};
struct fsdevunmap {
dev_t dev; /* Device to unmap. */
};
struct systaskinfo {
int proc_nr; /* Process number of caller. */
};
struct sysgetenv {
char *key; /* Name requested. */
size_t keylen; /* Length of name including \0. */

View file

@ -182,23 +182,14 @@ _PROTOTYPE( int getdomainname, (char *_domain, size_t _len) );
_PROTOTYPE( int ttyslot, (void) );
_PROTOTYPE( int fttyslot, (int _fd) );
_PROTOTYPE( char *crypt, (const char *_key, const char *_salt) );
_PROTOTYPE( int getsysinfo, (endpoint_t who, int what, void *where) );
_PROTOTYPE( int getsysinfo, (endpoint_t who, int what, void *where) );
_PROTOTYPE( int getsigset, (sigset_t *sigset) );
_PROTOTYPE( int getprocnr, (void) );
_PROTOTYPE( int getnprocnr, (pid_t pid) );
_PROTOTYPE( int getpprocnr, (void) );
_PROTOTYPE( int _pm_findproc, (char *proc_name, int *proc_nr) );
_PROTOTYPE( int allocmem, (phys_bytes size, phys_bytes *base) );
_PROTOTYPE( int freemem, (phys_bytes size, phys_bytes base) );
#define DEV_MAP 1
#define DEV_UNMAP 2
#define mapdriver(driver, device, style, force) \
devctl(DEV_MAP, driver, device, style, force)
#define unmapdriver(device) devctl(DEV_UNMAP, 0, device, 0)
_PROTOTYPE( int devctl, (int ctl_req, int driver, int device, int style,
int force) );
_PROTOTYPE( int mapdriver5, (char *label, size_t len, int major,
int style, int force) );
_PROTOTYPE( int mapdriver, (char *label, int major, int style,
int force) );
_PROTOTYPE(int adddma, (endpoint_t proc_e,
phys_bytes start, phys_bytes size) );
_PROTOTYPE(int deldma, (endpoint_t proc_e,

View file

@ -39,9 +39,7 @@
#define USE_NICE 1 /* change scheduling priority */
#define USE_UMAP 1 /* map virtual to physical address */
#define USE_VIRCOPY 1 /* copy using virtual addressing */
#define USE_VIRVCOPY 1 /* vector with virtual copy requests */
#define USE_PHYSCOPY 1 /* copy using physical addressing */
#define USE_PHYSVCOPY 1 /* vector with physical copy requests */
#define USE_MEMSET 1 /* write char to a given memory area */
#define USE_RUNCTL 1 /* control stop flags of a process */
@ -58,7 +56,6 @@
*/
#define NR_IRQ_HOOKS 16 /* number of interrupt hooks */
#define VDEVIO_BUF_SIZE 64 /* max elements per VDEVIO request */
#define VCOPY_VEC_SIZE 16 /* max elements per VCOPY request */
/* How many bytes for the kernel stack. Space allocated in mpx.s. */
#define K_STACK_BYTES 1024

View file

@ -204,8 +204,6 @@ PRIVATE void initialize(void)
map(SYS_UMAP, do_umap); /* map virtual to physical address */
map(SYS_VIRCOPY, do_vircopy); /* use pure virtual addressing */
map(SYS_PHYSCOPY, do_copy); /* use physical addressing */
map(SYS_VIRVCOPY, do_virvcopy); /* vector with copy requests */
map(SYS_PHYSVCOPY, do_vcopy); /* vector with copy requests */
map(SYS_SAFECOPYFROM, do_safecopy); /* copy with pre-granted permission */
map(SYS_SAFECOPYTO, do_safecopy); /* copy with pre-granted permission */
map(SYS_VSAFECOPY, do_vsafecopy); /* vectored safecopy */

View file

@ -13,7 +13,6 @@
* Jul 09, 2005 updated SYS_KILL to signal services (Jorrit N. Herder)
* Jun 21, 2005 created SYS_NICE for nice(2) kernel call (Ben J. Gras)
* Jun 21, 2005 created SYS_MEMSET to speed up exec(2) (Ben J. Gras)
* Apr 12, 2005 updated SYS_VCOPY for virtual_copy() (Jorrit N. Herder)
* Jan 20, 2005 updated SYS_COPY for virtual_copy() (Jorrit N. Herder)
* Oct 24, 2004 created SYS_GETKSIG to support PM (Jorrit N. Herder)
* Oct 10, 2004 created handler for unused calls (Jorrit N. Herder)
@ -80,12 +79,6 @@ _PROTOTYPE( int do_copy, (message *m_ptr) );
#define do_copy do_unused
#endif
_PROTOTYPE( int do_vcopy, (message *m_ptr) );
#define do_virvcopy do_vcopy
#if ! (USE_VIRVCOPY || USE_PHYSVCOPY)
#define do_vcopy do_unused
#endif
_PROTOTYPE( int do_umap, (message *m_ptr) );
#if ! USE_UMAP
#define do_umap do_unused

View file

@ -38,7 +38,6 @@ OBJECTS = \
$(SYSTEM)(do_devio.o) \
$(SYSTEM)(do_vdevio.o) \
$(SYSTEM)(do_copy.o) \
$(SYSTEM)(do_vcopy.o) \
$(SYSTEM)(do_umap.o) \
$(SYSTEM)(do_memset.o) \
$(SYSTEM)(do_setgrant.o) \
@ -120,9 +119,6 @@ $(SYSTEM)(do_vdevio.o): do_vdevio.c
$(SYSTEM)(do_copy.o): do_copy.c
$(CC) do_copy.c
$(SYSTEM)(do_vcopy.o): do_vcopy.c
$(CC) do_vcopy.c
$(SYSTEM)(do_umap.o): do_umap.c
$(CC) do_umap.c

View file

@ -3,7 +3,7 @@
*
* The parameters for this kernel call are:
* SCP_FROM_TO other endpoint
* SCP_INFO encoded: caller's own src/dst segment
* SCP_SEG segment in own address space
* SCP_GID grant id
* SCP_OFFSET offset within granted space
* SCP_ADDRESS address in own address space
@ -288,15 +288,13 @@ register message *m_ptr; /* pointer to request message */
{
static int access, src_seg, dst_seg;
/* Set src and dst parameters.
* The caller's seg is encoded in the SCP_INFO field.
*/
/* Set src and dst parameters. */
if(sys_call_code == SYS_SAFECOPYFROM) {
src_seg = D;
dst_seg = SCP_INFO2SEG(m_ptr->SCP_INFO);
dst_seg = m_ptr->SCP_SEG;
access = CPF_READ;
} else if(sys_call_code == SYS_SAFECOPYTO) {
src_seg = SCP_INFO2SEG(m_ptr->SCP_INFO);
src_seg = m_ptr->SCP_SEG;
dst_seg = D;
access = CPF_WRITE;
} else minix_panic("Impossible system call nr. ", sys_call_code);

View file

@ -1,79 +0,0 @@
/* The kernel call implemented in this file:
* m_type: SYS_VIRVCOPY, SYS_PHYSVCOPY
*
* The parameters for this kernel call are:
* m1_i3: VCP_VEC_SIZE size of copy request vector
* m1_p1: VCP_VEC_ADDR address of vector at caller
* m1_i2: VCP_NR_OK number of successfull copies
*/
#include "../system.h"
#include <minix/type.h>
#if (USE_VIRVCOPY || USE_PHYSVCOPY)
/* Buffer to hold copy request vector from user. */
PRIVATE struct vir_cp_req vir_cp_req[VCOPY_VEC_SIZE];
/*===========================================================================*
* do_vcopy *
*===========================================================================*/
PUBLIC int do_vcopy(m_ptr)
register message *m_ptr; /* pointer to request message */
{
/* Handle sys_virvcopy() and sys_physvcopy() that pass a vector with copy
* requests. Although a single handler function is used, there are two
* different kernel calls so that permissions can be checked.
*/
int nr_req, r;
vir_bytes caller_vir;
phys_bytes bytes;
int i,s;
struct vir_cp_req *req;
struct vir_addr src, dst;
struct proc *pr;
{ static int first=1;
if (first)
{
first= 0;
kprintf("do_vcopy: got request from %d\n", m_ptr->m_source);
}
}
if(!(pr = endpoint_lookup(who_e)))
minix_panic("do_vcopy: caller doesn't exist", who_e);
/* Check if request vector size is ok. */
nr_req = (unsigned) m_ptr->VCP_VEC_SIZE;
if (nr_req > VCOPY_VEC_SIZE) return(EINVAL);
bytes = nr_req * sizeof(struct vir_cp_req);
/* Calculate physical addresses and copy (port,value)-pairs from user. */
src.segment = dst.segment = D;
src.proc_nr_e = who_e;
dst.proc_nr_e = SYSTEM;
dst.offset = (vir_bytes) vir_cp_req;
src.offset = (vir_bytes) m_ptr->VCP_VEC_ADDR;
if((r=virtual_copy_vmcheck(&src, &dst, bytes)) != OK)
return r;
/* Assume vector with requests is correct. Try to copy everything. */
m_ptr->VCP_NR_OK = 0;
for (i=0; i<nr_req; i++) {
req = &vir_cp_req[i];
/* Check if physical addressing is used without SYS_PHYSVCOPY. */
if (((req->src.segment | req->dst.segment) & PHYS_SEG) &&
m_ptr->m_type != SYS_PHYSVCOPY) return(EPERM);
if ((s=virtual_copy_vmcheck(&req->src, &req->dst, req->count)) != OK)
return(s);
m_ptr->VCP_NR_OK ++;
}
return(OK);
}
#endif /* (USE_VIRVCOPY || USE_PHYSVCOPY) */

View file

@ -10,7 +10,6 @@ libc_FILES=" \
_brk.c \
_cprofile.c \
_deldma.c \
_devctl.c \
_getdents.c \
_getdma.c \
_getnpid.c \
@ -22,7 +21,7 @@ libc_FILES=" \
_getsigset.c \
_getsysinfo.c \
_lseek64.c \
_mapdriver5.c \
_mapdriver.c \
_mount.c \
_reboot.c \
_sbrk.c \

View file

@ -1,18 +0,0 @@
#include <lib.h>
#define devctl _devctl
#include <unistd.h>
PUBLIC int devctl(int ctl_req, int proc_nr, int dev_nr, int dev_style,
int force)
{
message m;
m.m4_l1 = ctl_req;
m.m4_l2 = proc_nr;
m.m4_l3 = dev_nr;
m.m4_l4 = dev_style;
m.m4_l5 = force;
if (_syscall(FS, DEVCTL, &m) < 0) return(-1);
return(0);
}

View file

@ -1,18 +1,18 @@
#include <lib.h>
#define mapdriver5 _mapdriver5
#define mapdriver _mapdriver
#include <string.h>
#include <unistd.h>
PUBLIC int mapdriver5(label, len, major, dev_style, force)
PUBLIC int mapdriver(label, major, dev_style, force)
char *label;
size_t len;
int major;
int dev_style;
int force;
{
message m;
m.m2_p1 = label;
m.m2_l1 = len;
m.m2_l1 = strlen(label);
m.m2_i1 = major;
m.m2_i2 = dev_style;
m.m2_i3 = force;

View file

@ -22,7 +22,6 @@ libc_FILES=" \
cprofile.s \
creat.s \
deldma.s \
devctl.s \
dup.s \
dup2.s \
execl.s \
@ -66,7 +65,7 @@ libc_FILES=" \
lseek.s \
lseek64.s \
lstat.s \
mapdriver5.s \
mapdriver.s \
mkdir.s \
mkfifo.s \
mknod.s \

View file

@ -1,7 +0,0 @@
.sect .text
.extern __devctl
.define _devctl
.align 2
_devctl:
jmp __devctl

7
lib/syscall/mapdriver.s Normal file
View file

@ -0,0 +1,7 @@
.sect .text
.extern __mapdriver
.define _mapdriver
.align 2
_mapdriver:
jmp __mapdriver

View file

@ -1,7 +0,0 @@
.sect .text
.extern __mapdriver5
.define _mapdriver5
.align 2
_mapdriver5:
jmp __mapdriver5

View file

@ -77,7 +77,6 @@ libsys_FILES=" \
sys_vtimer.c \
taskcall.c \
ds.c \
vm_allocmem.c \
vm_brk.c \
vm_ctl.c \
vm_exec_newmem.c \

View file

@ -15,7 +15,7 @@ PUBLIC int sys_safecopyfrom(endpoint_t src_e,
message copy_mess;
copy_mess.SCP_FROM_TO = src_e;
copy_mess.SCP_INFO = SCP_MAKEINFO(my_seg);
copy_mess.SCP_SEG = my_seg;
copy_mess.SCP_GID = gr_id;
copy_mess.SCP_OFFSET = (long) offset;
copy_mess.SCP_ADDRESS = (char *) address;
@ -37,7 +37,7 @@ PUBLIC int sys_safecopyto(endpoint_t dst_e,
message copy_mess;
copy_mess.SCP_FROM_TO = dst_e;
copy_mess.SCP_INFO = SCP_MAKEINFO(my_seg);
copy_mess.SCP_SEG = my_seg;
copy_mess.SCP_GID = gr_id;
copy_mess.SCP_OFFSET = (long) offset;
copy_mess.SCP_ADDRESS = (char *) address;

View file

@ -1,21 +0,0 @@
#include "syslib.h"
#include <minix/vm.h>
/*===========================================================================*
* vm_allocmem *
*===========================================================================*/
PUBLIC int vm_allocmem(phys_clicks bytes, phys_clicks *retmembase)
{
message m;
int result;
m.VMAM_BYTES = (char *) bytes;
result = _taskcall(VM_PROC_NR, VM_ALLOCMEM, &m);
if(result == OK)
*retmembase = m.VMAM_MEMBASE;
return result;
}

View file

@ -18,7 +18,6 @@ long ticks; /* number of ticks to wait */
if (ticks <= 0) return OK; /* check for robustness */
m.ALRM_ENDPT = SELF; /* SELF means this process nr */
m.ALRM_EXP_TIME = ticks; /* request message after ticks */
m.ALRM_ABS_TIME = 0; /* ticks are relative to now */
s = _taskcall(SYSTASK, SYS_SETALARM, &m);

View file

@ -4,8 +4,6 @@ mount \- mount a file system
.SH SYNOPSIS
\fBmount [\fB\-r\fR] [\fB\-t \fItype\fR] [\fB\-o \fIoptions\fR] \fIspecial \fIfile\fR
.br
\fBmount [\fB\-s\fR] \fIswapfile\fR
.br
.de FL
.TP
\\fB\\$1\\fR
@ -20,7 +18,6 @@ mount \- mount a file system
.FL "\-r" "File system is mounted read-only"
.FL "\-t" "File system type"
.FL "\-o" "Options passed to FS server"
.FL "\-s" "Mount swap space"
.SH EXAMPLES
.EX "mount /dev/fd1 /user" "Mount diskette 1 on \fI/user\fP"
.SH DESCRIPTION
@ -40,15 +37,10 @@ The
.B \-o
flag may be used to pass options to the file system server.
The interpretation of these options is up to the server.
.PP
With the
.B \-s
flag a device or file is mounted as swap space.
.SH "SEE ALSO"
.BR df (1),
.BR mkfs (1),
.BR fsck (1),
.BR mkswap (8),
.BR umount (1),
.BR mount (2),
.BR fstab (5).

View file

@ -14,38 +14,28 @@ int svrctl(u32_t \fIrequest\fP, void *\fIdata\fP);
.fi
.SH DESCRIPTION
.B Svrctl
allows root to control the kernel in various ways, or implements some very
MINIX 3 specific system calls that don't deserve their own system call number.
implements some very MINIX 3 specific system calls that don't deserve their own
system call number.
.PP
This system call makes it easy to add new ways of setting and getting kernel
This system call makes it easy to add new ways of setting and getting system
parameters, but at the same time, backwards compatibility is not guaranteed.
Read the <sys/svrctl.h> include file to see what the struct's mentioned below
Read the <sys/svrctl.h> include file to see what the structures mentioned below
look like. Most calls are root-only, unless specified otherwise.
.PP
The only way to know how to properly use these calls is to study the
associated kernel or server code, or the programs that already use these
associated server code, or the programs that already use these
calls.
.PP
Current requests are:
.TP 5
.B MMSIGNON
Inform MM that the current process wants to become a server.
.B MMGETPARAM
Request the value of one or all boot parameters. Can be used by non-root.
.TP
.B MMSWAPON
Instruct MM to mount a file or device as swapspace.
.TP
.B MMSWAPOFF
Tell MM to stop using swapspace.
.B MMSETPARAM
Set an override for a value of a boot parameter. Can be used by non-root.
.TP
.B FSSIGNON
Register a new device with FS.
.TP
.B SYSSIGNON
Inform the kernel that the process want to become a server.
The processes task number is filled-in in a \fBstruct systaskinfo\fP.
.TP
.B SYSGETENV
Request the value of one or all boot parameters. Can be used by non-root.
.SH "RETURN VALUES"
.B Svrctl
returns 0 upon success and -1 upon failure.

View file

@ -103,7 +103,7 @@ to
for disk 0 on controller 0. To make things interesting you can also place a
partition table in the first sector of a MINIX 3 partition, which divides the
partition into up to four subpartitions. Normally MINIX 3 is installed into a
single partition, with the root, swap and /usr file systems in subpartitions.
single partition, with the root, /home, and /usr file systems in subpartitions.
.PP
If a partition is an extended partition then it contains a linked list of
partition tables each of which may specify a logical partition. Up to four

View file

@ -17,9 +17,11 @@ and
.B /etc/fstab
is not read by
.B mount
as it should be. It is instead a simple shell script listing the two or
three devices that MINIX 3 needs to operate: The device names of the root
file system, the swap file system (optional), and the file system for
as it should be. It is instead a simple shell script listing the
three devices that MINIX 3 needs to operate: the device names of the root
file system, the file system for
.BR /home ,
and the file system for
.BR /usr .
.PP
.B /etc/mtab
@ -55,8 +57,8 @@ Either
.BR 1 ,
.BR 2 ,
or
.BR swap ,
indicating a V1 or a V2 file system, or swap space.
.BR 3 ,
indicating a V1, a V2, or a V3 file system.
.RE
.sp
.B options

View file

@ -10,8 +10,6 @@ service \- Start or stop an operating system server or device driver.
.PP
\fBservice refresh\fR \fI<pid>\fR
.PP
\fBservice rescue\fR \fI<dir>\fR
.PP
\fBservice shutdown\fR
.br
.de FL
@ -35,8 +33,6 @@ When an optional period is specified, the reincarnation server sends a status re
.PP
Stopping a system service requires the process id of a running system service. Issuing a kill command from the shell will not work, since the reincarnation server interprets this as an unexpected exit and will automatically restart a fresh copy of the process. The clean way to restart a process is using the refresh option of the service utility.
.PP
The rescue call can be used to set the current working directory of the reincarnation server. By using a trusted rescue driver to shadow certain binaries in RAM the reincarnation server can check that rescue directory for binaries if the normal execution of the absolute path fails. This allows recovery from failures of the root file system driver.
.PP
If the system is to be shutdown, the reincarnation server should know about this event to prevent it from restarting services that are killed during the shutdown
sequence.
.SH EXAMPLES

View file

@ -69,14 +69,15 @@ is an IBM PC/XT with 640 kb memory. MINIX-386 can more or less run in 2
MB memory. See sections 16 and 17 on "low memory" issues.
.SS "3. MINIX INSTALLATION BACKGROUND"
The objective of the installation is to create a partition on your disk
and to put MINIX into it. MINIX really requires at least two partitions
however, so the single "primary" partition is split into two or three
subpartitions.
and to put MINIX into it. MINIX really requires three partitions
however, so the single "primary" partition is split into three subpartitions.
The
.B s0
subpartition will contain the root file system, the
.B s1
subpartition may optionally contain swapspace, and the
subpartition will contain the
.B /home
file system, and the
.B s2
subpartition will contain the
.B /usr
@ -121,15 +122,15 @@ free space the disk will look like this:
/dev/c0d0p0 Windows C: drive
/dev/c0d0p1 MINIX primary partition
/dev/c0d0p1s0 MINIX root partition
/dev/c0d0p1s1 MINIX swap partition (optional)
/dev/c0d0p1s1 MINIX /home partition
/dev/c0d0p1s2 MINIX /usr partition
.in -8n
.fi
.PP
/dev/c0d0 is the sum of a partition table, /dev/c0d0p0 and /dev/c0d0p1.
Likewise is /dev/c0d0p1 the sum of a subpartition table, /dev/c0d0p1s0 and
/dev/c0d0p1s2. Read the "DEVICES" sections for more information on MINIX
devices.
Likewise is /dev/c0d0p1 the sum of a subpartition table, /dev/c0d0p1s0,
/dev/c0d0p1s1, and /dev/c0d0p1s2.
Read the "DEVICES" sections for more information on MINIX devices.
.SS "4. INSTALLATION"
.ig \" Only relevant when on CD-ROM.
If you have not already copied MINIX to floppy disks, please read
@ -217,17 +218,12 @@ The script then wants to know the name of the partition you've created. The
partition name is probably still visible on the screen. Combined with the
drive name you have to type c0d0p1, c0d2p0 or something.
.PP
The next question is the amount of swapspace you want to give MINIX. There
will be a suggested value based on the amount of memory your system has.
If you have more then enough memory then don't bother with swap. MINIX
doesn't handle it very well yet, or ever, only memory starved systems need it
so that
.B "make world"
can run.
The next question is the size of the /home partition that you want. There
will be a suggested value based on the amount of disk space available.
.PP
The new partition table is reloaded into the disk driver, and the
new MINIX partition is carved up into two or three subpartitions, a 1440 kb
root, maybe some amount of swap, and the rest for /usr.
new MINIX partition is carved up into two or three subpartitions, a
root, the chosen amount for /home, and the rest for /usr.
.PP
After making /usr, it is immediately put to use to replace the installation
/usr file system so that you can remove the \s-2USR\s+2 diskette and insert
@ -251,14 +247,14 @@ Run
.B part
to make partitions to load the system into. The best thing to do is to make
one large primary partition of type "MINIX" and to carve this partition up
into three subpartitions for root, swap and /usr. The assumption is that you
into three subpartitions for root, /home, and /usr. The assumption is that you
will use the second partition on the first hard disk,
.BR /dev/c0d0p1 ,
and that
.B c0d0p1s0
is the root subpartition,
.B c0d0p1s1
is swap and
is /home, and
.B c0d0p1s2
is /usr. If you want to use the first partition on
the second hard disk for instance, then substitute c0d1p0 and c0d1p0s[012] for
@ -283,11 +279,8 @@ make it larger if you want to, but it is advisable never to let the contents
outgrow a floppy. (The \s-2ROOT\s+2 diskette is a copy of a root file
system, and will be used to fill your root subpartition.)
.PP
The second subpartition is for swapspace. You can use it to enlarge the
amount of total memory (real + swap) if your system has less than 2M
(16-bit mode) or 4M (32-bit mode). Note that only one MINIX swap partition
is needed on your system, so if you have another MINIX partition then you can
use its swap partition instead.
The second subpartition is for the /home subpartition. You may choose to store
your personal files there.
.PP
Use the rest of the partition for
.BR s2 ,
@ -296,12 +289,6 @@ the /usr subpartition.
When you are done check that /dev/c0d0p1s0 is active (the * after the partition
number) so you can boot from it later.
.PP
If your disk has bad blocks then don't put the root or swap subpartition
on top of them. Make sure the inode tables in the other partitions don't
have bad blocks either. You can put the subpartitions out of order on the
disk if that helps. Subpartition tables, unlike the main partition
table, are not sorted by the driver.
.PP
After making the partitions you do not have to reboot. The disk driver
reloads the partition tables on the next access if the disk is not in use.
(Open or mounted.)
@ -316,11 +303,9 @@ if it told you that it was creating a new partition table, but
.PP
will put it there for sure.
.PP
Let's start by initializing the swap partition first, if you allocated one.
We may need it already, so mount it.
Next make a file system for on-disk /home. Leave it empty for now.
.PP
.XB "mkswap\0/dev/c0d0p1s1"
.XB "mount\0\-s\0/dev/c0d0p1s1"
.XB "mkfs\0/dev/c0d0p1s1"
.PP
Next make a file system for on-disk /usr and copy the floppy /usr on to it.
.PP
@ -361,7 +346,7 @@ to name the devices MINIX has been installed on. In our example it
should look like this:
.PP
.XB "root=/dev/c0d0p1s0"
.XB "swap=/dev/c0d0p1s1"
.XB "home=/dev/c0d0p1s1"
.XB "usr=/dev/c0d0p1s2"
.PP
Unmount the new root:

View file

@ -19,9 +19,6 @@ PRIVATE time_t curr_time;
PRIVATE time_t prev_time;
PRIVATE timer_t *timer_chain;
PRIVATE time_t next_timeout;
#ifdef __minix_vmd
PRIVATE int clck_tasknr= ANY;
#endif
FORWARD _PROTOTYPE( void clck_fast_release, (timer_t *timer) );
FORWARD _PROTOTYPE( void set_timer, (void) );
@ -35,32 +32,15 @@ PUBLIC void clck_init()
prev_time= 0;
next_timeout= 0;
timer_chain= 0;
#ifdef __minix_vmd
r= sys_findproc(CLOCK_NAME, &clck_tasknr, 0);
if (r != OK)
ip_panic(( "unable to find clock task: %d\n", r ));
#endif
}
PUBLIC time_t get_time()
{
if (!curr_time)
{
#ifdef __minix_vmd
static message mess;
mess.m_type= GET_UPTIME;
if (sendrec (clck_tasknr, &mess) < 0)
ip_panic(("unable to sendrec"));
if (mess.m_type != OK)
ip_panic(("can't read clock"));
curr_time= mess.NEW_TIME;
#else /* Minix 3 */
int s;
if ((s=getuptime(&curr_time)) != OK)
ip_panic(("can't read clock"));
#endif
assert(curr_time >= prev_time);
}
return curr_time;
@ -173,27 +153,11 @@ PRIVATE void set_timer()
if (next_timeout == 0 || new_time < next_timeout)
{
#ifdef __minix_vmd
static message mess;
next_timeout= new_time;
new_time -= curr_time;
mess.m_type= SET_SYNC_AL;
mess.CLOCK_PROC_NR= this_proc;
mess.DELTA_TICKS= new_time;
if (sendrec (clck_tasknr, &mess) < 0)
ip_panic(("unable to sendrec"));
if (mess.m_type != OK)
ip_panic(("can't set timer"));
#else /* Minix 3 */
next_timeout= new_time;
new_time -= curr_time;
if (sys_setalarm(new_time, 0) != OK)
ip_panic(("can't set timer"));
#endif
}
}

View file

@ -77,10 +77,6 @@ THIS_FILE
int this_proc; /* Process number of this server. */
#ifdef __minix_vmd
static int synal_tasknr= ANY;
#endif
/* Killing Solaris */
int killer_inet= 0;
@ -107,9 +103,6 @@ PUBLIC void main()
int source, m_type, timerand, fd;
u32_t tasknr;
struct fssignon device;
#ifdef __minix_vmd
struct systaskinfo info;
#endif
u8_t randbits[32];
struct timeval tv;
@ -152,11 +145,7 @@ PUBLIC void main()
if (timerand)
{
printf("inet: using current time for random-number seed\n");
#ifdef __minix_vmd
r= sysutime(UTIME_TIMEOFDAY, &tv);
#else /* Minix 3 */
r= gettimeofday(&tv, NULL);
#endif
if (r == -1)
{
printf("sysutime failed: %s\n", strerror(errno));
@ -166,19 +155,11 @@ PUBLIC void main()
}
init_rand256(randbits);
#ifdef __minix_vmd
if (svrctl(SYSSIGNON, (void *) &info) == -1) pause();
/* Our new identity as a server. */
this_proc = info.proc_nr;
#else /* Minix 3 */
/* Our new identity as a server. */
r= ds_retrieve_u32("inet", &tasknr);
if (r != OK)
ip_panic(("inet: ds_retrieve_u32 failed for 'inet': %d", r));
this_proc= tasknr;
#endif
/* Register the device group. */
device.dev= ip_dev;
@ -205,12 +186,6 @@ PUBLIC void main()
killer_inet= 1;
}
#ifdef __minix_vmd
r= sys_findproc(SYN_AL_NAME, &synal_tasknr, 0);
if (r != OK)
ip_panic(( "unable to find synchronous alarm task: %d\n", r ));
#endif
nw_init();
while (TRUE)
{
@ -253,13 +228,6 @@ PUBLIC void main()
{
sr_rec(mq);
}
#ifdef __minix_vmd
else if (source == synal_tasknr)
{
clck_tick (&mq->mq_mess);
mq_free(mq);
}
#else /* Minix 3 */
else if (is_notify(m_type))
{
if (_ENDPOINT_P(source) == CLOCK)
@ -280,7 +248,6 @@ PUBLIC void main()
mq_free(mq);
}
}
#endif
else if (m_type == DL_CONF_REPLY || m_type == DL_TASK_REPLY ||
m_type == DL_NAME_REPLY || m_type == DL_STAT_REPLY)
{
@ -345,11 +312,7 @@ PUBLIC void inet_panic()
{
printf("\ninet stacktrace: ");
util_stacktrace();
#ifdef __minix_vmd
sys_abort(RBT_PANIC);
#else /* Minix 3 */
(panic)("INET","aborted due to a panic",NO_NUM);
#endif
for(;;);
}

View file

@ -17,14 +17,6 @@ Copyright 1995 Philip Homburg
#include <stdlib.h>
#include <string.h>
#ifdef __minix_vmd
#include <minix/ansi.h>
#include <minix/cfg_public.h>
#include <minix/type.h>
#else /* Assume at least Minix 3.x */
#include <unistd.h>
#include <sys/ioc_file.h>
#include <sys/time.h>
@ -35,8 +27,6 @@ Copyright 1995 Philip Homburg
typedef int ioreq_t;
#endif
#include <minix/const.h>
#include <minix/com.h>
#include <minix/syslib.h>

View file

@ -99,16 +99,12 @@ PUBLIC void osdep_eth_init()
}
eth_port->etp_osdep.etp_rd_vec_grant= gid;
#ifdef __minix_vmd
r= sys_findproc(ecp->ec_task, &tasknr, 0);
#else /* Minix 3 */
r= ds_retrieve_u32(ecp->ec_task, &tasknr);
if (r != OK && r != ESRCH)
{
printf("inet: ds_retrieve_u32 failed for '%s': %d\n",
ecp->ec_task, r);
}
#endif
if (r != OK)
{
/* Eventually, we expect ethernet drivers to be

View file

@ -10,11 +10,7 @@ Created: June 1995 by Philip Homburg <philip@f-mnx.phicoh.com>
#include "generic/assert.h"
#include <sys/svrctl.h>
#ifdef __minix_vmd
#include <minix/queryparam.h>
#else /* Minix 3 */
#include <minix3/queryparam.h>
#endif
#include "generic/buf.h"
#include "generic/clock.h"

View file

@ -7,43 +7,53 @@
*
* Requests:
*
* m_type NDEV_MINOR NDEV_PROC NDEV_REF NDEV_MODE
* -------------------------------------------------------------
* | DEV_OPEN |minor dev | proc nr | fd | mode |
* |-------------+-----------+-----------+-----------+----------+
* | DEV_CLOSE |minor dev | proc nr | fd | |
* |-------------+-----------+-----------+-----------+----------+
* m_type DEVICE IO_ENDPT COUNT
* --------------------------------------------------
* | DEV_OPEN | minor dev | proc nr | mode |
* |-------------+-----------+-----------+----------+
* | DEV_CLOSE | minor dev | proc nr | |
* |-------------+-----------+-----------+----------+
*
* m_type NDEV_MINOR NDEV_PROC NDEV_REF NDEV_COUNT NDEV_BUFFER
* ---------------------------------------------------------------------------
* | DEV_READ |minor dev | proc nr | fd | count | buf ptr |
* |-------------+-----------+-----------+-----------+-----------+-----------|
* | DEV_WRITE |minor dev | proc nr | fd | count | buf ptr |
* |-------------+-----------+-----------+-----------+-----------+-----------|
* m_type DEVICE IO_ENDPT COUNT IO_GRANT
* ---------------------------------------------------------------
* | DEV_READ_S | minor dev | proc nr | count | grant ID |
* |-------------+-----------+-----------+-----------+-----------|
* | DEV_WRITE_S | minor dev | proc nr | count | grant ID |
* |-------------+-----------+-----------+-----------+-----------|
* | DEV_IOCTL_S | minor dev | proc nr | command | grant ID |
* |-------------+-----------+-----------+-----------+-----------|
* | DEV_SELECT | minor dev | ops | | |
* |-------------+-----------+-----------+-----------+-----------|
*
* m_type NDEV_MINOR NDEV_PROC NDEV_REF NDEV_IOCTL NDEV_BUFFER
* ---------------------------------------------------------------------------
* | DEV_IOCTL3 |minor dev | proc nr | fd | command | buf ptr |
* |-------------+-----------+-----------+-----------+-----------+-----------|
* m_type
* --------------|
* | DEV_STATUS |
* |-------------|
*
* m_type NDEV_MINOR NDEV_PROC NDEV_REF NDEV_OPERATION
* -------------------------------------------------------------------|
* | DEV_CANCEL |minor dev | proc nr | fd | which operation|
* |-------------+-----------+-----------+-----------+----------------|
* m_type DEVICE IO_ENDPT COUNT
* --------------------------------------------------|
* | CANCEL | minor dev | proc nr | mode |
* |-------------+-----------+-----------+-----------|
*
* Replies:
*
* m_type REP_PROC_NR REP_STATUS REP_REF REP_OPERATION
* ----------------------------------------------------------------------|
* | DEVICE_REPLY | proc nr | status | fd | which operation |
* |--------------+-------------+------------+---------+-----------------|
* m_type REP_ENDPT REP_STATUS REP_IO_GRANT
* -------------------------------------------------------|
* | TASK_REPLY | proc nr | status | grant ID |
* |---------------+-----------+-----------+--------------|
*
* m_type REP_ENDPT REP_STATUS REP_IO_GRANT
* ----------------+-----------+--------------------------|
* | DEV_REVIVE | proc nr | | grant ID |
* |---------------+-----------+-----------+--------------|
* | DEV_IO_READY | minor dev | sel ops | |
* |---------------+-----------+-----------+--------------|
* | DEV_NO_STATUS | | | |
* |---------------+-----------+-----------+--------------|
*/
#include "inet.h"
#ifndef __minix_vmd /* Minix 3 */
#include <sys/select.h>
#endif
#include <sys/svrctl.h>
#include <minix/callnr.h>
@ -58,64 +68,38 @@
#include "generic/sr.h"
#include "sr_int.h"
#ifndef __minix_vmd /* Minix 3 */
#define DEV_CANCEL NW_CANCEL
#define DEVICE_REPLY TASK_REPLY
#define DEV_IOCTL3 DEV_IOCTL
#define NDEV_BUFFER ADDRESS
#define NDEV_COUNT COUNT
#define NDEV_IOCTL REQUEST
#define NDEV_MINOR DEVICE
#define NDEV_PROC IO_ENDPT
#endif
THIS_FILE
PUBLIC sr_fd_t sr_fd_table[FD_NR];
PRIVATE mq_t *repl_queue, *repl_queue_tail;
#ifdef __minix_vmd
PRIVATE cpvec_t cpvec[CPVEC_NR];
#else /* Minix 3 */
PRIVATE struct vir_cp_req vir_cp_req[CPVEC_NR];
PRIVATE struct vscp_vec s_cp_req[CPVEC_NR];
#endif
PRIVATE struct vscp_vec s_cp_req[SCPVEC_NR];
FORWARD _PROTOTYPE ( int sr_open, (message *m) );
FORWARD _PROTOTYPE ( void sr_close, (message *m) );
FORWARD _PROTOTYPE ( int sr_rwio, (mq_t *m) );
FORWARD _PROTOTYPE ( int sr_rwio_s, (mq_t *m) );
FORWARD _PROTOTYPE ( int sr_restart_read, (sr_fd_t *fdp) );
FORWARD _PROTOTYPE ( int sr_restart_write, (sr_fd_t *fdp) );
FORWARD _PROTOTYPE ( int sr_restart_ioctl, (sr_fd_t *fdp) );
FORWARD _PROTOTYPE ( int sr_cancel, (message *m) );
#ifndef __minix_vmd /* Minix 3 */
FORWARD _PROTOTYPE ( int sr_select, (message *m) );
FORWARD _PROTOTYPE ( void sr_status, (message *m) );
#endif
FORWARD _PROTOTYPE ( void sr_reply_, (mq_t *m, int reply, int is_revive) );
FORWARD _PROTOTYPE ( sr_fd_t *sr_getchannel, (int minor));
FORWARD _PROTOTYPE ( acc_t *sr_get_userdata, (int fd, size_t offset,
size_t count, int for_ioctl) );
FORWARD _PROTOTYPE ( int sr_put_userdata, (int fd, size_t offset,
acc_t *data, int for_ioctl) );
#ifdef __minix_vmd
#define sr_select_res 0
#else /* Minix 3 */
FORWARD _PROTOTYPE (void sr_select_res, (int fd, unsigned ops) );
#endif
FORWARD _PROTOTYPE ( int sr_repl_queue, (int proc, int ref, int operation) );
FORWARD _PROTOTYPE ( int walk_queue, (sr_fd_t *sr_fd, mq_t **q_head_ptr,
mq_t **q_tail_ptr, int type, int proc_nr, int ref, int first_flag) );
FORWARD _PROTOTYPE ( void process_req_q, (mq_t *mq, mq_t *tail,
mq_t **tail_ptr) );
FORWARD _PROTOTYPE ( void sr_event, (event_t *evp, ev_arg_t arg) );
FORWARD _PROTOTYPE ( int cp_u2b, (int proc, char *src, acc_t **var_acc_ptr,
int size) );
FORWARD _PROTOTYPE ( int cp_b2u, (acc_t *acc_ptr, int proc, char *dest) );
FORWARD _PROTOTYPE ( int cp_u2b_s, (int proc, int gid, vir_bytes offset,
FORWARD _PROTOTYPE ( int cp_u2b, (int proc, int gid, vir_bytes offset,
acc_t **var_acc_ptr, int size) );
FORWARD _PROTOTYPE ( int cp_b2u_s, (acc_t *acc_ptr, int proc, int gid,
FORWARD _PROTOTYPE ( int cp_b2u, (acc_t *acc_ptr, int proc, int gid,
vir_bytes offset) );
PUBLIC void sr_init()
@ -140,16 +124,11 @@ mq_t *m;
if (repl_queue)
{
if (m->mq_mess.m_type == DEV_CANCEL)
if (m->mq_mess.m_type == CANCEL)
{
#ifdef __minix_vmd
result= sr_repl_queue(m->mq_mess.NDEV_PROC,
m->mq_mess.NDEV_REF,
m->mq_mess.NDEV_OPERATION);
#else /* Minix 3 */
result= sr_repl_queue(m->mq_mess.IO_ENDPT,
(int)m->mq_mess.IO_GRANT, 0);
#endif
if (result)
{
mq_free(m);
@ -175,36 +154,21 @@ mq_t *m;
send_reply= 1;
free_mess= 1;
break;
#ifdef DEV_READ
case DEV_READ:
case DEV_WRITE:
case DEV_IOCTL3:
case DEV_READ_S:
case DEV_WRITE_S:
case DEV_IOCTL_S:
result= sr_rwio(m);
assert(result == OK || result == SUSPEND);
send_reply= (result == SUSPEND);
free_mess= 0;
break;
#endif
case DEV_READ_S:
case DEV_WRITE_S:
case DEV_IOCTL_S:
result= sr_rwio_s(m);
assert(result == OK || result == SUSPEND);
send_reply= (result == SUSPEND);
free_mess= 0;
break;
case DEV_CANCEL:
case CANCEL:
result= sr_cancel(&m->mq_mess);
assert(result == OK || result == EINTR);
send_reply= (result == EINTR);
free_mess= 1;
#ifdef __minix_vmd
m->mq_mess.m_type= m->mq_mess.NDEV_OPERATION;
#else /* Minix 3 */
m->mq_mess.m_type= 0;
#endif
break;
#ifndef __minix_vmd /* Minix 3 */
case DEV_SELECT:
result= sr_select(&m->mq_mess);
send_reply= 1;
@ -215,7 +179,6 @@ mq_t *m;
send_reply= 0;
free_mess= 1;
break;
#endif
default:
ip_panic(("unknown message, from %d, type %d",
m->mq_mess.m_source, m->mq_mess.m_type));
@ -264,7 +227,7 @@ message *m;
{
sr_fd_t *sr_fd;
int minor= m->NDEV_MINOR;
int minor= m->DEVICE;
int i, fd;
if (minor<0 || minor>FD_NR)
@ -305,7 +268,7 @@ message *m;
{
sr_fd_t *sr_fd;
sr_fd= sr_getchannel(m->NDEV_MINOR);
sr_fd= sr_getchannel(m->DEVICE);
assert (sr_fd);
if (sr_fd->srf_flags & SFF_BUSY)
@ -326,108 +289,7 @@ mq_t *m;
ioreq_t request;
size_t size;
sr_fd= sr_getchannel(m->mq_mess.NDEV_MINOR);
assert (sr_fd);
switch(m->mq_mess.m_type)
{
#ifdef DEV_READ
case DEV_READ:
q_head_ptr= &sr_fd->srf_read_q;
q_tail_ptr= &sr_fd->srf_read_q_tail;
ip_flag= SFF_READ_IP;
susp_flag= SFF_READ_SUSP;
first_flag= SFF_READ_FIRST;
break;
case DEV_WRITE:
q_head_ptr= &sr_fd->srf_write_q;
q_tail_ptr= &sr_fd->srf_write_q_tail;
ip_flag= SFF_WRITE_IP;
susp_flag= SFF_WRITE_SUSP;
first_flag= SFF_WRITE_FIRST;
break;
case DEV_IOCTL3:
q_head_ptr= &sr_fd->srf_ioctl_q;
q_tail_ptr= &sr_fd->srf_ioctl_q_tail;
ip_flag= SFF_IOCTL_IP;
susp_flag= SFF_IOCTL_SUSP;
first_flag= SFF_IOCTL_FIRST;
break;
#endif
default:
ip_panic(("illegal case entry"));
}
if (sr_fd->srf_flags & ip_flag)
{
assert(sr_fd->srf_flags & susp_flag);
assert(*q_head_ptr);
(*q_tail_ptr)->mq_next= m;
*q_tail_ptr= m;
return SUSPEND;
}
assert(!*q_head_ptr);
*q_tail_ptr= *q_head_ptr= m;
sr_fd->srf_flags |= ip_flag;
assert(!(sr_fd->srf_flags & first_flag));
sr_fd->srf_flags |= first_flag;
switch(m->mq_mess.m_type)
{
#ifdef DEV_READ
case DEV_READ:
r= (*sr_fd->srf_read)(sr_fd->srf_fd,
m->mq_mess.NDEV_COUNT);
break;
case DEV_WRITE:
r= (*sr_fd->srf_write)(sr_fd->srf_fd,
m->mq_mess.NDEV_COUNT);
break;
case DEV_IOCTL3:
request= m->mq_mess.NDEV_IOCTL;
size= (request >> 16) & _IOCPARM_MASK;
if (size>MAX_IOCTL_S)
{
DBLOCK(1, printf("replying EINVAL\n"));
r= sr_put_userdata(sr_fd-sr_fd_table, EINVAL,
NULL, 1);
assert(r == OK);
assert(sr_fd->srf_flags & first_flag);
sr_fd->srf_flags &= ~first_flag;
return OK;
}
r= (*sr_fd->srf_ioctl)(sr_fd->srf_fd, request);
break;
#endif
default:
ip_panic(("illegal case entry"));
}
assert(sr_fd->srf_flags & first_flag);
sr_fd->srf_flags &= ~first_flag;
assert(r == OK || r == SUSPEND ||
(printf("r= %d\n", r), 0));
if (r == SUSPEND)
sr_fd->srf_flags |= susp_flag;
else
mq_free(m);
return r;
}
PRIVATE int sr_rwio_s(m)
mq_t *m;
{
sr_fd_t *sr_fd;
mq_t **q_head_ptr, **q_tail_ptr;
int ip_flag, susp_flag, first_flag;
int r;
ioreq_t request;
size_t size;
sr_fd= sr_getchannel(m->mq_mess.NDEV_MINOR);
sr_fd= sr_getchannel(m->mq_mess.DEVICE);
assert (sr_fd);
switch(m->mq_mess.m_type)
@ -477,14 +339,14 @@ mq_t *m;
{
case DEV_READ_S:
r= (*sr_fd->srf_read)(sr_fd->srf_fd,
m->mq_mess.NDEV_COUNT);
m->mq_mess.COUNT);
break;
case DEV_WRITE_S:
r= (*sr_fd->srf_write)(sr_fd->srf_fd,
m->mq_mess.NDEV_COUNT);
m->mq_mess.COUNT);
break;
case DEV_IOCTL_S:
request= m->mq_mess.NDEV_IOCTL;
request= m->mq_mess.REQUEST;
size= (request >> 16) & _IOCPARM_MASK;
if (size>MAX_IOCTL_S)
{
@ -531,7 +393,7 @@ sr_fd_t *sr_fd;
sr_fd->srf_flags |= SFF_READ_IP;
r= (*sr_fd->srf_read)(sr_fd->srf_fd,
mp->mq_mess.NDEV_COUNT);
mp->mq_mess.COUNT);
assert(r == OK || r == SUSPEND ||
(printf("r= %d\n", r), 0));
@ -557,7 +419,7 @@ sr_fd_t *sr_fd;
sr_fd->srf_flags |= SFF_WRITE_IP;
r= (*sr_fd->srf_write)(sr_fd->srf_fd,
mp->mq_mess.NDEV_COUNT);
mp->mq_mess.COUNT);
assert(r == OK || r == SUSPEND ||
(printf("r= %d\n", r), 0));
@ -583,7 +445,7 @@ sr_fd_t *sr_fd;
sr_fd->srf_flags |= SFF_IOCTL_IP;
r= (*sr_fd->srf_ioctl)(sr_fd->srf_fd,
mp->mq_mess.NDEV_COUNT);
mp->mq_mess.COUNT);
assert(r == OK || r == SUSPEND ||
(printf("r= %d\n", r), 0));
@ -600,61 +462,36 @@ message *m;
int proc_nr, ref, operation;
result=EINTR;
proc_nr= m->NDEV_PROC;
#ifdef __minix_vmd
ref= m->NDEV_REF;
operation= m->NDEV_OPERATION;
#else /* Minix 3 */
proc_nr= m->IO_ENDPT;
ref= (int)m->IO_GRANT;
operation= 0;
#endif
sr_fd= sr_getchannel(m->NDEV_MINOR);
sr_fd= sr_getchannel(m->DEVICE);
assert (sr_fd);
#ifdef __minix_vmd
if (operation == CANCEL_ANY || operation == DEV_IOCTL3)
#endif
{
result= walk_queue(sr_fd, &sr_fd->srf_ioctl_q,
&sr_fd->srf_ioctl_q_tail, SR_CANCEL_IOCTL,
proc_nr, ref, SFF_IOCTL_FIRST);
if (result != EAGAIN)
return result;
}
#ifdef __minix_vmd
if (operation == CANCEL_ANY || operation == DEV_READ)
#endif
{
result= walk_queue(sr_fd, &sr_fd->srf_read_q,
&sr_fd->srf_read_q_tail, SR_CANCEL_READ,
proc_nr, ref, SFF_READ_FIRST);
if (result != EAGAIN)
return result;
}
#ifdef __minix_vmd
if (operation == CANCEL_ANY || operation == DEV_WRITE)
#endif
{
result= walk_queue(sr_fd, &sr_fd->srf_write_q,
&sr_fd->srf_write_q_tail, SR_CANCEL_WRITE,
proc_nr, ref, SFF_WRITE_FIRST);
if (result != EAGAIN)
return result;
}
#ifdef __minix_vmd
ip_panic((
"request not found: from %d, type %d, MINOR= %d, PROC= %d, REF= %d OPERATION= %ld",
m->m_source, m->m_type, m->NDEV_MINOR,
m->NDEV_PROC, m->NDEV_REF, m->NDEV_OPERATION));
#else /* Minix 3 */
result= walk_queue(sr_fd, &sr_fd->srf_ioctl_q,
&sr_fd->srf_ioctl_q_tail, SR_CANCEL_IOCTL,
proc_nr, ref, SFF_IOCTL_FIRST);
if (result != EAGAIN)
return result;
result= walk_queue(sr_fd, &sr_fd->srf_read_q,
&sr_fd->srf_read_q_tail, SR_CANCEL_READ,
proc_nr, ref, SFF_READ_FIRST);
if (result != EAGAIN)
return result;
result= walk_queue(sr_fd, &sr_fd->srf_write_q,
&sr_fd->srf_write_q_tail, SR_CANCEL_WRITE,
proc_nr, ref, SFF_WRITE_FIRST);
if (result != EAGAIN)
return result;
ip_panic((
"request not found: from %d, type %d, MINOR= %d, PROC= %d, REF= %d",
m->m_source, m->m_type, m->NDEV_MINOR,
m->NDEV_PROC, m->IO_GRANT));
#endif
m->m_source, m->m_type, m->DEVICE,
m->IO_ENDPT, m->IO_GRANT));
}
#ifndef __minix_vmd /* Minix 3 */
PRIVATE int sr_select(m)
message *m;
{
@ -666,7 +503,7 @@ message *m;
ioreq_t request;
size_t size;
sr_fd= sr_getchannel(m->NDEV_MINOR);
sr_fd= sr_getchannel(m->DEVICE);
assert (sr_fd);
sr_fd->srf_select_proc= m->m_source;
@ -747,7 +584,6 @@ message *m;
if (result != OK)
ip_panic(("unable to send"));
}
#endif
PRIVATE int walk_queue(sr_fd, q_head_ptr, q_tail_ptr, type, proc_nr, ref,
first_flag)
@ -765,15 +601,10 @@ int first_flag;
for(q_ptr_prv= NULL, q_ptr= *q_head_ptr; q_ptr;
q_ptr_prv= q_ptr, q_ptr= q_ptr->mq_next)
{
if (q_ptr->mq_mess.NDEV_PROC != proc_nr)
if (q_ptr->mq_mess.IO_ENDPT != proc_nr)
continue;
#ifdef __minix_vmd
if (q_ptr->mq_mess.NDEV_REF != ref)
continue;
#else
if ((int)q_ptr->mq_mess.IO_GRANT != ref)
continue;
#endif
if (!q_ptr_prv)
{
assert(!(sr_fd->srf_flags & first_flag));
@ -823,31 +654,19 @@ int is_revive;
int result, proc, ref,operation;
message reply, *mp;
proc= mq->mq_mess.NDEV_PROC;
#ifdef __minix_vmd
ref= mq->mq_mess.NDEV_REF;
#else /* Minix 3 */
proc= mq->mq_mess.IO_ENDPT;
ref= (int)mq->mq_mess.IO_GRANT;
#endif
operation= mq->mq_mess.m_type;
#ifdef __minix_vmd
assert(operation != DEV_CANCEL);
#endif
if (is_revive)
mp= &mq->mq_mess;
else
mp= &reply;
mp->m_type= DEVICE_REPLY;
mp->m_type= TASK_REPLY;
mp->REP_ENDPT= proc;
mp->REP_STATUS= status;
#ifdef __minix_vmd
mp->REP_REF= ref;
mp->REP_OPERATION= operation;
#else
mp->REP_IO_GRANT= ref;
#endif
if (is_revive)
{
notify(mq->mq_mess.m_source);
@ -882,9 +701,8 @@ int for_ioctl;
{
sr_fd_t *loc_fd;
mq_t **head_ptr, *m, *mq;
int ip_flag, susp_flag, first_flag, m_type, safe_copy;
int ip_flag, susp_flag, first_flag;
int result, suspended, is_revive;
char *src;
acc_t *acc;
event_t *evp;
ev_arg_t arg;
@ -908,7 +726,7 @@ int for_ioctl;
first_flag= SFF_WRITE_FIRST;
}
assert (loc_fd->srf_flags & ip_flag);
assert (loc_fd->srf_flags & ip_flag);
if (!count)
{
@ -931,35 +749,8 @@ assert (loc_fd->srf_flags & ip_flag);
return NULL;
}
m_type= (*head_ptr)->mq_mess.m_type;
if (m_type == DEV_READ_S || m_type == DEV_WRITE_S ||
m_type == DEV_IOCTL_S)
{
safe_copy= 1;
}
else
{
#ifdef DEV_READ
assert(m_type == DEV_READ || m_type == DEV_WRITE ||
m_type == DEV_IOCTL);
#else
ip_panic(("sr_get_userdata: m_type not *_S\n"));
#endif
safe_copy= 0;
}
if (safe_copy)
{
result= cp_u2b_s ((*head_ptr)->mq_mess.NDEV_PROC,
(int)(*head_ptr)->mq_mess.NDEV_BUFFER, offset, &acc,
count);
}
else
{
src= (*head_ptr)->mq_mess.NDEV_BUFFER + offset;
result= cp_u2b ((*head_ptr)->mq_mess.NDEV_PROC, src, &acc,
count);
}
result= cp_u2b ((*head_ptr)->mq_mess.IO_ENDPT,
(int)(*head_ptr)->mq_mess.IO_GRANT, offset, &acc, count);
return result<0 ? NULL : acc;
}
@ -972,9 +763,8 @@ int for_ioctl;
{
sr_fd_t *loc_fd;
mq_t **head_ptr, *m, *mq;
int ip_flag, susp_flag, first_flag, m_type, safe_copy;
int ip_flag, susp_flag, first_flag;
int result, suspended, is_revive;
char *dst;
event_t *evp;
ev_arg_t arg;
@ -1020,36 +810,10 @@ int for_ioctl;
return OK;
}
m_type= (*head_ptr)->mq_mess.m_type;
if (m_type == DEV_READ_S || m_type == DEV_WRITE_S ||
m_type == DEV_IOCTL_S)
{
safe_copy= 1;
}
else
{
#ifdef DEV_READ
assert(m_type == DEV_READ || m_type == DEV_WRITE ||
m_type == DEV_IOCTL);
#else
ip_panic(("sr_put_userdata: m_type not *_S\n"));
#endif
safe_copy= 0;
}
if (safe_copy)
{
return cp_b2u_s (data, (*head_ptr)->mq_mess.NDEV_PROC,
(int)(*head_ptr)->mq_mess.NDEV_BUFFER, offset);
}
else
{
dst= (*head_ptr)->mq_mess.NDEV_BUFFER + offset;
return cp_b2u (data, (*head_ptr)->mq_mess.NDEV_PROC, dst);
}
return cp_b2u (data, (*head_ptr)->mq_mess.IO_ENDPT,
(int)(*head_ptr)->mq_mess.IO_GRANT, offset);
}
#ifndef __minix_vmd /* Minix 3 */
PRIVATE void sr_select_res(fd, ops)
int fd;
unsigned ops;
@ -1064,7 +828,6 @@ unsigned ops;
notify(sr_fd->srf_select_proc);
}
#endif
PRIVATE void process_req_q(mq, tail, tail_ptr)
mq_t *mq, *tail, **tail_ptr;
@ -1129,138 +892,10 @@ ev_arg_t arg;
}
return;
}
ip_panic(("sr_event: unkown event\n"));
ip_panic(("sr_event: unknown event\n"));
}
PRIVATE int cp_u2b (proc, src, var_acc_ptr, size)
int proc;
char *src;
acc_t **var_acc_ptr;
int size;
{
static message mess;
acc_t *acc;
int i;
acc= bf_memreq(size);
*var_acc_ptr= acc;
i=0;
while (acc)
{
size= (vir_bytes)acc->acc_length;
#ifdef __minix_vmd
cpvec[i].cpv_src= (vir_bytes)src;
cpvec[i].cpv_dst= (vir_bytes)ptr2acc_data(acc);
cpvec[i].cpv_size= size;
#else /* Minix 3 */
vir_cp_req[i].count= size;
vir_cp_req[i].src.proc_nr_e = proc;
vir_cp_req[i].src.segment = D;
vir_cp_req[i].src.offset = (vir_bytes) src;
vir_cp_req[i].dst.proc_nr_e = this_proc;
vir_cp_req[i].dst.segment = D;
vir_cp_req[i].dst.offset = (vir_bytes) ptr2acc_data(acc);
#endif
src += size;
acc= acc->acc_next;
i++;
if (i == CPVEC_NR || acc == NULL)
{
#ifdef __minix_vmd
mess.m_type= SYS_VCOPY;
mess.m1_i1= proc;
mess.m1_i2= this_proc;
mess.m1_i3= i;
mess.m1_p1= (char *)cpvec;
#else /* Minix 3 */
mess.m_type= SYS_VIRVCOPY;
mess.VCP_VEC_SIZE= i;
mess.VCP_VEC_ADDR= (char *)vir_cp_req;
#endif
if (sendrec(SYSTASK, &mess) <0)
ip_panic(("unable to sendrec"));
if (mess.m_type <0)
{
bf_afree(*var_acc_ptr);
*var_acc_ptr= 0;
return mess.m_type;
}
i= 0;
}
}
return OK;
}
PRIVATE int cp_b2u (acc_ptr, proc, dest)
acc_t *acc_ptr;
int proc;
char *dest;
{
static message mess;
acc_t *acc;
int i, size;
acc= acc_ptr;
i=0;
while (acc)
{
size= (vir_bytes)acc->acc_length;
if (size)
{
#ifdef __minix_vmd
cpvec[i].cpv_src= (vir_bytes)ptr2acc_data(acc);
cpvec[i].cpv_dst= (vir_bytes)dest;
cpvec[i].cpv_size= size;
#else /* Minix 3 */
vir_cp_req[i].src.proc_nr_e = this_proc;
vir_cp_req[i].src.segment = D;
vir_cp_req[i].src.offset= (vir_bytes)ptr2acc_data(acc);
vir_cp_req[i].dst.proc_nr_e = proc;
vir_cp_req[i].dst.segment = D;
vir_cp_req[i].dst.offset= (vir_bytes)dest;
vir_cp_req[i].count= size;
#endif
i++;
}
dest += size;
acc= acc->acc_next;
if (i == CPVEC_NR || acc == NULL)
{
#ifdef __minix_vmd
mess.m_type= SYS_VCOPY;
mess.m1_i1= this_proc;
mess.m1_i2= proc;
mess.m1_i3= i;
mess.m1_p1= (char *)cpvec;
#else /* Minix 3 */
mess.m_type= SYS_VIRVCOPY;
mess.VCP_VEC_SIZE= i;
mess.VCP_VEC_ADDR= (char *) vir_cp_req;
#endif
if (sendrec(SYSTASK, &mess) <0)
ip_panic(("unable to sendrec"));
if (mess.m_type <0)
{
bf_afree(acc_ptr);
return mess.m_type;
}
i= 0;
}
}
bf_afree(acc_ptr);
return OK;
}
PRIVATE int cp_u2b_s(proc, gid, offset, var_acc_ptr, size)
PRIVATE int cp_u2b(proc, gid, offset, var_acc_ptr, size)
int proc;
int gid;
vir_bytes offset;
@ -1305,13 +940,13 @@ int size;
i= 0;
continue;
}
if (i == CPVEC_NR || acc == NULL)
if (i == SCPVEC_NR || acc == NULL)
{
r= sys_vsafecopy(s_cp_req, i);
if (r <0)
{
printf("cp_u2b_s: sys_vsafecopy failed: %d\n",
printf("cp_u2b: sys_vsafecopy failed: %d\n",
r);
bf_afree(*var_acc_ptr);
*var_acc_ptr= 0;
@ -1323,7 +958,7 @@ int size;
return OK;
}
PRIVATE int cp_b2u_s(acc_ptr, proc, gid, offset)
PRIVATE int cp_b2u(acc_ptr, proc, gid, offset)
acc_t *acc_ptr;
int proc;
int gid;
@ -1368,13 +1003,13 @@ vir_bytes offset;
i= 0;
continue;
}
if (i == CPVEC_NR || acc == NULL)
if (i == SCPVEC_NR || acc == NULL)
{
r= sys_vsafecopy(s_cp_req, i);
if (r <0)
{
printf("cp_b2u_s: sys_vsafecopy failed: %d\n",
printf("cp_b2u: sys_vsafecopy failed: %d\n",
r);
bf_afree(acc_ptr);
return r;
@ -1392,9 +1027,7 @@ int ref;
int operation;
{
mq_t *m, *m_cancel, *m_tmp;
#ifndef __minix_vmd
mq_t *new_queue;
#endif
int result;
m_cancel= NULL;
@ -1402,39 +1035,20 @@ int operation;
for (m= repl_queue; m;)
{
#ifdef __minix_vmd
if (m->mq_mess.REP_ENDPT == proc &&
m->mq_mess.REP_REF == ref &&
(m->mq_mess.REP_OPERATION == operation ||
operation == CANCEL_ANY))
#else /* Minix 3 */
if (m->mq_mess.REP_ENDPT == proc &&
m->mq_mess.REP_IO_GRANT == ref)
#endif
{
assert(!m_cancel);
assert(!m_cancel);
m_cancel= m;
m= m->mq_next;
continue;
}
#ifdef __minix_vmd
result= send(m->mq_mess.m_source, &m->mq_mess);
if (result != OK)
ip_panic(("unable to send: %d", result));
m_tmp= m;
m= m->mq_next;
mq_free(m_tmp);
#else /* Minix 3 */
m_tmp= m;
m= m->mq_next;
m_tmp->mq_next= new_queue;
new_queue= m_tmp;
#endif
}
repl_queue= NULL;
#ifndef __minix_vmd /* Minix 3 */
repl_queue= new_queue;
#endif
if (m_cancel)
{
result= send(m_cancel->mq_mess.m_source, &m_cancel->mq_mess);

View file

@ -12,7 +12,7 @@
*
* The entry points into this file are:
* do_exec: perform the EXEC system call
* exec_newmem: allocate new memory map for a process that tries to exec
* do_exec_newmem: allocate new memory map for a process that tries to exec
* do_execrestart: finish the special exec call for RS
* exec_restart: finish a regular exec call
* find_share: find a process whose text segment can be shared
@ -58,9 +58,9 @@ PUBLIC int do_exec()
/*===========================================================================*
* exec_newmem *
* do_exec_newmem *
*===========================================================================*/
PUBLIC int exec_newmem()
PUBLIC int do_exec_newmem()
{
int proc_e, proc_n, allow_setuid;
char *ptr;
@ -75,7 +75,7 @@ PUBLIC int exec_newmem()
proc_e= m_in.EXC_NM_PROC;
if (pm_isokendpt(proc_e, &proc_n) != OK)
{
panic(__FILE__, "exec_newmem: got bad endpoint",
panic(__FILE__, "do_exec_newmem: got bad endpoint",
proc_e);
}
rmp= &mproc[proc_n];
@ -83,7 +83,7 @@ PUBLIC int exec_newmem()
r= sys_datacopy(who_e, (vir_bytes)ptr,
SELF, (vir_bytes)&args, sizeof(args));
if (r != OK)
panic(__FILE__, "exec_newmem: sys_datacopy failed", r);
panic(__FILE__, "do_exec_newmem: sys_datacopy failed", r);
if((r=vm_exec_newmem(proc_e, &args, sizeof(args), &stack_top, &flags)) == OK) {
allow_setuid= 0; /* Do not allow setuid execution */

View file

@ -117,27 +117,6 @@ PUBLIC int main()
else
result= ENOSYS;
break;
case ALLOCMEM:
result= do_allocmem();
break;
case FORK_NB:
result= do_fork_nb();
break;
case EXEC_NEWMEM:
result= exec_newmem();
break;
case EXEC_RESTART:
result= do_execrestart();
break;
case PROCSTAT:
result= do_procstat();
break;
case GETPROCNR:
result= do_getprocnr();
break;
case GETEPINFO:
result= do_getepinfo();
break;
default:
/* Else, if the system call number is valid, perform the
* call.
@ -338,9 +317,10 @@ PRIVATE void pm_init()
rmp->mp_endpoint = ip->endpoint;
/* Tell FS about this system process. */
mess.PR_SLOT = ip->proc_nr;
mess.PR_PID = rmp->mp_pid;
mess.PR_ENDPT = rmp->mp_endpoint;
mess.m_type = PM_INIT;
mess.PM_SLOT = ip->proc_nr;
mess.PM_PID = rmp->mp_pid;
mess.PM_PROC = rmp->mp_endpoint;
if (OK != (s=send(FS_PROC_NR, &mess)))
panic(__FILE__,"can't sync up with FS", s);
}

View file

@ -6,8 +6,6 @@
* do_getsysinfo: request copy of PM data structure (Jorrit N. Herder)
* do_getprocnr: lookup process slot number (Jorrit N. Herder)
* do_getepinfo: get the pid/uid/gid of a process given its endpoint
* do_allocmem: allocate a chunk of memory (Jorrit N. Herder)
* do_freemem: deallocate a chunk of memory (Jorrit N. Herder)
* do_getsetpriority: get/set process priority
* do_svrctl: process manager control
*/
@ -63,49 +61,7 @@ PRIVATE char *uts_tbl[] = {
PUBLIC unsigned long calls_stats[NCALLS];
#endif
FORWARD _PROTOTYPE( int getpciinfo, (struct pciinfo *pciinfo) );
/*===========================================================================*
* do_allocmem *
*===========================================================================*/
PUBLIC int do_allocmem()
{
int r;
phys_bytes retmembase;
r = vm_allocmem(m_in.memsize, (phys_clicks *) &retmembase);
if(r == OK)
mp->mp_reply.membase = retmembase;
return r;
}
/*===========================================================================*
* do_freemem *
*===========================================================================*/
PUBLIC int do_freemem()
{
#if 1
return ENOSYS;
#else
vir_clicks mem_clicks;
phys_clicks mem_base;
/* This call is dangerous. Even memory belonging to other processes can
* be freed.
*/
if (mp->mp_effuid != 0)
{
printf("PM: unauthorized call of do_freemem by proc %d\n",
mp->mp_endpoint);
sys_sysctl_stacktrace(mp->mp_endpoint);
return EPERM;
}
mem_clicks = (m_in.memsize + CLICK_SIZE -1 ) >> CLICK_SHIFT;
mem_base = (m_in.membase + CLICK_SIZE -1 ) >> CLICK_SHIFT;
free_mem(mem_base, mem_clicks);
return(OK);
#endif
}
FORWARD _PROTOTYPE( int getpciinfo, (struct pciinfo *pciinfo) );
/*===========================================================================*
* do_procstat *

View file

@ -23,7 +23,7 @@ _PROTOTYPE( int do_getdma, (void) );
/* exec.c */
_PROTOTYPE( int do_exec, (void) );
_PROTOTYPE( int exec_newmem, (void) );
_PROTOTYPE( int do_exec_newmem, (void) );
_PROTOTYPE( int do_execrestart, (void) );
_PROTOTYPE( void exec_restart, (struct mproc *rmp, int result) );
@ -54,8 +54,6 @@ _PROTOTYPE( int do_getsysinfo_up, (void) );
_PROTOTYPE( int do_getprocnr, (void) );
_PROTOTYPE( int do_getepinfo, (void) );
_PROTOTYPE( int do_svrctl, (void) );
_PROTOTYPE( int do_allocmem, (void) );
_PROTOTYPE( int do_freemem, (void) );
_PROTOTYPE( int do_getsetpriority, (void) );
/* profile.c */

View file

@ -111,14 +111,15 @@ _PROTOTYPE (int (*call_vec[]), (void) ) = {
do_getsysinfo_up,/* 97 = getsysinfo_up */
do_sprofile, /* 98 = sprofile */
do_cprofile, /* 99 = cprofile */
no_sys, /* 100 = unused */
no_sys, /* 101 = unused */
no_sys, /* 102 = unused */
no_sys, /* 103 = unused */
no_sys, /* 104 = unused */
/* THE MINIX3 ABI ENDS HERE */
do_exec_newmem, /* 100 = exec_newmem */
do_fork_nb, /* 101 = forknb */
do_execrestart, /* 102 = exec_restart */
do_procstat, /* 103 = procstat */
do_getprocnr, /* 104 = getprocnr */
no_sys, /* 105 = unused */
no_sys, /* 106 = unused */
no_sys, /* 107 = unused */
do_getepinfo, /* 107 = getepinfo */
do_adddma, /* 108 = adddma */
do_deldma, /* 109 = deldma */
do_getdma, /* 110 = getdma */

View file

@ -10,7 +10,6 @@
*/
#define MAX_SCRIPT_LEN 256 /* maximum restart script name length */
#define MAX_NR_ARGS 4 /* maximum number of arguments */
#define MAX_RESCUE_DIR_LEN 64 /* maximum rescue dir length */
#define MAX_IPC_LIST 256 /* Max size of list for IPC target
* process names

View file

@ -1183,7 +1183,7 @@ endpoint_t *endpoint;
* process, because VFS may be blocked on a sendrec() to a MFS that is
* waiting for a endpoint update for a dead driver. We have just published
* that update, but VFS may still be blocked. As a result, VFS may not yet
* have received PM's fork message. Hence, if we call mapdriver5()
* have received PM's fork message. Hence, if we call mapdriver()
* immediately, VFS may not know about the process and thus refuse to add the
* driver entry. The following temporary hack works around this by forcing
* blocking communication from PM to VFS. Once VFS has been made non-blocking
@ -1194,7 +1194,7 @@ endpoint_t *endpoint;
/* Map the new service. */
if (rp->r_dev_nr > 0) { /* set driver map */
if ((s=mapdriver5(rp->r_label, strlen(rp->r_label),
if ((s=mapdriver(rp->r_label,
rp->r_dev_nr, rp->r_dev_style, !!use_copy /* force */)) < 0) {
report("RS", "couldn't map driver (continuing)", errno);
}

View file

@ -57,7 +57,7 @@ PRIVATE char *known_requests[] = {
/* The following are relative to optind */
#define ARG_REQUEST 0 /* request to perform */
#define ARG_PATH 1 /* rescue dir or system service */
#define ARG_PATH 1 /* system service */
#define ARG_LABEL 1 /* name of system service */
#define ARG_LU_STATE 2 /* the state required to update */
#define ARG_PREPARE_MAXTIME 3 /* max time to prepare for the update */
@ -118,7 +118,6 @@ PRIVATE void print_usage(char *app_name, char *problem)
fprintf(stderr, " %s refresh label\n", app_name);
fprintf(stderr, " %s restart label\n", app_name);
fprintf(stderr, " %s update label state maxtime\n", app_name);
fprintf(stderr, " %s rescue <dir>\n", app_name);
fprintf(stderr, " %s shutdown\n", app_name);
fprintf(stderr, "\n");
}

View file

@ -15,7 +15,7 @@
* once at runtime.
*/
#define FS_KC SYS_KILL, SYS_VIRCOPY, SYS_SAFECOPYFROM, SYS_SAFECOPYTO, \
SYS_VIRVCOPY, SYS_UMAP, SYS_GETINFO, SYS_EXIT, SYS_TIMES, SYS_SETALARM, \
SYS_UMAP, SYS_GETINFO, SYS_EXIT, SYS_TIMES, SYS_SETALARM, \
SYS_PRIVCTL, SYS_TRACE , SYS_SETGRANT, SYS_PROFBUF, SYS_SYSCTL
#define DRV_KC FS_KC, SYS_SEGCTL, SYS_IRQCTL, SYS_INT86, SYS_DEVIO, \
SYS_SDEVIO, SYS_VDEVIO, SYS_SETGRANT, SYS_PROFBUF, SYS_SYSCTL
@ -28,7 +28,7 @@ PRIVATE int
drv_kc[] = { DRV_KC, SYS_NULL_C },
tty_kc[] = { DRV_KC, SYS_PHYSCOPY, SYS_ABORT, SYS_IOPENABLE,
SYS_READBIOS, SYS_NULL_C },
mem_kc[] = { DRV_KC, SYS_PHYSCOPY, SYS_PHYSVCOPY, SYS_IOPENABLE, SYS_NULL_C },
mem_kc[] = { DRV_KC, SYS_PHYSCOPY, SYS_IOPENABLE, SYS_NULL_C },
rusr_kc[] = { SYS_NULL_C },
no_kc[] = { SYS_NULL_C }; /* no kernel call */

View file

@ -7,8 +7,8 @@
/* Miscellaneous constants */
#define SU_UID ((uid_t) 0) /* super_user's uid_t */
#define SERVERS_UID ((uid_t) 11) /* who may do FSSIGNON */
#define SYS_UID ((uid_t) 0) /* uid_t for processes MM and INIT */
#define SYS_GID ((gid_t) 0) /* gid_t for processes MM and INIT */
#define SYS_UID ((uid_t) 0) /* uid_t for system processes and INIT */
#define SYS_GID ((gid_t) 0) /* gid_t for system processes and INIT */
#define FP_BLOCKED_ON_NONE 0 /* not blocked */
#define FP_BLOCKED_ON_PIPE 1 /* susp'd on pipe */

View file

@ -56,71 +56,6 @@ PRIVATE struct dmap init_dmap[] = {
#endif /* IBM_PC */
};
FORWARD _PROTOTYPE( int map_driverX, (char *label, int major,
endpoint_t proc_nr_e, int style, int force) );
/*===========================================================================*
* do_devctl *
*===========================================================================*/
PUBLIC int do_devctl()
{
if (!super_user)
{
printf("FS: unauthorized call of do_devctl by proc %d\n",
who_e);
return(EPERM); /* only su (should be only RS or some drivers)
* may call do_devctl.
*/
}
return fs_devctl(m_in.ctl_req, m_in.dev_nr, m_in.driver_nr,
m_in.dev_style, m_in.m_force);
}
/*===========================================================================*
* fs_devctl *
*===========================================================================*/
PUBLIC int fs_devctl(req, dev, proc_nr_e, style, force)
int req;
int dev;
int proc_nr_e;
int style;
int force;
{
int result, proc_nr_n;
switch(req) {
case DEV_MAP:
if (!force)
{
/* Check process number of new driver. */
if (isokendpt(proc_nr_e, &proc_nr_n) != OK)
return(EINVAL);
}
/* Try to update device mapping. */
result = map_driver(dev, proc_nr_e, style, force);
if (result == OK)
{
/* If a driver has completed its exec(), it can be announced to be
* up.
*/
if(force || fproc[proc_nr_n].fp_execced) {
dev_up(dev);
} else {
dmap[dev].dmap_flags |= DMAP_BABY;
}
}
break;
case DEV_UNMAP:
result = map_driver(dev, NONE, 0, 0);
break;
default:
result = EINVAL;
}
return(result);
}
/*===========================================================================*
* do_mapdriver *
*===========================================================================*/
@ -177,7 +112,7 @@ PUBLIC int do_mapdriver()
/* Try to update device mapping. */
major= m_in.md_major;
force= m_in.md_force;
r= map_driverX(label, major, tasknr, m_in.md_style, force);
r= map_driver(label, major, tasknr, m_in.md_style, force);
if (r == OK)
{
/* If a driver has completed its exec(), it can be announced
@ -193,72 +128,10 @@ PUBLIC int do_mapdriver()
return(r);
}
/*===========================================================================*
* map_driver *
*===========================================================================*/
PUBLIC int map_driver(major, proc_nr_e, style, force)
int major; /* major number of the device */
int proc_nr_e; /* process number of the driver */
int style; /* style of the device */
int force;
{
/* Set a new device driver mapping in the dmap table. Given that correct
* arguments are given, this only works if the entry is mutable and the
* current driver is not busy. If the proc_nr is set to NONE, we're supposed
* to unmap it.
*
* Normal error codes are returned so that this function can be used from
* a system call that tries to dynamically install a new driver.
*/
struct dmap *dp;
int proc_nr_n;
/* Get pointer to device entry in the dmap table. */
if (major < 0 || major >= NR_DEVICES) return(ENODEV);
dp = &dmap[major];
/* Check if we're supposed to unmap it. If so, do it even
* if busy or unmutable, as unmap is called when driver has
* exited.
*/
if(proc_nr_e == NONE) {
dp->dmap_opcl = no_dev;
dp->dmap_io = no_dev_io;
dp->dmap_driver = NONE;
dp->dmap_flags = DMAP_MUTABLE; /* When gone, not busy or reserved. */
return(OK);
}
/* See if updating the entry is allowed. */
if (! (dp->dmap_flags & DMAP_MUTABLE)) return(EPERM);
if (dp->dmap_flags & DMAP_BUSY) return(EBUSY);
if (!force)
{
/* Check process number of new driver. */
if (isokendpt(proc_nr_e, &proc_nr_n) != OK)
return(EINVAL);
}
/* Try to update the entry. */
switch (style) {
case STYLE_DEV: dp->dmap_opcl = gen_opcl; break;
case STYLE_TTY: dp->dmap_opcl = tty_opcl; break;
case STYLE_CLONE: dp->dmap_opcl = clone_opcl; break;
default: return(EINVAL);
}
dp->dmap_io = gen_io;
dp->dmap_driver = proc_nr_e;
return(OK);
}
/*===========================================================================*
* map_driverX *
*===========================================================================*/
PRIVATE int map_driverX(label, major, proc_nr_e, style, force)
PUBLIC int map_driver(label, major, proc_nr_e, style, force)
char *label; /* name of the driver */
int major; /* major number of the device */
endpoint_t proc_nr_e; /* process number of the driver */
@ -304,10 +177,12 @@ int force;
return(EINVAL);
}
len= strlen(label);
if (len+1 > sizeof(dp->dmap_label))
panic(__FILE__, "map_driver: label too long", len);
strcpy(dp->dmap_label, label);
if (label != NULL) {
len= strlen(label);
if (len+1 > sizeof(dp->dmap_label))
panic(__FILE__, "map_driver: label too long", len);
strcpy(dp->dmap_label, label);
}
/* Try to update the entry. */
switch (style) {
@ -333,7 +208,7 @@ PUBLIC void dmap_unmap_by_endpt(int proc_nr_e)
int i, r;
for (i=0; i<NR_DEVICES; i++)
if(dmap[i].dmap_driver && dmap[i].dmap_driver == proc_nr_e)
if((r=map_driver(i, NONE, 0, 0)) != OK)
if((r=map_driver(NULL, i, NONE, 0, 0)) != OK)
printf("FS: unmap of p %d / d %d failed: %d\n", proc_nr_e,i,r);
return;

View file

@ -189,11 +189,6 @@ PUBLIC int main(void)
/* Other calls. */
switch(call_nr)
{
case DEVCTL:
error= do_devctl();
if (error != SUSPEND) reply(who_e, error);
break;
case MAPDRIVER:
error= do_mapdriver();
if (error != SUSPEND) reply(who_e, error);
@ -376,11 +371,15 @@ PRIVATE void fs_init()
do {
if (OK != (s=sef_receive(PM_PROC_NR, &mess)))
panic(__FILE__,"FS couldn't receive from PM", s);
if (NONE == mess.PR_ENDPT) break;
rfp = &fproc[mess.PR_SLOT];
rfp->fp_pid = mess.PR_PID;
rfp->fp_endpoint = mess.PR_ENDPT;
if (mess.m_type != PM_INIT)
panic(__FILE__, "unexpected message from PM", mess.m_type);
if (NONE == mess.PM_PROC) break;
rfp = &fproc[mess.PM_SLOT];
rfp->fp_pid = mess.PM_PID;
rfp->fp_endpoint = mess.PM_PROC;
rfp->fp_realuid = (uid_t) SYS_UID;
rfp->fp_effuid = (uid_t) SYS_UID;
rfp->fp_realgid = (gid_t) SYS_GID;

View file

@ -8,8 +8,8 @@
* do_sync: perform the SYNC system call
* do_fsync: perform the FSYNC system call
* do_reboot: sync disks and prepare for shutdown
* do_fork: adjust the tables after MM has performed a FORK system call
* do_exec: handle files with FD_CLOEXEC on after MM has done an EXEC
* do_fork: adjust the tables after PM has performed a FORK system call
* do_exec: handle files with FD_CLOEXEC on after PM has done an EXEC
* do_exit: a process has exited; note that in the tables
* do_set: set uid or gid for some process
* do_revive: revive a process that was waiting for something (e.g. TTY)
@ -342,7 +342,7 @@ int cpid; /* Child process id */
/* Perform those aspects of the fork() system call that relate to files.
* In particular, let the child inherit its parent's file descriptors.
* The parent and child parameters tell who forked off whom. The file
* system uses the same slot numbers as the kernel. Only MM makes this call.
* system uses the same slot numbers as the kernel. Only PM makes this call.
*/
register struct fproc *cp;
@ -583,7 +583,7 @@ PUBLIC int do_svrctl()
/* Try to update device mapping. */
major = (device.dev >> MAJOR) & BYTE;
r=map_driver(major, who_e, device.style, 0 /* !force */);
r=map_driver(NULL, major, who_e, device.style, 0 /* !force */);
if (r == OK)
{
/* If a driver has completed its exec(), it can be announced
@ -604,18 +604,6 @@ PUBLIC int do_svrctl()
return(r);
}
case FSDEVUNMAP: {
struct fsdevunmap fdu;
int r, major;
/* Try to copy request structure to FS. */
if ((r = sys_datacopy(who_e, (vir_bytes) m_in.svrctl_argp,
FS_PROC_NR, (vir_bytes) &fdu,
(phys_bytes) sizeof(fdu))) != OK)
return(r);
major = (fdu.dev >> MAJOR) & BYTE;
r=map_driver(major, NONE, 0, 0);
return(r);
}
default:
return(EINVAL);
}

View file

@ -33,13 +33,10 @@ _PROTOTYPE( endpoint_t suspended_ep, (endpoint_t driver,
_PROTOTYPE( void reopen_reply, (void) );
/* dmap.c */
_PROTOTYPE( int do_devctl, (void) );
_PROTOTYPE( int fs_devctl, (int req, int dev, int proc_nr_e, int style,
int force) );
_PROTOTYPE( int do_mapdriver, (void) );
_PROTOTYPE( void build_dmap, (void) );
_PROTOTYPE( int map_driver, (int major, int proc_nr, int dev_style,
int force) );
_PROTOTYPE( int map_driver, (char *label, int major, int proc_nr,
int dev_style, int force) );
_PROTOTYPE( int dmap_driver_match, (endpoint_t proc, int major) );
_PROTOTYPE( void dmap_unmap_by_endpt, (int proc_nr) );
_PROTOTYPE( void dmap_endpt_up, (int proc_nr) );

View file

@ -46,22 +46,12 @@ int rw_flag; /* READING or WRITING */
off_t bytes_left;
u64_t position, res_pos, new_pos;
unsigned int off, cum_io, cum_io_incr, res_cum_io;
int op, oflags, r, chunk, usr, block_spec, char_spec;
int op, oflags, r, chunk, block_spec, char_spec;
int regular;
mode_t mode_word;
phys_bytes p;
struct dmap *dp;
/* PM loads segments by putting funny things in other bits of the
* message, indicated by a high bit in fd. */
if (who_e == PM_PROC_NR && (m_in.fd & _PM_SEG_FLAG)) {
panic(__FILE__,
"read_write: special read/write calls by PM no longer supported",
NO_NUM);
} else {
usr = who_e; /* normal case */
}
/* If the file descriptor is valid, get the vnode, size and mode. */
if (m_in.nbytes < 0) return(EINVAL);
if ((f = get_filp(m_in.fd)) == NIL_FILP) return(err_code);
@ -82,7 +72,7 @@ int rw_flag; /* READING or WRITING */
panic(__FILE__, "read_write: fp_cum_io_partial not clear",
NO_NUM);
}
return rw_pipe(rw_flag, usr, m_in.fd, f, m_in.buffer, m_in.nbytes);
return rw_pipe(rw_flag, who_e, m_in.fd, f, m_in.buffer, m_in.nbytes);
}
op = (rw_flag == READING ? VFS_DEV_READ : VFS_DEV_WRITE);
@ -109,7 +99,7 @@ int rw_flag; /* READING or WRITING */
suspend_reopen = (f->filp_state != FS_NORMAL);
dev = (dev_t) vp->v_sdev;
r = dev_io(op, dev, usr, m_in.buffer, position, m_in.nbytes, oflags,
r = dev_io(op, dev, who_e, m_in.buffer, position, m_in.nbytes, oflags,
suspend_reopen);
if (r >= 0) {
cum_io = r;
@ -117,8 +107,8 @@ int rw_flag; /* READING or WRITING */
r = OK;
}
} else if (block_spec) { /* Block special files. */
r = req_breadwrite(vp->v_bfs_e, usr, vp->v_sdev, position, m_in.nbytes,
m_in.buffer, rw_flag, &res_pos, &res_cum_io);
r = req_breadwrite(vp->v_bfs_e, who_e, vp->v_sdev, position,
m_in.nbytes, m_in.buffer, rw_flag, &res_pos, &res_cum_io);
position = res_pos;
cum_io += res_cum_io;
} else { /* Regular files */
@ -128,7 +118,7 @@ int rw_flag; /* READING or WRITING */
}
/* Issue request */
r = req_readwrite(vp->v_fs_e, vp->v_inode_nr, position, rw_flag, usr,
r = req_readwrite(vp->v_fs_e, vp->v_inode_nr, position, rw_flag, who_e,
m_in.buffer, m_in.nbytes, &new_pos, &cum_io_incr);
if (r >= 0) {

View file

@ -47,37 +47,8 @@ PUBLIC int do_fchdir()
*===========================================================================*/
PUBLIC int do_chdir()
{
/* Change directory. This function is also called by MM to simulate a chdir
* in order to do EXEC, etc. It also changes the root directory, the uids and
* gids, and the umask.
*/
int r;
register struct fproc *rfp;
/* Perform the chdir(name) system call. */
if (who_e == PM_PROC_NR) {
int slot;
if(isokendpt(m_in.endpt1, &slot) != OK) return(EINVAL);
rfp = &fproc[slot];
put_vnode(fp->fp_rd);
dup_vnode(fp->fp_rd = rfp->fp_rd);
put_vnode(fp->fp_wd);
dup_vnode(fp->fp_wd = rfp->fp_wd);
/* MM uses access() to check permissions. To make this work, pretend
* that the user's real ids are the same as the user's effective ids.
* FS calls other than access() do not use the real ids, so are not
* affected.
*/
fp->fp_realuid =
fp->fp_effuid = rfp->fp_effuid;
fp->fp_realgid =
fp->fp_effgid = rfp->fp_effgid;
fp->fp_umask = rfp->fp_umask;
return(OK);
}
/* Perform the chdir(name) system call. */
return change(&fp->fp_wd, m_in.name, m_in.name_length);
}

View file

@ -115,17 +115,18 @@ PUBLIC _PROTOTYPE (int (*call_vec[]), (void) ) = {
no_sys, /* 97 = getsysinfo_up */
no_sys, /* 98 = (sprofile) */
no_sys, /* 99 = (cprofile) */
no_sys, /* 100 = unused */
no_sys, /* 101 = unused */
no_sys, /* 102 = unused */
no_sys, /* 103 = unused */
no_sys, /* 104 = unused */
/* THE MINIX3 ABI ENDS HERE */
no_sys, /* 100 = (exec_newmem) */
no_sys, /* 101 = (fork_nb) */
no_sys, /* 102 = (exec_restart) */
no_sys, /* 103 = (procstat) */
no_sys, /* 104 = (getprocnr) */
no_sys, /* 105 = unused */
no_sys, /* 106 = unused */
no_sys, /* 107 = unused */
no_sys, /* 107 = (getepinfo) */
no_sys, /* 108 = (adddma) */
no_sys, /* 109 = unused */
no_sys, /* 110 = unused */
no_sys, /* 109 = (deldma) */
no_sys, /* 110 = (getdma) */
};
/* This should not fail with "array size is negative": */
extern int dummy[sizeof(call_vec) == NCALLS * sizeof(call_vec[0]) ? 1 : -1];

View file

@ -828,29 +828,7 @@ PUBLIC void release_dma(struct vmproc *vmp)
}
/*===========================================================================*
* do_allocmem *
*===========================================================================*/
PUBLIC int do_allocmem(message *m)
{
phys_clicks mem, clicks;
clicks = 1 + ((vir_bytes)m->VMAM_BYTES / CLICK_SIZE);
if((mem=ALLOC_MEM(clicks, PAF_CLEAR)) == NO_MEM) {
return ENOMEM;
}
m->VMAM_MEMBASE = CLICK2ABS(mem);
#if 0
printf("VM: do_allocmem: 0x%lx clicks OK at 0x%lx\n", m->VMAM_CLICKS, mem);
#endif
return OK;
}
/*===========================================================================*
* do_allocmem *
* printmemstats *
*===========================================================================*/
void printmemstats(void)
{

View file

@ -342,7 +342,6 @@ PRIVATE void vm_init(void)
CALLMAP(VM_ADDDMA, do_adddma, PM_PROC_NR);
CALLMAP(VM_DELDMA, do_deldma, PM_PROC_NR);
CALLMAP(VM_GETDMA, do_getdma, PM_PROC_NR);
CALLMAP(VM_ALLOCMEM, do_allocmem, PM_PROC_NR);
CALLMAP(VM_NOTIFY_SIG, do_notify_sig, PM_PROC_NR);
/* Requests from RS */

View file

@ -19,7 +19,6 @@ _PROTOTYPE( phys_clicks alloc_mem_f, (phys_clicks clicks, u32_t flags) );
_PROTOTYPE( int do_adddma, (message *msg) );
_PROTOTYPE( int do_deldma, (message *msg) );
_PROTOTYPE( int do_getdma, (message *msg) );
_PROTOTYPE( int do_allocmem, (message *msg) );
_PROTOTYPE( void release_dma, (struct vmproc *vmp) );
_PROTOTYPE( void memstats, (int *nodes, int *pages, int *largest) );
_PROTOTYPE( void printmemstats, (void) );