本文整理汇总了C++中proc_addr函数的典型用法代码示例。如果您正苦于以下问题:C++ proc_addr函数的具体用法?C++ proc_addr怎么用?C++ proc_addr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了proc_addr函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: generic_handler
/*===========================================================================*
* generic_handler *
*===========================================================================*/
static int generic_handler(irq_hook_t * hook)
{
/* This function handles hardware interrupt in a simple and generic way. All
* interrupts are transformed into messages to a driver. The IRQ line will be
* reenabled if the policy says so.
*/
int proc_nr;
/* As a side-effect, the interrupt handler gathers random information by
* timestamping the interrupt events. This is used for /dev/random.
*/
get_randomness(&krandom, hook->irq);
/* Check if the handler is still alive.
* If it's dead, this should never happen, as processes that die
* automatically get their interrupt hooks unhooked.
*/
if(!isokendpt(hook->proc_nr_e, &proc_nr))
panic("invalid interrupt handler: %d", hook->proc_nr_e);
/* Add a bit for this interrupt to the process' pending interrupts. When
* sending the notification message, this bit map will be magically set
* as an argument.
*/
priv(proc_addr(proc_nr))->s_int_pending |= (1 << hook->notify_id);
/* Build notification message and return. */
mini_notify(proc_addr(HARDWARE), hook->proc_nr_e);
return(hook->policy & IRQ_REENABLE);
}
开发者ID:Stichting-MINIX-Research-Foundation,项目名称:minix,代码行数:33,代码来源:do_irqctl.c
示例2: print_endpoint
static void
print_endpoint(endpoint_t ep)
{
int proc_nr;
struct proc *pp = NULL;
switch(ep) {
case ANY:
printf("ANY");
break;
case SELF:
printf("SELF");
break;
case NONE:
printf("NONE");
break;
default:
if(!isokendpt(ep, &proc_nr)) {
printf("??? %d\n", ep);
}
else {
pp = proc_addr(proc_nr);
if(isemptyp(pp)) {
printf("??? empty slot %d\n", proc_nr);
}
else {
print_proc_name(pp);
}
}
break;
}
}
开发者ID:Stichting-MINIX-Research-Foundation,项目名称:minix,代码行数:32,代码来源:debug.c
示例3: do_setmcontext
/*===========================================================================*
* do_setmcontext *
*===========================================================================*/
int do_setmcontext(struct proc * caller, message * m_ptr)
{
/* Set machine context of a process */
register struct proc *rp;
int proc_nr, r;
mcontext_t mc;
if (!isokendpt(m_ptr->m_lsys_krn_sys_setmcontext.endpt, &proc_nr)) return(EINVAL);
rp = proc_addr(proc_nr);
/* Get the mcontext structure into our address space. */
if ((r = data_copy(m_ptr->m_lsys_krn_sys_setmcontext.endpt,
m_ptr->m_lsys_krn_sys_setmcontext.ctx_ptr, KERNEL,
(vir_bytes) &mc, (phys_bytes) sizeof(mcontext_t))) != OK)
return(r);
#if defined(__i386__)
/* Copy FPU state */
if (mc.mc_flags & _MC_FPU_SAVED) {
rp->p_misc_flags |= MF_FPU_INITIALIZED;
assert(sizeof(mc.__fpregs.__fp_reg_set) == FPU_XFP_SIZE);
memcpy(rp->p_seg.fpu_state, &(mc.__fpregs.__fp_reg_set), FPU_XFP_SIZE);
} else
rp->p_misc_flags &= ~MF_FPU_INITIALIZED;
/* force reloading FPU in either case */
release_fpu(rp);
#endif
return(OK);
}
开发者ID:Hooman3,项目名称:minix,代码行数:34,代码来源:do_mcontext.c
示例4: print_proc_depends
static void print_proc_depends(struct proc *pp, const int level)
{
struct proc *depproc = NULL;
endpoint_t dep;
#define COL { int i; for(i = 0; i < level; i++) printf("> "); }
if(level >= NR_PROCS) {
printf("loop??\n");
return;
}
COL
print_proc(pp);
COL
proc_stacktrace(pp);
dep = P_BLOCKEDON(pp);
if(dep != NONE && dep != ANY) {
int procno;
if(isokendpt(dep, &procno)) {
depproc = proc_addr(procno);
if(isemptyp(depproc))
depproc = NULL;
}
if (depproc)
print_proc_depends(depproc, level+1);
}
}
开发者ID:Stichting-MINIX-Research-Foundation,项目名称:minix,代码行数:31,代码来源:debug.c
示例5: nmi_sprofile_handler
void nmi_sprofile_handler(struct nmi_frame * frame)
{
struct proc * p = get_cpulocal_var(proc_ptr);
/*
* test if the kernel was interrupted. If so, save first a sample fo
* kernel and than for the current process, otherwise save just the
* process
*/
if (nmi_in_kernel(frame)) {
struct proc *kern;
/*
* if we sample kernel, check if IDLE is scheduled. If so,
* account for idle time rather than taking kernel sample
*/
if (p->p_endpoint == IDLE) {
sprof_info.idle_samples++;
sprof_info.total_samples++;
return;
}
kern = proc_addr(KERNEL);
profile_sample(kern, (void *) frame->pc);
}
else
profile_sample(p, (void *) frame->pc);
}
开发者ID:Ga-vin,项目名称:MINIX3,代码行数:28,代码来源:profile.c
示例6: do_nice
/*===========================================================================*
* do_nice *
*===========================================================================*/
PUBLIC int do_nice(message *m_ptr)
{
/* Change process priority or stop the process. */
int proc_nr, pri, new_q ;
register struct proc *rp;
/* Extract the message parameters and do sanity checking. */
if(!isokendpt(m_ptr->PR_ENDPT, &proc_nr)) return EINVAL;
if (iskerneln(proc_nr)) return(EPERM);
pri = m_ptr->PR_PRIORITY;
rp = proc_addr(proc_nr);
/* The value passed in is currently between PRIO_MIN and PRIO_MAX.
* We have to scale this between MIN_USER_Q and MAX_USER_Q to match
* the kernel's scheduling queues.
*/
if (pri < PRIO_MIN || pri > PRIO_MAX) return(EINVAL);
new_q = MAX_USER_Q + (pri-PRIO_MIN) * (MIN_USER_Q-MAX_USER_Q+1) /
(PRIO_MAX-PRIO_MIN+1);
if (new_q < MAX_USER_Q) new_q = MAX_USER_Q; /* shouldn't happen */
if (new_q > MIN_USER_Q) new_q = MIN_USER_Q; /* shouldn't happen */
/* Make sure the process is not running while changing its priority.
* Put the process back in its new queue if it is runnable.
*/
RTS_LOCK_SET(rp, SYS_LOCK);
rp->p_max_priority = rp->p_priority = new_q;
RTS_LOCK_UNSET(rp, SYS_LOCK);
return(OK);
}
开发者ID:sebastianjaszczur,项目名称:minix3,代码行数:35,代码来源:do_nice.c
示例7: ser_dump_vfs
static void ser_dump_vfs()
{
/* Notify VFS it has to generate stack traces. Kernel can't do that as
* it's not aware of user space threads.
*/
mini_notify(proc_addr(KERNEL), VFS_PROC_NR);
}
开发者ID:bdeepak77,项目名称:minix3,代码行数:7,代码来源:arch_system.c
示例8: switch_to_user
/*===========================================================================*
* switch_to_user *
*===========================================================================*/
PUBLIC void switch_to_user(void)
{
/* This function is called an instant before proc_ptr is
* to be scheduled again.
*/
/*
* if the current process is still runnable check the misc flags and let
* it run unless it becomes not runnable in the meantime
*/
if (proc_is_runnable(proc_ptr))
goto check_misc_flags;
/*
* if a process becomes not runnable while handling the misc flags, we
* need to pick a new one here and start from scratch. Also if the
* current process wasn' runnable, we pick a new one here
*/
not_runnable_pick_new:
if (proc_is_preempted(proc_ptr)) {
proc_ptr->p_rts_flags &= ~RTS_PREEMPTED;
if (proc_is_runnable(proc_ptr)) {
if (!is_zero64(proc_ptr->p_cpu_time_left))
enqueue_head(proc_ptr);
else
enqueue(proc_ptr);
}
}
/*
* if we have no process to run, set IDLE as the current process for
* time accounting and put the cpu in and idle state. After the next
* timer interrupt the execution resumes here and we can pick another
* process. If there is still nothing runnable we "schedule" IDLE again
*/
while (!(proc_ptr = pick_proc())) {
proc_ptr = proc_addr(IDLE);
if (priv(proc_ptr)->s_flags & BILLABLE)
bill_ptr = proc_ptr;
idle();
}
switch_address_space(proc_ptr);
check_misc_flags:
assert(proc_ptr);
assert(proc_is_runnable(proc_ptr));
while (proc_ptr->p_misc_flags &
(MF_KCALL_RESUME | MF_DELIVERMSG |
MF_SC_DEFER | MF_SC_TRACE | MF_SC_ACTIVE)) {
assert(proc_is_runnable(proc_ptr));
if (proc_ptr->p_misc_flags & MF_KCALL_RESUME) {
kernel_call_resume(proc_ptr);
}
else if (proc_ptr->p_misc_flags & MF_DELIVERMSG) {
TRACE(VF_SCHEDULING, printf("delivering to %s / %d\n",
proc_ptr->p_name, proc_ptr->p_endpoint););
delivermsg(proc_ptr);
}
开发者ID:bdunlay,项目名称:os-projects,代码行数:63,代码来源:proc.c
示例9: do_profbuf
/*===========================================================================*
* do_profbuf *
*===========================================================================*/
int do_profbuf(struct proc * caller, message * m_ptr)
{
/* This kernel call is used by profiled system processes when Call
* Profiling is enabled. It is called on the first execution of procentry.
* By means of this kernel call, the profiled processes inform the kernel
* about the location of their profiling table and the control structure
* which is used to enable the kernel to have the tables cleared.
*/
int proc_nr;
struct proc *rp;
/* Store process name, control struct, table locations. */
if(!isokendpt(caller->p_endpoint, &proc_nr))
return EDEADSRCDST;
if(cprof_procs_no >= NR_SYS_PROCS)
return ENOSPC;
rp = proc_addr(proc_nr);
cprof_proc_info[cprof_procs_no].endpt = caller->p_endpoint;
cprof_proc_info[cprof_procs_no].name = rp->p_name;
cprof_proc_info[cprof_procs_no].ctl_v = (vir_bytes) m_ptr->PROF_CTL_PTR;
cprof_proc_info[cprof_procs_no].buf_v = (vir_bytes) m_ptr->PROF_MEM_PTR;
cprof_procs_no++;
return OK;
}
开发者ID:AgamAgarwal,项目名称:minix,代码行数:33,代码来源:do_profbuf.c
示例10: schedcheck
/*===========================================================================*
* schedcheck *
*===========================================================================*/
PUBLIC struct proc * schedcheck(void)
{
/* This function is called an instant before proc_ptr is
* to be scheduled again.
*/
NOREC_ENTER(schedch);
vmassert(intr_disabled());
/*
* if the current process is still runnable check the misc flags and let
* it run unless it becomes not runnable in the meantime
*/
if (proc_is_runnable(proc_ptr))
goto check_misc_flags;
/*
* if a process becomes not runnable while handling the misc flags, we
* need to pick a new one here and start from scratch. Also if the
* current process wasn' runnable, we pick a new one here
*/
not_runnable_pick_new:
if (proc_is_preempted(proc_ptr)) {
proc_ptr->p_rts_flags &= ~RTS_PREEMPTED;
if (proc_is_runnable(proc_ptr))
enqueue_head(proc_ptr);
}
/* this enqueues the process again */
if (proc_no_quantum(proc_ptr))
RTS_UNSET(proc_ptr, RTS_NO_QUANTUM);
/*
* if we have no process to run, set IDLE as the current process for
* time accounting and put the cpu in and idle state. After the next
* timer interrupt the execution resumes here and we can pick another
* process. If there is still nothing runnable we "schedule" IDLE again
*/
while( !(proc_ptr = pick_proc())) {
proc_ptr = proc_addr(IDLE);
if (priv(proc_ptr)->s_flags & BILLABLE)
bill_ptr = proc_ptr;
idle();
}
check_misc_flags:
vmassert(proc_ptr);
vmassert(proc_is_runnable(proc_ptr));
while (proc_ptr->p_misc_flags &
(MF_DELIVERMSG | MF_SC_DEFER | MF_SC_TRACE | MF_SC_ACTIVE)) {
vmassert(proc_is_runnable(proc_ptr));
if (proc_ptr->p_misc_flags & MF_DELIVERMSG) {
TRACE(VF_SCHEDULING, printf("delivering to %s / %d\n",
proc_ptr->p_name, proc_ptr->p_endpoint););
if(delivermsg(proc_ptr) == VMSUSPEND) {
TRACE(VF_SCHEDULING,
printf("suspending %s / %d\n",
proc_ptr->p_name,
proc_ptr->p_endpoint););
开发者ID:egall,项目名称:OS-code,代码行数:62,代码来源:proc.c
示例11: adjust_asyn_table
/*===========================================================================*
* adjust_asyn_table *
*===========================================================================*/
static void adjust_asyn_table(struct priv *src_privp, struct priv *dst_privp)
{
/* Transfer the asyn table if source's table belongs to the destination. */
endpoint_t src_e = proc_addr(src_privp->s_proc_nr)->p_endpoint;
endpoint_t dst_e = proc_addr(dst_privp->s_proc_nr)->p_endpoint;
if(src_privp->s_asynsize > 0 && dst_privp->s_asynsize > 0 && src_privp->s_asynendpoint == dst_e) {
if(data_copy(src_e, src_privp->s_asyntab, dst_e, dst_privp->s_asyntab,
src_privp->s_asynsize*sizeof(asynmsg_t)) != OK) {
printf("Warning: unable to transfer asyn table from ep %d to ep %d\n",
src_e, dst_e);
}
else {
dst_privp->s_asynsize = src_privp->s_asynsize;
}
}
}
开发者ID:josepedrazap,项目名称:trabajo2,代码行数:20,代码来源:do_update.c
示例12: arch_post_init
void arch_post_init(void)
{
/* Let memory mapping code know what's going on at bootstrap time */
struct proc *vm;
vm = proc_addr(VM_PROC_NR);
get_cpulocal_var(ptproc) = vm;
pg_info(&vm->p_seg.p_ttbr, &vm->p_seg.p_ttbr_v);
}
开发者ID:Stichting-MINIX-Research-Foundation,项目名称:minix,代码行数:8,代码来源:protect.c
示例13: cause_alarm
/*===========================================================================*
* cause_alarm *
*===========================================================================*/
static void cause_alarm(timer_t *tp)
{
/* Routine called if a timer goes off and the process requested a synchronous
* alarm. The process number is stored in timer argument 'ta_int'. Notify that
* process with a notification message from CLOCK.
*/
endpoint_t proc_nr_e = tmr_arg(tp)->ta_int; /* get process number */
mini_notify(proc_addr(CLOCK), proc_nr_e); /* notify process */
}
开发者ID:AjeyBohare,项目名称:minix,代码行数:12,代码来源:do_setalarm.c
示例14: do_vtimer
/*===========================================================================*
* do_vtimer *
*===========================================================================*/
int do_vtimer(struct proc * caller, message * m_ptr)
{
/* Set and/or retrieve the value of one of a process' virtual timers. */
struct proc *rp; /* pointer to process the timer belongs to */
register int pt_flag; /* the misc on/off flag for the req.d timer */
register clock_t *pt_left; /* pointer to the process' ticks-left field */
clock_t old_value; /* the previous number of ticks left */
int proc_nr, proc_nr_e;
/* The requesting process must be privileged. */
if (! (priv(caller)->s_flags & SYS_PROC)) return(EPERM);
if (m_ptr->VT_WHICH != VT_VIRTUAL && m_ptr->VT_WHICH != VT_PROF)
return(EINVAL);
/* The target process must be valid. */
proc_nr_e = (m_ptr->VT_ENDPT == SELF) ? caller->p_endpoint : m_ptr->VT_ENDPT;
if (!isokendpt(proc_nr_e, &proc_nr)) return(EINVAL);
rp = proc_addr(proc_nr);
/* Determine which flag and which field in the proc structure we want to
* retrieve and/or modify. This saves us having to differentiate between
* VT_VIRTUAL and VT_PROF multiple times below.
*/
if (m_ptr->VT_WHICH == VT_VIRTUAL) {
pt_flag = MF_VIRT_TIMER;
pt_left = &rp->p_virt_left;
} else { /* VT_PROF */
pt_flag = MF_PROF_TIMER;
pt_left = &rp->p_prof_left;
}
/* Retrieve the old value. */
if (rp->p_misc_flags & pt_flag) {
old_value = *pt_left;
if (old_value < 0) old_value = 0;
} else {
old_value = 0;
}
if (m_ptr->VT_SET) {
rp->p_misc_flags &= ~pt_flag; /* disable virtual timer */
if (m_ptr->VT_VALUE > 0) {
*pt_left = m_ptr->VT_VALUE; /* set new timer value */
rp->p_misc_flags |= pt_flag; /* (re)enable virtual timer */
} else {
*pt_left = 0; /* clear timer value */
}
}
m_ptr->VT_VALUE = old_value;
return(OK);
}
开发者ID:AgamAgarwal,项目名称:minix,代码行数:59,代码来源:do_vtimer.c
示例15: do_runctl
/*===========================================================================*
* do_runctl *
*===========================================================================*/
int do_runctl(struct proc * caller, message * m_ptr)
{
/* Control a process's RTS_PROC_STOP flag. Used for process management.
* If the process is queued sending a message or stopped for system call
* tracing, and the RC_DELAY request flag is given, set MF_SIG_DELAY instead
* of RTS_PROC_STOP, and send a SIGSNDELAY signal later when the process is done
* sending (ending the delay). Used by PM for safe signal delivery.
*/
int proc_nr, action, flags;
register struct proc *rp;
/* Extract the message parameters and do sanity checking. */
if (!isokendpt(m_ptr->RC_ENDPT, &proc_nr)) return(EINVAL);
if (iskerneln(proc_nr)) return(EPERM);
rp = proc_addr(proc_nr);
action = m_ptr->RC_ACTION;
flags = m_ptr->RC_FLAGS;
/* Is the target sending or syscall-traced? Then set MF_SIG_DELAY instead.
* Do this only when the RC_DELAY flag is set in the request flags field.
* The process will not become runnable before PM has called SYS_ENDKSIG.
* Note that asynchronous messages are not covered: a process using SENDA
* should not also install signal handlers *and* expect POSIX compliance.
*/
if (action == RC_STOP && (flags & RC_DELAY)) {
if (RTS_ISSET(rp, RTS_SENDING) || (rp->p_misc_flags & MF_SC_DEFER))
rp->p_misc_flags |= MF_SIG_DELAY;
if (rp->p_misc_flags & MF_SIG_DELAY)
return (EBUSY);
}
/* Either set or clear the stop flag. */
switch (action) {
case RC_STOP:
#if CONFIG_SMP
/* check if we must stop a process on a different CPU */
if (rp->p_cpu != cpuid) {
smp_schedule_stop_proc(rp);
break;
}
#endif
RTS_SET(rp, RTS_PROC_STOP);
break;
case RC_RESUME:
assert(RTS_ISSET(rp, RTS_PROC_STOP));
RTS_UNSET(rp, RTS_PROC_STOP);
break;
default:
return(EINVAL);
}
return(OK);
}
开发者ID:AgamAgarwal,项目名称:minix,代码行数:59,代码来源:do_runctl.c
示例16: sys_task
/*===========================================================================*
* sys_task *
*===========================================================================*/
PUBLIC void sys_task()
{
/* Main entry point of sys_task. Get the message and dispatch on type. */
/* 系统调用的主要入口点. 获取消息, 再根据类型分派. */
static message m;
register int result;
register struct proc *caller_ptr;
unsigned int call_nr;
int s;
/* Initialize the system task. */
/* 初始化系统任务. */ // 初始化系统调用
initialize();
while (TRUE) {
/* Get work. Block and wait until a request message arrives. */
/* 开始工作. 阻塞, 直到一个请求消息到来. */
receive(ANY, &m);
// 系统调用向量号
call_nr = (unsigned) m.m_type - KERNEL_CALL;
// 请求系统调用的进程指针
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))) {
kprintf("SYSTEM: request %d from %d denied.\n", call_nr,m.m_source);
result = ECALLDENIED; /* illegal message type */
} else if (call_nr >= NR_SYS_CALLS) { /* check call number */
// 检查系统调用向量号的合法性.
kprintf("SYSTEM: illegal request %d from %d.\n", call_nr,m.m_source);
result = EBADREQUEST; /* illegal message type */
}
else {
// 执行系统调用.
result = (*call_vec[call_nr])(&m); /* handle the kernel call */
}
/* Send a reply, unless inhibited by a handler function. Use the kernel
* function lock_send() to prevent a system call trap. The destination
* is known to be blocked waiting for a message.
*/
/*
* 发送一个回复, 除非被系统调用处理函数禁止了. 使得系统函数
* lock_send() 来禁止系统调用陷入. 已知目标进程因为等待一个消息而
* 阻塞.
*/
if (result != EDONTREPLY) {
// 将系统调用的执行结果发送给系统调用的主调进程.
m.m_type = result; /* report status of call */
if (OK != (s=lock_send(m.m_source, &m))) {
kprintf("SYSTEM, reply to %d failed: %d\n", m.m_source, s);
}
}
}
}
开发者ID:wuzhouhui,项目名称:misc,代码行数:59,代码来源:system.c
示例17: do_rt_set
/*===========================================================================*
* do_rt_set *
*===========================================================================*/
PUBLIC int do_rt_set(message *m_ptr)
{
/* Transform a normal user process into a real-time process */
struct proc *rp; /* pointer to process that wants to be real-time */
int proc_nr; /* process number of process that wants to be real-time */
/* if scheduler is undefined we cannot
* make processes real-time
*/
if (rt_sched == SCHED_UNDEFINED) {
return (EPERM);
}
/* if rt_sched is not equal to the
* scheduler defined in the message
* we cannot make this process real-time
*/
if (rt_sched != m_ptr->RT_SCHED) {
return (EINVAL);
}
/* check if endpoint is valid and convert endpoint
* to process number stored in proc_nr
*/
if (! isokendpt(m_ptr->RT_ENDPT, &proc_nr)) {
return (EINVAL);
}
/* get pointer to process from process number */
rp = proc_addr(proc_nr);
/* a process that is already real-time may
* not call this function.
*/
if (is_rtp(rp)) {
return (EPERM);
}
/* Dispatch to the right function.
* Each scheduler type has its own function.
*/
switch (rt_sched) {
case SCHED_RM:
return do_rt_set_rm(m_ptr, rp);
case SCHED_EDF:
return do_rt_set_edf(m_ptr, rp);
default:
return (EINVAL);
}
/* should not be reached */
return (EPERM);
}
开发者ID:BiancoZandbergen,项目名称:RTMINIX3,代码行数:57,代码来源:do_rt_set.c
示例18: update_idle_time
/*===========================================================================*
* update_idle_time *
*===========================================================================*/
static void update_idle_time(void)
{
int i;
struct proc * idl = proc_addr(IDLE);
idl->p_cycles = make64(0, 0);
for (i = 0; i < CONFIG_MAX_CPUS ; i++) {
idl->p_cycles += get_cpu_var(i, idle_proc).p_cycles;
}
}
开发者ID:anuragpeshne,项目名称:minix,代码行数:14,代码来源:do_getinfo.c
示例19: do_sysctl
/*===========================================================================*
* do_sysctl *
*===========================================================================*/
PUBLIC int do_sysctl(struct proc * caller, message * m_ptr)
{
vir_bytes len, buf;
static char mybuf[DIAG_BUFSIZE];
int s, i, proc_nr;
switch (m_ptr->SYSCTL_CODE) {
case SYSCTL_CODE_DIAG:
buf = (vir_bytes) m_ptr->SYSCTL_ARG1;
len = (vir_bytes) m_ptr->SYSCTL_ARG2;
if(len < 1 || len > DIAG_BUFSIZE) {
printf("do_sysctl: diag for %d: len %d out of range\n",
caller->p_endpoint, len);
return EINVAL;
}
if((s=data_copy_vmcheck(caller, caller->p_endpoint, buf, KERNEL,
(vir_bytes) mybuf, len)) != OK) {
printf("do_sysctl: diag for %d: len %d: copy failed: %d\n",
caller->p_endpoint, len, s);
return s;
}
for(i = 0; i < len; i++)
kputc(mybuf[i]);
kputc(END_OF_KMESS);
return OK;
case SYSCTL_CODE_STACKTRACE:
if(!isokendpt(m_ptr->SYSCTL_ARG2, &proc_nr))
return EINVAL;
proc_stacktrace(proc_addr(proc_nr));
proc_dump_regs(proc_addr(proc_nr));
return OK;
default:
printf("do_sysctl: invalid request %d\n", m_ptr->SYSCTL_CODE);
return(EINVAL);
}
panic("do_sysctl: can't happen");
return(OK);
}
开发者ID:mwilbur,项目名称:minix,代码行数:43,代码来源:do_sysctl.c
示例20: do_sigreturn
/*===========================================================================*
* do_sigreturn *
*===========================================================================*/
PUBLIC int do_sigreturn(struct proc * caller, message * m_ptr)
{
/* POSIX style signals require sys_sigreturn to put things in order before
* the signalled process can resume execution
*/
struct sigcontext sc;
register struct proc *rp;
int proc_nr, r;
if (! isokendpt(m_ptr->SIG_ENDPT, &proc_nr)) return(EINVAL);
if (iskerneln(proc_nr)) return(EPERM);
rp = proc_addr(proc_nr);
/* Copy in the sigcontext structure. */
if((r=data_copy(m_ptr->SIG_ENDPT, (vir_bytes) m_ptr->SIG_CTXT_PTR,
KERNEL, (vir_bytes) &sc, sizeof(struct sigcontext))) != OK)
return r;
/* Restore user bits of psw from sc, maintain system bits from proc. */
sc.sc_psw = (sc.sc_psw & X86_FLAGS_USER) |
(rp->p_reg.psw & ~X86_FLAGS_USER);
#if (_MINIX_CHIP == _CHIP_INTEL)
/* Don't panic kernel if user gave bad selectors. */
sc.sc_cs = rp->p_reg.cs;
sc.sc_ds = rp->p_reg.ds;
sc.sc_es = rp->p_reg.es;
sc.sc_ss = rp->p_reg.ss;
#if _WORD_SIZE == 4
sc.sc_fs = rp->p_reg.fs;
sc.sc_gs = rp->p_reg.gs;
#endif
#endif
/* Restore the registers. */
memcpy(&rp->p_reg, &sc.sc_regs, sizeof(sigregs));
#if (_MINIX_CHIP == _CHIP_INTEL)
if(sc.sc_flags & MF_FPU_INITIALIZED)
{
memcpy(rp->p_fpu_state.fpu_save_area_p, &sc.sc_fpu_state,
FPU_XFP_SIZE);
rp->p_misc_flags |= MF_FPU_INITIALIZED; /* Restore math usage flag. */
/* force reloading FPU */
if (fpu_owner == rp)
release_fpu();
}
#endif
rp->p_misc_flags |= MF_CONTEXT_SET;
return(OK);
}
开发者ID:Spenser309,项目名称:CS551,代码行数:55,代码来源:do_sigreturn.c
注:本文中的proc_addr函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论