emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MPS: Forwording symbols


From: Gerd Möllmann
Subject: Re: MPS: Forwording symbols
Date: Mon, 17 Jun 2024 14:58:21 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Gerd Möllmann <gerd.moellmann@gmail.com>
>> Cc: eller.helmut@gmail.com,  emacs-devel@gnu.org
>> Date: Mon, 17 Jun 2024 14:15:25 +0200
>> 
>> Eli Zaretskii <eliz@gnu.org> writes:
>> 
>> >> > Hm, why do you think it writes to the data segment?  Confusing names
>> >> > aside, it seems to read a value, which presumably is a pointer, adjusts
>> >> > it to the new basis and then writes it back.
>> >> 
>> >> Becasue of this
>> >> 
>> >>      value += emacs_basis ();
>> >> 
>> >> It has dumnped pointer - basis, and now uses that value to get the
>> >> pointer in the current process.
>> >
>> > Isn't this because the dumped data is loaded with a different base
>> > address than the one with which is was dumped?
>> 
>> That'c correct. The same happens, with a different basis, for addresses
>> in the dump. Helmut asked how I know that it writes to Emacs' data
>> segment. That's from the use of emacs_basis.
>
> My reading of the code snippet you posted is that it writes to the
> same address as the one from which it read.  IOW, the value is read,
> updated, and then written to the same address.  Or what did I miss?
>
> Maybe I don't understand what you mean by "Emacs data segment" or what
> is the significance of that.

Oh, I think you're right, I landed in the wrong place. It seems to be
this one:

  static void
  dump_do_emacs_relocation (const uintptr_t dump_base,
                            const struct emacs_reloc reloc)
  {
    ptrdiff_t pval;
    Lisp_Object lv;

    switch (reloc.type)
      {
      case RELOC_EMACS_COPY_FROM_DUMP:
        eassume (reloc.length > 0);
        memcpy (emacs_ptr_at (reloc.emacs_offset),
                dump_ptr (dump_base, reloc.u.dump_offset),
                reloc.length);
        break;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]