xref: /titanic_50/usr/src/tools/protocmp/arch.c (revision c77a61a72b5ecdc507d6cf104142edd371a16c84)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 
23 /*
24  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
25  * Use is subject to license terms.
26  */
27 
28 #pragma ident	"%Z%%M%	%I%	%E% SMI"
29 
30 #include <stdio.h>
31 #include <string.h>
32 
33 #include "list.h"
34 
35 int
36 assign_arch(const char *architecture)
37 {
38 	int	arch = 0;
39 
40 #if defined(sparc)
41 	if (strcmp(architecture, "sparc") == 0)
42 		arch = P_SPARC;
43 	else if (strcmp(architecture, "ISA") == 0)
44 		arch = P_SPARC;
45 	else if (strcmp(architecture, "all") == 0)
46 		arch = P_SPARC;
47 	else if (strcmp(architecture, "sparc.sun4") == 0)
48 		arch = P_SUN4;
49 	else if (strcmp(architecture, "sparc.sun4c") == 0)
50 		arch = P_SUN4c;
51 	else if (strcmp(architecture, "sparc.sun4u") == 0)
52 		arch = P_SUN4u;
53 	else if (strcmp(architecture, "sparc.sun4d") == 0)
54 		arch = P_SUN4d;
55 	else if (strcmp(architecture, "sparc.sun4e") == 0)
56 		arch = P_SUN4e;
57 	else if (strcmp(architecture, "sparc.sun4m") == 0)
58 		arch = P_SUN4m;
59 	else if (strcmp(architecture, "sparc.sun4v") == 0)
60 		arch = P_SUN4v;
61 #elif defined(i386)
62 	if (strcmp(architecture, "i386") == 0)
63 		arch = P_I386;
64 	else if (strcmp(architecture, "ISA") == 0)
65 		arch = P_I386;
66 	else if (strcmp(architecture, "all") == 0)
67 		arch = P_I386;
68 	else if (strcmp(architecture, "i386.i86pc") == 0)
69 		arch = P_I86PC;
70 #elif defined(__ppc)
71 	if (strcmp(architecture, "ppc") == 0)
72 		arch = P_PPC;
73 	else if (strcmp(architecture, "ISA") == 0)
74 		arch = P_PPC;
75 	else if (strcmp(architecture, "all") == 0)
76 		arch = P_PPC;
77 	else if (strcmp(architecture, "ppc.prep") == 0)
78 		arch = P_PREP;
79 #else
80 #error "Unknown instruction set"
81 #endif
82 
83 	return (arch);
84 }
85