Home | History | Annotate | Download | only in common
History log of /src/sys/arch/alpha/stand/common/prom.c
RevisionDateAuthorComments
 1.16  03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.15  13-Oct-2016  flxd branches: 1.15.14; 1.15.16;
Match the two prom_getenv() and fix buffer overflow causing wrong host controller SCSI ID for DEC 3000.
OK skrll@
 1.14  18-Mar-2009  cegger branches: 1.14.18; 1.14.22; 1.14.38; 1.14.40; 1.14.42; 1.14.44; 1.14.46;
Ansify function definitions w/o arguments. Generated with sed.
 1.13  14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.12  14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.11  30-Jul-2002  nathanw branches: 1.11.112; 1.11.120; 1.11.126;
Experimentation reveals that the implementation of GET_ENV on at least
some systems chokes if the buffer is not 8-byte aligned. GCC only aligns
character arrays to 4-byte boundaries by default, so it's possible to get
unlucky and die in the boot blocks with a "kernel stack not valid halt".

Avoid the problem by using a local, aligned buffer as the argument to GET_ENV,
and copying the result into the caller's buffer.

Should fix PRs port-alpha/17682 and port-alpha/17717.
CVS ----------------------------------------------------------------------
 1.10  02-Apr-1999  cgd branches: 1.10.2; 1.10.20; 1.10.22; 1.10.34; 1.10.36;
unrevert the changes made last night, now that 'installboot' has
had a few bugs fixed that let the problem slip in, and since bootxx's
Makefile now goes out of its way to satisfy installboot's undocumented
and totally unreasonable assumptions about the bootxx file it's operating
on. No point in fixing the assumptions, because sooner rather than later
this incarnation of installboot is going to die.
 1.9  01-Apr-1999  ross Revert recent changes, which either don't work, or can't be built
successfully by ordinary mortals.
 1.8  31-Mar-1999  cgd implement NO_GETCHAR, to remove getchar(), and NO_PUTCHAR_HALT to remove
the check in putchar() for character input (specifically control-c, which
causes a halt).
 1.7  31-Mar-1999  cgd no point in passing &ret to test_getchar(); nobody cares! also, no
point in doing the check-for-abort functionality twice in putchar()
(once with a call to test_getchar(), once open coded).
 1.6  31-Mar-1999  cgd In putchar(), don't open-code two calls to the prom puts routine. Instead,
call a helper function (putonechar()). Savings: 64 bytes. Cha-ching!
 1.5  15-Oct-1998  ross Delete prom_open() wrapper routine. Other clients of prom_open
can use the prom.h dispatch macros instead, especially since they
all presently expect the raw return bits.
 1.4  22-Sep-1998  ross While we are here in alpha/stand, bail out on ^C during boot.
 1.3  06-Sep-1997  drochner -Wall fixes
 1.2  06-Apr-1997  cgd branches: 1.2.4; 1.2.6;
clean up NetBSD RCS ID strings
 1.1  24-Jan-1997  cgd branches: 1.1.2;
reorganize Alpha boot block sources: put common sources in a 'common'
directory (so they don't clutter up the arch/alpha/stand), and put
not-common sources in programs' directories.
 1.1.2.1  01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.2.6.2  06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.2.6.1  06-Apr-1997  cgd file prom.c was added on branch alpha-nwscons on 1997-04-06 08:41:01 +0000
 1.2.4.1  06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.10.36.1  31-Jul-2002  lukem Pull up revision 1.11 (requested by nathanw in ticket #591):
Experimentation reveals that the implementation of GET_ENV on at least
some systems chokes if the buffer is not 8-byte aligned. GCC only aligns
character arrays to 4-byte boundaries by default, so it's possible to get
unlucky and die in the boot blocks with a "kernel stack not valid halt".
Avoid the problem by using a local, aligned buffer as the argument to GET_ENV,
and copying the result into the caller's buffer.
Should fix PRs port-alpha/17682 and port-alpha/17717.
 1.10.34.1  30-Aug-2002  gehenna catch up with -current.
 1.10.22.1  06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.10.20.1  01-Aug-2002  nathanw Catch up to -current.
 1.10.2.2  02-Apr-1999  cgd unrevert the changes made last night, now that 'installboot' has
had a few bugs fixed that let the problem slip in, and since bootxx's
Makefile now goes out of its way to satisfy installboot's undocumented
and totally unreasonable assumptions about the bootxx file it's operating
on. No point in fixing the assumptions, because sooner rather than later
this incarnation of installboot is going to die.
 1.10.2.1  02-Apr-1999  cgd file prom.c was added on branch netbsd-1-4 on 1999-04-02 03:11:58 +0000
 1.11.126.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.11.120.1  28-Apr-2009  skrll Sync with HEAD.
 1.11.112.1  04-May-2009  yamt sync with head.
 1.14.46.1  18-Jan-2017  skrll Sync with netbsd-5
 1.14.44.1  04-Nov-2016  pgoyette Sync with HEAD
 1.14.42.1  01-Nov-2016  snj Pull up following revision(s) (requested by maxv in ticket #1269):
sys/arch/alpha/alpha/machdep.c: revision 1.347
sys/arch/alpha/alpha/prom.c: revision 1.49
sys/arch/alpha/stand/common/booted_dev.c: revision 1.4
sys/arch/alpha/stand/common/prom.c: revision 1.15
Match the two prom_getenv() and fix buffer overflow causing wrong host
controller SCSI ID for DEC 3000.
OK skrll@
 1.14.40.1  05-Dec-2016  skrll Sync with HEAD
 1.14.38.1  01-Nov-2016  snj Pull up following revision(s) (requested by maxv in ticket #1269):
sys/arch/alpha/alpha/prom.c: revision 1.49
sys/arch/alpha/stand/common/prom.c: revision 1.15
sys/arch/alpha/alpha/machdep.c: revision 1.347
sys/arch/alpha/stand/common/booted_dev.c: revision 1.4
Match the two prom_getenv() and fix buffer overflow causing wrong host
controller SCSI ID for DEC 3000.
OK skrll@
 1.14.22.1  03-Dec-2017  jdolecek update from HEAD
 1.14.18.1  16-Nov-2016  snj Pull up following revision(s) (requested by flxd in ticket #1416):
sys/arch/alpha/alpha/machdep.c: revision 1.347
sys/arch/alpha/alpha/prom.c: revision 1.49
sys/arch/alpha/stand/common/booted_dev.c: revision 1.4
sys/arch/alpha/stand/common/prom.c: revision 1.15
Match the two prom_getenv() and fix buffer overflow causing wrong host
controller SCSI ID for DEC 3000.
OK skrll@
 1.15.16.1  10-Jun-2019  christos Sync with HEAD
 1.15.14.1  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)

RSS XML Feed