Ignore:
Timestamp:
Nov 4, 2011, 12:22:17 PM (9 years ago)
Author:
ayache
Message:

Function pointers in D2.2/8051. Bugged for now.

Location:
Deliverables/D2.2/8051/src/ASM
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • Deliverables/D2.2/8051/src/ASM/ASMInterpret.ml

    r1462 r1488  
    10361036             List.flatten (List.map assembly1 translation)
    10371037      | `Mov (`DPTR,s) ->
    1038           let addrr16 = StringTools.Map.find s datalabels in
    1039            assembly1 (`MOV (`U4 (`DPTR,`DATA16 addrr16)))
     1038          (* let addr16 = StringTools.Map.find s datalabels in *)
     1039          let addrr16 =
     1040            try StringTools.Map.find s datalabels
     1041            with Not_found -> StringTools.Map.find s labels in
     1042          assembly1 (`MOV (`U4 (`DPTR,`DATA16 addrr16)))
    10401043      | `Jmp s ->
    10411044          let pc_offset = StringTools.Map.find s labels in
     
    20052008    (res, List.rev !trace)
    20062009  else (IntValue.Int32.zero, [])
     2010
     2011
     2012let size_of_instr instr =
     2013  let exit_lbl = "exit" in
     2014  let p = { ASM.ppreamble = [] ; ASM.pexit_label = exit_lbl ;
     2015            ASM.pcode = [instr ; `Label exit_lbl] ; ASM.phas_main = false } in
     2016  let p = assembly p in
     2017  let status = load_program p in
     2018  let addr_zero = BitVectors.vect_of_int 0 `Sixteen in
     2019  let (_, size, _) = fetch status.code_memory addr_zero in
     2020  BitVectors.int_of_vect size
     2021
     2022let size_of_instrs instrs =
     2023  let f res instr = res + (size_of_instr instr) in
     2024  List.fold_left f 0 instrs
  • Deliverables/D2.2/8051/src/ASM/ASMInterpret.mli

    r743 r1488  
    129129val load_program : ASM.program -> status
    130130val interpret    : bool -> ASM.program -> AST.trace
     131
     132val size_of_instrs : ASM.labelled_instruction list -> int
  • Deliverables/D2.2/8051/src/ASM/I8051.ml

    r818 r1488  
    170170let rets = [dpl ; dph ; r00 ; r01]
    171171
     172let spl_addr = spl
     173let spl_init = 255
     174let sph_addr = sph
     175let sph_init = 255
    172176let isp_addr = 129
    173177let isp_init = 47
  • Deliverables/D2.2/8051/src/ASM/I8051.mli

    r818 r1488  
    5555val carry : register (* only used for the liveness analysis *)
    5656
     57val spl_addr : int
     58val spl_init : int
     59val sph_addr : int
     60val sph_init : int
    5761val isp_addr : int
    5862val isp_init : int
Note: See TracChangeset for help on using the changeset viewer.