mirror of
https://github.com/corda/corda.git
synced 2025-01-07 13:38:47 +00:00
c537dcfd34
This avoids the requirement of putting the code image in a section/segment which is both writable and executable, which is good for security and avoids trouble with systems like iOS which disallow such things. The implementation relies on relative addressing such that the offset of the desired address is fixed as a compile-time constant relative to the start of the memory area of interest (e.g. the code image, heap image, or thunk table). At runtime, the base pointer to the memory area is retrieved from the thread structure and added to the offset to compute the final address. Using the thread pointer allows us to generate read-only, position-independent code while avoiding the use of IP-relative addressing, which is not available on all architectures.
44 lines
688 B
C++
44 lines
688 B
C++
#ifndef FIELD
|
|
# define FIELD(name)
|
|
# define FIELD_DEFINED
|
|
#endif
|
|
|
|
FIELD(magic)
|
|
|
|
FIELD(heapSize)
|
|
FIELD(codeSize)
|
|
|
|
FIELD(bootClassCount)
|
|
FIELD(appClassCount)
|
|
FIELD(stringCount)
|
|
FIELD(callCount)
|
|
|
|
FIELD(bootLoader)
|
|
FIELD(appLoader)
|
|
FIELD(types)
|
|
FIELD(methodTree)
|
|
FIELD(methodTreeSentinal)
|
|
FIELD(virtualThunks)
|
|
|
|
#ifdef FIELD_DEFINED
|
|
# undef FIELD
|
|
# undef FIELD_DEFINED
|
|
#endif
|
|
|
|
#ifndef THUNK_FIELD
|
|
# define THUNK_FIELD(name)
|
|
# define THUNK_FIELD_DEFINED
|
|
#endif
|
|
|
|
THUNK_FIELD(default_);
|
|
THUNK_FIELD(defaultVirtual);
|
|
THUNK_FIELD(native);
|
|
THUNK_FIELD(aioob);
|
|
THUNK_FIELD(stackOverflow);
|
|
THUNK_FIELD(table);
|
|
|
|
#ifdef THUNK_FIELD_DEFINED
|
|
# undef THUNK_FIELD
|
|
# undef THUNK_FIELD_DEFINED
|
|
#endif
|