mirror of
https://github.com/intel/linux-sgx
synced 2026-06-08 14:49:32 +00:00
9441de4c38
This release is used in conjunction with the linux-sgx-driver Intial release: https://github.com/01org/linux-sgx-driver commit-id: 0e865ce5e6b297a787bcdc12d98bada8174be6d7 Intel-id: 33399 Signed-off-by: Angie Chinchilla <angie.v.chinchilla@intel.com>
26 lines
465 B
C
26 lines
465 B
C
#include <libunwind.h>
|
|
|
|
unw_word_t
|
|
_ReadSLEB (unsigned char **dpp)
|
|
{
|
|
unsigned shift = 0;
|
|
unw_word_t byte, result = 0;
|
|
unsigned char *bp = *dpp;
|
|
|
|
while (1)
|
|
{
|
|
byte = *bp++;
|
|
result |= (byte & 0x7f) << shift;
|
|
shift += 7;
|
|
if ((byte & 0x80) == 0)
|
|
break;
|
|
}
|
|
|
|
if (shift < 8 * sizeof (unw_word_t) && (byte & 0x40) != 0)
|
|
/* sign-extend negative value */
|
|
result |= ((unw_word_t) -1) << shift;
|
|
|
|
*dpp = bp;
|
|
return result;
|
|
}
|