🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Steven M. Schultz Thu, 06 Jun 1991 06:46
Missing _ in spl calls
#124
Author: Steven M. Schultz
Date: Thu, 06 Jun 1991 06:46
305 lines
7941 bytes
Subject: Missing _ in spl calls
Index:	sys/{sys,pdpuba,pdp}/<several> 2.11BSD

Description:
	A missing underscore in front of spl?() functions causes the
	generation of an extra instruction to save the current priority
	level.

	Statements of the form "(void) spl?();" do not need to save
	the current priority level.  The 'ed' scripts used in compiling
	the kernel will not generate the extra instruction if the _spl?()
	form of the call is used.

	The space savings are small (but real), the goal was to save some time.

Repeat-By:
	Examine the generated code.

Fix:
	Apply the following patches  and recompile the kernel.
-------------------------------------------------------------------------
*** /usr/src/sys/pdpuba/dz.c.old	Tue Apr  3 15:44:25 1990
--- /usr/src/sys/pdpuba/dz.c	Wed Jun  5 23:12:12 1991
***************
*** 157,168 ****
  	else
  		dzsoftCAR[unit >> 3] &= ~(1<<(unit&07));
  #endif /* BSD2_10 */
! 	(void) spl5();
  	while ((tp->t_state & TS_CARR_ON) == 0) {
  		tp->t_state |= TS_WOPEN;
  		sleep((caddr_t)&tp->t_rawq, TTIPRI);
  	}
! 	(void) spl0();
  	return ((*linesw[tp->t_line].l_open)(dev, tp));
  }
  
--- 157,168 ----
  	else
  		dzsoftCAR[unit >> 3] &= ~(1<<(unit&07));
  #endif /* BSD2_10 */
! 	(void) _spl5();
  	while ((tp->t_state & TS_CARR_ON) == 0) {
  		tp->t_state |= TS_WOPEN;
  		sleep((caddr_t)&tp->t_rawq, TTIPRI);
  	}
! 	(void) _spl0();
  	return ((*linesw[tp->t_line].l_open)(dev, tp));
  }
  
*** /usr/src/sys/sys/kern_clock.c.old	Fri Jun 22 15:46:17 1990
--- /usr/src/sys/sys/kern_clock.c	Wed Jun  5 23:05:41 1991
***************
*** 144,150 ****
  	}
  
  	if (needsoft && BASEPRI(ps)) {	/* if ps is high, just return */
! 		(void) splsoftclock();
  		softclock(pc,ps);
  	}
  	restormap(map);
--- 144,150 ----
  	}
  
  	if (needsoft && BASEPRI(ps)) {	/* if ps is high, just return */
! 		(void) _splsoftclock();
  		softclock(pc,ps);
  	}
  	restormap(map);
*** /usr/src/sys/sys/kern_sig.c.old	Sat Apr  7 22:39:58 1990
--- /usr/src/sys/sys/kern_sig.c	Wed Jun  5 23:07:01 1991
***************
*** 91,97 ****
  	/*
  	 * Change setting atomically.
  	 */
! 	(void) splhigh();
  	u.u_signal[sig] = sv->sv_handler;
  	u.u_sigmask[sig] = sv->sv_mask &~ cantmask;
  	if (sv->sv_flags & SV_INTERRUPT)
--- 91,97 ----
  	/*
  	 * Change setting atomically.
  	 */
! 	(void) _splhigh();
  	u.u_signal[sig] = sv->sv_handler;
  	u.u_sigmask[sig] = sv->sv_mask &~ cantmask;
  	if (sv->sv_flags & SV_INTERRUPT)
***************
*** 113,119 ****
  		else
  			p->p_sigcatch |= bit;
  	}
! 	(void) spl0();
  }
  
  sigblock()
--- 113,119 ----
  		else
  			p->p_sigcatch |= bit;
  	}
! 	(void) _spl0();
  }
  
  sigblock()
***************
*** 123,132 ****
  	} *uap = (struct a *)u.u_ap;
  	register struct proc *p = u.u_procp;
  
! 	(void) splhigh();
  	u.u_r.r_long = p->p_sigmask;
  	p->p_sigmask |= uap->mask &~ cantmask;
! 	(void) spl0();
  }
  
  sigsetmask()
--- 123,132 ----
  	} *uap = (struct a *)u.u_ap;
  	register struct proc *p = u.u_procp;
  
! 	(void) _splhigh();
  	u.u_r.r_long = p->p_sigmask;
  	p->p_sigmask |= uap->mask &~ cantmask;
! 	(void) _spl0();
  }
  
  sigsetmask()
***************
*** 136,145 ****
  	} *uap = (struct a *)u.u_ap;
  	register struct proc *p = u.u_procp;
  
! 	(void) splhigh();
  	u.u_r.r_long = p->p_sigmask;
  	p->p_sigmask = uap->mask &~ cantmask;
! 	(void) spl0();
  }
  
  sigpause()
--- 136,145 ----
  	} *uap = (struct a *)u.u_ap;
  	register struct proc *p = u.u_procp;
  
! 	(void) _splhigh();
  	u.u_r.r_long = p->p_sigmask;
  	p->p_sigmask = uap->mask &~ cantmask;
! 	(void) _spl0();
  }
  
  sigpause()
***************
*** 758,764 ****
  		 * mask from before the sigpause is what we want restored
  		 * after the signal processing is completed.
  		 */
! 		(void) splhigh();
  		if (p->p_flag & SOMASK) {
  			returnmask = u.u_oldmask;
  			p->p_flag &= ~SOMASK;
--- 758,764 ----
  		 * mask from before the sigpause is what we want restored
  		 * after the signal processing is completed.
  		 */
! 		(void) _splhigh();
  		if (p->p_flag & SOMASK) {
  			returnmask = u.u_oldmask;
  			p->p_flag &= ~SOMASK;
***************
*** 765,771 ****
  		} else
  			returnmask = p->p_sigmask;
  		p->p_sigmask |= u.u_sigmask[sig] | mask;
! 		(void) spl0();
  #ifdef UCB_RUSAGE
  		u.u_ru.ru_nsignals++;
  #endif
--- 765,771 ----
  		} else
  			returnmask = p->p_sigmask;
  		p->p_sigmask |= u.u_sigmask[sig] | mask;
! 		(void) _spl0();
  #ifdef UCB_RUSAGE
  		u.u_ru.ru_nsignals++;
  #endif
*** /usr/src/sys/sys/kern_synch.c.old	Thu May 24 23:49:36 1990
--- /usr/src/sys/sys/kern_synch.c	Wed Jun  5 23:07:32 1991
***************
*** 120,126 ****
  		 * by the filesystem, but for now avoid network interrupts
  		 * that might cause another panic.
  		 */
! 		(void)splnet();
  		noop();
  		splx(s);
  		return;
--- 120,126 ----
  		 * by the filesystem, but for now avoid network interrupts
  		 * that might cause another panic.
  		 */
! 		(void) _splnet();
  		noop();
  		splx(s);
  		return;
***************
*** 142,154 ****
  			if (rp->p_wchan)
  				unsleep(rp);
  			rp->p_stat = SRUN;
! 			(void) spl0();
  			goto psig;
  		}
  		if (rp->p_wchan == 0)
  			goto out;
  		rp->p_stat = SSLEEP;
! 		(void) spl0();
  		/*
  		 * maybe a very small core memory, give swapped out
  		 * processes a chance.
--- 142,154 ----
  			if (rp->p_wchan)
  				unsleep(rp);
  			rp->p_stat = SRUN;
! 			(void) _spl0();
  			goto psig;
  		}
  		if (rp->p_wchan == 0)
  			goto out;
  		rp->p_stat = SSLEEP;
! 		(void) _spl0();
  		/*
  		 * maybe a very small core memory, give swapped out
  		 * processes a chance.
***************
*** 165,171 ****
  			goto psig;
  	} else {
  		rp->p_stat = SSLEEP;
! 		(void) spl0();
  #ifdef UCB_RUSAGE
  		u.u_ru.ru_nvcsw++;
  #endif
--- 165,171 ----
  			goto psig;
  	} else {
  		rp->p_stat = SSLEEP;
! 		(void) _spl0();
  #ifdef UCB_RUSAGE
  		u.u_ru.ru_nvcsw++;
  #endif
*** /usr/src/sys/pdp/machdep2.c.old	Sat May 18 20:11:12 1991
--- /usr/src/sys/pdp/machdep2.c	Wed Jun  5 22:50:37 1991
***************
*** 384,390 ****
  	if ((howto&RB_NOSYNC)==0 && waittime < 0 && bfreelist[0].b_forw) {
  		waittime = 0;
  		printf("syncing disks... ");
! 		(void) splnet();
  		/*
  		 * Release inodes held by texts before update.
  		 */
--- 384,390 ----
  	if ((howto&RB_NOSYNC)==0 && waittime < 0 && bfreelist[0].b_forw) {
  		waittime = 0;
  		printf("syncing disks... ");
! 		(void) _splnet();
  		/*
  		 * Release inodes held by texts before update.
  		 */
***************
*** 406,412 ****
  		}
  		printf("done\n");
  	}
! 	(void)splhigh();
  	if (howto & RB_HALT) {
  		printf("halting\n");
  		halt();
--- 406,412 ----
  		}
  		printf("done\n");
  	}
! 	(void) _splhigh();
  	if (howto & RB_HALT) {
  		printf("halting\n");
  		halt();
*** /usr/src/sys/pdp/trap.c.old	Fri Aug  4 14:44:16 1989
--- /usr/src/sys/pdp/trap.c	Wed Jun  5 22:51:06 1991
***************
*** 94,100 ****
  	 * futher traps will be handled by looping in place.
  	 */
  	if (once_thru) {
! 		(void)splhigh();
  		for(;;);
  	}
  
--- 94,100 ----
  	 * futher traps will be handled by looping in place.
  	 */
  	if (once_thru) {
! 		(void) _splhigh();
  		for(;;);
  	}
  
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads