mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Initialisation of debugging and floating point registers in
PsBeginThread*. svn path=/trunk/; revision=3504
This commit is contained in:
parent
2b22998369
commit
c9aa7a8462
4 changed files with 62 additions and 35 deletions
|
@ -20,6 +20,8 @@
|
||||||
#ifndef __NTOSKRNL_INCLUDE_INTERNAL_I386_FPU_H
|
#ifndef __NTOSKRNL_INCLUDE_INTERNAL_I386_FPU_H
|
||||||
#define __NTOSKRNL_INCLUDE_INTERNAL_I386_FPU_H
|
#define __NTOSKRNL_INCLUDE_INTERNAL_I386_FPU_H
|
||||||
|
|
||||||
|
extern ULONG HardwareMathSupport;
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
KiCheckFPU(VOID);
|
KiCheckFPU(VOID);
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: bthread.S,v 1.5 2002/09/08 10:23:29 chorns Exp $
|
/* $Id: bthread.S,v 1.6 2002/09/15 13:49:57 guido Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -52,6 +52,25 @@ _PsBeginThread:
|
||||||
*/
|
*/
|
||||||
call _PiBeforeBeginThread
|
call _PiBeforeBeginThread
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialize debugging registers
|
||||||
|
*/
|
||||||
|
movl $0, %eax /* set to 0 */
|
||||||
|
movl %eax, %dr0
|
||||||
|
movl %eax, %dr1
|
||||||
|
movl %eax, %dr2
|
||||||
|
movl %eax, %dr3
|
||||||
|
movl %eax, %dr6
|
||||||
|
movl %eax, %dr7
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialize floating point registers
|
||||||
|
*/
|
||||||
|
movl (_HardwareMathSupport), %eax
|
||||||
|
jz nofpu
|
||||||
|
fninit
|
||||||
|
nofpu:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Call the actual start of the thread
|
* Call the actual start of the thread
|
||||||
*/
|
*/
|
||||||
|
@ -93,22 +112,32 @@ _PsBeginThreadWithContextInternal:
|
||||||
*/
|
*/
|
||||||
call _PiBeforeBeginThread
|
call _PiBeforeBeginThread
|
||||||
|
|
||||||
/* FIXME: Don't ignore the debugging registers. */
|
/*
|
||||||
|
* Load the debugging registers
|
||||||
|
*/
|
||||||
popl %eax /* Dr0 */
|
popl %eax /* Dr0 */
|
||||||
|
movl %eax, %dr0
|
||||||
popl %eax /* Dr1 */
|
popl %eax /* Dr1 */
|
||||||
|
movl %eax, %dr1
|
||||||
popl %eax /* Dr2 */
|
popl %eax /* Dr2 */
|
||||||
|
movl %eax, %dr2
|
||||||
popl %eax /* Dr3 */
|
popl %eax /* Dr3 */
|
||||||
|
movl %eax, %dr3
|
||||||
popl %eax /* Dr6 */
|
popl %eax /* Dr6 */
|
||||||
|
movl %eax, %dr6
|
||||||
popl %eax /* Dr7 */
|
popl %eax /* Dr7 */
|
||||||
|
movl %eax, %dr7
|
||||||
|
|
||||||
/* FIXME: Don't ignore the floating point registers. */
|
/*
|
||||||
addl $112,%esp /* FloatSave */
|
* Load the floating point registers
|
||||||
|
*/
|
||||||
|
movl (_HardwareMathSupport), %eax
|
||||||
|
jz nofpu2
|
||||||
|
frstor 0(%esp)
|
||||||
|
nofpu2:
|
||||||
|
addl $4, %esp
|
||||||
|
|
||||||
/* Load the rest of the thread's user mode context. */
|
/* Load the rest of the thread's user mode context. */
|
||||||
movl $0, %eax
|
movl $0, %eax
|
||||||
jmp KeReturnFromSystemCallWithHook
|
jmp KeReturnFromSystemCallWithHook
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
/* GLOBALS *******************************************************************/
|
/* GLOBALS *******************************************************************/
|
||||||
|
|
||||||
static ULONG HardwareMathSupport;
|
ULONG HardwareMathSupport;
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
|
|
|
@ -124,12 +124,10 @@ Ke386InitThreadWithContext(PKTHREAD Thread, PCONTEXT Context)
|
||||||
KernelStack[10] = Context->Dr7;
|
KernelStack[10] = Context->Dr7;
|
||||||
|
|
||||||
/* Set up the initial floating point state. */
|
/* Set up the initial floating point state. */
|
||||||
memcpy((PVOID)&KernelStack[11], (PVOID)&Context->FloatSave,
|
KernelStack[11] = (ULONG)&Context->FloatSave;
|
||||||
sizeof(FLOATING_SAVE_AREA));
|
|
||||||
|
|
||||||
/* Set up a trap frame from the context. */
|
/* Set up a trap frame from the context. */
|
||||||
TrapFrame = (PKTRAP_FRAME)
|
TrapFrame = (PKTRAP_FRAME)((PBYTE)KernelStack + 12 * sizeof(DWORD));
|
||||||
((PBYTE)KernelStack + 11 * sizeof(DWORD) + sizeof(FLOATING_SAVE_AREA));
|
|
||||||
TrapFrame->DebugEbp = (PVOID)Context->Ebp;
|
TrapFrame->DebugEbp = (PVOID)Context->Ebp;
|
||||||
TrapFrame->DebugEip = (PVOID)Context->Eip;
|
TrapFrame->DebugEip = (PVOID)Context->Eip;
|
||||||
TrapFrame->DebugArgMark = 0;
|
TrapFrame->DebugArgMark = 0;
|
||||||
|
@ -177,8 +175,6 @@ Ke386InitThread(PKTHREAD Thread,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KernelStack = (PULONG)(Thread->KernelStack - (8*4));
|
KernelStack = (PULONG)(Thread->KernelStack - (8*4));
|
||||||
/* FIXME: Add initial floating point information */
|
|
||||||
/* FIXME: Add initial debugging information */
|
|
||||||
KernelStack[0] = 0; /* EDI */
|
KernelStack[0] = 0; /* EDI */
|
||||||
KernelStack[1] = 0; /* ESI */
|
KernelStack[1] = 0; /* ESI */
|
||||||
KernelStack[2] = 0; /* EBX */
|
KernelStack[2] = 0; /* EBX */
|
||||||
|
|
Loading…
Reference in a new issue