12.07.2015 Views

INTRO (9) NetBSD Kernel Developer's Manual INTRO (9) NAME ...

INTRO (9) NetBSD Kernel Developer's Manual INTRO (9) NAME ...

INTRO (9) NetBSD Kernel Developer's Manual INTRO (9) NAME ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

RAS (9) <strong>NetBSD</strong> <strong>Kernel</strong> Developer’s <strong>Manual</strong> RAS (9)<strong>NAME</strong>ras_lookup, ras_fork, ras_purgeall —restartable atomic sequencesSYNOPSIS#include #include #include void ∗ras_lookup(struct proc ∗p , void ∗addr);intras_fork(struct proc ∗p1 , struct proc ∗p2);intras_purgeall(struct proc ∗p);DESCRIPTIONRestartable atomic sequences are user code sequences which are guaranteed to execute without preemption.This property is assured by checking the set of restartable atomic sequences registered for a process duringcpu_switch(9). If aprocess is found to have been preempted during a restartable sequence, then itsexecution is rolled-back to the start of the sequence by resetting its program counter saved inits process controlblock (PCB).The RAS functionality is provided by a combination of the machine-independent routines discussed in thispage and a machine-dependent component in cpu_switch(9). A port which supports restartable atomicsequences will define __HAVE_RAS in machine/types.h for machine-independent code to conditionallyprovide RAS support.Acomplicated side-effect of restartable atomic sequences is their interaction with the machine-dependentptrace(2) support. Specifically, single-step traps and/or the emulation of single-stepping must carefullyconsider the effect on restartable atomic sequences. Ageneral solution is to ignore these traps or disablethem within restartable atomic sequences.FUNCTIONSThe functions which operate on restartable atomic sequences are:ras_lookup(p , addr)This function searches the registered restartable atomic sequences for process p which containthe user address addr. Ifthe address addr is found within a RAS, then the restart address ofthe RAS is returned, otherwise −1 is returned.ras_fork(p1 , p2)This function is used to copy all registered restartable atomic sequences for process p1 to processp2. Itisprimarily called from fork1(9) when the sequences are inherited from the parent bythe child.ras_purgeall(p)This function is used to remove all registered restartable atomic sequences for process p. Itisprimarily used to remove all registered restartable atomic sequences for a process duringexec(3) and by rasctl(2).CODE REFERENCESThis section describes places within the <strong>NetBSD</strong> source tree where actual code implementing or using theRAS functionality can be found. All pathnames are relative to /usr/src.<strong>NetBSD</strong> 3.0 August 12, 2002 1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!