In XS code, SvPVX(sv) is correct if you're sure that sv is a valid PV value; otherwise one of the SvPV() or SvPV_force() functions/macros would be more appropriate. You're seeing a truncated version of the SvPVX() value because you're coercing it to an integer. You should be returning a suitable pointer type instead, or using an integer type like UV, which is large enough to hold a pointer.
Dave.