Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support 128-bit pointers (protected mode) on E2K #461

Open
ivmai opened this issue Jul 25, 2022 · 5 comments
Open

Support 128-bit pointers (protected mode) on E2K #461

ivmai opened this issue Jul 25, 2022 · 5 comments

Comments

@ivmai
Copy link
Owner

ivmai commented Jul 25, 2022

Default compilation mode is 64-bit (as if -m64 option is passed).

If -m128 option is passed to gcc, the following predefined macros are changed:

#undef __ptr64__
#define __ptr128__ 1
#define __SIZEOF_POINTER__ 16
#define __PROTECTED__ 1

Related issue: #411, #456

@ivmai
Copy link
Owner Author

ivmai commented Jun 29, 2023

This would probably also require usage of GC_size_t for counters in gc.h (instead of GC_word)

@ivmai
Copy link
Owner Author

ivmai commented Oct 25, 2023

Additional big task (both for E2K protected mode and CHERI arch extension) would be to organize objects protection and object access right revocation on sweep (i.e. if some object is collected then pointer tag bit should be cleared in all remaining (inaccessible) pointers to it).

@ivmai
Copy link
Owner Author

ivmai commented Nov 4, 2023

Related issue (in libatomic_ops): ivmai/libatomic_ops#61

@ivmai
Copy link
Owner Author

ivmai commented Nov 15, 2023

CHERI is a similar protection technology (with double-wide pointer).

@ivmai
Copy link
Owner Author

ivmai commented Aug 3, 2024

Besides the changes done and to be done in #627, there at least a number of extra code places to care of:

  • include/gc/gc.h: define GC_uintptr_t to unsigned __int128
  • include/gc/gc.h: GC_REVEAL_POINTER, GC_REVEAL_NZ_POINTER
  • include/private/gc_priv.h: CAST_THRU_UINTPTR: do not cast to numeric type
  • include/private/gc_priv.h: CPTR_CLEAR_FLAGS: define to ((ptr_t)(p) - (ADDR(p) & (word)(mask))), add comment: The pointer argument should not have side effects. Avoid conversion from a numeric type to a pointer one
  • include/private/gc_priv.h: MAKE_CPTR
  • include/private/gcconfig.h: PTR_ALIGN_DOWN, PTR_ALIGN_UP (e.g. define to ((ptr_t)(p) + (~ADDR(p) & (word)(mask))))
  • include/private/gcconfig.h: CPP_PTRSZ
  • include/private/gcconfig.h: FIXUP_POINTER
  • mallocx.c: GC_realloc: define cleared_p to p

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant