12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788(*Generated by Lem from abis/riscv/abi_riscv.lem.*)(** [abi_riscv] contains top-level definition for the RISCV ABI.
*)openLem_basic_classesopenLem_boolopenLem_listopenLem_numopenLem_maybeopenErroropenLem_mapopenLem_assert_extraopenMissing_pervasivesopenElf_headeropenElf_types_native_uintopenElf_fileopenElf_interpreted_segmentopenElf_interpreted_sectionopenEndiannessopenMemory_image(* open import Elf_memory_image *)openAbi_classes(*open import Abi_riscv_relocation*)openAbi_riscv_elf_header(** [abi_riscv_compute_program_entry_point segs entry] computes the program
* entry point using ABI-specific conventions. On RISCV the entry point in
* the ELF header ([entry] here) is the real entry point. On other ABIs, e.g.
* PowerPC64, the entry point [entry] is a pointer into one of the segments
* constituting the process image (passed in as [segs] here for a uniform
* interface).
*)(*val abi_riscv_compute_program_entry_point : list elf64_interpreted_segments -> elf64_addr -> error natural*)letabi_riscv_compute_program_entry_pointsegsentry:(Nat_big_num.num)error=(return(Ml_bindings.nat_big_num_of_uint64entry))(*val header_is_riscv : elf64_header -> bool*)letheader_is_riscvh:bool=(is_valid_elf64_headerh&&((Lem.option_equal(=)(Lem_list.list_indexh.elf64_ident(Nat_big_num.to_intelf_ii_data))(Some(Uint32_wrapper.of_bigintelf_data_2msb)))&&(is_valid_abi_riscv_machine_architecture(Uint32_wrapper.to_biginth.elf64_machine)&&is_valid_abi_riscv_magic_numberh.elf64_ident)))type'abifeatureplt_entry_address_fn0=Nat_big_num.num(* offset in PLT? *)->'abifeatureannotated_memory_image(* img *)->Nat_big_num.num(* addr *)type'abifeatureriscv_abi_feature=GOT2of((string*(symbol_definitionoption))list)|PLT2of((string*(symbol_definitionoption)*'abifeatureplt_entry_address_fn0)list)(*val abiFeatureCompare : forall 'abifeature. riscv_abi_feature 'abifeature -> riscv_abi_feature 'abifeature -> Basic_classes.ordering*)letabiFeatureCompare2f1f2:int=((match(f1,f2)with(GOT2(_),GOT2(_))->0|(GOT2(_),PLT2(_))->(-1)|(PLT2(_),PLT2(_))->0|(PLT2(_),GOT2(_))->1))(*val abiFeatureTagEq : forall 'abifeature. riscv_abi_feature 'abifeature -> riscv_abi_feature 'abifeature -> bool*)letabiFeatureTagEq2f1f2:bool=((match(f1,f2)with(GOT2(_),GOT2(_))->true|(PLT2(_),PLT2(_))->true|(_,_)->false))letinstance_Abi_classes_AbiFeatureTagEquiv_Abi_riscv_riscv_abi_feature_dict:('abifeatureriscv_abi_feature)abiFeatureTagEquiv_class=({abiFeatureTagEquiv_method=abiFeatureTagEq2})letinstance_Basic_classes_Ord_Abi_riscv_riscv_abi_feature_dict:('abifeatureriscv_abi_feature)ord_class=({compare_method=abiFeatureCompare2;isLess_method=(funf1->(funf2->(Lem.orderingEqual(abiFeatureCompare2f1f2)(-1))));isLessEqual_method=(funf1->(funf2->Pset.mem(abiFeatureCompare2f1f2)(Pset.from_listcompare[(-1);0])));isGreater_method=(funf1->(funf2->(Lem.orderingEqual(abiFeatureCompare2f1f2)1)));isGreaterEqual_method=(funf1->(funf2->Pset.mem(abiFeatureCompare2f1f2)(Pset.from_listcompare[1;0])))})(*val section_is_special : forall 'abifeature. elf64_interpreted_section -> annotated_memory_image 'abifeature -> bool*)letsection_is_special3simg2:bool=(elf_section_is_specialsimg2)