Ejemplo n.º 1
0
    def generate_init_script(self, kernel, elf, image, machine):
        data = self.create_ops(kernel, elf, machine)

        # All these symbols *must* exist
        may_not_exist = False
        for p in self.patches:
            (addr, size) = get_symbol(elf, p[0], may_not_exist)
            image.patch(addr, size, p[1])

        dlen = len(data)
        assert(dlen <= kernel.heap_attrs.size)

        kernel.heap.segment.sections[0]._data[:dlen] = data
Ejemplo n.º 2
0
    def generate_init_script(self, kernel, elf, image, machine):
        data = self.create_ops(kernel, elf, machine)

        # All these symbols *must* exist
        may_not_exist = False
        for p in self.patches:
            (addr, size) = get_symbol(elf, p[0], may_not_exist)
            image.patch(addr, size, p[1])

        dlen = len(data)
        assert (dlen <= kernel.heap_attrs.size)

        kernel.heap.segment.sections[0]._data[:dlen] = data
Ejemplo n.º 3
0
def get_symbol(elf, symbol, may_not_exist=False):
    """
    Return the address, and size in bytes, of a symbol from the ELF
    file.

    If may_not_exist is true then failing to find the symbol is not a
    fatal error.
    """
    try:
        return util.get_symbol(elf, symbol, may_not_exist)
    except MergeError:
        raise MergeError, \
              'Symbol "%s" not found in kernel ELF file.'  % \
              (symbol)
Ejemplo n.º 4
0
def get_symbol(elf, symbol, may_not_exist = False):
    """
    Return the address, and size in bytes, of a symbol from the ELF
    file.

    If may_not_exist is true then failing to find the symbol is not a
    fatal error.
    """
    try:
        return util.get_symbol(elf, symbol, may_not_exist)
    except MergeError:
        raise MergeError, \
              'Symbol "%s" not found in kernel ELF file.'  % \
              (symbol)
Ejemplo n.º 5
0
 def set_callbacks(self, elf, premap_callback, access_callback, destroy_callback):
     (self.premap_callback, _) = get_symbol(elf, premap_callback)
     (self.access_callback, _) = get_symbol(elf, access_callback)
     (self.destroy_callback, _) = get_symbol(elf, destroy_callback)
Ejemplo n.º 6
0
 def set_callbacks(self, elf, premap_callback, access_callback,
                   destroy_callback):
     (self.premap_callback, _) = get_symbol(elf, premap_callback)
     (self.access_callback, _) = get_symbol(elf, access_callback)
     (self.destroy_callback, _) = get_symbol(elf, destroy_callback)