Compare commits

...

32 Commits
main ... R3.1.1

Author SHA1 Message Date
Ben Gras
03a4531650 Don't zero before if you zero after 2005-10-22 20:43:02 +00:00
Ben Gras
7c60518934 *** empty log message *** 2005-10-22 20:42:05 +00:00
Ben Gras
3720284a4d *** empty log message *** 2005-10-22 20:38:11 +00:00
Ben Gras
987fe231fe Clean 2005-10-22 20:38:08 +00:00
Ben Gras
1c6ec4723e smaller 2005-10-22 20:17:52 +00:00
Ben Gras
e93effa794 Small release mode 2005-10-22 20:14:18 +00:00
Ben Gras
8e4b66a75b Don't fail if big commands directories don't exist 2005-10-22 16:16:12 +00:00
Ben Gras
7d5630e619 Set a sigterm handler too 2005-10-22 12:25:55 +00:00
Ben Gras
4a70459fdb Correct panic mesg 2005-10-22 12:24:30 +00:00
Ben Gras
af9f0f176a Don't make nvi in the small commands 2005-10-22 11:54:43 +00:00
Ben Gras
864d801cc2 Don't check for failure on unmapping at exit. 2005-10-22 11:08:57 +00:00
Ben Gras
7445065719 Make lance driver work again - >1k stack 2005-10-22 11:07:23 +00:00
Ben Gras
2ccb1528af Make bios driver get messages for SIGTERM. 2005-10-22 10:52:04 +00:00
Ben Gras
e0e0a14b23 sig2mess for memory driver. 2005-10-22 10:43:19 +00:00
Ben Gras
ad1d6afbba Print these errors after all 2005-10-22 02:36:06 +00:00
Ben Gras
9b7138b3b1 Don't print these scary messages either 2005-10-22 02:34:27 +00:00
Ben Gras
d78c32d1c9 Al's comments. 2005-10-22 02:19:16 +00:00
Ben Gras
c178d8e0a4 Reboot problem workaround - call shutdown directly. 2005-10-22 01:12:38 +00:00
Ben Gras
2823b3de0e *** empty log message *** 2005-10-22 01:10:45 +00:00
Ben Gras
88f45c6a5f Don't print scary errors 2005-10-21 23:37:58 +00:00
Ben Gras
efe2a2a69a Build+install rescue driver too 2005-10-21 23:18:00 +00:00
Ben Gras
8386f885d8 Bigger 2005-10-21 22:16:31 +00:00
Ben Gras
6e8a35b368 Separate zlib install target 2005-10-21 21:27:14 +00:00
Ben Gras
f9199802f2 Change the way $PATH is assigned 2005-10-21 21:00:06 +00:00
Ben Gras
0784a340b7 *** empty log message *** 2005-10-21 20:44:17 +00:00
Ben Gras
2b07601c65 Tell makefile where to find gmake 2005-10-21 20:23:11 +00:00
Ben Gras
cf59444d65 Don't let everyone do IOPENABLE. 2005-10-21 20:22:27 +00:00
Ben Gras
0cdfba8476 *** empty log message *** 2005-10-21 20:11:14 +00:00
Ben Gras
3c6b23e763 Remember old scratch devices 2005-10-21 20:08:26 +00:00
Ben Gras
ff21c5d22c Support -r 2005-10-21 20:05:10 +00:00
Ben Gras
d0f8cb390c Removed VM changes for SOSP release (3.1.1). 2005-10-21 20:04:02 +00:00
nobody
3e5c23fed7 This commit was manufactured by cvs2svn to create branch 'b3_1_1'. 2005-10-21 19:37:31 +00:00
36 changed files with 131 additions and 593 deletions

View File

@ -1,7 +1,7 @@
# Master Makefile to compile everything in /usr/src except the system.
MAKE = exec make -$(MAKEFLAGS)
GMAKE = gmake
GMAKE = /usr/gnu/bin/gmake
usage:
@echo ""
@ -38,6 +38,7 @@ includes:
cd include && $(MAKE) install gcc
libraries:
cd lib && $(GMAKE) all
cd lib && $(GMAKE) install
cmds:

View File

@ -16,6 +16,8 @@ PERL=perl-5.8.7
SMALLPROGRAMS=`arch` aal advent ash autil awk bc byacc cawf cron de dhcpd dis88 elle elvis ftp ftpd ftpd200 httpd ibm indent m4 make mdb mined patch ps reboot rlogind scripts sh simple talk talkd telnet telnetd urlget yap zmodem
BIGDIRS=$(FLEX) $(BZIP2) $(KERMIT) $(LYNX) $(COREUTILS) $(PERL) $(EMACS) $(PYTHON) $(VIM) $(NVI)
usage:
@echo "Usage: make all # Compile all commands" >&2
@echo " make install # Install the result (run as bin!)" >&2
@ -36,35 +38,17 @@ all: small big
install: biginstall smallinstall
small::
-mkdir $(NVIWORK)
cd $(GZIP) && CC="$(CC)" /bin/sh ./configure --prefix=/usr/local && $(MAKE) all
cd $(NVI) && make all
smallinstall:: small
cd $(GZIP) && $(MAKE) install
cd $(NVI) && make install
big:
cd $(FLEX) && /bin/sh makeme.sh
cd $(BZIP2) && /bin/sh makeme.sh
cd $(KERMIT) && /bin/sh makeme.sh
cd $(LYNX) && /bin/sh makeme.sh
cd $(COREUTILS) && /bin/sh makeme.sh
cd $(PERL) && /bin/sh makeme.sh
cd $(EMACS) && /bin/sh makeme.sh
cd $(PYTHON) && /bin/sh makeme.sh
cd $(VIM) && /bin/sh makeme.sh
-mkdir $(NVIWORK)
for d in $(BIGDIRS); do if [ -d $$d ]; then ( cd $$d && /bin/sh makeme.sh ); fi; done
biginstall: big
cd $(FLEX) && make install
cd $(PYTHON) && make install
cd $(BZIP2) && make install
cd $(KERMIT) && make install
cd $(LYNX) && make install
cd $(EMACS) && make install
cd $(COREUTILS) && make install
cd $(PERL) && make install
cd $(VIM) && make install
for d in $(BIGDIRS); do if [ -d $$d ]; then ( cd $$d && make install ); fi; done
clean::
if [ -f $(FLEX)/Makefile ] ; then cd $(FLEX) && make $@; fi
@ -75,8 +59,8 @@ clean::
if [ -f $(NVIWORK)/Makefile ]; then cd $(NVIWORK) && make clean; fi
if [ -f $(LYNX)/Makefile ] ; then cd $(LYNX) && make clean; fi
if [ -f $(EMACS)/Makefile ] ; then cd $(EMACS) && make clean; fi
cd $(COREUTILS) && make clean
for p in $(SMALLPROGRAMS); do ( cd $$p && make clean ); done
for d in $(BIGDIRS); do if [ -d $$d ]; then ( cd $$d && make clean ); fi; done
small::
for p in $(SMALLPROGRAMS); do ( cd $$p && make all ); done

View File

@ -32,6 +32,7 @@ all install depend clean:
cd ./dp8390 && $(MAKE) $@
cd ./sb16 && $(MAKE) $@
cd ./lance && $(MAKE) $@
cd ./rescue && $(MAKE) $@
image:
cd ./libdriver && $(MAKE) build

View File

@ -97,6 +97,13 @@ PRIVATE struct driver w_dtab = {
PUBLIC int main()
{
long v;
struct sigaction sa;
sa.sa_handler = SIG_MESS;
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
if (sigaction(SIGTERM,&sa,NULL)<0) panic("bios_wini","sigaction failed", errno);
signal(SIGTERM, SIG_IGN);
v= 0;
env_parse("bios_remap_first", "d", 0, &v, 0, 1);

View File

@ -292,6 +292,13 @@ PUBLIC void main()
struct floppy *fp;
int s;
struct sigaction sa;
sa.sa_handler = SIG_MESS;
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
if (sigaction(SIGTERM,&sa,NULL)<0) panic("floppy","sigaction failed", errno);
signal(SIGTERM, SIG_IGN);
f_next_timeout = TMR_NEVER;
tmr_inittimer(&f_tmr_timeout);

View File

@ -23,7 +23,7 @@ LIBPCI = $d/libpci/pci.o $d/libpci/pci_table.o
all build: $(DRIVER)
$(DRIVER): $(OBJ) $(LIBPCI)
$(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBPCI) $(LIBS)
install -S 1k $(DRIVER)
install -S 8k $(DRIVER)
$(LIBPCI):
cd $d/libpci && $(MAKE)

View File

@ -21,8 +21,6 @@
#include "../../kernel/config.h"
#include "../../kernel/type.h"
#include <sys/vm.h>
#include "assert.h"
#define NR_DEVS 6 /* number of minor devices */
@ -340,25 +338,6 @@ message *m_ptr; /* pointer to control message */
dv->dv_size = cvul64(ramdev_size);
break;
}
case MIOCMAP:
case MIOCUNMAP: {
int r, do_map;
struct mapreq mapreq;
if (m_device != MEM_DEV)
return ENOTTY;
do_map= (m_ptr->REQUEST == MIOCMAP); /* else unmap */
/* Get request structure */
r= sys_vircopy(m_ptr->PROC_NR, D, (vir_bytes)m_ptr->ADDRESS,
SELF, D, (vir_bytes)&mapreq, sizeof(mapreq));
if (r != OK)
return r;
r= sys_vm_map(m_ptr->PROC_NR, do_map,
(phys_bytes)mapreq.base, mapreq.size, mapreq.offset);
return r;
}
default:
return(do_diocntl(&m_dtab, m_ptr));

View File

@ -45,6 +45,8 @@
* |-------------+---------+---------+---------+---------+---------+---------|
* | DEV_CLOSE |minor dev| proc nr | | | | |
* |-------------+---------+---------+---------+---------+---------+---------|
* | DEV_SELECT | | | | | | |
* |-------------+---------+---------+---------+---------+---------+---------|
* | DEV_STATUS | | | | | | |
* |-------------+---------+---------+---------+---------+---------+---------|
* | CANCEL |minor dev| proc nr | | | | |
@ -56,7 +58,6 @@
* Jul 13, 2004 support for function key observers (Jorrit N. Herder)
*/
#include "../drivers.h"
#include "../drivers.h"
#include <termios.h>
#if ENABLE_SRCCOMPAT || ENABLE_BINCOMPAT

13
etc/rc
View File

@ -16,10 +16,13 @@ up()
{
service=$1
args=$2
device=$3
# Function to dynamically start a system service
command="/sbin/$service"
if [ ! -z "$args" ]; then command="$command -args \"$args\""; fi
if [ ! -z "$device" ]; then command="$command -dev \"$device\""; fi
echo -n " $service"
command="/sbin/$service $args"
eval service up $command
}
@ -52,11 +55,11 @@ start)
# Start crucial system services. The floppy driver *must* be loaded
# first, as it needs memory below 16MB in order to do ISA DMA.
if [ ! "`sysenv label`" = "FLOPPY" ]
then up floppy "-dev /dev/fd0 -period 5HZ"
else up at_wini "-dev /dev/c0d0 -period 5HZ"
then up floppy "" /dev/fd0
else up at_wini "" /dev/c0d0
fi
up is "-period 5HZ"
up cmos "-dev /dev/cmos -period 5HZ"
up is ""
up cmos "" /dev/cmos
echo .
# Set timezone.

View File

@ -6,7 +6,7 @@ if [ "$1" != start ]
then exit
fi
service up $DRIVERS/rescue -dev /dev/rescue -args 128 -period 4HZ
service up $DRIVERS/rescue -dev /dev/rescue -args 128
mkfs /dev/rescue || exit
mount /dev/rescue $RESCUE || exit
cp $DRIVERS/memory $RESCUE
@ -25,4 +25,4 @@ BIOS)
;;
esac
cp $DRIVERS/$d $RESCUE/driver
service rescue $RESCUE
service rescue $RESCUE

View File

@ -56,6 +56,7 @@ up()
{
service=$1
args=$2
device=$3
# Function to dynamically start a system service
@ -63,8 +64,10 @@ up()
if disabled $service; then return; fi
# Service is not disabled. Try to bring it up.
command="/usr/sbin/$service"
if [ ! -z "$args" ]; then command="$command -args \"$args\""; fi
if [ ! -z "$device" ]; then command="$command -dev \"$device\""; fi
echo -n " $service"
command="/usr/sbin/$service $args"
eval service up $command
}
@ -78,7 +81,7 @@ start)
# Start servers and drivers set at the boot monitor.
echo -n "Starting services:"
up random "-dev /dev/random -period 3HZ"
up random "" /dev/random
# load random number generator
if [ -f $RANDOM_FILE ]
@ -94,11 +97,11 @@ start)
if grep " $driver " /etc/inet.conf > /dev/null 2>&1
then
eval arg=\$${driver}_arg
up $driver "$arg -period 5HZ"
up $driver "$arg"
fi
done
up inet "-period 3HZ"
up printer "-dev /dev/lp -period 10HZ"
up inet ""
up printer "" /dev/lp
echo .
# Network initialization.

View File

@ -222,10 +222,8 @@
# define SYS_GETINFO (KERNEL_CALL + 26) /* sys_getinfo() */
# define SYS_ABORT (KERNEL_CALL + 27) /* sys_abort() */
# define SYS_IOPENABLE (KERNEL_CALL + 28) /* sys_enable_iop() */
# define SYS_VM_SETBUF (KERNEL_CALL + 29) /* sys_vm_setbuf() */
# define SYS_VM_MAP (KERNEL_CALL + 30) /* sys_vm_map() */
#define NR_SYS_CALLS 31 /* number of system calls */
#define NR_SYS_CALLS 29 /* number of system calls */
/* Field names for SYS_MEMSET, SYS_SEGCTL. */
#define MEM_PTR m2_p1 /* base */

View File

@ -38,10 +38,6 @@ _PROTOTYPE( int sys_svrctl, (int proc, int req, int priv,vir_bytes argp));
_PROTOTYPE( int sys_nice, (int proc, int priority));
_PROTOTYPE( int sys_int86, (struct reg86u *reg86p));
_PROTOTYPE( int sys_vm_setbuf, (phys_bytes base, phys_bytes size,
phys_bytes high));
_PROTOTYPE( int sys_vm_map, (int proc_nr, int do_map,
phys_bytes base, phys_bytes size, phys_bytes offset));
/* Shorthands for sys_sdevio() system call. */
#define sys_insb(port, proc_nr, buffer, count) \

View File

@ -10,7 +10,5 @@
#include <minix/ioctl.h>
#define MIOCRAMSIZE _IOW('m', 3, u32_t)
#define MIOCMAP _IOR('m', 4, struct mapreq)
#define MIOCUNMAP _IOR('m', 5, struct mapreq)
#endif /* _S_I_MEMORY_H */

View File

@ -1,28 +0,0 @@
/*
sys/vm.h
*/
#define PAGE_SIZE 4096
/* MIOCMAP */
struct mapreq
{
void *base;
size_t size;
off_t offset;
int readonly;
};
/* i386 paging constants */
#define I386_VM_PRESENT 0x001 /* Page is present */
#define I386_VM_WRITE 0x002 /* Read/write access allowed */
#define I386_VM_USER 0x004 /* User access allowed */
#define I386_VM_ADDR_MASK 0xFFFFF000 /* physical address */
#define I386_VM_PT_ENT_SIZE 4 /* Size of a page table entry */
#define I386_VM_DIR_ENTRIES 1024 /* Number of entries in a page dir */
#define I386_VM_DIR_ENT_SHIFT 22 /* Shift to get entry in page dir. */
#define I386_VM_PT_ENT_SHIFT 12 /* Shift to get entry in page table */
#define I386_VM_PT_ENT_MASK 0x3FF /* Mask to get entry in page table */
#define I386_CR0_PG 0x80000000 /* Enable paging */

View File

@ -46,11 +46,6 @@ EXTERN reg_t mon_ss, mon_sp; /* boot monitor stack */
EXTERN int mon_return; /* true if we can return to monitor */
EXTERN int do_serial_debug;
/* VM */
EXTERN phys_bytes vm_base;
EXTERN phys_bytes vm_size;
EXTERN phys_bytes vm_mem_high;
/* Variables that are initialized elsewhere are just extern here. */
extern struct boot_image image[]; /* system image processes */
extern char *t_stack[]; /* task stack space */

View File

@ -209,7 +209,7 @@ int how;
*/
kprintf("MINIX will now be shut down ...\n");
tmr_arg(&shutdown_timer)->ta_int = how;
set_timer(&shutdown_timer, get_uptime() + HZ, shutdown);
shutdown(&shutdown_timer);
}
/*===========================================================================*
* shutdown *

View File

@ -145,9 +145,6 @@ _PROTOTYPE( void phys2seg, (u16_t *seg, vir_bytes *off, phys_bytes phys));
_PROTOTYPE( void enable_iop, (struct proc *pp) );
_PROTOTYPE( void alloc_segments, (struct proc *rp) );
/* system/do_vm.c */
_PROTOTYPE( void vm_map_default, (struct proc *pp) );
#endif /* (CHIP == INTEL) */
#if (CHIP == M68000)

View File

@ -75,8 +75,7 @@ PUBLIC void sys_task()
caller_ptr = proc_addr(m.m_source);
/* See if the caller made a valid request and try to handle it. */
if (! (priv(caller_ptr)->s_call_mask & (1<<call_nr)) &&
m.m_type != SYS_IOPENABLE ) {
if (! (priv(caller_ptr)->s_call_mask & (1<<call_nr))) {
#if DEBUG_ENABLE_IPC_WARNINGS
kprintf("SYSTEM: request %d from %d denied.\n", call_nr,m.m_source);
#endif
@ -157,8 +156,6 @@ PRIVATE void initialize(void)
map(SYS_NEWMAP, do_newmap); /* set up a process memory map */
map(SYS_SEGCTL, do_segctl); /* add segment and get selector */
map(SYS_MEMSET, do_memset); /* write char to memory area */
map(SYS_VM_SETBUF, do_vm_setbuf); /* PM passes buffer for page tables */
map(SYS_VM_MAP, do_vm_map); /* Map/unmap physical (device) memory */
/* Copying. */
map(SYS_UMAP, do_umap); /* map virtual to physical address */

View File

@ -92,9 +92,6 @@ _PROTOTYPE( int do_memset, (message *m_ptr) );
#define do_memset do_unused
#endif
_PROTOTYPE( int do_vm_setbuf, (message *m_ptr) );
_PROTOTYPE( int do_vm_map, (message *m_ptr) );
_PROTOTYPE( int do_abort, (message *m_ptr) );
#if ! USE_ABORT
#define do_abort do_unused

View File

@ -44,9 +44,7 @@ OBJECTS = \
$(SYSTEM)(do_sigreturn.o) \
$(SYSTEM)(do_abort.o) \
$(SYSTEM)(do_getinfo.o) \
$(SYSTEM)(do_iopenable.o) \
$(SYSTEM)(do_vm.o) \
$(SYSTEM)(do_vm_setbuf.o) \
$(SYSTEM)(do_iopenable.o)
$(SYSTEM): $(OBJECTS)
aal cr $@ *.o
@ -144,10 +142,3 @@ $(SYSTEM)(do_segctl.o): do_segctl.c
$(SYSTEM)(do_iopenable.o): do_iopenable.c
$(CC) do_iopenable.c
$(SYSTEM)(do_vm.o): do_vm.o
do_vm.o: do_vm.c
$(CC) do_vm.c
$(SYSTEM)(do_vm_setbuf.o): do_vm_setbuf.c
$(CC) do_vm_setbuf.c

View File

@ -126,10 +126,6 @@ register struct proc *rc; /* slot of process to clean up */
irq_hooks[i].proc_nr = NONE; /* mark hook as free */
}
}
/* Clean up virtual memory */
if (rc->p_misc_flags & MF_VM)
vm_map_default(rc);
}
#endif /* USE_EXIT */

View File

@ -1,265 +0,0 @@
/* The system call implemented in this file:
* m_type: SYS_VM_MAP
*
* The parameters for this system call are:
* m4_l1: Process that requests map
* m4_l2: Map (TRUE) or unmap (FALSE)
* m4_l3: Base address
* m4_l4: Size
* m4_l5: Memory address
*/
#include "../system.h"
#include <sys/vm.h>
PRIVATE int vm_needs_init= 1;
PRIVATE u32_t vm_cr3;
FORWARD _PROTOTYPE( void vm_init, (void) );
FORWARD _PROTOTYPE( void phys_put32, (phys_bytes addr, u32_t value) );
FORWARD _PROTOTYPE( u32_t phys_get32, (phys_bytes addr) );
FORWARD _PROTOTYPE( void vm_set_cr3, (u32_t value) );
FORWARD _PROTOTYPE( void set_cr3, (void) );
FORWARD _PROTOTYPE( void vm_enable_paging, (void) );
FORWARD _PROTOTYPE( void map_range, (u32_t base, u32_t size,
u32_t offset) );
#define VM_DEBUG 0 /* enable/ disable debug output */
/*===========================================================================*
* do_vm_setbuf *
*===========================================================================*/
PUBLIC int do_vm_map(m_ptr)
message *m_ptr; /* pointer to request message */
{
int proc_nr, do_map;
phys_bytes base, size, offset, p_phys;
struct proc *pp;
/* do_serial_debug= 1; */
#if VM_DEBUG
kprintf("in do_vm_map\n");
#endif
if (vm_needs_init)
{
vm_needs_init= 0;
vm_init();
}
proc_nr= m_ptr->m4_l1;
do_map= m_ptr->m4_l2;
base= m_ptr->m4_l3;
size= m_ptr->m4_l4;
offset= m_ptr->m4_l5;
pp= proc_addr(proc_nr);
p_phys= umap_local(pp, D, base, size);
if (p_phys == 0)
return EFAULT;
#if VM_DEBUG
kprintf("got 0x%x for 0x%x [D].mem_start = 0x%x\n",
p_phys, base, pp->p_memmap[D].mem_phys);
#endif
if (do_map)
{
#if VM_DEBUG
kprintf(
"do_vm_map: mapping 0x%x @ 0x%x to 0x%x @ proc %d\n",
size, offset, base, proc_nr);
#endif
pp->p_misc_flags |= MF_VM;
map_range(p_phys, size, offset);
}
else
{
map_range(p_phys, size, p_phys);
}
vm_set_cr3(vm_cr3);
return OK;
}
/*===========================================================================*
* vm_map_default *
*===========================================================================*/
PUBLIC void vm_map_default(pp)
struct proc *pp;
{
phys_bytes base_clicks, size_clicks;
if (vm_needs_init)
panic("vm_map_default: VM not initialized?", NO_NUM);
pp->p_misc_flags &= ~MF_VM;
base_clicks= pp->p_memmap[D].mem_phys;
size_clicks= pp->p_memmap[S].mem_phys+pp->p_memmap[S].mem_len -
base_clicks;
map_range(base_clicks << CLICK_SHIFT, size_clicks << CLICK_SHIFT,
base_clicks << CLICK_SHIFT);
vm_set_cr3(vm_cr3);
}
PRIVATE void vm_init(void)
{
int o;
phys_bytes p, pt_size;
phys_bytes vm_dir_base, vm_pt_base, phys_mem;
u32_t entry;
unsigned pages;
#if VM_DEBUG
kprintf("in vm_init\n");
kprintf("%s, %d\n", __FILE__, __LINE__);
#endif
if (!vm_size)
panic("vm_init: no space for page tables", NO_NUM);
/* Align page directory */
o= (vm_base % PAGE_SIZE);
if (o != 0)
o= PAGE_SIZE-o;
vm_dir_base= vm_base+o;
/* Page tables start after the page directory */
vm_pt_base= vm_dir_base+PAGE_SIZE;
pt_size= (vm_base+vm_size)-vm_pt_base;
pt_size -= (pt_size % PAGE_SIZE);
/* Compute the number of pages based on vm_mem_high */
pages= (vm_mem_high-1)/PAGE_SIZE + 1;
if (pages * I386_VM_PT_ENT_SIZE > pt_size)
panic("vm_init: page table too small", NO_NUM);
#if VM_DEBUG
kprintf("%s, %d\n", __FILE__, __LINE__);
#endif
for (p= 0; p*I386_VM_PT_ENT_SIZE < pt_size; p++)
{
phys_mem= p*PAGE_SIZE;
entry= phys_mem | I386_VM_USER | I386_VM_WRITE |
I386_VM_PRESENT;
if (phys_mem >= vm_mem_high)
entry= 0;
phys_put32(vm_pt_base + p*I386_VM_PT_ENT_SIZE, entry);
}
for (p= 0; p < I386_VM_DIR_ENTRIES; p++)
{
phys_mem= vm_pt_base + p*PAGE_SIZE;
entry= phys_mem | I386_VM_USER | I386_VM_WRITE |
I386_VM_PRESENT;
if (phys_mem >= vm_pt_base + pt_size)
entry= 0;
phys_put32(vm_dir_base + p*I386_VM_PT_ENT_SIZE, entry);
}
#if VM_DEBUG
kprintf("%s, %d\n", __FILE__, __LINE__);
#endif
vm_set_cr3(vm_dir_base);
level0(vm_enable_paging);
}
PRIVATE void phys_put32(addr, value)
phys_bytes addr;
u32_t value;
{
#if VM_DEBUG
kprintf("%s, %d: %d bytes from 0x%x to 0x%x\n", __FILE__, __LINE__,
sizeof(value), vir2phys((vir_bytes)&value), addr);
#endif
phys_copy(vir2phys((vir_bytes)&value), addr, sizeof(value));
}
PRIVATE u32_t phys_get32(addr)
phys_bytes addr;
{
u32_t value;
phys_copy(addr, vir2phys((vir_bytes)&value), sizeof(value));
return value;
}
PRIVATE void vm_set_cr3(value)
u32_t value;
{
#if VM_DEBUG
kprintf("%s, %d\n", __FILE__, __LINE__);
#endif
vm_cr3= value;
#if VM_DEBUG
kprintf("%s, %d\n", __FILE__, __LINE__);
#endif
level0(set_cr3);
#if VM_DEBUG
kprintf("%s, %d\n", __FILE__, __LINE__);
#endif
}
PRIVATE void set_cr3()
{
write_cr3(vm_cr3);
}
PRIVATE void vm_enable_paging(void)
{
u32_t cr0;
cr0= read_cr0();
write_cr0(cr0 | I386_CR0_PG);
}
PRIVATE void map_range(base, size, offset)
u32_t base;
u32_t size;
u32_t offset;
{
u32_t curr_pt, curr_pt_addr, entry;
int dir_ent, pt_ent;
if (base % PAGE_SIZE != 0)
panic("map_range: bad base", base);
if (size % PAGE_SIZE != 0)
panic("map_range: bad size", size);
if (offset % PAGE_SIZE != 0)
panic("map_range: bad offset", offset);
curr_pt= -1;
curr_pt_addr= 0;
while (size != 0)
{
dir_ent= (base >> I386_VM_DIR_ENT_SHIFT);
pt_ent= (base >> I386_VM_PT_ENT_SHIFT) & I386_VM_PT_ENT_MASK;
if (dir_ent != curr_pt)
{
/* Get address of page table */
curr_pt= dir_ent;
curr_pt_addr= phys_get32(vm_cr3 +
dir_ent * I386_VM_PT_ENT_SIZE);
curr_pt_addr &= I386_VM_ADDR_MASK;
#if VM_DEBUG
kprintf("got address 0x%x for page table 0x%x\n",
curr_pt_addr, curr_pt);
#endif
}
entry= offset | I386_VM_USER | I386_VM_WRITE |
I386_VM_PRESENT;
#if VM_DEBUG
kprintf(
"putting 0x%x at dir_ent 0x%x, pt_ent 0x%x (addr 0x%x)\n",
entry, dir_ent, pt_ent,
curr_pt_addr + pt_ent * I386_VM_PT_ENT_SIZE);
#endif
phys_put32(curr_pt_addr + pt_ent * I386_VM_PT_ENT_SIZE, entry);
offset += PAGE_SIZE;
base += PAGE_SIZE;
size -= PAGE_SIZE;
}
}

View File

@ -1,29 +0,0 @@
/* The system call implemented in this file:
* m_type: SYS_VM_SETBUF
*
* The parameters for this system call are:
* m4_l1: Start of the buffer
* m4_l2: Length of the buffer
* m4_l3: End of main memory
*/
#include "../system.h"
#define VM_DEBUG 0 /* enable/ disable debug output */
/*===========================================================================*
* do_vm_setbuf *
*===========================================================================*/
PUBLIC int do_vm_setbuf(m_ptr)
message *m_ptr; /* pointer to request message */
{
vm_base= m_ptr->m4_l1;
vm_size= m_ptr->m4_l2;
vm_mem_high= m_ptr->m4_l3;
#if VM_DEBUG
kprintf("do_vm_setbuf: got 0x%x @ 0x%x for 0x%x\n",
vm_size, vm_base, vm_mem_high);
#endif
return OK;
}

View File

@ -83,7 +83,7 @@ PUBLIC char *t_stack[TOT_STACK_SPACE / sizeof(char *)];
#define FS_C (c(SYS_KILL) | c(SYS_VIRCOPY) | c(SYS_VIRVCOPY) | c(SYS_UMAP) | c(SYS_GETINFO) | c(SYS_EXIT) | c(SYS_TIMES) | c(SYS_SETALARM))
#define DRV_C (FS_C | c(SYS_SEGCTL) | c(SYS_IRQCTL) | c(SYS_INT86) | c(SYS_DEVIO) | c(SYS_VDEVIO) | c(SYS_SDEVIO))
#define TTY_C (DRV_C | c(SYS_ABORT))
#define MEM_C (DRV_C | c(SYS_PHYSCOPY) | c(SYS_PHYSVCOPY) | c(SYS_VM_MAP))
#define MEM_C (DRV_C | c(SYS_PHYSCOPY) | c(SYS_PHYSVCOPY))
/* The system image table lists all programs that are part of the boot image.
* The order of the entries here MUST agree with the order of the programs

View File

@ -1,6 +1,7 @@
ACKBASE=$(CURDIR)/obj-ack
GNUBASE=$(CURDIR)/obj-gnu
ZLIB=zlib-1.2.3
OBJDIR=.
@ -23,13 +24,16 @@ SUBDIRS = ansi \
sysutil \
timers \
i386 \
zlib-1.2.3 \
$(ZLIB) \
ack \
gnu
include Makefile.inc
install::
cd $(ZLIB) && $(MAKE) ACKBASE=$(ACKBASE) GNUBASE=$(GNUBASE) install
install:: all
install -o bin $(ACKBASE)/*.[ao] /usr/lib/i386
install -o bin $(GNUBASE)/*.[ao] /usr/gnu/lib

View File

@ -37,8 +37,6 @@ libsys_OBJECTS = \
sys_voutl.o \
sys_setalarm.o \
sys_memset.o \
taskcall.o \
sys_vm_setbuf.o \
sys_vm_map.o \
taskcall.o
include ../Makefile.inc

View File

@ -1,25 +0,0 @@
#include "syslib.h"
/*===========================================================================*
* sys_vm_map *
*===========================================================================*/
PUBLIC int sys_vm_map(proc_nr, do_map, base, size, offset)
int proc_nr;
int do_map;
phys_bytes base;
phys_bytes size;
phys_bytes offset;
{
message m;
int result;
m.m4_l1= proc_nr;
m.m4_l2= do_map;
m.m4_l3= base;
m.m4_l4= size;
m.m4_l5= offset;
result = _taskcall(SYSTASK, SYS_VM_MAP, &m);
return(result);
}

View File

@ -1,21 +0,0 @@
#include "syslib.h"
/*===========================================================================*
* sys_vm_setbuf *
*===========================================================================*/
PUBLIC int sys_vm_setbuf(base, size, high)
phys_bytes base;
phys_bytes size;
phys_bytes high;
{
message m;
int result;
m.m4_l1= base;
m.m4_l2= size;
m.m4_l3= high;
result = _taskcall(SYSTASK, SYS_VM_SETBUF, &m);
return(result);
}

View File

@ -28,7 +28,7 @@ CFLAGS=-D_MINIX=1 -D_POSIX_SOURCE=1
#LDSHARED=cc
#CPP=cc -E
#LIBS=libz.a
LIBS=$(ACKBASE)/libz.a
LIBRARIES=libz
#SHAREDLIB=libz.so
#SHAREDLIBV=libz.so.1.2.2
@ -40,12 +40,12 @@ LIBRARIES=libz
#SHELL=/bin/sh
#EXE=
#prefix =/usr/local
#exec_prefix =${prefix}
#libdir =${exec_prefix}/lib
#includedir =${prefix}/include
#mandir =/usr/local/man
#man3dir = ${mandir}/man3
prefix =/usr/local
exec_prefix =${prefix}
libdir =${exec_prefix}/lib
includedir =${prefix}/include
mandir =/usr/local/man
man3dir = ${mandir}/man3
#OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
# zutil.o inflate.o infback.o inftrees.o inffast.o
@ -95,24 +95,24 @@ libz_OBJECTS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
#minigzip$(EXE): minigzip.o $(LIBS)
# $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
#install: $(LIBS)
# -@if [ ! -d $(exec_prefix) ]; then mkdir -p $(exec_prefix); fi
# -@if [ ! -d $(includedir) ]; then mkdir -p $(includedir); fi
# -@if [ ! -d $(libdir) ]; then mkdir -p $(libdir); fi
# -@if [ ! -d $(man3dir) ]; then mkdir -p $(man3dir); fi
# install -o bin zlib.h zconf.h $(includedir)
# chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h
# install -o bin $(LIBS) $(libdir)
# cd $(libdir); chmod 755 $(LIBS)
# -@(cd $(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
# cd $(libdir); if test -f $(SHAREDLIBV); then \
# rm -f $(SHAREDLIB) $(SHAREDLIBM); \
# ln -s $(SHAREDLIBV) $(SHAREDLIB); \
# ln -s $(SHAREDLIBV) $(SHAREDLIBM); \
# (ldconfig || true) >/dev/null 2>&1; \
# fi
# install -o bin zlib.3 $(man3dir)
# chmod 644 $(man3dir)/zlib.3
install::
-@if [ ! -d $(exec_prefix) ]; then mkdir -p $(exec_prefix); fi
-@if [ ! -d $(includedir) ]; then mkdir -p $(includedir); fi
-@if [ ! -d $(libdir) ]; then mkdir -p $(libdir); fi
-@if [ ! -d $(man3dir) ]; then mkdir -p $(man3dir); fi
install -o bin zlib.h zconf.h $(includedir)
chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h
install -o bin $(LIBS) $(libdir)
cd $(libdir); chmod 755 $(LIBS)
-@(cd $(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
cd $(libdir); if test -f $(SHAREDLIBV); then \
rm -f $(SHAREDLIB) $(SHAREDLIBM); \
ln -s $(SHAREDLIBV) $(SHAREDLIB); \
ln -s $(SHAREDLIBV) $(SHAREDLIBM); \
(ldconfig || true) >/dev/null 2>&1; \
fi
install -o bin zlib.3 $(man3dir)
chmod 644 $(man3dir)/zlib.3
# The ranlib in install is needed on NeXTSTEP which checks file times
# ldconfig is for Linux

View File

@ -49,10 +49,7 @@ int flags; /* mode bits and flags */
major = (dev >> MAJOR) & BYTE;
if (major >= NR_DEVICES) major = 0;
dp = &dmap[major];
if (dp->dmap_driver == NONE) {
printf("FS: open: no driver for dev %x\n", dev);
return EIO;
}
if (dp->dmap_driver == NONE) return ENXIO;
r = (*dp->dmap_opcl)(DEV_OPEN, dev, proc, flags);
if (r == SUSPEND) panic(__FILE__,"suspend on open from", dp->dmap_driver);
return(r);
@ -91,7 +88,6 @@ PUBLIC void dev_status(message *m)
int r;
st.m_type = DEV_STATUS;
if ((r=sendrec(m->m_source, &st)) != OK) {
printf("DEV_STATUS failed to %d: %d\n", m->m_source, r);
if (r == EDEADSRCDST) return;
if (r == EDSTDIED) return;
if (r == ESRCDIED) return;
@ -137,10 +133,7 @@ int flags; /* special flags, like O_NONBLOCK */
dp = &dmap[(dev >> MAJOR) & BYTE];
/* See if driver is roughly valid. */
if (dp->dmap_driver == NONE) {
printf("FS: dev_io: no driver for dev %x\n", dev);
return EIO;
}
if (dp->dmap_driver == NONE) return ENXIO;
/* Set up the message passed to task. */
dev_mess.m_type = op;
@ -438,7 +431,6 @@ int flags; /* mode bits and flags */
PUBLIC void no_dev_io(int proc, message *m)
{
/* Called when doing i/o on a nonexistent device. */
printf("FS: I/O on unmapped device number\n");
return;
}

View File

@ -78,8 +78,10 @@ PUBLIC int main()
printf("FS, warning illegal %d system call by %d\n", call_nr, who);
} else if (fp->fp_pid == PID_FREE) {
error = ENOSYS;
#if FS_VERBOSE
printf("FS, bad process, who = %d, call_nr = %d, slot1 = %d\n",
who, call_nr, m_in.slot1);
#endif
} else {
error = (*call_vec[call_nr])();
}
@ -168,7 +170,9 @@ int result; /* result of the call (usually OK or error #) */
int s;
m_out.reply_type = result;
s = send(whom, &m_out);
#if FS_VERBOSE
if (s != OK) printf("FS: couldn't send reply %d: %d\n", result, s);
#endif
}
/*===========================================================================*

View File

@ -120,8 +120,7 @@ PRIVATE void exit_server()
fkeys = sfkeys = 0;
for (i=1; i<=12; i++) bit_set(fkeys, i);
for (i=1; i<= 7; i++) bit_set(sfkeys, i);
if ((s=fkey_unmap(&fkeys, &sfkeys)) != OK)
report("IS", "warning, unfkey_map failed:", s);
fkey_unmap(&fkeys, &sfkeys);
/* Done. Now exit. */
exit(0);

View File

@ -32,7 +32,6 @@ FORWARD _PROTOTYPE( int get_nice_value, (int queue) );
FORWARD _PROTOTYPE( void get_mem_chunks, (struct memory *mem_chunks) );
FORWARD _PROTOTYPE( void patch_mem_chunks, (struct memory *mem_chunks,
struct mem_map *map_ptr) );
FORWARD _PROTOTYPE( void do_x86_vm, (struct memory mem_chunks[NR_MEMS]) );
#define click_to_round_k(n) \
((unsigned) ((((unsigned long) (n) << CLICK_SHIFT) + 512) / 1024))
@ -254,6 +253,7 @@ PRIVATE void pm_init()
sigfillset(&mproc[PM_PROC_NR].mp_ignore); /* guard against signals */
sigfillset(&mproc[FS_PROC_NR].mp_sig2mess); /* forward signals */
sigfillset(&mproc[TTY_PROC_NR].mp_sig2mess); /* forward signals */
sigfillset(&mproc[MEM_PROC_NR].mp_sig2mess); /* forward signals */
/* Tell FS that no more system processes follow and synchronize. */
mess.PR_PROC_NR = NONE;
@ -270,9 +270,6 @@ PRIVATE void pm_init()
}
#endif /* ENABLE_BOOTDEV */
/* Withhold some memory from x86 VM */
do_x86_vm(mem_chunks);
/* Initialize tables to all physical memory and print memory information. */
printf("Physical memory:");
mem_init(mem_chunks, &free_clicks);
@ -394,64 +391,3 @@ struct mem_map *map_ptr; /* memory to remove */
}
}
#define PAGE_SIZE 4096
#define PAGE_TABLE_COVER (1024*PAGE_SIZE)
/*=========================================================================*
* do_x86_vm *
*=========================================================================*/
PRIVATE void do_x86_vm(mem_chunks)
struct memory mem_chunks[NR_MEMS];
{
phys_bytes high, bytes;
phys_clicks clicks, base_click;
unsigned pages;
int i, r;
/* Compute the highest memory location */
high= 0;
for (i= 0; i<NR_MEMS; i++)
{
if (mem_chunks[i].size == 0)
continue;
if (mem_chunks[i].base + mem_chunks[i].size > high)
high= mem_chunks[i].base + mem_chunks[i].size;
}
high <<= CLICK_SHIFT;
#if VERBOSE_VM
printf("do_x86_vm: found high 0x%x\n", high);
#endif
/* The number of pages we need is one for the page directory, enough
* page tables to cover the memory, and one page for alignement.
*/
pages= 1 + (high + PAGE_TABLE_COVER-1)/PAGE_TABLE_COVER + 1;
bytes= pages*PAGE_SIZE;
clicks= (bytes + CLICK_SIZE-1) >> CLICK_SHIFT;
#if VERBOSE_VM
printf("do_x86_vm: need %d pages\n", pages);
printf("do_x86_vm: need %d bytes\n", bytes);
printf("do_x86_vm: need %d clicks\n", clicks);
#endif
for (i= 0; i<NR_MEMS; i++)
{
if (mem_chunks[i].size <= clicks)
continue;
break;
}
if (i >= NR_MEMS)
panic("PM", "not enough memory for VM page tables?", NO_NUM);
base_click= mem_chunks[i].base;
mem_chunks[i].base += clicks;
mem_chunks[i].size -= clicks;
#if VERBOSE_VM
printf("do_x86_vm: using 0x%x clicks @ 0x%x\n", clicks, base_click);
#endif
r= sys_vm_setbuf(base_click << CLICK_SHIFT, clicks << CLICK_SHIFT,
high);
if (r != 0)
printf("do_x86_vm: sys_vm_setbuf failed: %d\n", r);
}

View File

@ -1,5 +1,6 @@
#!/bin/sh
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
export PATH
cd /usr/src || exit 1
make etcfiles
su bin -c 'make world install' || exit 1

View File

@ -67,8 +67,9 @@ BS=4096
HDEMU=0
COPY=0
CVSTAG=HEAD
CHECKOUTLIST=src
while getopts "ch?" c
while getopts "sr:ch?" c
do
case "$c" in
\?)
@ -86,15 +87,18 @@ do
;;
r)
CVSTAG=$OPTARG
;;
s) CHECKOUTLIST="src/LICENSE src/Makefile src/boot src/drivers src/etc src/include src/kernel src/lib src/man src/servers src/test src/tools src/commands/Makefile src/commands/aal src/commands/advent src/commands/ash src/commands/autil src/commands/awk src/commands/bc src/commands/bigmake.inc src/commands/byacc src/commands/cawf src/commands/cron src/commands/de src/commands/dhcpd src/commands/dis88 src/commands/elle src/commands/elvis src/commands/ftp src/commands/ftpd src/commands/ftpd200 src/commands/gzip-1.2.4 src/commands/httpd src/commands/i386 src/commands/i86 src/commands/ibm src/commands/indent src/commands/m4 src/commands/make src/commands/mdb src/commands/mined src/commands/nvi-1.79 src/commands/patch src/commands/ps src/commands/reboot src/commands/rlogind src/commands/scripts src/commands/sh src/commands/simple src/commands/talk src/commands/talkd src/commands/telnet src/commands/telnetd src/commands/urlget src/commands/yap src/commands/zmodem"
;;
esac
done
ISO=${ISO}.iso
ISO=${ISO}_${CVSTAG}.iso
ISOGZ=${ISO}.gz
echo "Making $ISOGZ"
USRMB=600
USRMB=200
USRBLOCKS="`expr $USRMB \* 1024 \* 1024 / $BS`"
USRSECTS="`expr $USRMB \* 1024 \* 2`"
@ -109,13 +113,21 @@ then
echo ""
fi
echo "Warning: I'm going to mkfs $RAM! It has to be at least $ROOTKB KB."
echo ""
echo "Temporary (sub)partition to use to make the /usr FS image? "
echo "I need $USRMB MB. It will be mkfsed!"
echo -n "Device: /dev/"
read dev || exit 1
TMPDISK=/dev/$dev
TD1=.td1
TD2=.td2
if [ -f $TD1 ]
then TMPDISK="`cat $TD1`"
else
echo "Warning: I'm going to mkfs $RAM!"
echo "It has to be at least $ROOTKB KB."
echo ""
echo "Temporary (sub)partition to use to make the /usr FS image? "
echo "I need $USRMB MB. It will be mkfsed!"
echo -n "Device: /dev/"
read dev || exit 1
TMPDISK=/dev/$dev
fi
if [ -b $TMPDISK ]
then :
@ -123,11 +135,17 @@ else echo "$TMPDISK is not a block device.."
exit 1
fi
echo "Temporary (sub)partition to use for /tmp? "
echo "It will be mkfsed!"
echo -n "Device: /dev/"
read dev || exit 1
TMPDISK2=/dev/$dev
echo $TMPDISK >$TD1
if [ -f $TD2 ]
then TMPDISK2="`cat $TD2`"
else
echo "Temporary (sub)partition to use for /tmp? "
echo "It will be mkfsed!"
echo -n "Device: /dev/"
read dev || exit 1
TMPDISK2=/dev/$dev
fi
if [ -b $TMPDISK2 ]
then :
@ -135,6 +153,8 @@ else echo "$TMPDISK2 is not a block device.."
exit 1
fi
echo $TMPDISK2 >$TD2
umount $TMPDISK
umount $TMPDISK2
umount $RAM
@ -143,8 +163,6 @@ echo " * Cleanup old files"
rm -rf $RELEASEDIR $ISO $IMAGE $ROOTIMAGE $ISOGZ $CDFILES
mkdir -p $CDFILES || exit
mkdir -p $RELEASEDIR
echo " * Zeroing $RAM"
dd if=/dev/zero of=$RAM bs=$BS count=$ROOTBLOCKS
mkfs -B $BS -b $ROOTBLOCKS $RAM || exit
mkfs $TMPDISK2 || exit
echo " * mounting $RAM as $RELEASEDIR"
@ -153,8 +171,6 @@ mkdir -m 755 $RELEASEDIR/usr
mkdir -m 1777 $RELEASEDIR/tmp
mount $TMPDISK2 $RELEASEDIR/tmp
echo " * Zeroing $TMPDISK"
dd if=/dev/zero of=$TMPDISK bs=$BS count=$USRBLOCKS
mkfs -B $BS -b $USRBLOCKS $TMPDISK || exit
echo " * Mounting $TMPDISK as $RELEASEDIR/usr"
mount $TMPDISK $RELEASEDIR/usr || exit
@ -171,7 +187,7 @@ chmod -R u+w $RELEASEDIR/usr/lib
if [ "$COPY" -ne 1 ]
then
echo " * Doing new cvs export"
( cd $RELEASEDIR/usr && mkdir src && cvs export -r$CVSTAG src )
( cd $RELEASEDIR/usr && mkdir src && cvs export -r$CVSTAG $CHECKOUTLIST )
else
( cd .. && make clean )
srcdir=/usr/src
@ -210,6 +226,11 @@ du -s $RELEASEDIR/usr/src.* | awk '{ t += $1 } END { print t }' >$RELEASEDIR/.ex
( for d in $RELEASEDIR/usr/src.*; do find $d; done) | wc -l >$RELEASEDIR/.extrasrcfiles
find $RELEASEDIR/usr | wc -l >$RELEASEDIR/.usrfiles
find $RELEASEDIR -xdev | wc -l >$RELEASEDIR/.rootfiles
echo " * Scrubbing /.."
cp /dev/zero $RELEASEDIR/.z ; rm $RELEASEDIR/.z
echo " * Scrubbing /usr.."
cp /dev/zero $RELEASEDIR/usr/.z ; rm $RELEASEDIR/usr/.z
echo " * Scrubbing done."
umount $TMPDISK || exit
umount $TMPDISK2 || exit
umount $RAM || exit