- align_pos(pos, int_class->p.alignment);
- if (int_class->byte_order == LITTLE_ENDIAN)
- ctf_bitfield_read_le(pos->base, pos->offset,
- int_class->len, &v);
- else
- ctf_bitfield_read_be(pos->base, pos->offset,
- int_class->len, &v);
- move_pos(pos, int_class->len);
- return v;
+ if (!ctf_pos_access_ok(pos, integer_declaration->len))
+ return -EFAULT;
+
+ if (!integer_declaration->signedness) {
+ if (integer_declaration->byte_order == LITTLE_ENDIAN)
+ bt_bitfield_read_le(mmap_align_addr(pos->base_mma) +
+ pos->mmap_base_offset, unsigned long,
+ pos->offset, integer_declaration->len,
+ &integer_definition->value._unsigned);
+ else
+ bt_bitfield_read_be(mmap_align_addr(pos->base_mma) +
+ pos->mmap_base_offset, unsigned long,
+ pos->offset, integer_declaration->len,
+ &integer_definition->value._unsigned);
+ } else {
+ if (integer_declaration->byte_order == LITTLE_ENDIAN)
+ bt_bitfield_read_le(mmap_align_addr(pos->base_mma) +
+ pos->mmap_base_offset, unsigned long,
+ pos->offset, integer_declaration->len,
+ &integer_definition->value._signed);
+ else
+ bt_bitfield_read_be(mmap_align_addr(pos->base_mma) +
+ pos->mmap_base_offset, unsigned long,
+ pos->offset, integer_declaration->len,
+ &integer_definition->value._signed);
+ }
+ ctf_move_pos(pos, integer_declaration->len);
+ return 0;