Exemplo n.º 1
0
  def label(self, label_thunk, reserves=0):
    '''
    Create a symbolic label at the current output address of the assembly
    process. If ``reserves`` is given (and greater than zero) that many
    bytes are reserved by adding the value to the current output address.

    :param label_thunk: An ``intbv`` object serving as a container for a
       pointer value to an address in your assembly program.

       When you mention a previously unused name in your asm code the
       execution context will automatically provide that name with a new
       ``intbv`` object initialized to zero.

       Because this ``intbv`` object will be (re-)used in other parts of
       your program wherever the name is used it becomes a container for
       the eventual value (a thunk) of the address.

       When you use this *directive* with a given named address thunk
       (label) it fills in the value of the current output address of the
       assembly process.
    :type label_thunk: ``intbv``
    :param reserves: Reserve this many bytes by increasing the current
       output address of the assembly process.
    :type reserves: ``int``
    :rtype: ``None``
    '''
    assert isinstance(label_thunk, intbv), repr(label_thunk)
    assert label_thunk == 0, repr(label_thunk)
    name = self._name_of_address_thunk(label_thunk)
    log.debug('label %s => %#06x', name, self.here)
    update(label_thunk, self.here)
    if reserves:
      assert reserves > 0, repr(reserves)
      self.here += reserves
Exemplo n.º 2
0
  def org(self, address):
    '''
    Set the current output address of the assembly process to
    ``address``.  If ``address`` isn't an ``intbv`` it is converted to
    one.

    :param address: Location in program.
    :type address: ``intbv``, ``int``, or symbolic label.
    :rtype: ``None``
    '''
    address = ibv(address)
    log.debug('setting org to %#06x', address)
    update(self.here, address)