Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Cyborg)
  • No Skin
Collapse
Brand Logo

CIRCLE WITH A DOT

  1. Home
  2. Uncategorized
  3. I really appreciate the elegance of pointer tagging.

I really appreciate the elegance of pointer tagging.

Scheduled Pinned Locked Moved Uncategorized
4 Posts 2 Posters 0 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ammarfaizi2@social.gnuweeb.orgA This user is from outside of this forum
    ammarfaizi2@social.gnuweeb.orgA This user is from outside of this forum
    ammarfaizi2@social.gnuweeb.org
    wrote last edited by
    #1

    RE: https://mstdn.social/@hkrn/116216511686844081

    I really appreciate the elegance of pointer tagging. A standard 64-bit pointer isn't actually fully utilized for addressing. On most systems, virtual addresses are only 48 bits wide, leaving the upper 16 bits theoretically free to embed extra user data

    ammarfaizi2@social.gnuweeb.orgA 1 Reply Last reply
    0
    • ammarfaizi2@social.gnuweeb.orgA ammarfaizi2@social.gnuweeb.org

      RE: https://mstdn.social/@hkrn/116216511686844081

      I really appreciate the elegance of pointer tagging. A standard 64-bit pointer isn't actually fully utilized for addressing. On most systems, virtual addresses are only 48 bits wide, leaving the upper 16 bits theoretically free to embed extra user data

      ammarfaizi2@social.gnuweeb.orgA This user is from outside of this forum
      ammarfaizi2@social.gnuweeb.orgA This user is from outside of this forum
      ammarfaizi2@social.gnuweeb.org
      wrote last edited by
      #2

      BTW, using those bits to store extra user data can drastically simplify object identification.

      I often use it when dealing with async I/O user data in epoll or io_uring.

      How I typically macro this out to pack and unpack event bits:
      ```
      #define EV_BIT_ALL (0xFFFFull << 48)
      #define GET_EV_BIT(X) ((X) & EV_BIT_ALL)
      #define CLEAR_EV_BIT(X) ((X) & ~EV_BIT_ALL)
      #define SET_EV_BIT(X, EV) ((X) | ((uint64_t)(EV) << 48))
      ```

      ammarfaizi2@social.gnuweeb.orgA 1 Reply Last reply
      0
      • ammarfaizi2@social.gnuweeb.orgA ammarfaizi2@social.gnuweeb.org

        BTW, using those bits to store extra user data can drastically simplify object identification.

        I often use it when dealing with async I/O user data in epoll or io_uring.

        How I typically macro this out to pack and unpack event bits:
        ```
        #define EV_BIT_ALL (0xFFFFull << 48)
        #define GET_EV_BIT(X) ((X) & EV_BIT_ALL)
        #define CLEAR_EV_BIT(X) ((X) & ~EV_BIT_ALL)
        #define SET_EV_BIT(X, EV) ((X) | ((uint64_t)(EV) << 48))
        ```

        ammarfaizi2@social.gnuweeb.orgA This user is from outside of this forum
        ammarfaizi2@social.gnuweeb.orgA This user is from outside of this forum
        ammarfaizi2@social.gnuweeb.org
        wrote last edited by
        #3

        I doubt that it will be forward compatible, though.

        viro_ssfs@social.gnuweeb.orgV 1 Reply Last reply
        0
        • ammarfaizi2@social.gnuweeb.orgA ammarfaizi2@social.gnuweeb.org

          I doubt that it will be forward compatible, though.

          viro_ssfs@social.gnuweeb.orgV This user is from outside of this forum
          viro_ssfs@social.gnuweeb.orgV This user is from outside of this forum
          viro_ssfs@social.gnuweeb.org
          wrote last edited by
          #4

          @ammarfaizi2

          Yeah, since Ice Lake (2019), Intel supports 5-level paging, it extends the virtual memory from 48 bits to 57 bits.

          Link Preview Image
          Intel 5-level paging - Wikipedia

          favicon

          (en.wikipedia.org)

          At least you can still use the remaining unused 7 bits wkwkwk

          1 Reply Last reply
          1
          0
          • R relay@relay.infosec.exchange shared this topic
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups