Changeset 1525 for Deliverables/D2.2


Ignore:
Timestamp:
Nov 21, 2011, 6:17:45 PM (8 years ago)
Author:
ayache
Message:

D2.2: function pointers using JMP.

Location:
Deliverables/D2.2/8051
Files:
23 added
2 edited

Legend:

Unmodified
Added
Removed
  • Deliverables/D2.2/8051/src/LIN/LINToASM.ml

    r1492 r1525  
    118118  | LIN.St_call_ptr ->
    119119    let lbl = env.fresh () in
    120     [`MOV (`U3 (st0_addr, dpl_addr)) ;
    121      `MOV (`U3 (st1_addr, dph_addr)) ;
    122      `Mov (`DPTR, lbl) ;
    123      `PUSH dpl_addr ;
    124      `PUSH dph_addr ;
    125      `PUSH st0_addr ;
    126      `PUSH st1_addr ;
    127      `RET ;
    128      `Label lbl]
    129 (* TODO: tell Claudio about the false assertion raised by the following. *)
    130 (*
    131   | LIN.St_call_ptr ->
    132     let lbl = env.fresh () in
    133     [`MOV (`U3 (st0_addr, dpl_addr)) ;
    134      `MOV (`U3 (st1_addr, dph_addr)) ;
    135      `Mov (`DPTR, lbl) ;
    136      `PUSH dpl_addr ;
    137      `PUSH dph_addr ;
    138      `MOV (`U3 (dpl_addr, st0_addr)) ;
    139      `MOV (`U3 (dph_addr, st1_addr)) ;
    140      `JMP `IND_DPTR ;
    141      `Label lbl]
    142 *)
     120    [`MOV (`U3 (st0_addr, dpl_addr)) ; (* save DPL *)
     121     `MOV (`U3 (st1_addr, dph_addr)) ; (* save DPH *)
     122     `Mov (`DPTR, lbl) ;               (* DPTR <- return address *)
     123     `PUSH dpl_addr ;                  (* push DPL *)
     124     `PUSH dph_addr ;                  (* push DPH *)
     125     `MOV (`U3 (dpl_addr, st0_addr)) ; (* restore DPL *)
     126     `MOV (`U3 (dph_addr, st1_addr)) ; (* restore DPH *)
     127     `MOV (`U1 (`A, data_of_int 0)) ;  (* A <- 0 *)
     128     `JMP `IND_DPTR ;                  (* jump to A+DPTR *)
     129     `Label lbl]                       (* return address *)
    143130  | LIN.St_condacc lbl ->
    144131    [`WithLabel (`JNZ (`Label lbl))]
  • Deliverables/D2.2/8051/src/clight/runtime.ml

    r818 r1525  
    3636       function *)
    3737    (string -> string) *
    38     (* dependences *)
     38    (* dependencies *)
    3939    operation list
    4040
Note: See TracChangeset for help on using the changeset viewer.