PowerPC64 support in safe_address function

Add a ppc64-specific implementation of the safe_address
function with overflow checking.
depending on declaration the tsrm cache pointer might be unavailable

during shutdown when the main thread frees all the other threads
resources. Even otherwise, exact resource passed to the dtor should
be freed, not the one from the current thread.
fix perms
Merge branch 'PHP-5.5' into PHP-5.6

* PHP-5.5:
  fix perms
Merge branch 'PHP-5.6'

* PHP-5.6:
  fix perms
fix perms
Merge remote-tracking branch 'origin/master' into native-tls

* origin/master:
  fix perms
  fix perms
  PowerPC64 support in safe_address function
free the right globals

That's the same as in the previous commit. In the TS mode the tsrm
cache pointer might be unavailable or point to a wrong thread, so
the exact globals passed should be freed.