001/**
002 * Copyright 2012 Emmanuel Bourg
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http:/**www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package net.jsign.pe;
018
019/**
020 * Target architecture of an executable file.
021 * 
022 * @author Emmanuel Bourg
023 * @since 1.0
024 */
025public enum MachineType {
026
027    /** Executable assumed to be applicable to any machine type */
028    UNKNOWN(0x0),
029
030    /** Matsushita AM33 */
031    AM33(0x1d3),
032
033    /** x64 */
034    AMD64(0x8664),
035
036    /** ARM little endian */
037    ARM(0x1c0),
038
039    /** ARMv7 (or higher) Thumb mode only */
040    ARMV7(0x1c4),
041
042    /** ARMv8 in 64-bit mode */
043    ARM64(0xaa64),
044
045    /** EFI byte code */
046    EBC(0xebc),
047
048    /** Intel 386 or later processors and compatible processors */
049    I386(0x14c),
050
051    /** Intel Itanium processor family */
052    IA64(0x200),
053
054    /** Mitsubishi M32R little endian */
055    M32R(0x9041),
056
057    /** MIPS16 */
058    MIPS16(0x266),
059
060    /** MIPS with FPU */
061    MIPSFPU(0x366),
062
063    /** MIPS16 with FPU */
064    MIPSFPU16(0x466),
065
066    /** Power PC little endian */
067    POWERPC(0x1f0),
068
069    /** Power PC with floating point support */
070    POWERPCFP(0x1f1),
071
072    /** MIPS little endian */
073    R4000(0x166),
074
075    /** Hitachi SH3 */
076    SH3(0x1a2),
077
078    /** Hitachi SH3 DSP */
079    SH3DSP(0x1a3),
080
081    /** Hitachi SH4 */
082    SH4(0x1a6),
083
084    /** Hitachi SH5 */
085    SH5(0x1a8),
086
087    /** ARM or Thumb (interworking) */
088    THUMB(0x1c2),
089
090    /** MIPS little-endian WCE v2 */
091    WCEMIPSV2(0x169); 
092
093    private final int value;
094
095    MachineType(int value) {
096        this.value = value;
097    }
098
099    static MachineType valueOf(int value) {
100        for (MachineType format : values()) {
101            if (format.value == value) {
102                return format;
103            }
104        }
105        
106        return null;
107    }
108}