1{- 2 Arch.hs: Architecture-specific information needed for stub generation. 3 4 Part of Flounder: a message passing IDL for Barrelfish 5 6 Copyright (c) 2007-2010, ETH Zurich. 7 Copyright (c) 2015, Hewlett Packard Enterprise Development LP. 8 All rights reserved. 9 10 This file is distributed under the terms in the attached LICENSE file. 11 If you do not find this file, copies can be found by writing to: 12 ETH Zurich D-INFK, Universit\"atstr. 6, CH-8092 Zurich. Attn: Systems Group. 13-} 14 15module Arch (Arch (..), parse_arch) where 16 17import Syntax 18 19-- everything the generic LMP backend needs to know about the architecture 20data Arch = Arch { 21 archname :: String, -- name of the architecture 22 23 -- architecture-specific sizes 24 wordsize :: Int, -- size of words, in bits 25 ptrsize :: Int, -- size of pointers, in bits 26 sizesize :: Int, -- size of size_t, in bits 27 enum_type :: TypeBuiltin, -- type of an enumeration 28 29 -- details of the barrelfish LMP channel implementation for this arch 30 lmp_words :: Int, -- payload of an LMP message, in number of words 31 lrpc_words :: Int -- payload of LRPC, in number of words 32} 33 34x86_64 = Arch { 35 archname = "x86_64", 36 wordsize = 64, 37 ptrsize = 64, 38 sizesize = 64, 39 enum_type = Int32, 40 lmp_words = 10, 41 lrpc_words = 4 42} 43 44x86_32 = Arch { 45 archname = "x86_32", 46 wordsize = 32, 47 ptrsize = 32, 48 sizesize = 32, 49 enum_type = Int32, 50 lmp_words = 4, 51 lrpc_words = 0 52} 53 54arm = Arch { 55 archname = "arm", 56 wordsize = 32, 57 ptrsize = 32, 58 sizesize = 32, 59 enum_type = Int32, 60 lmp_words = 4, 61 lrpc_words = 0 62} 63 64aarch64 = Arch { 65 archname = "aarch64", 66 wordsize = 64, 67 ptrsize = 64, 68 sizesize = 64, 69 enum_type = Int32, 70 lmp_words = 4, -- XXX: Should be more 71 lrpc_words = 4 72} 73 74-- settings for the xeon phi. TODO: Verify. 75k1om = Arch { 76 archname = "k1om", 77 wordsize = 64, 78 ptrsize = 64, 79 sizesize = 64, 80 enum_type = Int32, 81 lmp_words = 10, 82 lrpc_words = 4 83} 84 85all_archs = [x86_64, x86_32, arm, aarch64, k1om] 86 87-- for option parsing: find the matching arch info 88parse_arch :: String -> Maybe Arch 89parse_arch n = case [a | a <- all_archs, archname a == n] of 90 [a] -> Just a 91 _ -> Nothing 92