. remove some call cycles by low-level functions invoking printf(); e.g.
send_sig() gets a return value that the caller should check
. reason: very-early-phase printf() would trigger a printf() causing
infinite recursion -> GPF
. move serial initialization a little earlier so DEBUG_EXTRA works for
serial earlier (e.g. its first instance, for "cstart")
. closes tracker item 583:
System Fails to Complete Startup with Verbose 2 and 3 Boot Parameters,
reported by Stephen Hatton / pikpik.
/* Connect caller on vmrequest wait queue. */
if(!(caller->p_vmrequest.nextrequestor = vmrequest))
- send_sig(VM_PROC_NR, SIGKMEM);
+ if(OK != send_sig(VM_PROC_NR, SIGKMEM))
+ panic("send_sig failed");
vmrequest = caller;
}
* succeed.
*/
*p = _ENDPOINT_P(e);
- if(!isokprocn(*p)) {
-#if DEBUG_ENABLE_IPC_WARNINGS
- printf("kernel:%s:%d: bad endpoint %d: proc %d out of range\n",
- file, line, e, *p);
-#endif
- } else if(isemptyn(*p)) {
-#if 0
- printf("kernel:%s:%d: bad endpoint %d: proc %d empty\n", file, line, e, *p);
-#endif
- } else if(proc_addr(*p)->p_endpoint != e) {
-#if DEBUG_ENABLE_IPC_WARNINGS
- printf("kernel:%s:%d: bad endpoint %d: proc %d has ept %d (generation %d vs. %d)\n", file, line,
- e, *p, proc_addr(*p)->p_endpoint,
- _ENDPOINT_G(e), _ENDPOINT_G(proc_addr(*p)->p_endpoint));
-#endif
- } else ok = 1;
- if(!ok && fatalflag) {
+ ok = 0;
+ if(isokprocn(*p) && !isemptyn(*p) && proc_addr(*p)->p_endpoint == e)
+ ok = 1;
+ if(!ok && fatalflag)
panic("invalid endpoint: %d", e);
- }
return ok;
}
void set_sendto_bit(const struct proc *rc, int id);
void unset_sendto_bit(const struct proc *rc, int id);
void fill_sendto_mask(const struct proc *rc, sys_map_t *map);
-void send_sig(endpoint_t proc_nr, int sig_nr);
+int send_sig(endpoint_t proc_nr, int sig_nr);
void cause_sig(proc_nr_t proc_nr, int sig_nr);
void sig_delay_done(struct proc *rp);
void kernel_call(message *m_user, struct proc * caller);
system_hz = DEFAULT_HZ;
#endif
+#ifdef DEBUG_SERIAL
+ /* Intitialize serial debugging */
+ value = env_get(SERVARNAME);
+ if(value && atoi(value) == 0) {
+ do_serial_debug=1;
+
+ value = env_get(SERBAUDVARNAME);
+ if (value) serial_debug_baud = atoi(value);
+ }
+#endif
+
DEBUGEXTRA(("cstart\n"));
/* Record miscellaneous information for user-space servers. */
for(h = 0; h < _LOAD_HISTORY; h++)
kloadinfo.proc_load_history[h] = 0;
-#ifdef DEBUG_SERIAL
- /* Intitialize serial debugging */
- value = env_get(SERVARNAME);
- if(value && atoi(value) == 0) {
- do_serial_debug=1;
-
- value = env_get(SERBAUDVARNAME);
- if (value) serial_debug_baud = atoi(value);
- }
-#endif
-
#ifdef USE_APIC
value = env_get("no_apic");
if(value)
/*===========================================================================*
* send_sig *
*===========================================================================*/
-void send_sig(endpoint_t ep, int sig_nr)
+int send_sig(endpoint_t ep, int sig_nr)
{
/* Notify a system process about a signal. This is straightforward. Simply
* set the signal that is to be delivered in the pending signals map and
int proc_nr;
if(!isokendpt(ep, &proc_nr) || isemptyn(proc_nr))
- panic("send_sig to empty process: %d", ep);
+ return EINVAL;
rp = proc_addr(proc_nr);
sigaddset(&priv(rp)->s_sig_pending, sig_nr);
mini_notify(proc_addr(SYSTEM), rp->p_endpoint);
+
+ return OK;
}
/*===========================================================================*
rp->p_endpoint, sig_nr);
}
sigaddset(&priv(rp)->s_sig_pending, sig_nr);
- send_sig(rp->p_endpoint, SIGKSIGSM);
+ if(OK != send_sig(rp->p_endpoint, SIGKSIGSM))
+ panic("send_sig failed");
return;
}
sigaddset(&rp->p_pending, sig_nr);
if (! (RTS_ISSET(rp, RTS_SIGNALED))) { /* other pending */
RTS_SET(rp, RTS_SIGNALED | RTS_SIG_PENDING);
- send_sig(sig_mgr, SIGKSIG);
+ if(OK != send_sig(sig_mgr, SIGKSIG))
+ panic("send_sig failed");
}
}
}
/* Connect caller on vmrequest wait queue. */
if(!(caller->p_vmrequest.nextrequestor = vmrequest))
- send_sig(VM_PROC_NR, SIGKMEM);
+ if(OK != send_sig(VM_PROC_NR, SIGKMEM))
+ panic("send_sig failed");
vmrequest = caller;
return OK;