svn commit: r232711 - in projects/bigbb: share/mk sys/boot/i386/boot2 sys/boot/pc98/boot2

John Baldwin jhb at freebsd.org
Fri Mar 9 13:45:57 UTC 2012


On Thursday, March 08, 2012 7:53:55 pm Jung-uk Kim wrote:
> Author: jkim
> Date: Fri Mar  9 00:53:54 2012
> New Revision: 232711
> URL: http://svn.freebsd.org/changeset/base/232711
> 
> Log:
>   Spread more shrink ray on boot2.
>   
>   Submitted by:	dim
> 
> Modified:
>   projects/bigbb/share/mk/bsd.sys.mk
>   projects/bigbb/sys/boot/i386/boot2/Makefile
>   projects/bigbb/sys/boot/i386/boot2/boot2.c
>   projects/bigbb/sys/boot/pc98/boot2/Makefile
> 
> Modified: projects/bigbb/sys/boot/i386/boot2/boot2.c
> 
==============================================================================
> --- projects/bigbb/sys/boot/i386/boot2/boot2.c	Fri Mar  9 00:28:28 2012	
(r232710)
> +++ projects/bigbb/sys/boot/i386/boot2/boot2.c	Fri Mar  9 00:53:54 2012	
(r232711)
> @@ -148,8 +148,8 @@ static int xputc(int);
>  static int xgetc(int);
>  static inline int getc(int);
>  
> -static void memcpy(void *, const void *, int);
> -static void
> +static __noinline void memcpy(void *, const void *, int);
> +static __noinline void
>  memcpy(void *dst, const void *src, int len)
>  {
>      const char *s = src;
> @@ -223,10 +223,7 @@ main(void)
>  {
>      uint8_t autoboot;
>      ino_t ino;
> -    size_t nbyte;
>  
> -    opts = 0;
> -    kname = NULL;
>      dmadat = (void *)(roundup2(__base + (int32_t)&_end, 0x10000) - __base);
>      v86.ctl = V86_FLAGS;
>      v86.efl = PSL_RESERVED_DEFAULT | PSL_I;
> @@ -242,10 +239,8 @@ main(void)
>      autoboot = 1;
>  
>      if ((ino = lookup(PATH_CONFIG)) ||
> -        (ino = lookup(PATH_DOTCONFIG))) {
> -	nbyte = fsread(ino, cmd, sizeof(cmd) - 1);
> -	cmd[nbyte] = '\0';
> -    }
> +        (ino = lookup(PATH_DOTCONFIG)))
> +	fsread(ino, cmd, sizeof(cmd) - 1);

These changes will all break functionality.  The bss for boot2 is not cleared 
automatically (see note in revision log for 219452).  That means you can end
up with garbage in kname or opts, and the parse() routine relies on the string
stored in cmd[] being nul-terminated.

-- 
John Baldwin


More information about the svn-src-projects mailing list