2005-04-21 16:53:53 +02:00
|
|
|
/* Function prototypes. */
|
|
|
|
|
2010-09-15 16:09:52 +02:00
|
|
|
/* FIXME this is a hack how to avoid inclusion conflicts */
|
|
|
|
#ifdef __kernel__
|
|
|
|
|
2005-04-21 16:53:53 +02:00
|
|
|
#ifndef PROTO_H
|
|
|
|
#define PROTO_H
|
|
|
|
|
2006-06-20 11:57:00 +02:00
|
|
|
#include <minix/safecopies.h>
|
2010-03-09 10:41:14 +01:00
|
|
|
#include <machine/archtypes.h>
|
2010-06-03 13:32:22 +02:00
|
|
|
#include <sys/sigcontext.h>
|
2008-11-19 13:26:10 +01:00
|
|
|
#include <a.out.h>
|
2006-06-20 11:57:00 +02:00
|
|
|
|
2005-04-21 16:53:53 +02:00
|
|
|
/* Struct declarations. */
|
|
|
|
struct proc;
|
|
|
|
struct timer;
|
|
|
|
|
|
|
|
/* clock.c */
|
|
|
|
_PROTOTYPE( clock_t get_uptime, (void) );
|
|
|
|
_PROTOTYPE( void set_timer, (struct timer *tp, clock_t t, tmr_func_t f) );
|
2005-07-14 17:12:12 +02:00
|
|
|
_PROTOTYPE( void reset_timer, (struct timer *tp) );
|
2007-04-23 15:36:11 +02:00
|
|
|
_PROTOTYPE( void ser_dump_proc, (void) );
|
2005-04-21 16:53:53 +02:00
|
|
|
|
2010-02-10 16:36:54 +01:00
|
|
|
_PROTOTYPE( void cycles_accounting_init, (void) );
|
|
|
|
/*
|
|
|
|
* This functions start and stop accounting for process, kernel or idle cycles.
|
|
|
|
* It inherently have to account for some kernel cycles for process too,
|
|
|
|
* therefore it should be called asap after trapping to kernel and as late as
|
|
|
|
* possible before returning to userspace. These function is architecture
|
|
|
|
* dependent
|
|
|
|
*/
|
2010-05-18 15:00:39 +02:00
|
|
|
_PROTOTYPE( void context_stop, (struct proc * p) );
|
2010-02-10 16:36:54 +01:00
|
|
|
/* this is a wrapper to make calling it from assembly easier */
|
2010-05-18 15:00:39 +02:00
|
|
|
_PROTOTYPE( void context_stop_idle, (void) );
|
2010-06-03 13:32:22 +02:00
|
|
|
_PROTOTYPE( void restore_fpu, (struct proc *) );
|
|
|
|
_PROTOTYPE( void save_fpu, (struct proc *) );
|
2010-09-15 16:11:25 +02:00
|
|
|
_PROTOTYPE( void save_local_fpu, (struct proc *) );
|
2010-06-03 13:32:22 +02:00
|
|
|
_PROTOTYPE( void fpu_sigcontext, (struct proc *, struct sigframe *fr, struct sigcontext *sc) );
|
2010-02-10 16:36:54 +01:00
|
|
|
|
2005-04-21 16:53:53 +02:00
|
|
|
/* main.c */
|
2010-07-06 14:14:59 +02:00
|
|
|
_PROTOTYPE( int main, (void) );
|
2005-07-27 16:32:16 +02:00
|
|
|
_PROTOTYPE( void prepare_shutdown, (int how) );
|
2010-07-06 13:59:19 +02:00
|
|
|
_PROTOTYPE( __dead void minix_shutdown, (struct timer *tp) );
|
2010-09-15 16:09:52 +02:00
|
|
|
_PROTOTYPE( void bsp_finish_booting, (void) );
|
2005-04-21 16:53:53 +02:00
|
|
|
|
|
|
|
/* proc.c */
|
2010-04-06 13:24:26 +02:00
|
|
|
|
|
|
|
_PROTOTYPE( int do_ipc, (reg_t r1, reg_t r2, reg_t r3) );
|
2010-09-15 16:09:43 +02:00
|
|
|
_PROTOTYPE( void proc_init, (void) );
|
2011-04-08 17:14:48 +02:00
|
|
|
_PROTOTYPE( int has_pending, (sys_map_t *map, int src_p) );
|
|
|
|
_PROTOTYPE( int cancel_async, (struct proc *src, struct proc *dst) );
|
2010-03-27 15:31:00 +01:00
|
|
|
_PROTOTYPE( int mini_notify, (const struct proc *src, endpoint_t dst) );
|
2008-11-19 13:26:10 +01:00
|
|
|
_PROTOTYPE( void enqueue, (struct proc *rp) );
|
2010-09-19 17:52:12 +02:00
|
|
|
_PROTOTYPE( void dequeue, (struct proc *rp) );
|
2010-05-18 15:00:39 +02:00
|
|
|
_PROTOTYPE( void switch_to_user, (void) );
|
|
|
|
_PROTOTYPE( struct proc * arch_finish_switch_to_user, (void) );
|
2008-11-19 13:26:10 +01:00
|
|
|
_PROTOTYPE( struct proc *endpoint_lookup, (endpoint_t ep) );
|
'proc number' is process slot, 'endpoint' are generation-aware process
instance numbers, encoded and decoded using macros in <minix/endpoint.h>.
proc number -> endpoint migration
. proc_nr in the interrupt hook is now an endpoint, proc_nr_e.
. m_source for messages and notifies is now an endpoint, instead of
proc number.
. isokendpt() converts an endpoint to a process number, returns
success (but fails if the process number is out of range, the
process slot is not a living process, or the given endpoint
number does not match the endpoint number in the process slot,
indicating an old process).
. okendpt() is the same as isokendpt(), but panic()s if the conversion
fails. This is mainly used for decoding message.m_source endpoints,
and other endpoint numbers in kernel data structures, which should
always be correct.
. if DEBUG_ENABLE_IPC_WARNINGS is enabled, isokendpt() and okendpt()
get passed the __FILE__ and __LINE__ of the calling lines, and
print messages about what is wrong with the endpoint number
(out of range proc, empty proc, or inconsistent endpoint number),
with the caller, making finding where the conversion failed easy
without having to include code for every call to print where things
went wrong. Sometimes this is harmless (wrong arg to a kernel call),
sometimes it's a fatal internal inconsistency (bogus m_source).
. some process table fields have been appended an _e to indicate it's
become and endpoint.
. process endpoint is stored in p_endpoint, without generation number.
it turns out the kernel never needs the generation number, except
when fork()ing, so it's decoded then.
. kernel calls all take endpoints as arguments, not proc numbers.
the one exception is sys_fork(), which needs to know in which slot
to put the child.
2006-03-03 11:00:02 +01:00
|
|
|
#if DEBUG_ENABLE_IPC_WARNINGS
|
2010-03-27 15:31:00 +01:00
|
|
|
_PROTOTYPE( int isokendpt_f, (const char *file, int line, endpoint_t e, int *p, int f));
|
'proc number' is process slot, 'endpoint' are generation-aware process
instance numbers, encoded and decoded using macros in <minix/endpoint.h>.
proc number -> endpoint migration
. proc_nr in the interrupt hook is now an endpoint, proc_nr_e.
. m_source for messages and notifies is now an endpoint, instead of
proc number.
. isokendpt() converts an endpoint to a process number, returns
success (but fails if the process number is out of range, the
process slot is not a living process, or the given endpoint
number does not match the endpoint number in the process slot,
indicating an old process).
. okendpt() is the same as isokendpt(), but panic()s if the conversion
fails. This is mainly used for decoding message.m_source endpoints,
and other endpoint numbers in kernel data structures, which should
always be correct.
. if DEBUG_ENABLE_IPC_WARNINGS is enabled, isokendpt() and okendpt()
get passed the __FILE__ and __LINE__ of the calling lines, and
print messages about what is wrong with the endpoint number
(out of range proc, empty proc, or inconsistent endpoint number),
with the caller, making finding where the conversion failed easy
without having to include code for every call to print where things
went wrong. Sometimes this is harmless (wrong arg to a kernel call),
sometimes it's a fatal internal inconsistency (bogus m_source).
. some process table fields have been appended an _e to indicate it's
become and endpoint.
. process endpoint is stored in p_endpoint, without generation number.
it turns out the kernel never needs the generation number, except
when fork()ing, so it's decoded then.
. kernel calls all take endpoints as arguments, not proc numbers.
the one exception is sys_fork(), which needs to know in which slot
to put the child.
2006-03-03 11:00:02 +01:00
|
|
|
#define isokendpt_d(e, p, f) isokendpt_f(__FILE__, __LINE__, (e), (p), (f))
|
|
|
|
#else
|
2006-06-20 11:57:00 +02:00
|
|
|
_PROTOTYPE( int isokendpt_f, (endpoint_t e, int *p, int f) );
|
'proc number' is process slot, 'endpoint' are generation-aware process
instance numbers, encoded and decoded using macros in <minix/endpoint.h>.
proc number -> endpoint migration
. proc_nr in the interrupt hook is now an endpoint, proc_nr_e.
. m_source for messages and notifies is now an endpoint, instead of
proc number.
. isokendpt() converts an endpoint to a process number, returns
success (but fails if the process number is out of range, the
process slot is not a living process, or the given endpoint
number does not match the endpoint number in the process slot,
indicating an old process).
. okendpt() is the same as isokendpt(), but panic()s if the conversion
fails. This is mainly used for decoding message.m_source endpoints,
and other endpoint numbers in kernel data structures, which should
always be correct.
. if DEBUG_ENABLE_IPC_WARNINGS is enabled, isokendpt() and okendpt()
get passed the __FILE__ and __LINE__ of the calling lines, and
print messages about what is wrong with the endpoint number
(out of range proc, empty proc, or inconsistent endpoint number),
with the caller, making finding where the conversion failed easy
without having to include code for every call to print where things
went wrong. Sometimes this is harmless (wrong arg to a kernel call),
sometimes it's a fatal internal inconsistency (bogus m_source).
. some process table fields have been appended an _e to indicate it's
become and endpoint.
. process endpoint is stored in p_endpoint, without generation number.
it turns out the kernel never needs the generation number, except
when fork()ing, so it's decoded then.
. kernel calls all take endpoints as arguments, not proc numbers.
the one exception is sys_fork(), which needs to know in which slot
to put the child.
2006-03-03 11:00:02 +01:00
|
|
|
#define isokendpt_d(e, p, f) isokendpt_f((e), (p), (f))
|
|
|
|
#endif
|
2010-05-25 10:06:14 +02:00
|
|
|
_PROTOTYPE( void proc_no_time, (struct proc *p));
|
2010-09-19 17:52:12 +02:00
|
|
|
_PROTOTYPE( void reset_proc_accounting, (struct proc *p));
|
|
|
|
_PROTOTYPE( void flag_account, (struct proc *p, int flag));
|
2005-04-21 16:53:53 +02:00
|
|
|
|
|
|
|
/* start.c */
|
2010-04-21 13:05:22 +02:00
|
|
|
_PROTOTYPE( void cstart, (u16_t cs, u16_t ds, u16_t mds,
|
|
|
|
u16_t parmoff, u16_t parmsize) );
|
2010-05-19 12:00:02 +02:00
|
|
|
_PROTOTYPE( char *env_get, (const char *key));
|
2005-04-21 16:53:53 +02:00
|
|
|
|
|
|
|
/* system.c */
|
2005-08-04 11:26:36 +02:00
|
|
|
_PROTOTYPE( int get_priv, (register struct proc *rc, int proc_type) );
|
2010-03-27 15:31:00 +01:00
|
|
|
_PROTOTYPE( void set_sendto_bit, (const struct proc *rc, int id) );
|
|
|
|
_PROTOTYPE( void unset_sendto_bit, (const struct proc *rc, int id) );
|
2010-12-07 11:32:42 +01:00
|
|
|
_PROTOTYPE( void fill_sendto_mask, (const struct proc *rc,
|
|
|
|
sys_map_t *map) );
|
2010-03-30 16:07:15 +02:00
|
|
|
_PROTOTYPE( void send_sig, (endpoint_t proc_nr, int sig_nr) );
|
2010-01-26 13:26:06 +01:00
|
|
|
_PROTOTYPE( void cause_sig, (proc_nr_t proc_nr, int sig_nr) );
|
Merge of David's ptrace branch. Summary:
o Support for ptrace T_ATTACH/T_DETACH and T_SYSCALL
o PM signal handling logic should now work properly, even with debuggers
being present
o Asynchronous PM/VFS protocol, full IPC support for senda(), and
AMF_NOREPLY senda() flag
DETAILS
Process stop and delay call handling of PM:
o Added sys_runctl() kernel call with sys_stop() and sys_resume()
aliases, for PM to stop and resume a process
o Added exception for sending/syscall-traced processes to sys_runctl(),
and matching SIGKREADY pseudo-signal to PM
o Fixed PM signal logic to deal with requests from a process after
stopping it (so-called "delay calls"), using the SIGKREADY facility
o Fixed various PM panics due to race conditions with delay calls versus
VFS calls
o Removed special PRIO_STOP priority value
o Added SYS_LOCK RTS kernel flag, to stop an individual process from
running while modifying its process structure
Signal and debugger handling in PM:
o Fixed debugger signals being dropped if a second signal arrives when
the debugger has not retrieved the first one
o Fixed debugger signals being sent to the debugger more than once
o Fixed debugger signals unpausing process in VFS; removed PM_UNPAUSE_TR
protocol message
o Detached debugger signals from general signal logic and from being
blocked on VFS calls, meaning that even VFS can now be traced
o Fixed debugger being unable to receive more than one pending signal in
one process stop
o Fixed signal delivery being delayed needlessly when multiple signals
are pending
o Fixed wait test for tracer, which was returning for children that were
not waited for
o Removed second parallel pending call from PM to VFS for any process
o Fixed process becoming runnable between exec() and debugger trap
o Added support for notifying the debugger before the parent when a
debugged child exits
o Fixed debugger death causing child to remain stopped forever
o Fixed consistently incorrect use of _NSIG
Extensions to ptrace():
o Added T_ATTACH and T_DETACH ptrace request, to attach and detach a
debugger to and from a process
o Added T_SYSCALL ptrace request, to trace system calls
o Added T_SETOPT ptrace request, to set trace options
o Added TO_TRACEFORK trace option, to attach automatically to children
of a traced process
o Added TO_ALTEXEC trace option, to send SIGSTOP instead of SIGTRAP upon
a successful exec() of the tracee
o Extended T_GETUSER ptrace support to allow retrieving a process's priv
structure
o Removed T_STOP ptrace request again, as it does not help implementing
debuggers properly
o Added MINIX3-specific ptrace test (test42)
o Added proper manual page for ptrace(2)
Asynchronous PM/VFS interface:
o Fixed asynchronous messages not being checked when receive() is called
with an endpoint other than ANY
o Added AMF_NOREPLY senda() flag, preventing such messages from
satisfying the receive part of a sendrec()
o Added asynsend3() that takes optional flags; asynsend() is now a
#define passing in 0 as third parameter
o Made PM/VFS protocol asynchronous; reintroduced tell_fs()
o Made PM_BASE request/reply number range unique
o Hacked in a horrible temporary workaround into RS to deal with newly
revealed RS-PM-VFS race condition triangle until VFS is asynchronous
System signal handling:
o Fixed shutdown logic of device drivers; removed old SIGKSTOP signal
o Removed is-superuser check from PM's do_procstat() (aka getsigset())
o Added sigset macros to allow system processes to deal with the full
signal set, rather than just the POSIX subset
Miscellaneous PM fixes:
o Split do_getset into do_get and do_set, merging common code and making
structure clearer
o Fixed setpriority() being able to put to sleep processes using an
invalid parameter, or revive zombie processes
o Made find_proc() global; removed obsolete proc_from_pid()
o Cleanup here and there
Also included:
o Fixed false-positive boot order kernel warning
o Removed last traces of old NOTIFY_FROM code
THINGS OF POSSIBLE INTEREST
o It should now be possible to run PM at any priority, even lower than
user processes
o No assumptions are made about communication speed between PM and VFS,
although communication must be FIFO
o A debugger will now receive incoming debuggee signals at kill time
only; the process may not yet be fully stopped
o A first step has been made towards making the SYSTEM task preemptible
2009-09-30 11:57:22 +02:00
|
|
|
_PROTOTYPE( void sig_delay_done, (struct proc *rp) );
|
2010-02-09 16:20:09 +01:00
|
|
|
_PROTOTYPE( void kernel_call, (message *m_user, struct proc * caller) );
|
2010-02-09 16:12:20 +01:00
|
|
|
_PROTOTYPE( void system_init, (void) );
|
2005-08-04 11:26:36 +02:00
|
|
|
#define numap_local(proc_nr, vir_addr, bytes) \
|
|
|
|
umap_local(proc_addr(proc_nr), D, (vir_addr), (bytes))
|
2010-02-03 10:04:48 +01:00
|
|
|
_PROTOTYPE( phys_bytes umap_grant, (struct proc *, cp_grant_id_t, vir_bytes));
|
2006-03-15 13:01:59 +01:00
|
|
|
_PROTOTYPE( void clear_endpoint, (struct proc *rc) );
|
2010-04-08 15:41:35 +02:00
|
|
|
_PROTOTYPE( void clear_ipc_refs, (struct proc *rc, int caller_ret) );
|
2008-11-19 13:26:10 +01:00
|
|
|
_PROTOTYPE( phys_bytes umap_bios, (vir_bytes vir_addr, vir_bytes bytes));
|
2010-02-09 16:20:09 +01:00
|
|
|
_PROTOTYPE( void kernel_call_resume, (struct proc *p));
|
2010-07-13 17:30:17 +02:00
|
|
|
_PROTOTYPE( int sched_proc, (struct proc *rp,
|
2010-09-15 16:10:42 +02:00
|
|
|
int priority, int quantum, int cpu));
|
2008-11-19 13:26:10 +01:00
|
|
|
|
2006-05-11 16:49:46 +02:00
|
|
|
/* system/do_newmap.c */
|
2010-02-03 10:04:48 +01:00
|
|
|
_PROTOTYPE( int newmap, (struct proc * caller, struct proc *rp,
|
|
|
|
struct mem_map *map_ptr));
|
2006-05-11 16:49:46 +02:00
|
|
|
|
2009-08-15 23:37:26 +02:00
|
|
|
/* system/do_vtimer.c */
|
|
|
|
_PROTOTYPE( void vtimer_check, (struct proc *rp) );
|
|
|
|
|
Split of architecture-dependent and -independent functions for i386,
mainly in the kernel and headers. This split based on work by
Ingmar Alting <iaalting@cs.vu.nl> done for his Minix PowerPC architecture
port.
. kernel does not program the interrupt controller directly, do any
other architecture-dependent operations, or contain assembly any more,
but uses architecture-dependent functions in arch/$(ARCH)/.
. architecture-dependent constants and types defined in arch/$(ARCH)/include.
. <ibm/portio.h> moved to <minix/portio.h>, as they have become, for now,
architecture-independent functions.
. int86, sdevio, readbios, and iopenable are now i386-specific kernel calls
and live in arch/i386/do_* now.
. i386 arch now supports even less 86 code; e.g. mpx86.s and klib86.s have
gone, and 'machine.protected' is gone (and always taken to be 1 in i386).
If 86 support is to return, it should be a new architecture.
. prototypes for the architecture-dependent functions defined in
kernel/arch/$(ARCH)/*.c but used in kernel/ are in kernel/proto.h
. /etc/make.conf included in makefiles and shell scripts that need to
know the building architecture; it defines ARCH=<arch>, currently only
i386.
. some basic per-architecture build support outside of the kernel (lib)
. in clock.c, only dequeue a process if it was ready
. fixes for new include files
files deleted:
. mpx/klib.s - only for choosing between mpx/klib86 and -386
. klib86.s - only for 86
i386-specific files files moved (or arch-dependent stuff moved) to arch/i386/:
. mpx386.s (entry point)
. klib386.s
. sconst.h
. exception.c
. protect.c
. protect.h
. i8269.c
2006-12-22 16:22:27 +01:00
|
|
|
/* interrupt.c */
|
2005-04-21 16:53:53 +02:00
|
|
|
_PROTOTYPE( void put_irq_handler, (irq_hook_t *hook, int irq,
|
Split of architecture-dependent and -independent functions for i386,
mainly in the kernel and headers. This split based on work by
Ingmar Alting <iaalting@cs.vu.nl> done for his Minix PowerPC architecture
port.
. kernel does not program the interrupt controller directly, do any
other architecture-dependent operations, or contain assembly any more,
but uses architecture-dependent functions in arch/$(ARCH)/.
. architecture-dependent constants and types defined in arch/$(ARCH)/include.
. <ibm/portio.h> moved to <minix/portio.h>, as they have become, for now,
architecture-independent functions.
. int86, sdevio, readbios, and iopenable are now i386-specific kernel calls
and live in arch/i386/do_* now.
. i386 arch now supports even less 86 code; e.g. mpx86.s and klib86.s have
gone, and 'machine.protected' is gone (and always taken to be 1 in i386).
If 86 support is to return, it should be a new architecture.
. prototypes for the architecture-dependent functions defined in
kernel/arch/$(ARCH)/*.c but used in kernel/ are in kernel/proto.h
. /etc/make.conf included in makefiles and shell scripts that need to
know the building architecture; it defines ARCH=<arch>, currently only
i386.
. some basic per-architecture build support outside of the kernel (lib)
. in clock.c, only dequeue a process if it was ready
. fixes for new include files
files deleted:
. mpx/klib.s - only for choosing between mpx/klib86 and -386
. klib86.s - only for 86
i386-specific files files moved (or arch-dependent stuff moved) to arch/i386/:
. mpx386.s (entry point)
. klib386.s
. sconst.h
. exception.c
. protect.c
. protect.h
. i8269.c
2006-12-22 16:22:27 +01:00
|
|
|
irq_handler_t handler) );
|
2010-03-27 15:31:00 +01:00
|
|
|
_PROTOTYPE( void rm_irq_handler, (const irq_hook_t *hook) );
|
|
|
|
_PROTOTYPE( void enable_irq, (const irq_hook_t *hook) );
|
|
|
|
_PROTOTYPE( int disable_irq, (const irq_hook_t *hook) );
|
Split of architecture-dependent and -independent functions for i386,
mainly in the kernel and headers. This split based on work by
Ingmar Alting <iaalting@cs.vu.nl> done for his Minix PowerPC architecture
port.
. kernel does not program the interrupt controller directly, do any
other architecture-dependent operations, or contain assembly any more,
but uses architecture-dependent functions in arch/$(ARCH)/.
. architecture-dependent constants and types defined in arch/$(ARCH)/include.
. <ibm/portio.h> moved to <minix/portio.h>, as they have become, for now,
architecture-independent functions.
. int86, sdevio, readbios, and iopenable are now i386-specific kernel calls
and live in arch/i386/do_* now.
. i386 arch now supports even less 86 code; e.g. mpx86.s and klib86.s have
gone, and 'machine.protected' is gone (and always taken to be 1 in i386).
If 86 support is to return, it should be a new architecture.
. prototypes for the architecture-dependent functions defined in
kernel/arch/$(ARCH)/*.c but used in kernel/ are in kernel/proto.h
. /etc/make.conf included in makefiles and shell scripts that need to
know the building architecture; it defines ARCH=<arch>, currently only
i386.
. some basic per-architecture build support outside of the kernel (lib)
. in clock.c, only dequeue a process if it was ready
. fixes for new include files
files deleted:
. mpx/klib.s - only for choosing between mpx/klib86 and -386
. klib86.s - only for 86
i386-specific files files moved (or arch-dependent stuff moved) to arch/i386/:
. mpx386.s (entry point)
. klib386.s
. sconst.h
. exception.c
. protect.c
. protect.h
. i8269.c
2006-12-22 16:22:27 +01:00
|
|
|
|
2010-09-23 12:49:52 +02:00
|
|
|
_PROTOTYPE(void interrupts_enable, (void));
|
|
|
|
_PROTOTYPE(void interrupts_disable, (void));
|
|
|
|
|
Split of architecture-dependent and -independent functions for i386,
mainly in the kernel and headers. This split based on work by
Ingmar Alting <iaalting@cs.vu.nl> done for his Minix PowerPC architecture
port.
. kernel does not program the interrupt controller directly, do any
other architecture-dependent operations, or contain assembly any more,
but uses architecture-dependent functions in arch/$(ARCH)/.
. architecture-dependent constants and types defined in arch/$(ARCH)/include.
. <ibm/portio.h> moved to <minix/portio.h>, as they have become, for now,
architecture-independent functions.
. int86, sdevio, readbios, and iopenable are now i386-specific kernel calls
and live in arch/i386/do_* now.
. i386 arch now supports even less 86 code; e.g. mpx86.s and klib86.s have
gone, and 'machine.protected' is gone (and always taken to be 1 in i386).
If 86 support is to return, it should be a new architecture.
. prototypes for the architecture-dependent functions defined in
kernel/arch/$(ARCH)/*.c but used in kernel/ are in kernel/proto.h
. /etc/make.conf included in makefiles and shell scripts that need to
know the building architecture; it defines ARCH=<arch>, currently only
i386.
. some basic per-architecture build support outside of the kernel (lib)
. in clock.c, only dequeue a process if it was ready
. fixes for new include files
files deleted:
. mpx/klib.s - only for choosing between mpx/klib86 and -386
. klib86.s - only for 86
i386-specific files files moved (or arch-dependent stuff moved) to arch/i386/:
. mpx386.s (entry point)
. klib386.s
. sconst.h
. exception.c
. protect.c
. protect.h
. i8269.c
2006-12-22 16:22:27 +01:00
|
|
|
/* debug.c */
|
2010-03-10 14:00:05 +01:00
|
|
|
_PROTOTYPE( int runqueues_ok, (void) );
|
2010-09-15 16:10:18 +02:00
|
|
|
#ifndef CONFIG_SMP
|
|
|
|
#define runqueues_ok_local runqueues_ok
|
|
|
|
#else
|
|
|
|
#define runqueues_ok_local() runqueues_ok_cpu(cpuid)
|
|
|
|
_PROTOTYPE( int runqueues_ok_cpu, (unsigned cpu));
|
|
|
|
#endif
|
2010-09-23 12:49:36 +02:00
|
|
|
_PROTOTYPE( char *rtsflagstr, (u32_t flags) );
|
|
|
|
_PROTOTYPE( char *miscflagstr, (u32_t flags) );
|
Userspace scheduling
- cotributed by Bjorn Swift
- In this first phase, scheduling is moved from the kernel to the PM
server. The next steps are to a) moving scheduling to its own server
and b) include useful information in the "out of quantum" message,
so that the scheduler can make use of this information.
- The kernel process table now keeps record of who is responsible for
scheduling each process (p_scheduler). When this pointer is NULL,
the process will be scheduled by the kernel. If such a process runs
out of quantum, the kernel will simply renew its quantum an requeue
it.
- When PM loads, it will take over scheduling of all running
processes, except system processes, using sys_schedctl().
Essentially, this only results in taking over init. As children
inherit a scheduler from their parent, user space programs forked by
init will inherit PM (for now) as their scheduler.
- Once a process has been assigned a scheduler, and runs out of
quantum, its RTS_NO_QUANTUM flag will be set and the process
dequeued. The kernel will send a message to the scheduler, on the
process' behalf, informing the scheduler that it has run out of
quantum. The scheduler can take what ever action it pleases, based
on its policy, and then reschedule the process using the
sys_schedule() system call.
- Balance queues does not work as before. While the old in-kernel
function used to renew the quantum of processes in the highest
priority run queue, the user-space implementation only acts on
processes that have been bumped down to a lower priority queue.
This approach reacts slower to changes than the old one, but saves
us sending a sys_schedule message for each process every time we
balance the queues. Currently, when processes are moved up a
priority queue, their quantum is also renewed, but this can be
fiddled with.
- do_nice has been removed from kernel. PM answers to get- and
setpriority calls, updates it's own nice variable as well as the
max_run_queue. This will be refactored once scheduling is moved to a
separate server. We will probably have PM update it's local nice
value and then send a message to whoever is scheduling the process.
- changes to fix an issue in do_fork() where processes could run out
of quantum but bypassing the code path that handles it correctly.
The future plan is to remove the policy from do_fork() and implement
it in userspace too.
2010-03-29 13:07:20 +02:00
|
|
|
_PROTOTYPE( char *schedulerstr, (struct proc *scheduler) );
|
2010-05-03 19:37:18 +02:00
|
|
|
/* prints process information */
|
|
|
|
_PROTOTYPE( void print_proc, (struct proc *pp));
|
|
|
|
/* prints the given process and recursively all processes it depends on */
|
|
|
|
_PROTOTYPE( void print_proc_recursive, (struct proc *pp));
|
2011-02-08 14:54:33 +01:00
|
|
|
#if DEBUG_IPC_HOOK
|
|
|
|
_PROTOTYPE( void hook_ipc_msgrecv, (message *msg, struct proc *src,
|
2010-06-24 15:31:40 +02:00
|
|
|
struct proc *dst) );
|
2011-02-08 14:54:33 +01:00
|
|
|
_PROTOTYPE( void hook_ipc_msgsend, (message *msg, struct proc *src,
|
2010-06-24 15:31:40 +02:00
|
|
|
struct proc *dst) );
|
2011-02-08 14:54:33 +01:00
|
|
|
_PROTOTYPE( void hook_ipc_msgkcall, (message *msg, struct proc *proc) );
|
|
|
|
_PROTOTYPE( void hook_ipc_msgkresult, (message *msg, struct proc *proc) );
|
|
|
|
_PROTOTYPE( void hook_ipc_clear, (struct proc *proc) );
|
2010-06-24 15:31:40 +02:00
|
|
|
#endif
|
2005-09-30 14:54:59 +02:00
|
|
|
|
2010-01-14 16:24:16 +01:00
|
|
|
/* system/do_safemap.c */
|
2010-02-03 10:04:48 +01:00
|
|
|
_PROTOTYPE( int map_invoke_vm, (struct proc * caller, int req_type,
|
2010-01-14 16:24:16 +01:00
|
|
|
endpoint_t end_d, int seg_d, vir_bytes off_d,
|
|
|
|
endpoint_t end_s, int seg_s, vir_bytes off_s,
|
|
|
|
size_t size, int flag));
|
|
|
|
|
2006-06-20 11:57:00 +02:00
|
|
|
/* system/do_safecopy.c */
|
2010-02-03 10:04:48 +01:00
|
|
|
_PROTOTYPE( int verify_grant, (endpoint_t, endpoint_t,
|
|
|
|
cp_grant_id_t, vir_bytes, int,
|
|
|
|
vir_bytes, vir_bytes *, endpoint_t *));
|
2006-06-20 11:57:00 +02:00
|
|
|
|
2009-01-26 18:43:59 +01:00
|
|
|
/* system/do_sysctl.c */
|
2010-02-03 10:04:48 +01:00
|
|
|
_PROTOTYPE( int do_sysctl, (struct proc * caller, message *m));
|
2009-01-26 18:43:59 +01:00
|
|
|
|
Split of architecture-dependent and -independent functions for i386,
mainly in the kernel and headers. This split based on work by
Ingmar Alting <iaalting@cs.vu.nl> done for his Minix PowerPC architecture
port.
. kernel does not program the interrupt controller directly, do any
other architecture-dependent operations, or contain assembly any more,
but uses architecture-dependent functions in arch/$(ARCH)/.
. architecture-dependent constants and types defined in arch/$(ARCH)/include.
. <ibm/portio.h> moved to <minix/portio.h>, as they have become, for now,
architecture-independent functions.
. int86, sdevio, readbios, and iopenable are now i386-specific kernel calls
and live in arch/i386/do_* now.
. i386 arch now supports even less 86 code; e.g. mpx86.s and klib86.s have
gone, and 'machine.protected' is gone (and always taken to be 1 in i386).
If 86 support is to return, it should be a new architecture.
. prototypes for the architecture-dependent functions defined in
kernel/arch/$(ARCH)/*.c but used in kernel/ are in kernel/proto.h
. /etc/make.conf included in makefiles and shell scripts that need to
know the building architecture; it defines ARCH=<arch>, currently only
i386.
. some basic per-architecture build support outside of the kernel (lib)
. in clock.c, only dequeue a process if it was ready
. fixes for new include files
files deleted:
. mpx/klib.s - only for choosing between mpx/klib86 and -386
. klib86.s - only for 86
i386-specific files files moved (or arch-dependent stuff moved) to arch/i386/:
. mpx386.s (entry point)
. klib386.s
. sconst.h
. exception.c
. protect.c
. protect.h
. i8269.c
2006-12-22 16:22:27 +01:00
|
|
|
#if SPROFILE
|
|
|
|
/* profile.c */
|
|
|
|
_PROTOTYPE( void init_profile_clock, (u32_t) );
|
|
|
|
_PROTOTYPE( void stop_profile_clock, (void) );
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* functions defined in architecture-dependent files. */
|
2009-12-02 12:52:26 +01:00
|
|
|
_PROTOTYPE( void prot_init, (void) );
|
Primary goal for these changes is:
- no longer have kernel have its own page table that is loaded
on every kernel entry (trap, interrupt, exception). the primary
purpose is to reduce the number of required reloads.
Result:
- kernel can only access memory of process that was running when
kernel was entered
- kernel must be mapped into every process page table, so traps to
kernel keep working
Problem:
- kernel must often access memory of arbitrary processes (e.g. send
arbitrary processes messages); this can't happen directly any more;
usually because that process' page table isn't loaded at all, sometimes
because that memory isn't mapped in at all, sometimes because it isn't
mapped in read-write.
So:
- kernel must be able to map in memory of any process, in its own
address space.
Implementation:
- VM and kernel share a range of memory in which addresses of
all page tables of all processes are available. This has two purposes:
. Kernel has to know what data to copy in order to map in a range
. Kernel has to know where to write the data in order to map it in
That last point is because kernel has to write in the currently loaded
page table.
- Processes and kernel are separated through segments; kernel segments
haven't changed.
- The kernel keeps the process whose page table is currently loaded
in 'ptproc.'
- If it wants to map in a range of memory, it writes the value of the
page directory entry for that range into the page directory entry
in the currently loaded map. There is a slot reserved for such
purposes. The kernel can then access this memory directly.
- In order to do this, its segment has been increased (and the
segments of processes start where it ends).
- In the pagefault handler, detect if the kernel is doing
'trappable' memory access (i.e. a pagefault isn't a fatal
error) and if so,
- set the saved instruction pointer to phys_copy_fault,
breaking out of phys_copy
- set the saved eax register to the address of the page
fault, both for sanity checking and for checking in
which of the two ranges that phys_copy was called
with the fault occured
- Some boot-time processes do not have their own page table,
and are mapped in with the kernel, and separated with
segments. The kernel detects this using HASPT. If such a
process has to be scheduled, any page table will work and
no page table switch is done.
Major changes in kernel are
- When accessing user processes memory, kernel no longer
explicitly checks before it does so if that memory is OK.
It simply makes the mapping (if necessary), tries to do the
operation, and traps the pagefault if that memory isn't present;
if that happens, the copy function returns EFAULT.
So all of the CHECKRANGE_OR_SUSPEND macros are gone.
- Kernel no longer has to copy/read and parse page tables.
- A message copying optimisation: when messages are copied, and
the recipient isn't mapped in, they are copied into a buffer
in the kernel. This is done in QueueMess. The next time
the recipient is scheduled, this message is copied into
its memory. This happens in schedcheck().
This eliminates the mapping/copying step for messages, and makes
it easier to deliver messages. This eliminates soft_notify.
- Kernel no longer creates a page table at all, so the vm_setbuf
and pagetable writing in memory.c is gone.
Minor changes in kernel are
- ipc_stats thrown out, wasn't used
- misc flags all renamed to MF_*
- NOREC_* macros to enter and leave functions that should not
be called recursively; just sanity checks really
- code to fully decode segment selectors and descriptors
to print on exceptions
- lots of vmassert()s added, only executed if DEBUG_VMASSERT is 1
2009-09-21 16:31:52 +02:00
|
|
|
_PROTOTYPE( phys_bytes phys_copy, (phys_bytes source, phys_bytes dest,
|
Split of architecture-dependent and -independent functions for i386,
mainly in the kernel and headers. This split based on work by
Ingmar Alting <iaalting@cs.vu.nl> done for his Minix PowerPC architecture
port.
. kernel does not program the interrupt controller directly, do any
other architecture-dependent operations, or contain assembly any more,
but uses architecture-dependent functions in arch/$(ARCH)/.
. architecture-dependent constants and types defined in arch/$(ARCH)/include.
. <ibm/portio.h> moved to <minix/portio.h>, as they have become, for now,
architecture-independent functions.
. int86, sdevio, readbios, and iopenable are now i386-specific kernel calls
and live in arch/i386/do_* now.
. i386 arch now supports even less 86 code; e.g. mpx86.s and klib86.s have
gone, and 'machine.protected' is gone (and always taken to be 1 in i386).
If 86 support is to return, it should be a new architecture.
. prototypes for the architecture-dependent functions defined in
kernel/arch/$(ARCH)/*.c but used in kernel/ are in kernel/proto.h
. /etc/make.conf included in makefiles and shell scripts that need to
know the building architecture; it defines ARCH=<arch>, currently only
i386.
. some basic per-architecture build support outside of the kernel (lib)
. in clock.c, only dequeue a process if it was ready
. fixes for new include files
files deleted:
. mpx/klib.s - only for choosing between mpx/klib86 and -386
. klib86.s - only for 86
i386-specific files files moved (or arch-dependent stuff moved) to arch/i386/:
. mpx386.s (entry point)
. klib386.s
. sconst.h
. exception.c
. protect.c
. protect.h
. i8269.c
2006-12-22 16:22:27 +01:00
|
|
|
phys_bytes count) );
|
Primary goal for these changes is:
- no longer have kernel have its own page table that is loaded
on every kernel entry (trap, interrupt, exception). the primary
purpose is to reduce the number of required reloads.
Result:
- kernel can only access memory of process that was running when
kernel was entered
- kernel must be mapped into every process page table, so traps to
kernel keep working
Problem:
- kernel must often access memory of arbitrary processes (e.g. send
arbitrary processes messages); this can't happen directly any more;
usually because that process' page table isn't loaded at all, sometimes
because that memory isn't mapped in at all, sometimes because it isn't
mapped in read-write.
So:
- kernel must be able to map in memory of any process, in its own
address space.
Implementation:
- VM and kernel share a range of memory in which addresses of
all page tables of all processes are available. This has two purposes:
. Kernel has to know what data to copy in order to map in a range
. Kernel has to know where to write the data in order to map it in
That last point is because kernel has to write in the currently loaded
page table.
- Processes and kernel are separated through segments; kernel segments
haven't changed.
- The kernel keeps the process whose page table is currently loaded
in 'ptproc.'
- If it wants to map in a range of memory, it writes the value of the
page directory entry for that range into the page directory entry
in the currently loaded map. There is a slot reserved for such
purposes. The kernel can then access this memory directly.
- In order to do this, its segment has been increased (and the
segments of processes start where it ends).
- In the pagefault handler, detect if the kernel is doing
'trappable' memory access (i.e. a pagefault isn't a fatal
error) and if so,
- set the saved instruction pointer to phys_copy_fault,
breaking out of phys_copy
- set the saved eax register to the address of the page
fault, both for sanity checking and for checking in
which of the two ranges that phys_copy was called
with the fault occured
- Some boot-time processes do not have their own page table,
and are mapped in with the kernel, and separated with
segments. The kernel detects this using HASPT. If such a
process has to be scheduled, any page table will work and
no page table switch is done.
Major changes in kernel are
- When accessing user processes memory, kernel no longer
explicitly checks before it does so if that memory is OK.
It simply makes the mapping (if necessary), tries to do the
operation, and traps the pagefault if that memory isn't present;
if that happens, the copy function returns EFAULT.
So all of the CHECKRANGE_OR_SUSPEND macros are gone.
- Kernel no longer has to copy/read and parse page tables.
- A message copying optimisation: when messages are copied, and
the recipient isn't mapped in, they are copied into a buffer
in the kernel. This is done in QueueMess. The next time
the recipient is scheduled, this message is copied into
its memory. This happens in schedcheck().
This eliminates the mapping/copying step for messages, and makes
it easier to deliver messages. This eliminates soft_notify.
- Kernel no longer creates a page table at all, so the vm_setbuf
and pagetable writing in memory.c is gone.
Minor changes in kernel are
- ipc_stats thrown out, wasn't used
- misc flags all renamed to MF_*
- NOREC_* macros to enter and leave functions that should not
be called recursively; just sanity checks really
- code to fully decode segment selectors and descriptors
to print on exceptions
- lots of vmassert()s added, only executed if DEBUG_VMASSERT is 1
2009-09-21 16:31:52 +02:00
|
|
|
_PROTOTYPE( void phys_copy_fault, (void));
|
2009-11-06 10:08:26 +01:00
|
|
|
_PROTOTYPE( void phys_copy_fault_in_kernel, (void));
|
2010-02-03 10:04:48 +01:00
|
|
|
#define virtual_copy(src, dst, bytes) \
|
|
|
|
virtual_copy_f(NULL, src, dst, bytes, 0)
|
|
|
|
#define virtual_copy_vmcheck(caller, src, dst, bytes) \
|
|
|
|
virtual_copy_f(caller, src, dst, bytes, 1)
|
|
|
|
_PROTOTYPE( int virtual_copy_f, (struct proc * caller,
|
|
|
|
struct vir_addr *src, struct vir_addr *dst,
|
|
|
|
vir_bytes bytes, int vmcheck) );
|
2008-11-19 13:26:10 +01:00
|
|
|
_PROTOTYPE( int data_copy, (endpoint_t from, vir_bytes from_addr,
|
|
|
|
endpoint_t to, vir_bytes to_addr, size_t bytes));
|
2010-02-03 10:04:48 +01:00
|
|
|
_PROTOTYPE( int data_copy_vmcheck, (struct proc *,
|
|
|
|
endpoint_t from, vir_bytes from_addr,
|
Primary goal for these changes is:
- no longer have kernel have its own page table that is loaded
on every kernel entry (trap, interrupt, exception). the primary
purpose is to reduce the number of required reloads.
Result:
- kernel can only access memory of process that was running when
kernel was entered
- kernel must be mapped into every process page table, so traps to
kernel keep working
Problem:
- kernel must often access memory of arbitrary processes (e.g. send
arbitrary processes messages); this can't happen directly any more;
usually because that process' page table isn't loaded at all, sometimes
because that memory isn't mapped in at all, sometimes because it isn't
mapped in read-write.
So:
- kernel must be able to map in memory of any process, in its own
address space.
Implementation:
- VM and kernel share a range of memory in which addresses of
all page tables of all processes are available. This has two purposes:
. Kernel has to know what data to copy in order to map in a range
. Kernel has to know where to write the data in order to map it in
That last point is because kernel has to write in the currently loaded
page table.
- Processes and kernel are separated through segments; kernel segments
haven't changed.
- The kernel keeps the process whose page table is currently loaded
in 'ptproc.'
- If it wants to map in a range of memory, it writes the value of the
page directory entry for that range into the page directory entry
in the currently loaded map. There is a slot reserved for such
purposes. The kernel can then access this memory directly.
- In order to do this, its segment has been increased (and the
segments of processes start where it ends).
- In the pagefault handler, detect if the kernel is doing
'trappable' memory access (i.e. a pagefault isn't a fatal
error) and if so,
- set the saved instruction pointer to phys_copy_fault,
breaking out of phys_copy
- set the saved eax register to the address of the page
fault, both for sanity checking and for checking in
which of the two ranges that phys_copy was called
with the fault occured
- Some boot-time processes do not have their own page table,
and are mapped in with the kernel, and separated with
segments. The kernel detects this using HASPT. If such a
process has to be scheduled, any page table will work and
no page table switch is done.
Major changes in kernel are
- When accessing user processes memory, kernel no longer
explicitly checks before it does so if that memory is OK.
It simply makes the mapping (if necessary), tries to do the
operation, and traps the pagefault if that memory isn't present;
if that happens, the copy function returns EFAULT.
So all of the CHECKRANGE_OR_SUSPEND macros are gone.
- Kernel no longer has to copy/read and parse page tables.
- A message copying optimisation: when messages are copied, and
the recipient isn't mapped in, they are copied into a buffer
in the kernel. This is done in QueueMess. The next time
the recipient is scheduled, this message is copied into
its memory. This happens in schedcheck().
This eliminates the mapping/copying step for messages, and makes
it easier to deliver messages. This eliminates soft_notify.
- Kernel no longer creates a page table at all, so the vm_setbuf
and pagetable writing in memory.c is gone.
Minor changes in kernel are
- ipc_stats thrown out, wasn't used
- misc flags all renamed to MF_*
- NOREC_* macros to enter and leave functions that should not
be called recursively; just sanity checks really
- code to fully decode segment selectors and descriptors
to print on exceptions
- lots of vmassert()s added, only executed if DEBUG_VMASSERT is 1
2009-09-21 16:31:52 +02:00
|
|
|
endpoint_t to, vir_bytes to_addr, size_t bytes));
|
Split of architecture-dependent and -independent functions for i386,
mainly in the kernel and headers. This split based on work by
Ingmar Alting <iaalting@cs.vu.nl> done for his Minix PowerPC architecture
port.
. kernel does not program the interrupt controller directly, do any
other architecture-dependent operations, or contain assembly any more,
but uses architecture-dependent functions in arch/$(ARCH)/.
. architecture-dependent constants and types defined in arch/$(ARCH)/include.
. <ibm/portio.h> moved to <minix/portio.h>, as they have become, for now,
architecture-independent functions.
. int86, sdevio, readbios, and iopenable are now i386-specific kernel calls
and live in arch/i386/do_* now.
. i386 arch now supports even less 86 code; e.g. mpx86.s and klib86.s have
gone, and 'machine.protected' is gone (and always taken to be 1 in i386).
If 86 support is to return, it should be a new architecture.
. prototypes for the architecture-dependent functions defined in
kernel/arch/$(ARCH)/*.c but used in kernel/ are in kernel/proto.h
. /etc/make.conf included in makefiles and shell scripts that need to
know the building architecture; it defines ARCH=<arch>, currently only
i386.
. some basic per-architecture build support outside of the kernel (lib)
. in clock.c, only dequeue a process if it was ready
. fixes for new include files
files deleted:
. mpx/klib.s - only for choosing between mpx/klib86 and -386
. klib86.s - only for 86
i386-specific files files moved (or arch-dependent stuff moved) to arch/i386/:
. mpx386.s (entry point)
. klib386.s
. sconst.h
. exception.c
. protect.c
. protect.h
. i8269.c
2006-12-22 16:22:27 +01:00
|
|
|
_PROTOTYPE( void alloc_segments, (struct proc *rp) );
|
2010-06-08 00:21:45 +02:00
|
|
|
_PROTOTYPE( void vm_stop, (void) );
|
Split of architecture-dependent and -independent functions for i386,
mainly in the kernel and headers. This split based on work by
Ingmar Alting <iaalting@cs.vu.nl> done for his Minix PowerPC architecture
port.
. kernel does not program the interrupt controller directly, do any
other architecture-dependent operations, or contain assembly any more,
but uses architecture-dependent functions in arch/$(ARCH)/.
. architecture-dependent constants and types defined in arch/$(ARCH)/include.
. <ibm/portio.h> moved to <minix/portio.h>, as they have become, for now,
architecture-independent functions.
. int86, sdevio, readbios, and iopenable are now i386-specific kernel calls
and live in arch/i386/do_* now.
. i386 arch now supports even less 86 code; e.g. mpx86.s and klib86.s have
gone, and 'machine.protected' is gone (and always taken to be 1 in i386).
If 86 support is to return, it should be a new architecture.
. prototypes for the architecture-dependent functions defined in
kernel/arch/$(ARCH)/*.c but used in kernel/ are in kernel/proto.h
. /etc/make.conf included in makefiles and shell scripts that need to
know the building architecture; it defines ARCH=<arch>, currently only
i386.
. some basic per-architecture build support outside of the kernel (lib)
. in clock.c, only dequeue a process if it was ready
. fixes for new include files
files deleted:
. mpx/klib.s - only for choosing between mpx/klib86 and -386
. klib86.s - only for 86
i386-specific files files moved (or arch-dependent stuff moved) to arch/i386/:
. mpx386.s (entry point)
. klib386.s
. sconst.h
. exception.c
. protect.c
. protect.h
. i8269.c
2006-12-22 16:22:27 +01:00
|
|
|
_PROTOTYPE( phys_bytes umap_local, (register struct proc *rp, int seg,
|
|
|
|
vir_bytes vir_addr, vir_bytes bytes));
|
2010-02-03 10:04:48 +01:00
|
|
|
_PROTOTYPE( phys_bytes umap_virtual, (struct proc* rp,
|
|
|
|
int seg, vir_bytes vir_addr, vir_bytes bytes) );
|
2010-04-21 13:05:22 +02:00
|
|
|
_PROTOTYPE( phys_bytes seg2phys, (u16_t) );
|
Primary goal for these changes is:
- no longer have kernel have its own page table that is loaded
on every kernel entry (trap, interrupt, exception). the primary
purpose is to reduce the number of required reloads.
Result:
- kernel can only access memory of process that was running when
kernel was entered
- kernel must be mapped into every process page table, so traps to
kernel keep working
Problem:
- kernel must often access memory of arbitrary processes (e.g. send
arbitrary processes messages); this can't happen directly any more;
usually because that process' page table isn't loaded at all, sometimes
because that memory isn't mapped in at all, sometimes because it isn't
mapped in read-write.
So:
- kernel must be able to map in memory of any process, in its own
address space.
Implementation:
- VM and kernel share a range of memory in which addresses of
all page tables of all processes are available. This has two purposes:
. Kernel has to know what data to copy in order to map in a range
. Kernel has to know where to write the data in order to map it in
That last point is because kernel has to write in the currently loaded
page table.
- Processes and kernel are separated through segments; kernel segments
haven't changed.
- The kernel keeps the process whose page table is currently loaded
in 'ptproc.'
- If it wants to map in a range of memory, it writes the value of the
page directory entry for that range into the page directory entry
in the currently loaded map. There is a slot reserved for such
purposes. The kernel can then access this memory directly.
- In order to do this, its segment has been increased (and the
segments of processes start where it ends).
- In the pagefault handler, detect if the kernel is doing
'trappable' memory access (i.e. a pagefault isn't a fatal
error) and if so,
- set the saved instruction pointer to phys_copy_fault,
breaking out of phys_copy
- set the saved eax register to the address of the page
fault, both for sanity checking and for checking in
which of the two ranges that phys_copy was called
with the fault occured
- Some boot-time processes do not have their own page table,
and are mapped in with the kernel, and separated with
segments. The kernel detects this using HASPT. If such a
process has to be scheduled, any page table will work and
no page table switch is done.
Major changes in kernel are
- When accessing user processes memory, kernel no longer
explicitly checks before it does so if that memory is OK.
It simply makes the mapping (if necessary), tries to do the
operation, and traps the pagefault if that memory isn't present;
if that happens, the copy function returns EFAULT.
So all of the CHECKRANGE_OR_SUSPEND macros are gone.
- Kernel no longer has to copy/read and parse page tables.
- A message copying optimisation: when messages are copied, and
the recipient isn't mapped in, they are copied into a buffer
in the kernel. This is done in QueueMess. The next time
the recipient is scheduled, this message is copied into
its memory. This happens in schedcheck().
This eliminates the mapping/copying step for messages, and makes
it easier to deliver messages. This eliminates soft_notify.
- Kernel no longer creates a page table at all, so the vm_setbuf
and pagetable writing in memory.c is gone.
Minor changes in kernel are
- ipc_stats thrown out, wasn't used
- misc flags all renamed to MF_*
- NOREC_* macros to enter and leave functions that should not
be called recursively; just sanity checks really
- code to fully decode segment selectors and descriptors
to print on exceptions
- lots of vmassert()s added, only executed if DEBUG_VMASSERT is 1
2009-09-21 16:31:52 +02:00
|
|
|
_PROTOTYPE( int vm_phys_memset, (phys_bytes source, u8_t pattern,
|
Split of architecture-dependent and -independent functions for i386,
mainly in the kernel and headers. This split based on work by
Ingmar Alting <iaalting@cs.vu.nl> done for his Minix PowerPC architecture
port.
. kernel does not program the interrupt controller directly, do any
other architecture-dependent operations, or contain assembly any more,
but uses architecture-dependent functions in arch/$(ARCH)/.
. architecture-dependent constants and types defined in arch/$(ARCH)/include.
. <ibm/portio.h> moved to <minix/portio.h>, as they have become, for now,
architecture-independent functions.
. int86, sdevio, readbios, and iopenable are now i386-specific kernel calls
and live in arch/i386/do_* now.
. i386 arch now supports even less 86 code; e.g. mpx86.s and klib86.s have
gone, and 'machine.protected' is gone (and always taken to be 1 in i386).
If 86 support is to return, it should be a new architecture.
. prototypes for the architecture-dependent functions defined in
kernel/arch/$(ARCH)/*.c but used in kernel/ are in kernel/proto.h
. /etc/make.conf included in makefiles and shell scripts that need to
know the building architecture; it defines ARCH=<arch>, currently only
i386.
. some basic per-architecture build support outside of the kernel (lib)
. in clock.c, only dequeue a process if it was ready
. fixes for new include files
files deleted:
. mpx/klib.s - only for choosing between mpx/klib86 and -386
. klib86.s - only for 86
i386-specific files files moved (or arch-dependent stuff moved) to arch/i386/:
. mpx386.s (entry point)
. klib386.s
. sconst.h
. exception.c
. protect.c
. protect.h
. i8269.c
2006-12-22 16:22:27 +01:00
|
|
|
phys_bytes count) );
|
2009-11-16 22:41:44 +01:00
|
|
|
_PROTOTYPE( int intr_init, (int, int) );
|
2009-11-12 09:42:18 +01:00
|
|
|
_PROTOTYPE( void halt_cpu, (void) );
|
2009-08-30 16:55:30 +02:00
|
|
|
_PROTOTYPE( void arch_init, (void) );
|
2010-10-26 23:07:27 +02:00
|
|
|
_PROTOTYPE( void cpu_identify, (void) );
|
2010-09-15 16:11:25 +02:00
|
|
|
/* arch dependent FPU initialization per CPU */
|
|
|
|
_PROTOTYPE( void fpu_init, (void) );
|
|
|
|
/* returns true if pfu is present and initialized */
|
|
|
|
_PROTOTYPE( int is_fpu, (void) );
|
Split of architecture-dependent and -independent functions for i386,
mainly in the kernel and headers. This split based on work by
Ingmar Alting <iaalting@cs.vu.nl> done for his Minix PowerPC architecture
port.
. kernel does not program the interrupt controller directly, do any
other architecture-dependent operations, or contain assembly any more,
but uses architecture-dependent functions in arch/$(ARCH)/.
. architecture-dependent constants and types defined in arch/$(ARCH)/include.
. <ibm/portio.h> moved to <minix/portio.h>, as they have become, for now,
architecture-independent functions.
. int86, sdevio, readbios, and iopenable are now i386-specific kernel calls
and live in arch/i386/do_* now.
. i386 arch now supports even less 86 code; e.g. mpx86.s and klib86.s have
gone, and 'machine.protected' is gone (and always taken to be 1 in i386).
If 86 support is to return, it should be a new architecture.
. prototypes for the architecture-dependent functions defined in
kernel/arch/$(ARCH)/*.c but used in kernel/ are in kernel/proto.h
. /etc/make.conf included in makefiles and shell scripts that need to
know the building architecture; it defines ARCH=<arch>, currently only
i386.
. some basic per-architecture build support outside of the kernel (lib)
. in clock.c, only dequeue a process if it was ready
. fixes for new include files
files deleted:
. mpx/klib.s - only for choosing between mpx/klib86 and -386
. klib86.s - only for 86
i386-specific files files moved (or arch-dependent stuff moved) to arch/i386/:
. mpx386.s (entry point)
. klib386.s
. sconst.h
. exception.c
. protect.c
. protect.h
. i8269.c
2006-12-22 16:22:27 +01:00
|
|
|
_PROTOTYPE( void ser_putc, (char) );
|
2010-07-06 13:59:19 +02:00
|
|
|
_PROTOTYPE( __dead void arch_shutdown, (int) );
|
|
|
|
_PROTOTYPE( __dead void arch_monitor, (void) );
|
2011-02-27 00:00:55 +01:00
|
|
|
#if !defined(__ELF__)
|
2008-11-19 13:26:10 +01:00
|
|
|
_PROTOTYPE( void arch_get_aout_headers, (int i, struct exec *h) );
|
2011-02-27 00:00:55 +01:00
|
|
|
#endif
|
2010-05-18 15:00:39 +02:00
|
|
|
_PROTOTYPE( void restore_user_context, (struct proc * p) );
|
Split of architecture-dependent and -independent functions for i386,
mainly in the kernel and headers. This split based on work by
Ingmar Alting <iaalting@cs.vu.nl> done for his Minix PowerPC architecture
port.
. kernel does not program the interrupt controller directly, do any
other architecture-dependent operations, or contain assembly any more,
but uses architecture-dependent functions in arch/$(ARCH)/.
. architecture-dependent constants and types defined in arch/$(ARCH)/include.
. <ibm/portio.h> moved to <minix/portio.h>, as they have become, for now,
architecture-independent functions.
. int86, sdevio, readbios, and iopenable are now i386-specific kernel calls
and live in arch/i386/do_* now.
. i386 arch now supports even less 86 code; e.g. mpx86.s and klib86.s have
gone, and 'machine.protected' is gone (and always taken to be 1 in i386).
If 86 support is to return, it should be a new architecture.
. prototypes for the architecture-dependent functions defined in
kernel/arch/$(ARCH)/*.c but used in kernel/ are in kernel/proto.h
. /etc/make.conf included in makefiles and shell scripts that need to
know the building architecture; it defines ARCH=<arch>, currently only
i386.
. some basic per-architecture build support outside of the kernel (lib)
. in clock.c, only dequeue a process if it was ready
. fixes for new include files
files deleted:
. mpx/klib.s - only for choosing between mpx/klib86 and -386
. klib86.s - only for 86
i386-specific files files moved (or arch-dependent stuff moved) to arch/i386/:
. mpx386.s (entry point)
. klib386.s
. sconst.h
. exception.c
. protect.c
. protect.h
. i8269.c
2006-12-22 16:22:27 +01:00
|
|
|
_PROTOTYPE( void read_tsc, (unsigned long *high, unsigned long *low) );
|
|
|
|
_PROTOTYPE( int arch_init_profile_clock, (u32_t freq) );
|
|
|
|
_PROTOTYPE( void arch_stop_profile_clock, (void) );
|
|
|
|
_PROTOTYPE( void arch_ack_profile_clock, (void) );
|
2007-04-23 17:59:16 +02:00
|
|
|
_PROTOTYPE( void do_ser_debug, (void) );
|
2008-11-19 13:26:10 +01:00
|
|
|
_PROTOTYPE( int arch_get_params, (char *parm, int max));
|
|
|
|
_PROTOTYPE( int arch_set_params, (char *parm, int max));
|
2010-01-28 14:17:07 +01:00
|
|
|
_PROTOTYPE( void arch_pre_exec, (struct proc *pr, u32_t, u32_t));
|
2010-04-07 13:25:51 +02:00
|
|
|
_PROTOTYPE( int arch_umap, (const struct proc *pr, vir_bytes, vir_bytes,
|
2008-11-19 13:26:10 +01:00
|
|
|
int, phys_bytes *));
|
|
|
|
_PROTOTYPE( int arch_do_vmctl, (message *m_ptr, struct proc *p));
|
2010-04-07 13:25:51 +02:00
|
|
|
_PROTOTYPE( int vm_contiguous, (const struct proc *targetproc, vir_bytes vir_buf, size_t count));
|
2008-11-19 13:26:10 +01:00
|
|
|
_PROTOTYPE( void proc_stacktrace, (struct proc *proc) );
|
2010-03-27 15:31:00 +01:00
|
|
|
_PROTOTYPE( int vm_lookup, (const struct proc *proc, vir_bytes virtual, vir_bytes *result, u32_t *ptent));
|
2010-06-11 10:16:10 +02:00
|
|
|
_PROTOTYPE( void delivermsg, (struct proc *target));
|
Merge of David's ptrace branch. Summary:
o Support for ptrace T_ATTACH/T_DETACH and T_SYSCALL
o PM signal handling logic should now work properly, even with debuggers
being present
o Asynchronous PM/VFS protocol, full IPC support for senda(), and
AMF_NOREPLY senda() flag
DETAILS
Process stop and delay call handling of PM:
o Added sys_runctl() kernel call with sys_stop() and sys_resume()
aliases, for PM to stop and resume a process
o Added exception for sending/syscall-traced processes to sys_runctl(),
and matching SIGKREADY pseudo-signal to PM
o Fixed PM signal logic to deal with requests from a process after
stopping it (so-called "delay calls"), using the SIGKREADY facility
o Fixed various PM panics due to race conditions with delay calls versus
VFS calls
o Removed special PRIO_STOP priority value
o Added SYS_LOCK RTS kernel flag, to stop an individual process from
running while modifying its process structure
Signal and debugger handling in PM:
o Fixed debugger signals being dropped if a second signal arrives when
the debugger has not retrieved the first one
o Fixed debugger signals being sent to the debugger more than once
o Fixed debugger signals unpausing process in VFS; removed PM_UNPAUSE_TR
protocol message
o Detached debugger signals from general signal logic and from being
blocked on VFS calls, meaning that even VFS can now be traced
o Fixed debugger being unable to receive more than one pending signal in
one process stop
o Fixed signal delivery being delayed needlessly when multiple signals
are pending
o Fixed wait test for tracer, which was returning for children that were
not waited for
o Removed second parallel pending call from PM to VFS for any process
o Fixed process becoming runnable between exec() and debugger trap
o Added support for notifying the debugger before the parent when a
debugged child exits
o Fixed debugger death causing child to remain stopped forever
o Fixed consistently incorrect use of _NSIG
Extensions to ptrace():
o Added T_ATTACH and T_DETACH ptrace request, to attach and detach a
debugger to and from a process
o Added T_SYSCALL ptrace request, to trace system calls
o Added T_SETOPT ptrace request, to set trace options
o Added TO_TRACEFORK trace option, to attach automatically to children
of a traced process
o Added TO_ALTEXEC trace option, to send SIGSTOP instead of SIGTRAP upon
a successful exec() of the tracee
o Extended T_GETUSER ptrace support to allow retrieving a process's priv
structure
o Removed T_STOP ptrace request again, as it does not help implementing
debuggers properly
o Added MINIX3-specific ptrace test (test42)
o Added proper manual page for ptrace(2)
Asynchronous PM/VFS interface:
o Fixed asynchronous messages not being checked when receive() is called
with an endpoint other than ANY
o Added AMF_NOREPLY senda() flag, preventing such messages from
satisfying the receive part of a sendrec()
o Added asynsend3() that takes optional flags; asynsend() is now a
#define passing in 0 as third parameter
o Made PM/VFS protocol asynchronous; reintroduced tell_fs()
o Made PM_BASE request/reply number range unique
o Hacked in a horrible temporary workaround into RS to deal with newly
revealed RS-PM-VFS race condition triangle until VFS is asynchronous
System signal handling:
o Fixed shutdown logic of device drivers; removed old SIGKSTOP signal
o Removed is-superuser check from PM's do_procstat() (aka getsigset())
o Added sigset macros to allow system processes to deal with the full
signal set, rather than just the POSIX subset
Miscellaneous PM fixes:
o Split do_getset into do_get and do_set, merging common code and making
structure clearer
o Fixed setpriority() being able to put to sleep processes using an
invalid parameter, or revive zombie processes
o Made find_proc() global; removed obsolete proc_from_pid()
o Cleanup here and there
Also included:
o Fixed false-positive boot order kernel warning
o Removed last traces of old NOTIFY_FROM code
THINGS OF POSSIBLE INTEREST
o It should now be possible to run PM at any priority, even lower than
user processes
o No assumptions are made about communication speed between PM and VFS,
although communication must be FIFO
o A debugger will now receive incoming debuggee signals at kill time
only; the process may not yet be fully stopped
o A first step has been made towards making the SYSTEM task preemptible
2009-09-30 11:57:22 +02:00
|
|
|
_PROTOTYPE( void arch_do_syscall, (struct proc *proc) );
|
2009-11-11 13:07:06 +01:00
|
|
|
_PROTOTYPE( int arch_phys_map, (int index, phys_bytes *addr,
|
|
|
|
phys_bytes *len, int *flags));
|
|
|
|
_PROTOTYPE( int arch_phys_map_reply, (int index, vir_bytes addr));
|
2010-03-27 15:31:00 +01:00
|
|
|
_PROTOTYPE( int arch_enable_paging, (struct proc * caller, const message * m_ptr));
|
2005-04-21 16:53:53 +02:00
|
|
|
|
2010-02-09 16:15:45 +01:00
|
|
|
_PROTOTYPE( int copy_msg_from_user, (struct proc * p, message * user_mbuf,
|
|
|
|
message * dst));
|
|
|
|
_PROTOTYPE( int copy_msg_to_user, (struct proc * p, message * src,
|
|
|
|
message * user_mbuf));
|
2010-02-09 16:13:52 +01:00
|
|
|
_PROTOTYPE(void switch_address_space, (struct proc * p));
|
2010-05-12 10:31:05 +02:00
|
|
|
_PROTOTYPE(void release_address_space, (struct proc *pr));
|
2010-05-25 10:06:14 +02:00
|
|
|
|
2010-06-07 09:43:17 +02:00
|
|
|
_PROTOTYPE(void enable_fpu_exception, (void));
|
|
|
|
_PROTOTYPE(void disable_fpu_exception, (void));
|
2010-09-15 16:11:25 +02:00
|
|
|
_PROTOTYPE(void release_fpu, (struct proc * p));
|
2010-06-07 09:43:17 +02:00
|
|
|
|
2010-05-25 10:06:14 +02:00
|
|
|
/* utility.c */
|
|
|
|
_PROTOTYPE( void cpu_print_freq, (unsigned cpu));
|
2010-09-15 16:09:52 +02:00
|
|
|
#endif /* __kernel__ */
|
|
|
|
|
2005-04-21 16:53:53 +02:00
|
|
|
#endif /* PROTO_H */
|