Index: lib/libc/sys/ptrace.2 =================================================================== --- lib/libc/sys/ptrace.2 +++ lib/libc/sys/ptrace.2 @@ -506,16 +506,16 @@ .Sh x86 MACHINE-SPECIFIC REQUESTS .Bl -tag -width "Dv PT_GETXSTATE_INFO" .It Dv PT_GETXMMREGS -Copies out the XMM FPU state into the buffer pointed to by the +Copy the XMM FPU state into the buffer pointed to by the argument .Fa addr . -The buffer has the same layout as the 32bit save buffer for the +The buffer has the same layout as the 32-bit save buffer for the machine instruction .Dv FXSAVE . .Pp -This request is only valid for i386 programs, both on native 32bit +This request is only valid for i386 programs, both on native 32-bit systems and on amd64 kernels. -For 64bit amd64 programs, the XMM state is reported as part of +For 64-bit amd64 programs, the XMM state is reported as part of the FPU state returned by the .Dv PT_GETFPREGS request. @@ -524,10 +524,10 @@ .Fa data argument is ignored. .It Dv PT_SETXMMREGS -Loads the XMM FPU state for the thread from the buffer pointed to +Load the XMM FPU state for the thread from the buffer pointed to by the argument .Fa addr . -The buffer has the same layout as the 32bit load buffer for the +The buffer has the same layout as the 32-bit load buffer for the machine instruction .Dv FXRSTOR . .Pp @@ -539,15 +539,13 @@ .Fa data argument is ignored. .It Dv PT_GETXSTATE_INFO -Returns the information about the enablement state of the XSAVE FPU -extensions supported by the CPU and allowed by the OS for use by userspace -programs. +Report which XSAVE FPU extensions are supported by the CPU +and allowed in userspace programs. The .Fa addr -argument must point to the variable of type +argument must point to a variable of type .Vt struct ptrace_xstate_info , which contains the information on the request return. -The .Vt struct ptrace_xstate_info is defined as follows: .Bd -literal @@ -558,8 +556,8 @@ .Ed The .Dv xsave_mask -field is the bitmask of the currently enabled extensions. -The meaning of the bits is defined by the Intel and AMD +field is a bitmask of the currently enabled extensions. +The meaning of the bits is defined in the Intel and AMD processor documentation. The .Dv xsave_len @@ -573,10 +571,10 @@ argument value must be equal to the size of the .Vt struct ptrace_xstate_info . .It Dv PT_GETXSTATE -Returns the content of the XSAVE area for the thread. +Return the content of the XSAVE area for the thread. The .Fa addr -argument points to the buffer where the content is copied, the +argument points to the buffer where the content is copied, and the .Fa data argument specifies the size of the buffer. The kernel copies out as much content as allowed by the buffer size. @@ -590,8 +588,12 @@ The buffer size is passed in the .Fa data argument. -The buffer must be at least as large to allow the x87 FPU and XMM state, -but not large than the XSAVE state length, as reported by the +The buffer must be at least as large as the +.Vt struct savefpu +(defined in +.Pa x86/fpu.h ) +to allow the complete x87 FPU and XMM state load. +It must not be larger than the XSAVE state length, as reported by the .Dv xsave_len field from the .Vt struct ptrace_xstate_info @@ -602,26 +604,28 @@ .Dv XRSTOR machine instruction. .It Dv PT_GETFSBASE -The request returns the value of base used when doing segmented +Return the value of the base used when doing segmented memory addressing using the %fs segment register. The .Fa addr -argument points to the +argument points to an .Vt unsigned long -variable which gets the base value. +variable where the base value is stored. .Pp The .Fa data argument is ignored. .It Dv PT_GETGSBASE -Same as the +Like the .Dv PT_GETFSBASE request, but returns the base for the %gs segment register. .It Dv PT_SETFSBASE -Sets the base for the %fs segment register to the value pointed +Set the base for the %fs segment register to the value pointed to by the .Fa addr -argument, which must point to the +argument. +.Fa addr +must point to the .Vt unsigned long variable containing the new base. .Pp @@ -629,27 +633,25 @@ .Fa data argument is ignored. .It Dv PT_SETGSBASE -Same as the +Like the .Dv PT_SETFSBASE -request, but allows setting the base for the %gs segment register. +request, but sets the base for the %gs segment register. .El .Sh PowerPC MACHINE-SPECIFIC REQUESTS .Bl -tag -width "Dv PT_SETVRREGS" .It Dv PT_GETVRREGS -Returns the +Return the thread's .Dv ALTIVEC -machine state for the thread into the buffer pointed to by -the argument +machine state in the buffer pointed to by .Fa addr . .Pp The .Fa data argument is ignored. .It Dv PT_SETVRREGS -Set the +Set the thread's .Dv ALTIVEC -machine state for the thread from the buffer pointed to by -the argument +machine state from the buffer pointed to by .Fa addr . .Pp The @@ -719,24 +721,36 @@ structure known to the kernel. .It The size (in -.Fa data) +.Fa data ) provided to the x86-specific .Dv PT_GETXSTATE_INFO request was not equal to the size of the .Vt struct ptrace_xstate_info . .It The size (in -.Fa data) +.Fa data ) +provided to the x86-specific +.Dv PT_SETXSTATE +request was less than the size of the x87 plus the XMM save area. +.It +The size (in +.Fa data ) provided to the x86-specific .Dv PT_SETXSTATE -request was less than the size of the x87 + XMM save area, -or larger than returned in the +request was larger than returned in the .Dv xsave_len member of the .Vt struct ptrace_xstate_info from the .Dv PT_GETXSTATE_INFO request. +.It +The base value, provided to the amd64-specific requests +.Dv PT_SETFSBASE +or +.Dv PT_SETGSBASE , +pointed outside of the valid user address space. +This error will not occur in 32-bit programs. .El .It Bq Er EBUSY .Bl -bullet -compact