def write_vcpu_struct_field(self, field_name, value, x, y, p):
        """Write a value to the VCPU struct for a specific core.

        Parameters
        ----------
        field_name : string
            Name of the field to write (e.g. `"user0"`)
        value :
            Value to write to this field.
        """
        field, address, pack_chars = \
            self._get_vcpu_field_and_address(field_name, x, y, p)

        # Pack the data
        if b"s" in pack_chars:
            data = struct.pack(pack_chars, value.encode('utf-8'))
        elif field.length == 1:
            data = struct.pack(pack_chars, value)
        else:
            # NOTE: At the time of writing no VCPU struct fields are of this
            # form.
            data = struct.pack(pack_chars, *value)  # pragma: no cover

        # Perform the write
        self.write(address, data, x, y)
def write_vcpu_struct_field ( self , field_name , value , x , y , p ) : field , address , pack_chars = self . _get_vcpu_field_and_address ( field_name , x , y , p ) if b"s" in pack_chars : data = struct . pack ( pack_chars , value . encode ( 'utf-8' ) ) elif field . length == 1 : data = struct . pack ( pack_chars , value ) else : data = struct . pack ( pack_chars , * value ) self . write ( address , data , x , y )
Write a value to the VCPU struct for a specific core.

        Parameters
        ----------
        field_name : string
            Name of the field to write (e.g. `"user0"`)
        value :
            Value to write to this field.