GLdispatch: Change entry_get_patch_address to return a single address.

entry_get_patch_address now returns a single address, since it doesn't have
separate writable and executable mappings anymore.
This commit is contained in:
Kyle Brenneman 2017-05-02 16:53:05 -06:00
parent 5222e64d82
commit 44ea7c355b
4 changed files with 17 additions and 18 deletions

View file

@ -74,12 +74,15 @@ int entry_patch_start(void);
int entry_patch_finish(void);
/**
* Returns the addresses for an entrypoint that a vendor library can patch.
* Returns the address for an entrypoint that a vendor library can patch.
*
* \param[in] int The index of the entrypoint to patch.
* \param[out] writePtr The address that the vendor library can write to.
* \param[out] execPtr An executable mapping of \p writePtr.
* Note that this may be different than \c entry_get_public. For example, in
* ARMv7, \c entry_get_public adds one to the address so that it switches to
* thumb mode.
*
* \param int The index of the entrypoint to patch.
* \return The address of the function to patch.
*/
void entry_get_patch_addresses(int index, void **writePtr, const void **execPtr);
void *entry_get_patch_address(int index);
#endif /* _ENTRY_H_ */

View file

@ -74,9 +74,7 @@ int entry_patch_finish(void)
return entry_patch_mprotect(PROT_READ | PROT_EXEC);
}
void entry_get_patch_addresses(int index, void **writePtr, const void **execPtr)
void *entry_get_patch_address(int index)
{
void *entry = (void *) (public_entry_start + (index * entry_stub_size));
*execPtr = (const void *) entry;
*writePtr = (void *) entry;
return (void *) (public_entry_start + (index * entry_stub_size));
}

View file

@ -87,9 +87,8 @@ int entry_patch_finish(void)
return 0;
}
void entry_get_patch_addresses(int index, void **writePtr, const void **execPtr)
void *entry_get_patch_address(int index)
{
assert(!"This should never be called");
*writePtr = NULL;
*execPtr = NULL;
return NULL;
}

View file

@ -255,8 +255,7 @@ static void stubAbortPatch(void)
static GLboolean stubGetPatchOffset(const char *name, void **writePtr, const void **execPtr)
{
int index;
void *writeAddr = NULL;
const void *execAddr = NULL;
void *addr = NULL;
index = stub_find_public(name);
@ -267,17 +266,17 @@ static GLboolean stubGetPatchOffset(const char *name, void **writePtr, const voi
#endif // !defined(STATIC_DISPATCH_ONLY)
if (index >= 0) {
entry_get_patch_addresses(index, &writeAddr, &execAddr);
addr = entry_get_patch_address(index);
}
if (writePtr != NULL) {
*writePtr = writeAddr;
*writePtr = addr;
}
if (execPtr != NULL) {
*execPtr = execAddr;
*execPtr = addr;
}
return ((writeAddr != NULL && execAddr != NULL) ? GL_TRUE : GL_FALSE);
return (addr != NULL ? GL_TRUE : GL_FALSE);
}
static int stubGetStubType(void)