Skip to contentSkip to conversation

PTRACE_GET_THREAD_AREA

DISCUSSION Roland McGrath 1 participant 1 message Jan 14, 2003 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 5 lines

i've just seen your patch submitted to 2.5 and i think there's a mistake in there. this:

#define GET_32BIT(desc) (((desc)->b >> 23) & 1)

Quoted 7 lines

should be

#define GET_32BIT(desc) (((desc)->b >> 22) & 1)

i.e., bit 22 determines the segment bitness (default address/operand size), whereas bit 23 determines the granularity used to interpret the segment limit.

Those macros in my patch are copied directly from process.c where get_thread_area is implemented. Since the purpose of PTRACE_GET_THREAD_AREA is to match what get_thread_area does, it's correct that it match.

But I think you are right that the definition is wrong. It's obviously suspect that two things are defined using the same bit:

#define GET_32BIT(desc) (((desc)->b >> 23) & 1)
#define GET_LIMIT_PAGES(desc) (((desc)->b >> 23) & 1)

This should be fixed in both process.c and ptrace.c together.