This patch avoids GCC's built-in knowledge of the type of exit().
The function previously named exit() in the kernel wasn't really
the exit() system call (although it implemented said call), so
it has been renamed.
*** c:/tmp/T0AA.AAA Tue Aug 17 21:15:26 1993
--- kern/proc.c Tue Aug 17 21:11:10 1993
***************
*** 522,538 ****
free(p);
}
/*
! * exit()
! * The exit() system call
*
* Tricky once we tear down our kernel stack, because we can no longer
* use stack variables once this happens. The trivial way to deal with
* this is to declare them "register" and hope the declaration is honored.
* I'm trying to avoid this by using just the percpu "curthread" value.
*/
! exit(int code)
{
struct thread *t = curthread, *t2, **tp;
struct proc *p = t->t_proc;
int last;
--- 522,541 ----
free(p);
}
/*
! * do_exit()
! * The exit() system call, really
*
* Tricky once we tear down our kernel stack, because we can no longer
* use stack variables once this happens. The trivial way to deal with
* this is to declare them "register" and hope the declaration is honored.
* I'm trying to avoid this by using just the percpu "curthread" value.
+ *
+ * GCC tends to *know* what exit() means, so we name it do_exit() and
+ * avoid the issue.
*/
! do_exit(int code)
{
struct thread *t = curthread, *t2, **tp;
struct proc *p = t->t_proc;
int last;
***************
*** 548,556 ****
break;
}
tp = &t2->t_next;
}
! ASSERT(t2, "exit: lost thread");
last = (p->p_threads == 0);
/*
* Accumulate CPU in proc
--- 551,559 ----
break;
}
tp = &t2->t_next;
}
! ASSERT(t2, "do_exit: lost thread");
last = (p->p_threads == 0);
/*
* Accumulate CPU in proc
***************
*** 605,613 ****
p_lock(&runq_lock, SPLHI);
ATOMIC_DEC(&cpu.pc_locks); /* swtch() will handle dispatch */
for (;;) {
swtch();
! ASSERT(0, "exit: swtch returned");
}
}
/*
--- 608,616 ----
p_lock(&runq_lock, SPLHI);
ATOMIC_DEC(&cpu.pc_locks); /* swtch() will handle dispatch */
for (;;) {
swtch();
! ASSERT(0, "do_exit: swtch returned");
}
}
/*
*** c:/tmp/T0AA.AAA Tue Aug 17 21:15:28 1993
--- mach/syscall.c Tue Aug 17 21:09:46 1993
***************
*** 18,26 ****
/* #define SYSCALLTRACE /* */
extern int msg_port(), msg_connect(), msg_accept(), msg_send(),
msg_receive(), msg_reply(), msg_disconnect(), msg_err();
! extern int exit(), fork(), fork_thread(), enable_io(), enable_isr(),
mmap(), munmap(), strerror(), notify(), clone();
extern int page_wire(), page_release(), enable_dma(), time_get(),
time_sleep(), exec(), waits(), perm_ctl(), set_swapdev(),
run_qio(), set_cmd(), pageout(), getid(), unhash();
--- 18,26 ----
/* #define SYSCALLTRACE /* */
extern int msg_port(), msg_connect(), msg_accept(), msg_send(),
msg_receive(), msg_reply(), msg_disconnect(), msg_err();
! extern int do_exit(), fork(), fork_thread(), enable_io(), enable_isr(),
mmap(), munmap(), strerror(), notify(), clone();
extern int page_wire(), page_release(), enable_dma(), time_get(),
time_sleep(), exec(), waits(), perm_ctl(), set_swapdev(),
run_qio(), set_cmd(), pageout(), getid(), unhash();
***************
*** 37,45 ****
{msg_receive, 2}, /* 4 */
{msg_reply, 2}, /* 5 */
{msg_disconnect, 1}, /* 6 */
{msg_err, 3}, /* 7 */
! {exit, 1}, /* 8 */
{fork, 0}, /* 9 */
{fork_thread, 1}, /* 10 */
{enable_io, 2}, /* 11 */
{enable_isr, 2}, /* 12 */
--- 37,45 ----
{msg_receive, 2}, /* 4 */
{msg_reply, 2}, /* 5 */
{msg_disconnect, 1}, /* 6 */
{msg_err, 3}, /* 7 */
! {do_exit, 1}, /* 8 */
{fork, 0}, /* 9 */
{fork_thread, 1}, /* 10 */
{enable_io, 2}, /* 11 */
{enable_isr, 2}, /* 12 */
*** c:/tmp/T0AA.AAA Tue Aug 17 21:15:28 1993
--- mach/trap.c Tue Aug 17 21:12:34 1993
***************
*** 489,497 ****
{
struct evframe e;
struct trapframe *f;
struct proc *p;
! extern void exit();
ASSERT(t->t_uregs, "sendev: no user frame");
f = t->t_uregs;
--- 489,497 ----
{
struct evframe e;
struct trapframe *f;
struct proc *p;
! extern int do_exit();
ASSERT(t->t_uregs, "sendev: no user frame");
f = t->t_uregs;
***************
*** 505,513 ****
t->t_pid, ev);
dbg_enter();
#endif
strcpy(p->p_event, ev);
! exit(_W_EV);
}
/*
* Build event frame
--- 505,513 ----
t->t_pid, ev);
dbg_enter();
#endif
strcpy(p->p_event, ev);
! do_exit(_W_EV);
}
/*
* Build event frame
***************
*** 524,532 ****
printf("Stack overflow pid %ld/%ld sp 0x%x\n",
p->p_pid, t->t_pid, f->esp);
dbg_enter();
#endif
! exit(1);
}
/*
* Update user's registers to reflect this nesting
--- 524,532 ----
printf("Stack overflow pid %ld/%ld sp 0x%x\n",
p->p_pid, t->t_pid, f->esp);
dbg_enter();
#endif
! do_exit(1);
}
/*
* Update user's registers to reflect this nesting
Received on Tue Aug 17 21:26:51 1993
This archive was generated by hypermail 2.1.8 : Wed Sep 21 2005 - 19:37:12 PDT