diff options
| author | Kathy Gray | 2014-09-29 12:36:14 +0100 |
|---|---|---|
| committer | Kathy Gray | 2014-09-29 12:36:14 +0100 |
| commit | c205e3e77e35cf07fdf616c133d9a70a96986394 (patch) | |
| tree | a827d3d436fb69c4a73df9b9fb066c98fbceab84 /src/elf_model/endianness.lem | |
| parent | 80eabf2fca417f5dc245e5212e0f33f6c23bb58b (diff) | |
Add in elf model from Dominic/Stephen. Make run_power build again. Does not effectively use elf model yet
Diffstat (limited to 'src/elf_model/endianness.lem')
| -rw-r--r-- | src/elf_model/endianness.lem | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/elf_model/endianness.lem b/src/elf_model/endianness.lem new file mode 100644 index 00000000..9adba6cd --- /dev/null +++ b/src/elf_model/endianness.lem @@ -0,0 +1,35 @@ +(** [endian.lem] defines a type for describing the endianness of an ELF file, + * and functions and other operations over that type. + *) + +open import String + +open import Show + +(** Type [endianness] describes the endianness of an ELF file. This is deduced from + * the first few bytes (magic number, etc.) of the ELF header. + *) +type endianness + = Big (* Big endian *) + | Little (* Little endian *) + +(** [default_endianness] is a default endianness to use when reading in the ELF header + * before we have deduced from its entries what the rest of the file is encoded + * with. + *) +val default_endianness : endianness +let default_endianness = Little + +(** [string_of_endianness e] produces a string representation of the [endianness] value + * [e]. + *) +val string_of_endianness : endianness -> string +let string_of_endianness e = + match e with + | Big -> "Big" + | Little -> "Little" + end + +instance (Show endianness) + let show = string_of_endianness +end
\ No newline at end of file |
