1
2
3
4 package joeq.Assembler;
5
6 import java.io.DataOutput;
7 import java.io.IOException;
8 import joeq.Memory.CodeAddress;
9 import joeq.Memory.HeapAddress;
10
11 /***
12 * Code2HeapReference
13 *
14 * @author John Whaley <jwhaley@alum.mit.edu>
15 * @version $Id: Code2HeapReference.java 1941 2004-09-30 03:37:06Z joewhaley $
16 */
17 public class Code2HeapReference extends Reloc {
18
19 private CodeAddress from_codeloc;
20 private HeapAddress to_heaploc;
21
22 /*** Creates new Code2HeapReference */
23 public Code2HeapReference(CodeAddress from_codeloc, HeapAddress to_heaploc) {
24 this.from_codeloc = from_codeloc; this.to_heaploc = to_heaploc;
25 }
26
27 public CodeAddress getFrom() { return from_codeloc; }
28 public HeapAddress getTo() { return to_heaploc; }
29
30 public void patch() { from_codeloc.poke(to_heaploc); }
31
32 public void dumpCOFF(DataOutput out) throws IOException {
33 out.writeInt(from_codeloc.to32BitValue());
34 out.writeInt(1);
35 out.writeChar(Reloc.RELOC_ADDR32);
36 }
37
38 public String toString() {
39 return "from code:"+from_codeloc.stringRep()+" to heap:"+to_heaploc.stringRep();
40 }
41
42 }