add support for a function to be called from execve to check a_mid type
This commit is contained in:
parent
9c46a9333d
commit
94f52462a4
|
@ -35,7 +35,7 @@
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
|
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
|
||||||
* $Id: machdep.c,v 1.23 1993/06/02 04:28:07 cgd Exp $
|
* $Id: machdep.c,v 1.24 1993/06/03 01:31:05 cgd Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "param.h"
|
#include "param.h"
|
||||||
|
@ -102,6 +102,8 @@ int biosmem;
|
||||||
|
|
||||||
extern cyloffset;
|
extern cyloffset;
|
||||||
|
|
||||||
|
int cpu_class;
|
||||||
|
|
||||||
cpu_startup()
|
cpu_startup()
|
||||||
{
|
{
|
||||||
register int unixsize;
|
register int unixsize;
|
||||||
|
@ -261,18 +263,16 @@ struct cpu_nameclass i386_cpus[] = {
|
||||||
|
|
||||||
identifycpu() /* translated from hp300 -- cgd */
|
identifycpu() /* translated from hp300 -- cgd */
|
||||||
{
|
{
|
||||||
int class;
|
|
||||||
|
|
||||||
printf("CPU: ");
|
printf("CPU: ");
|
||||||
if (cpu >= 0 && cpu < (sizeof i386_cpus/sizeof(struct cpu_nameclass))) {
|
if (cpu >= 0 && cpu < (sizeof i386_cpus/sizeof(struct cpu_nameclass))) {
|
||||||
printf("%s", i386_cpus[cpu].cpu_name);
|
printf("%s", i386_cpus[cpu].cpu_name);
|
||||||
class = i386_cpus[cpu].cpu_class;
|
cpu_class = i386_cpus[cpu].cpu_class;
|
||||||
} else {
|
} else {
|
||||||
printf("unknown cpu type %d\n", cpu);
|
printf("unknown cpu type %d\n", cpu);
|
||||||
panic("startup: bad cpu id");
|
panic("startup: bad cpu id");
|
||||||
}
|
}
|
||||||
printf(" (");
|
printf(" (");
|
||||||
switch(class) {
|
switch(cpu_class) {
|
||||||
case CPUCLASS_286:
|
case CPUCLASS_286:
|
||||||
printf("286");
|
printf("286");
|
||||||
break;
|
break;
|
||||||
|
@ -295,7 +295,7 @@ identifycpu() /* translated from hp300 -- cgd */
|
||||||
* Now that we have told the user what they have,
|
* Now that we have told the user what they have,
|
||||||
* let them know if that machine type isn't configured.
|
* let them know if that machine type isn't configured.
|
||||||
*/
|
*/
|
||||||
switch (class) {
|
switch (cpu_class) {
|
||||||
case CPUCLASS_286: /* a 286 should not make it this far, anyway */
|
case CPUCLASS_286: /* a 286 should not make it this far, anyway */
|
||||||
#if !defined(I386_CPU)
|
#if !defined(I386_CPU)
|
||||||
case CPUCLASS_386:
|
case CPUCLASS_386:
|
||||||
|
@ -1179,3 +1179,32 @@ copystr(fromaddr, toaddr, maxlength, lencopied) u_int *lencopied, maxlength;
|
||||||
if(lencopied) *lencopied = tally;
|
if(lencopied) *lencopied = tally;
|
||||||
return(ENAMETOOLONG);
|
return(ENAMETOOLONG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* the following function checks to see if a given machine
|
||||||
|
* type (a_mid) field is valid for this architecture
|
||||||
|
* a non-zero return value indicates that the machine type is correct.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
cpu_exec_checkmid(int mid)
|
||||||
|
{
|
||||||
|
int rv;
|
||||||
|
|
||||||
|
switch (mid) {
|
||||||
|
#ifdef COMPAT_NOMID
|
||||||
|
case MID_ZERO:
|
||||||
|
return 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
case MID_I386:
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
case MID_I486:
|
||||||
|
return ((cpu_class == CPUCLASS_486) ||
|
||||||
|
(cpu_class == CPUCLASS_586));
|
||||||
|
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue