ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
February 2012
----- 2024 -----
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
22 participants
577 discussions
Start a n
N
ew thread
[ion] 55637: [CSRSRV]: Move the CsrSv* APIs to session.c where they belong. Also enable most of the code in CsrSbCreateSession now since it works, minus one hack needed since we don't have a real B...
by ion@svn.reactos.org
Author: ion Date: Thu Feb 16 16:21:48 2012 New Revision: 55637 URL:
http://svn.reactos.org/svn/reactos?rev=55637&view=rev
Log: [CSRSRV]: Move the CsrSv* APIs to session.c where they belong. Also enable most of the code in CsrSbCreateSession now since it works, minus one hack needed since we don't have a real BaseSrv yet. Modified: trunk/reactos/subsystems/win32/csrss/csrsrv/api/wapi.c trunk/reactos/subsystems/win32/csrss/csrsrv/session.c trunk/reactos/subsystems/win32/csrss/include/api.h Modified: trunk/reactos/subsystems/win32/csrss/csrsrv/api/wapi.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/csr…
============================================================================== --- trunk/reactos/subsystems/win32/csrss/csrsrv/api/wapi.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/csrsrv/api/wapi.c [iso-8859-1] Thu Feb 16 16:21:48 2012 @@ -17,19 +17,8 @@ /* GLOBALS *******************************************************************/ -extern HANDLE hApiPort; - static unsigned ApiDefinitionsCount = 0; static PCSRSS_API_DEFINITION ApiDefinitions = NULL; - -PCHAR CsrServerSbApiName[5] = -{ - "SbCreateSession", - "SbTerminateSession", - "SbForeignSessionComplete", - "SbCreateProcess", - "Unknown Csr Sb Api Number" -}; /* FUNCTIONS *****************************************************************/ @@ -1050,391 +1039,4 @@ RtlFreeHeap(CsrHeap, 0, RemoteCaptureBuffer); } -/* SESSION MANAGER FUNCTIONS**************************************************/ - -/*++ - * @name CsrSbCreateSession - * - * The CsrSbCreateSession API is called by the Session Manager whenever a new - * session is created. - * - * @param ApiMessage - * Pointer to the Session Manager API Message. - * - * @return TRUE in case of success, FALSE othwerwise. - * - * @remarks The CsrSbCreateSession routine will initialize a new CSR NT - * Session and allocate a new CSR Process for the subsystem process. - * - *--*/ -BOOLEAN -NTAPI -CsrSbCreateSession(IN PSB_API_MSG ApiMessage) -{ - PSB_CREATE_SESSION_MSG CreateSession = &ApiMessage->CreateSession; - HANDLE hProcess, hThread; -// PCSR_PROCESS CsrProcess; - NTSTATUS Status; - KERNEL_USER_TIMES KernelTimes; - //PCSR_THREAD CsrThread; - //PVOID ProcessData; - //ULONG i; - - /* Save the Process and Thread Handles */ - hProcess = CreateSession->ProcessInfo.ProcessHandle; - hThread = CreateSession->ProcessInfo.ThreadHandle; - -#if 0 - /* Lock the Processes */ - CsrAcquireProcessLock(); - - /* Allocate a new process */ - CsrProcess = CsrAllocateProcess(); - if (!CsrProcess) - { - /* Fail */ - ApiMessage->ReturnValue = STATUS_NO_MEMORY; - CsrReleaseProcessLock(); - return TRUE; - } -#endif - - /* Set the exception port */ - Status = NtSetInformationProcess(hProcess, - ProcessExceptionPort, - &hApiPort,//&CsrApiPort, - sizeof(HANDLE)); - - /* Check for success */ - if (!NT_SUCCESS(Status)) - { - /* Fail the request */ -#if 0 - CsrDeallocateProcess(CsrProcess); - CsrReleaseProcessLock(); -#endif - /* Strange as it seems, NTSTATUSes are actually returned */ - return (BOOLEAN)STATUS_NO_MEMORY; - } - - /* Get the Create Time */ - Status = NtQueryInformationThread(hThread, - ThreadTimes, - &KernelTimes, - sizeof(KERNEL_USER_TIMES), - NULL); - - /* Check for success */ - if (!NT_SUCCESS(Status)) - { - /* Fail the request */ -#if 0 - CsrDeallocateProcess(CsrProcess); - CsrReleaseProcessLock(); -#endif - - /* Strange as it seems, NTSTATUSes are actually returned */ - return (BOOLEAN)Status; - } - - /* Allocate a new Thread */ -#if 0 - CsrThread = CsrAllocateThread(CsrProcess); - if (!CsrThread) - { - /* Fail the request */ - CsrDeallocateProcess(CsrProcess); - CsrReleaseProcessLock(); - - ApiMessage->ReturnValue = STATUS_NO_MEMORY; - return TRUE; - } - - /* Setup the Thread Object */ - CsrThread->CreateTime = KernelTimes.CreateTime; - CsrThread->ClientId = CreateSession->ProcessInfo.ClientId; - CsrThread->ThreadHandle = hThread; - ProtectHandle(hThread); - CsrThread->Flags = 0; - - /* Insert it into the Process List */ - CsrInsertThread(CsrProcess, CsrThread); - - /* Setup Process Data */ - CsrProcess->ClientId = CreateSession->ProcessInfo.ClientId; - CsrProcess->ProcessHandle = hProcess; - CsrProcess->NtSession = CsrAllocateNtSession(CreateSession->SessionId); - - /* Set the Process Priority */ - CsrSetBackgroundPriority(CsrProcess); - - /* Get the first data location */ - ProcessData = &CsrProcess->ServerData[CSR_SERVER_DLL_MAX]; - - /* Loop every DLL */ - for (i = 0; i < CSR_SERVER_DLL_MAX; i++) - { - /* Check if the DLL is loaded and has Process Data */ - if (CsrLoadedServerDll[i] && CsrLoadedServerDll[i]->SizeOfProcessData) - { - /* Write the pointer to the data */ - CsrProcess->ServerData[i] = ProcessData; - - /* Move to the next data location */ - ProcessData = (PVOID)((ULONG_PTR)ProcessData + - CsrLoadedServerDll[i]->SizeOfProcessData); - } - else - { - /* Nothing for this Process */ - CsrProcess->ServerData[i] = NULL; - } - } - - /* Insert the Process */ - CsrInsertProcess(NULL, NULL, CsrProcess); -#endif - /* Activate the Thread */ - ApiMessage->ReturnValue = NtResumeThread(hThread, NULL); - - /* Release lock and return */ -// CsrReleaseProcessLock(); - return TRUE; -} - -/*++ - * @name CsrSbForeignSessionComplete - * - * The CsrSbForeignSessionComplete API is called by the Session Manager - * whenever a foreign session is completed (ie: terminated). - * - * @param ApiMessage - * Pointer to the Session Manager API Message. - * - * @return TRUE in case of success, FALSE othwerwise. - * - * @remarks The CsrSbForeignSessionComplete API is not yet implemented. - * - *--*/ -BOOLEAN -NTAPI -CsrSbForeignSessionComplete(IN PSB_API_MSG ApiMessage) -{ - /* Deprecated/Unimplemented in NT */ - ApiMessage->ReturnValue = STATUS_NOT_IMPLEMENTED; - return TRUE; -} - -/*++ - * @name CsrSbTerminateSession - * - * The CsrSbTerminateSession API is called by the Session Manager - * whenever a foreign session should be destroyed. - * - * @param ApiMessage - * Pointer to the Session Manager API Message. - * - * @return TRUE in case of success, FALSE othwerwise. - * - * @remarks The CsrSbTerminateSession API is not yet implemented. - * - *--*/ -BOOLEAN -NTAPI -CsrSbTerminateSession(IN PSB_API_MSG ApiMessage) -{ - ApiMessage->ReturnValue = STATUS_NOT_IMPLEMENTED; - return TRUE; -} - -/*++ - * @name CsrSbCreateProcess - * - * The CsrSbCreateProcess API is called by the Session Manager - * whenever a foreign session is created and a new process should be started. - * - * @param ApiMessage - * Pointer to the Session Manager API Message. - * - * @return TRUE in case of success, FALSE othwerwise. - * - * @remarks The CsrSbCreateProcess API is not yet implemented. - * - *--*/ -BOOLEAN -NTAPI -CsrSbCreateProcess(IN PSB_API_MSG ApiMessage) -{ - ApiMessage->ReturnValue = STATUS_NOT_IMPLEMENTED; - return TRUE; -} - -PSB_API_ROUTINE CsrServerSbApiDispatch[5] = -{ - CsrSbCreateSession, - CsrSbTerminateSession, - CsrSbForeignSessionComplete, - CsrSbCreateProcess, - NULL -}; - -/*++ - * @name CsrSbApiHandleConnectionRequest - * - * The CsrSbApiHandleConnectionRequest routine handles and accepts a new - * connection request to the SM API LPC Port. - * - * @param ApiMessage - * Pointer to the incoming CSR API Message which contains the - * connection request. - * - * @return STATUS_SUCCESS in case of success, or status code which caused - * the routine to error. - * - * @remarks None. - * - *--*/ -NTSTATUS -NTAPI -CsrSbApiHandleConnectionRequest(IN PSB_API_MSG Message) -{ - NTSTATUS Status; - REMOTE_PORT_VIEW RemotePortView; - HANDLE hPort; - - /* Set the Port View Structure Length */ - RemotePortView.Length = sizeof(REMOTE_PORT_VIEW); - - /* Accept the connection */ - Status = NtAcceptConnectPort(&hPort, - NULL, - (PPORT_MESSAGE)Message, - TRUE, - NULL, - &RemotePortView); - if (!NT_SUCCESS(Status)) - { - DPRINT1("CSRSS: Sb Accept Connection failed %lx\n", Status); - return Status; - } - - /* Complete the Connection */ - Status = NtCompleteConnectPort(hPort); - if (!NT_SUCCESS(Status)) - { - DPRINT1("CSRSS: Sb Complete Connection failed %lx\n",Status); - } - - /* Return status */ - return Status; -} - -/*++ - * @name CsrSbApiRequestThread - * - * The CsrSbApiRequestThread routine handles incoming messages or connection - * requests on the SM API LPC Port. - * - * @param Parameter - * System-default user-defined parameter. Unused. - * - * @return The thread exit code, if the thread is terminated. - * - * @remarks Before listening on the port, the routine will first attempt - * to connect to the user subsystem. - * - *--*/ -VOID -NTAPI -CsrSbApiRequestThread(IN PVOID Parameter) -{ - NTSTATUS Status; - SB_API_MSG ReceiveMsg; - PSB_API_MSG ReplyMsg = NULL; - PVOID PortContext; - ULONG MessageType; - - /* Start the loop */ - while (TRUE) - { - /* Wait for a message to come in */ - Status = NtReplyWaitReceivePort(CsrSbApiPort, - &PortContext, - &ReplyMsg->h, - &ReceiveMsg.h); - - /* Check if we didn't get success */ - if (Status != STATUS_SUCCESS) - { - /* If we only got a warning, keep going */ - if (NT_SUCCESS(Status)) continue; - - /* We failed big time, so start out fresh */ - ReplyMsg = NULL; - DPRINT1("CSRSS: ReceivePort failed - Status == %X\n", Status); - continue; - } - - /* Save the message type */ - MessageType = ReceiveMsg.h.u2.s2.Type; - - /* Check if this is a connection request */ - if (MessageType == LPC_CONNECTION_REQUEST) - { - /* Handle connection request */ - CsrSbApiHandleConnectionRequest(&ReceiveMsg); - - /* Start over */ - ReplyMsg = NULL; - continue; - } - - /* Check if the port died */ - if (MessageType == LPC_PORT_CLOSED) - { - /* Close the handle if we have one */ - if (PortContext) NtClose((HANDLE)PortContext); - - /* Client died, start over */ - ReplyMsg = NULL; - continue; - } - else if (MessageType == LPC_CLIENT_DIED) - { - /* Client died, start over */ - ReplyMsg = NULL; - continue; - } - - /* - * It's an API Message, check if it's within limits. If it's not, the - * NT Behaviour is to set this to the Maximum API. - */ - if (ReceiveMsg.ApiNumber > SbpMaxApiNumber) - { - ReceiveMsg.ApiNumber = SbpMaxApiNumber; - DPRINT1("CSRSS: %lx is invalid Sb ApiNumber\n", ReceiveMsg.ApiNumber); - } - - /* Reuse the message */ - ReplyMsg = &ReceiveMsg; - - /* Make sure that the message is supported */ - if (ReceiveMsg.ApiNumber < SbpMaxApiNumber) - { - /* Call the API */ - if (!CsrServerSbApiDispatch[ReceiveMsg.ApiNumber](&ReceiveMsg)) - { - /* It failed, so return nothing */ - ReplyMsg = NULL; - } - } - else - { - /* We don't support this API Number */ - ReplyMsg->ReturnValue = STATUS_NOT_IMPLEMENTED; - } - } -} - /* EOF */ Modified: trunk/reactos/subsystems/win32/csrss/csrsrv/session.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/csr…
============================================================================== --- trunk/reactos/subsystems/win32/csrss/csrsrv/session.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/csrsrv/session.c [iso-8859-1] Thu Feb 16 16:21:48 2012 @@ -18,6 +18,15 @@ RTL_CRITICAL_SECTION CsrNtSessionLock; LIST_ENTRY CsrNtSessionList; +PCHAR CsrServerSbApiName[5] = +{ + "SbCreateSession", + "SbTerminateSession", + "SbForeignSessionComplete", + "SbCreateProcess", + "Unknown Csr Sb Api Number" +}; + /* PRIVATE FUNCTIONS *********************************************************/ /*++ @@ -172,4 +181,388 @@ } } +/* SESSION MANAGER FUNCTIONS**************************************************/ + +/*++ + * @name CsrSbCreateSession + * + * The CsrSbCreateSession API is called by the Session Manager whenever a new + * session is created. + * + * @param ApiMessage + * Pointer to the Session Manager API Message. + * + * @return TRUE in case of success, FALSE othwerwise. + * + * @remarks The CsrSbCreateSession routine will initialize a new CSR NT + * Session and allocate a new CSR Process for the subsystem process. + * + *--*/ +BOOLEAN +NTAPI +CsrSbCreateSession(IN PSB_API_MSG ApiMessage) +{ + PSB_CREATE_SESSION_MSG CreateSession = &ApiMessage->CreateSession; + HANDLE hProcess, hThread; + PCSR_PROCESS CsrProcess; + NTSTATUS Status; + KERNEL_USER_TIMES KernelTimes; + PCSR_THREAD CsrThread; + //PVOID ProcessData; + //ULONG i; + + /* Save the Process and Thread Handles */ + hProcess = CreateSession->ProcessInfo.ProcessHandle; + hThread = CreateSession->ProcessInfo.ThreadHandle; + + /* Lock the Processes */ + CsrAcquireProcessLock(); + + /* Allocate a new process */ + CsrProcess = CsrAllocateProcess(); + if (!CsrProcess) + { + /* Fail */ + ApiMessage->ReturnValue = STATUS_NO_MEMORY; + CsrReleaseProcessLock(); + return TRUE; + } + + /* Set the exception port */ + Status = NtSetInformationProcess(hProcess, + ProcessExceptionPort, + &hApiPort,//&CsrApiPort, + sizeof(HANDLE)); + + /* Check for success */ + if (!NT_SUCCESS(Status)) + { + /* Fail the request */ + CsrDeallocateProcess(CsrProcess); + CsrReleaseProcessLock(); + + /* Strange as it seems, NTSTATUSes are actually returned */ + return (BOOLEAN)STATUS_NO_MEMORY; + } + + /* Get the Create Time */ + Status = NtQueryInformationThread(hThread, + ThreadTimes, + &KernelTimes, + sizeof(KERNEL_USER_TIMES), + NULL); + + /* Check for success */ + if (!NT_SUCCESS(Status)) + { + /* Fail the request */ + CsrDeallocateProcess(CsrProcess); + CsrReleaseProcessLock(); + + /* Strange as it seems, NTSTATUSes are actually returned */ + return (BOOLEAN)Status; + } + + /* Allocate a new Thread */ + CsrThread = CsrAllocateThread(CsrProcess); + if (!CsrThread) + { + /* Fail the request */ + CsrDeallocateProcess(CsrProcess); + CsrReleaseProcessLock(); + + ApiMessage->ReturnValue = STATUS_NO_MEMORY; + return TRUE; + } + + /* Setup the Thread Object */ + CsrThread->CreateTime = KernelTimes.CreateTime; + CsrThread->ClientId = CreateSession->ProcessInfo.ClientId; + CsrThread->ThreadHandle = hThread; + ProtectHandle(hThread); + CsrThread->Flags = 0; + + /* Insert it into the Process List */ + CsrInsertThread(CsrProcess, CsrThread); + + /* Setup Process Data */ + CsrProcess->ClientId = CreateSession->ProcessInfo.ClientId; + CsrProcess->ProcessHandle = hProcess; + CsrProcess->NtSession = CsrAllocateNtSession(CreateSession->SessionId); + + /* Set the Process Priority */ + CsrSetBackgroundPriority(CsrProcess); +#if 0 + /* Get the first data location */ + ProcessData = &CsrProcess->ServerData[CSR_SERVER_DLL_MAX]; + + /* Loop every DLL */ + for (i = 0; i < CSR_SERVER_DLL_MAX; i++) + { + /* Check if the DLL is loaded and has Process Data */ + if (CsrLoadedServerDll[i] && CsrLoadedServerDll[i]->SizeOfProcessData) + { + /* Write the pointer to the data */ + CsrProcess->ServerData[i] = ProcessData; + + /* Move to the next data location */ + ProcessData = (PVOID)((ULONG_PTR)ProcessData + + CsrLoadedServerDll[i]->SizeOfProcessData); + } + else + { + /* Nothing for this Process */ + CsrProcess->ServerData[i] = NULL; + } + } +#else + /* HACKZ: should go in BaseSrv part of CreateCallback done in Insert below */ + RtlInitializeCriticalSection(&CsrProcess->HandleTableLock); +#endif + /* Insert the Process */ + CsrInsertProcess(NULL, NULL, CsrProcess); + + /* Activate the Thread */ + ApiMessage->ReturnValue = NtResumeThread(hThread, NULL); + + /* Release lock and return */ + CsrReleaseProcessLock(); + return TRUE; +} + +/*++ + * @name CsrSbForeignSessionComplete + * + * The CsrSbForeignSessionComplete API is called by the Session Manager + * whenever a foreign session is completed (ie: terminated). + * + * @param ApiMessage + * Pointer to the Session Manager API Message. + * + * @return TRUE in case of success, FALSE othwerwise. + * + * @remarks The CsrSbForeignSessionComplete API is not yet implemented. + * + *--*/ +BOOLEAN +NTAPI +CsrSbForeignSessionComplete(IN PSB_API_MSG ApiMessage) +{ + /* Deprecated/Unimplemented in NT */ + ApiMessage->ReturnValue = STATUS_NOT_IMPLEMENTED; + return TRUE; +} + +/*++ + * @name CsrSbTerminateSession + * + * The CsrSbTerminateSession API is called by the Session Manager + * whenever a foreign session should be destroyed. + * + * @param ApiMessage + * Pointer to the Session Manager API Message. + * + * @return TRUE in case of success, FALSE othwerwise. + * + * @remarks The CsrSbTerminateSession API is not yet implemented. + * + *--*/ +BOOLEAN +NTAPI +CsrSbTerminateSession(IN PSB_API_MSG ApiMessage) +{ + ApiMessage->ReturnValue = STATUS_NOT_IMPLEMENTED; + return TRUE; +} + +/*++ + * @name CsrSbCreateProcess + * + * The CsrSbCreateProcess API is called by the Session Manager + * whenever a foreign session is created and a new process should be started. + * + * @param ApiMessage + * Pointer to the Session Manager API Message. + * + * @return TRUE in case of success, FALSE othwerwise. + * + * @remarks The CsrSbCreateProcess API is not yet implemented. + * + *--*/ +BOOLEAN +NTAPI +CsrSbCreateProcess(IN PSB_API_MSG ApiMessage) +{ + ApiMessage->ReturnValue = STATUS_NOT_IMPLEMENTED; + return TRUE; +} + +PSB_API_ROUTINE CsrServerSbApiDispatch[5] = +{ + CsrSbCreateSession, + CsrSbTerminateSession, + CsrSbForeignSessionComplete, + CsrSbCreateProcess, + NULL +}; + +/*++ + * @name CsrSbApiHandleConnectionRequest + * + * The CsrSbApiHandleConnectionRequest routine handles and accepts a new + * connection request to the SM API LPC Port. + * + * @param ApiMessage + * Pointer to the incoming CSR API Message which contains the + * connection request. + * + * @return STATUS_SUCCESS in case of success, or status code which caused + * the routine to error. + * + * @remarks None. + * + *--*/ +NTSTATUS +NTAPI +CsrSbApiHandleConnectionRequest(IN PSB_API_MSG Message) +{ + NTSTATUS Status; + REMOTE_PORT_VIEW RemotePortView; + HANDLE hPort; + + /* Set the Port View Structure Length */ + RemotePortView.Length = sizeof(REMOTE_PORT_VIEW); + + /* Accept the connection */ + Status = NtAcceptConnectPort(&hPort, + NULL, + (PPORT_MESSAGE)Message, + TRUE, + NULL, + &RemotePortView); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSS: Sb Accept Connection failed %lx\n", Status); + return Status; + } + + /* Complete the Connection */ + Status = NtCompleteConnectPort(hPort); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSRSS: Sb Complete Connection failed %lx\n",Status); + } + + /* Return status */ + return Status; +} + +/*++ + * @name CsrSbApiRequestThread + * + * The CsrSbApiRequestThread routine handles incoming messages or connection + * requests on the SM API LPC Port. + * + * @param Parameter + * System-default user-defined parameter. Unused. + * + * @return The thread exit code, if the thread is terminated. + * + * @remarks Before listening on the port, the routine will first attempt + * to connect to the user subsystem. + * + *--*/ +VOID +NTAPI +CsrSbApiRequestThread(IN PVOID Parameter) +{ + NTSTATUS Status; + SB_API_MSG ReceiveMsg; + PSB_API_MSG ReplyMsg = NULL; + PVOID PortContext; + ULONG MessageType; + + /* Start the loop */ + while (TRUE) + { + /* Wait for a message to come in */ + Status = NtReplyWaitReceivePort(CsrSbApiPort, + &PortContext, + &ReplyMsg->h, + &ReceiveMsg.h); + + /* Check if we didn't get success */ + if (Status != STATUS_SUCCESS) + { + /* If we only got a warning, keep going */ + if (NT_SUCCESS(Status)) continue; + + /* We failed big time, so start out fresh */ + ReplyMsg = NULL; + DPRINT1("CSRSS: ReceivePort failed - Status == %X\n", Status); + continue; + } + + /* Save the message type */ + MessageType = ReceiveMsg.h.u2.s2.Type; + + /* Check if this is a connection request */ + if (MessageType == LPC_CONNECTION_REQUEST) + { + /* Handle connection request */ + CsrSbApiHandleConnectionRequest(&ReceiveMsg); + + /* Start over */ + ReplyMsg = NULL; + continue; + } + + /* Check if the port died */ + if (MessageType == LPC_PORT_CLOSED) + { + /* Close the handle if we have one */ + if (PortContext) NtClose((HANDLE)PortContext); + + /* Client died, start over */ + ReplyMsg = NULL; + continue; + } + else if (MessageType == LPC_CLIENT_DIED) + { + /* Client died, start over */ + ReplyMsg = NULL; + continue; + } + + /* + * It's an API Message, check if it's within limits. If it's not, the + * NT Behaviour is to set this to the Maximum API. + */ + if (ReceiveMsg.ApiNumber > SbpMaxApiNumber) + { + ReceiveMsg.ApiNumber = SbpMaxApiNumber; + DPRINT1("CSRSS: %lx is invalid Sb ApiNumber\n", ReceiveMsg.ApiNumber); + } + + /* Reuse the message */ + ReplyMsg = &ReceiveMsg; + + /* Make sure that the message is supported */ + if (ReceiveMsg.ApiNumber < SbpMaxApiNumber) + { + /* Call the API */ + if (!CsrServerSbApiDispatch[ReceiveMsg.ApiNumber](&ReceiveMsg)) + { + /* It failed, so return nothing */ + ReplyMsg = NULL; + } + } + else + { + /* We don't support this API Number */ + ReplyMsg->ReturnValue = STATUS_NOT_IMPLEMENTED; + } + } +} + /* EOF */ Modified: trunk/reactos/subsystems/win32/csrss/include/api.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/inc…
============================================================================== --- trunk/reactos/subsystems/win32/csrss/include/api.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/include/api.h [iso-8859-1] Thu Feb 16 16:21:48 2012 @@ -91,7 +91,7 @@ LIST_ENTRY ListLink; LIST_ENTRY ThreadList; struct _CSR_PROCESS *Parent; -// PCSR_NT_SESSION NtSession; + PCSR_NT_SESSION NtSession; ULONG ExpectedVersion; HANDLE ClientPort; ULONG_PTR ClientViewBase; @@ -229,6 +229,7 @@ NTAPI CsrReleaseCapturedArguments(IN PCSR_API_MESSAGE ApiMessage); +extern HANDLE hApiPort; extern HANDLE CsrSmApiPort; extern HANDLE CsrSbApiPort; extern LIST_ENTRY CsrThreadHashTable[256];
12 years, 7 months
1
0
0
0
[tkreuzer] 55636: [WIN32K] - Modify NtGdiSelectBitmap to correctly handle the case of pdc->dclevel.pSurface == 0 - Small code improvement without functional change for rtlstr functions
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Thu Feb 16 16:05:25 2012 New Revision: 55636 URL:
http://svn.reactos.org/svn/reactos?rev=55636&view=rev
Log: [WIN32K] - Modify NtGdiSelectBitmap to correctly handle the case of pdc->dclevel.pSurface == 0 - Small code improvement without functional change for rtlstr functions Modified: trunk/reactos/subsystems/win32/win32k/misc/rtlstr.c trunk/reactos/subsystems/win32/win32k/objects/dcobjs.c Modified: trunk/reactos/subsystems/win32/win32k/misc/rtlstr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/mi…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/misc/rtlstr.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/misc/rtlstr.c [iso-8859-1] Thu Feb 16 16:05:25 2012 @@ -3,7 +3,6 @@ * FILE: subsystems/win32/win32k/misc/rtlstr.c * PURPOSE: Large Strings * PROGRAMMER: - * UPDATE HISTORY: * */ @@ -12,11 +11,13 @@ #include <win32k.h> /* FUNCTIONS *****************************************************************/ + VOID NTAPI -RtlInitLargeAnsiString(IN OUT PLARGE_ANSI_STRING DestinationString, - IN PCSZ SourceString, - IN INT Unknown) +RtlInitLargeAnsiString( + IN OUT PLARGE_ANSI_STRING DestinationString, + IN PCSZ SourceString, + IN INT Unknown) { ULONG DestSize; @@ -38,9 +39,10 @@ VOID NTAPI -RtlInitLargeUnicodeString(IN OUT PLARGE_UNICODE_STRING DestinationString, - IN PCWSTR SourceString, - IN INT Unknown) +RtlInitLargeUnicodeString( + IN OUT PLARGE_UNICODE_STRING DestinationString, + IN PCWSTR SourceString, + IN INT Unknown) { ULONG DestSize; @@ -62,21 +64,29 @@ BOOL NTAPI -RtlLargeStringToUnicodeString( PUNICODE_STRING DestinationString, - PLARGE_STRING SourceString) +RtlLargeStringToUnicodeString( + PUNICODE_STRING DestinationString, + PLARGE_STRING SourceString) { - ANSI_STRING AnsiString; + ANSI_STRING AnsiString; - RtlInitUnicodeString(DestinationString, NULL); - if (DestinationString && SourceString && SourceString->bAnsi) - { - RtlInitAnsiString(&AnsiString, (LPSTR)SourceString->Buffer); - return NT_SUCCESS(RtlAnsiStringToUnicodeString(DestinationString, &AnsiString, TRUE)); - } - else if (DestinationString && SourceString) - { - return RtlCreateUnicodeString(DestinationString, SourceString->Buffer); - } - else - return FALSE; + /* Check parameters */ + if (!DestinationString || !SourceString) return FALSE; + + /* Check if size if ok */ + // We can't do this atm and truncate the string instead. + //if (SourceString->Length > 0xffff) return FALSE; + + RtlInitUnicodeString(DestinationString, NULL); + + if (SourceString->bAnsi) + { + RtlInitAnsiString(&AnsiString, (LPSTR)SourceString->Buffer); + return NT_SUCCESS(RtlAnsiStringToUnicodeString(DestinationString, &AnsiString, TRUE)); + } + else + { + return RtlCreateUnicodeString(DestinationString, SourceString->Buffer); + } } + Modified: trunk/reactos/subsystems/win32/win32k/objects/dcobjs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/dcobjs.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/dcobjs.c [iso-8859-1] Thu Feb 16 16:05:25 2012 @@ -263,7 +263,7 @@ PDC pdc; PDC_ATTR pdcattr; HBITMAP hbmpOld; - PSURFACE psurfNew; + PSURFACE psurfNew, psurfOld; HRGN hVisRgn; SIZEL sizlBitmap = {1, 1}; HDC hdcOld; @@ -287,17 +287,8 @@ return NULL; } - /* Check if there was a bitmap selected before */ - if (pdc->dclevel.pSurface) - { - /* Return its handle */ - hbmpOld = pdc->dclevel.pSurface->BaseObject.hHmgr; - } - else - { - /* Return default bitmap */ - hbmpOld = StockObjects[DEFAULT_BITMAP]; - } + /* Save the old bitmap */ + psurfOld = pdc->dclevel.pSurface; /* Check if the default bitmap was passed */ if (hbmp == StockObjects[DEFAULT_BITMAP]) @@ -342,14 +333,26 @@ } } - /* Select the new surface, release the old */ - DC_vSelectSurface(pdc, psurfNew); - - /* Set the new size */ - pdc->dclevel.sizl = sizlBitmap; - - /* Release one reference we added */ - SURFACE_ShareUnlockSurface(psurfNew); + /* Select the new bitmap */ + pdc->dclevel.pSurface = psurfNew; + + /* Check if there was a bitmap selected before */ + if (psurfOld) + { + /* Get the old bitmap's handle */ + hbmpOld = psurfOld->BaseObject.hHmgr; + + /* Reset hdc of the old bitmap,it isn't selected anymore */ + psurfOld->hdc = NULL; + + /* Dereference the old bitmap */ + SURFACE_ShareUnlockSurface(psurfOld); + } + else + { + /* Return default bitmap */ + hbmpOld = StockObjects[DEFAULT_BITMAP]; + } /* Mark the dc brushes invalid */ pdcattr->ulDirty_ |= DIRTY_FILL | DIRTY_LINE;
12 years, 7 months
1
0
0
0
[janderwald] 55635: [USBEHCI] - Fix build
by janderwald@svn.reactos.org
Author: janderwald Date: Thu Feb 16 14:52:57 2012 New Revision: 55635 URL:
http://svn.reactos.org/svn/reactos?rev=55635&view=rev
Log: [USBEHCI] - Fix build Modified: trunk/reactos/drivers/usb/usbehci/hub_controller.cpp Modified: trunk/reactos/drivers/usb/usbehci/hub_controller.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbehci/hub_co…
============================================================================== --- trunk/reactos/drivers/usb/usbehci/hub_controller.cpp [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbehci/hub_controller.cpp [iso-8859-1] Thu Feb 16 14:52:57 2012 @@ -1757,7 +1757,7 @@ // // failed // - DPRINT1("[USBEHCI] failed to reset pipe %x\n", Status) + DPRINT1("[USBEHCI] failed to reset pipe %x\n", Status); }
12 years, 7 months
1
0
0
0
[janderwald] 55634: [USBEHCI] - Abort pipe when performing sync reset request - add assert to check for bogus interface descriptors - use endpoint max packet size when available - flip data toggle ...
by janderwald@svn.reactos.org
Author: janderwald Date: Thu Feb 16 14:49:59 2012 New Revision: 55634 URL:
http://svn.reactos.org/svn/reactos?rev=55634&view=rev
Log: [USBEHCI] - Abort pipe when performing sync reset request - add assert to check for bogus interface descriptors - use endpoint max packet size when available - flip data toggle after each transfer - remove dead code - use maximum of 4 pages or rest current buffer size when performing a bulk requests - use nak reload count 3 - perform 1 transaction per frame Modified: trunk/reactos/drivers/usb/usbehci/hub_controller.cpp trunk/reactos/drivers/usb/usbehci/usb_device.cpp trunk/reactos/drivers/usb/usbehci/usb_queue.cpp trunk/reactos/drivers/usb/usbehci/usb_request.cpp Modified: trunk/reactos/drivers/usb/usbehci/hub_controller.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbehci/hub_co…
============================================================================== --- trunk/reactos/drivers/usb/usbehci/hub_controller.cpp [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbehci/hub_controller.cpp [iso-8859-1] Thu Feb 16 14:49:59 2012 @@ -1740,13 +1740,26 @@ // if (!ValidateUsbDevice(PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle))) { - DPRINT1("HandleAbortPipe invalid device handle %p\n", Urb->UrbHeader.UsbdDeviceHandle); + DPRINT1("HandleSyncResetAndClearStall invalid device handle %p\n", Urb->UrbHeader.UsbdDeviceHandle); // // invalid device handle // return STATUS_DEVICE_NOT_CONNECTED; } + + // + // abort pipe + // + Status = HandleAbortPipe(Irp, Urb); + if (!NT_SUCCESS(Status)) + { + // + // failed + // + DPRINT1("[USBEHCI] failed to reset pipe %x\n", Status) + } + // // get endpoint descriptor Modified: trunk/reactos/drivers/usb/usbehci/usb_device.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbehci/usb_de…
============================================================================== --- trunk/reactos/drivers/usb/usbehci/usb_device.cpp [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbehci/usb_device.cpp [iso-8859-1] Thu Feb 16 14:49:59 2012 @@ -819,6 +819,7 @@ // // move to next descriptor // + ASSERT(InterfaceDescriptor->bLength); InterfaceDescriptor = (PUSB_INTERFACE_DESCRIPTOR)((ULONG_PTR)InterfaceDescriptor + InterfaceDescriptor->bLength); } Modified: trunk/reactos/drivers/usb/usbehci/usb_queue.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbehci/usb_qu…
============================================================================== --- trunk/reactos/drivers/usb/usbehci/usb_queue.cpp [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbehci/usb_queue.cpp [iso-8859-1] Thu Feb 16 14:49:59 2012 @@ -427,7 +427,7 @@ // // Link the LIST_ENTRYs // - ASSERT(IsListEmpty(&HeadQueueHead->LinkedQueueHeads)); + //ASSERT(IsListEmpty(&HeadQueueHead->LinkedQueueHeads)); InsertTailList(&HeadQueueHead->LinkedQueueHeads, &NewQueueHead->LinkedQueueHeads); // @@ -435,7 +435,7 @@ // Entry = NewQueueHead->LinkedQueueHeads.Blink; LastQueueHead = CONTAINING_RECORD(Entry, QUEUE_HEAD, LinkedQueueHeads); - ASSERT(LastQueueHead == HeadQueueHead); + //ASSERT(LastQueueHead == HeadQueueHead); LastQueueHead->HorizontalLinkPointer = (NewQueueHead->PhysicalAddr | QH_TYPE_QH); // @@ -443,7 +443,7 @@ // Entry = NewQueueHead->LinkedQueueHeads.Flink; NextQueueHead = CONTAINING_RECORD(Entry, QUEUE_HEAD, LinkedQueueHeads); - ASSERT(NextQueueHead == HeadQueueHead); + //ASSERT(NextQueueHead == HeadQueueHead); NewQueueHead->HorizontalLinkPointer = (NextQueueHead->PhysicalAddr | QH_TYPE_QH); // @@ -858,7 +858,6 @@ KIRQL OldLevel; PLIST_ENTRY Entry; PQUEUE_HEAD CurrentQH; - IUSBRequest *Request; DPRINT("CUSBQueue::CompleteAsyncRequests\n"); @@ -883,11 +882,6 @@ // get queue head structure // CurrentQH = (PQUEUE_HEAD)CONTAINING_RECORD(Entry, QUEUE_HEAD, LinkedQueueHeads); - - // - // Get the Request for this QueueHead - // - Request = (IUSBRequest*) CurrentQH->Request; // // release lock @@ -937,8 +931,82 @@ IN UCHAR DeviceAddress, IN PUSB_ENDPOINT_DESCRIPTOR EndpointDescriptor) { - UNIMPLEMENTED - return STATUS_NOT_IMPLEMENTED; + KIRQL OldLevel; + PLIST_ENTRY Entry; + PQUEUE_HEAD QueueHead; + LIST_ENTRY ListHead; + + // + // lock completed async list + // + KeAcquireSpinLock(m_Lock, &OldLevel); + + DPRINT1("AbortDevicePipe DeviceAddress %x EndpointDescriptor %p Addr %x\n", DeviceAddress, EndpointDescriptor, EndpointDescriptor->bEndpointAddress); + + // + // init list head + // + InitializeListHead(&ListHead); + + + // + // walk async list + // + ASSERT(AsyncListQueueHead); + Entry = AsyncListQueueHead->LinkedQueueHeads.Flink; + + while(Entry != &AsyncListQueueHead->LinkedQueueHeads) + { + // + // get queue head structure + // + QueueHead = (PQUEUE_HEAD)CONTAINING_RECORD(Entry, QUEUE_HEAD, LinkedQueueHeads); + ASSERT(QueueHead); + + // + // move to next entry + // + Entry = Entry->Flink; + + if (QueueHead->EndPointCharacteristics.DeviceAddress == DeviceAddress && + QueueHead->EndPointCharacteristics.EndPointNumber == (EndpointDescriptor->bEndpointAddress & 0xF) && QueueHead->Token.Bits.Halted) + { + // + // unlink queue head + // + UnlinkQueueHead(QueueHead); + + // + // add to temp list + // + InsertTailList(&ListHead, &QueueHead->LinkedQueueHeads); + } + } + + // + // release lock + // + KeReleaseSpinLock(m_Lock, OldLevel); + + while(!IsListEmpty(&ListHead)) + { + // + // remove entry + // + Entry = RemoveHeadList(&ListHead); + + // + // get queue head structure + // + QueueHead = (PQUEUE_HEAD)CONTAINING_RECORD(Entry, QUEUE_HEAD, LinkedQueueHeads); + ASSERT(QueueHead); + + // + // cleanup queue head + // + QueueHeadCleanup(QueueHead); + } + return STATUS_SUCCESS; } Modified: trunk/reactos/drivers/usb/usbehci/usb_request.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbehci/usb_re…
============================================================================== --- trunk/reactos/drivers/usb/usbehci/usb_request.cpp [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbehci/usb_request.cpp [iso-8859-1] Thu Feb 16 14:49:59 2012 @@ -62,10 +62,9 @@ NTSTATUS BuildSetupPacket(); NTSTATUS BuildSetupPacketFromURB(); ULONG InternalCalculateTransferLength(); - NTSTATUS BuildTransferDescriptorChain(IN PQUEUE_HEAD QueueHead, IN PVOID TransferBuffer, IN ULONG TransferBufferLength, IN UCHAR PidCode, IN UCHAR InitialDataToggle, OUT PQUEUE_TRANSFER_DESCRIPTOR * OutFirstDescriptor, OUT PQUEUE_TRANSFER_DESCRIPTOR * OutLastDescriptor, OUT PUCHAR OutDataToggle, OUT PULONG OutTransferBufferOffset); + NTSTATUS BuildTransferDescriptorChain(IN PQUEUE_HEAD QueueHead, IN PVOID TransferBuffer, IN ULONG TransferBufferLength, IN UCHAR PidCode, IN UCHAR InitialDataToggle, IN PQUEUE_TRANSFER_DESCRIPTOR AlternativeDescriptor, OUT PQUEUE_TRANSFER_DESCRIPTOR * OutFirstDescriptor, OUT PQUEUE_TRANSFER_DESCRIPTOR * OutLastDescriptor, OUT PUCHAR OutDataToggle, OUT PULONG OutTransferBufferOffset); VOID InitDescriptor(IN PQUEUE_TRANSFER_DESCRIPTOR CurrentDescriptor, IN PVOID TransferBuffer, IN ULONG TransferBufferLength, IN UCHAR PidCode, IN UCHAR DataToggle, OUT PULONG OutDescriptorLength); VOID DumpQueueHead(IN PQUEUE_HEAD QueueHead); - // constructor / destructor CUSBRequest(IUnknown *OuterUnknown){} @@ -734,6 +733,7 @@ IN ULONG TransferBufferLength, IN UCHAR PidCode, IN UCHAR InitialDataToggle, + IN PQUEUE_TRANSFER_DESCRIPTOR AlternativeDescriptor, OUT PQUEUE_TRANSFER_DESCRIPTOR * OutFirstDescriptor, OUT PQUEUE_TRANSFER_DESCRIPTOR * OutLastDescriptor, OUT PUCHAR OutDataToggle, @@ -742,6 +742,19 @@ PQUEUE_TRANSFER_DESCRIPTOR FirstDescriptor = NULL, CurrentDescriptor, LastDescriptor = NULL; NTSTATUS Status; ULONG DescriptorLength, TransferBufferOffset = 0; + ULONG MaxPacketSize = 0, TransferSize; + + // + // is there an endpoint descriptor + // + if (m_EndpointDescriptor) + { + // + // use endpoint packet size + // + MaxPacketSize = m_EndpointDescriptor->EndPointDescriptor.wMaxPacketSize; + } + do { @@ -754,8 +767,22 @@ // // failed to allocate transfer descriptor // - ASSERT(FALSE); - return Status; + return STATUS_INSUFFICIENT_RESOURCES; + } + + if (MaxPacketSize) + { + // + // transfer size is minimum available buffer or endpoint size + // + TransferSize = min(TransferBufferLength - TransferBufferOffset, MaxPacketSize); + } + else + { + // + // use available buffer + // + TransferSize = TransferBufferLength - TransferBufferOffset; } // @@ -763,7 +790,7 @@ // InitDescriptor(CurrentDescriptor, (PVOID)((ULONG_PTR)TransferBuffer + TransferBufferOffset), - TransferBufferLength - TransferBufferOffset, + TransferSize, PidCode, InitialDataToggle, &DescriptorLength); @@ -783,9 +810,17 @@ // // link to current descriptor // - LastDescriptor->AlternateNextPointer = CurrentDescriptor->PhysicalAddr; LastDescriptor->NextPointer = CurrentDescriptor->PhysicalAddr; LastDescriptor = CurrentDescriptor; + + if (AlternativeDescriptor) + { + // + // link to alternative next pointer + // + LastDescriptor->AlternateNextPointer = AlternativeDescriptor->PhysicalAddr; + } + } else { @@ -795,6 +830,11 @@ LastDescriptor = FirstDescriptor = CurrentDescriptor; } + // + // flip data toggle + // + InitialDataToggle = !InitialDataToggle; + if(TransferBufferLength == TransferBufferOffset) { // @@ -802,6 +842,7 @@ // break; } + }while(TRUE); if (OutFirstDescriptor) @@ -822,11 +863,6 @@ if (OutDataToggle) { - // - // flip data toggle - // - InitialDataToggle = !InitialDataToggle; - // // store result data toggle // @@ -918,14 +954,7 @@ // QueueHead->EndPointCharacteristics.DeviceAddress = GetDeviceAddress(); - if (m_EndpointDescriptor) - { - // - // set endpoint address and max packet length - // - QueueHead->EndPointCharacteristics.EndPointNumber = m_EndpointDescriptor->EndPointDescriptor.bEndpointAddress & 0x0F; - QueueHead->EndPointCharacteristics.MaximumPacketLength = m_EndpointDescriptor->EndPointDescriptor.wMaxPacketSize; - } + ASSERT(m_EndpointDescriptor == FALSE); // // init setup descriptor @@ -954,6 +983,7 @@ m_TransferBufferLength, InternalGetPidDirection(), TRUE, + NULL, &FirstDescriptor, &LastDescriptor, NULL, @@ -1137,13 +1167,19 @@ ASSERT(m_EndpointDescriptor); // + // use 4 * PAGE_SIZE at max for each new request + // + ULONG MaxTransferLength = min(4 * PAGE_SIZE, m_TransferBufferLength - m_TransferBufferLengthCompleted); + + // // build bulk transfer descriptor chain // Status = BuildTransferDescriptorChain(QueueHead, Base, - m_TransferBufferLength - m_TransferBufferLengthCompleted, + MaxTransferLength, InternalGetPidDirection(), m_EndpointDescriptor->DataToggle, + NULL, &FirstDescriptor, &LastDescriptor, &m_EndpointDescriptor->DataToggle, @@ -1152,7 +1188,7 @@ // // FIXME: handle errors // - ASSERT(ChainDescriptorLength == m_TransferBufferLength); + //ASSERT(ChainDescriptorLength == m_TransferBufferLength); // // move to next offset @@ -1279,7 +1315,7 @@ // // Set NakCountReload to max value possible // - QueueHead->EndPointCharacteristics.NakCountReload = 0xF; + QueueHead->EndPointCharacteristics.NakCountReload = 0x3; // // Get the Initial Data Toggle from the QEDT @@ -1290,7 +1326,7 @@ // FIXME: check if High Speed Device // QueueHead->EndPointCharacteristics.EndPointSpeed = QH_ENDPOINT_HIGHSPEED; - QueueHead->EndPointCapabilities.NumberOfTransactionPerFrame = 0x03; + QueueHead->EndPointCapabilities.NumberOfTransactionPerFrame = 0x01; QueueHead->Token.DWord = 0; QueueHead->Token.Bits.InterruptOnComplete = FALSE;
12 years, 7 months
1
0
0
0
[tkreuzer] 55633: [RTL] Fix a bug I introduced in r55527
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Thu Feb 16 14:37:53 2012 New Revision: 55633 URL:
http://svn.reactos.org/svn/reactos?rev=55633&view=rev
Log: [RTL] Fix a bug I introduced in r55527 Modified: trunk/reactos/lib/rtl/unicode.c Modified: trunk/reactos/lib/rtl/unicode.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/unicode.c?rev=5563…
============================================================================== --- trunk/reactos/lib/rtl/unicode.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/unicode.c [iso-8859-1] Thu Feb 16 14:37:53 2012 @@ -2545,7 +2545,7 @@ Length = SearchString->Length / sizeof(WCHAR); if (Flags & RTL_FIND_CHAR_IN_UNICODE_STRING_START_AT_END) { - for (i = Length - 1; i >= 0; i--) + for (i = Length - 1; (SHORT)i >= 0; i--) { Found = RtlpIsCharInUnicodeString(SearchString->Buffer[i], MatchString, CaseInSensitive); if (Found == WantToFind)
12 years, 7 months
1
0
0
0
[jgardou] 55632: [CMAKE] - use relative paths for reactos.dff generation. May fix Pierre's issue, but a deeper fix is needed.
by jgardou@svn.reactos.org
Author: jgardou Date: Thu Feb 16 13:03:29 2012 New Revision: 55632 URL:
http://svn.reactos.org/svn/reactos?rev=55632&view=rev
Log: [CMAKE] - use relative paths for reactos.dff generation. May fix Pierre's issue, but a deeper fix is needed. Modified: trunk/reactos/cmake/CMakeMacros.cmake Modified: trunk/reactos/cmake/CMakeMacros.cmake URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/cmake/CMakeMacros.cmake?re…
============================================================================== --- trunk/reactos/cmake/CMakeMacros.cmake [iso-8859-1] (original) +++ trunk/reactos/cmake/CMakeMacros.cmake [iso-8859-1] Thu Feb 16 13:03:29 2012 @@ -154,11 +154,13 @@ else() #add it in reactos.cab dir_to_num(${_CD_DESTINATION} _num) + file(RELATIVE_PATH __relative_file ${REACTOS_SOURCE_DIR} ${_CD_FILE}) if(CMAKE_HOST_SYSTEM_NAME MATCHES Windows) - file(APPEND ${REACTOS_BINARY_DIR}/boot/bootdata/packages/reactos.dff.dyn "${_CD_FILE} ${_num}\n") + file(APPEND ${REACTOS_BINARY_DIR}/boot/bootdata/packages/reactos.dff.dyn "${__relative_file} ${_num}\n") else() - file(APPEND ${REACTOS_BINARY_DIR}/boot/bootdata/packages/reactos.dff.dyn "\"${_CD_FILE}\" ${_num}\n") - endif() + file(APPEND ${REACTOS_BINARY_DIR}/boot/bootdata/packages/reactos.dff.dyn "\"${__relative_file}\" ${_num}\n") + endif() + unset(__relative_file) if(_CD_TARGET) #manage dependency add_dependencies(reactos_cab ${_CD_TARGET})
12 years, 7 months
1
0
0
0
[jgardou] 55631: [NTOSKRNL/MM] - use ARM3 allocation for PDE pages. There is now one table for system PDEs, and their pages are not leaked anymore. Also fix bug 5857 (aka mshtml bug). Only for x86 ...
by jgardou@svn.reactos.org
Author: jgardou Date: Thu Feb 16 11:16:10 2012 New Revision: 55631 URL:
http://svn.reactos.org/svn/reactos?rev=55631&view=rev
Log: [NTOSKRNL/MM] - use ARM3 allocation for PDE pages. There is now one table for system PDEs, and their pages are not leaked anymore. Also fix bug 5857 (aka mshtml bug). Only for x86 now. Timo, I think you should do it for amd64 as well. Thanks for your patience, go back to testing now. A huge congrats to Cameron and Thomas, without them I wouldn't even have dared touching this code. Modified: trunk/reactos/ntoskrnl/mm/ARM3/virtual.c trunk/reactos/ntoskrnl/mm/i386/page.c Modified: trunk/reactos/ntoskrnl/mm/ARM3/virtual.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/virtual.c…
============================================================================== --- trunk/reactos/ntoskrnl/mm/ARM3/virtual.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/ARM3/virtual.c [iso-8859-1] Thu Feb 16 11:16:10 2012 @@ -258,8 +258,8 @@ #if (_MI_PAGING_LEVELS == 2) } #endif - /* FIXME: Drop the reference on the page table. For now, leak it until RosMM is gone */ - //MiDecrementShareCount(MiGetPfnEntry(PFN_FROM_PTE(PointerPde)), PFN_FROM_PTE(PointerPde)); + /* Drop the reference on the page table. */ + MiDecrementShareCount(MiGetPfnEntry(PFN_FROM_PTE(PointerPde)), PFN_FROM_PTE(PointerPde)); /* Drop the share count */ MiDecrementShareCount(Pfn1, PageFrameIndex); Modified: trunk/reactos/ntoskrnl/mm/i386/page.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/i386/page.c?re…
============================================================================== --- trunk/reactos/ntoskrnl/mm/i386/page.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/i386/page.c [iso-8859-1] Thu Feb 16 11:16:10 2012 @@ -42,8 +42,6 @@ #define HYPERSPACE (0xc0400000) #define IS_HYPERSPACE(v) (((ULONG)(v) >= HYPERSPACE && (ULONG)(v) < HYPERSPACE + 0x400000)) - -ULONG MmGlobalKernelPageDirectory[1024]; #define PTE_TO_PFN(X) ((X) >> PAGE_SHIFT) #define PFN_TO_PTE(X) ((X) << PAGE_SHIFT) @@ -200,72 +198,101 @@ return(Attributes); } -static -VOID -MmDeletePageDirectoryEntry(ULONG PdeEntry) +VOID +FORCEINLINE +MmDeletePageDirectoryEntry(PMMPDE PointerPde) { KIRQL OldIrql; PMMPFN Page; - Page = MiGetPfnEntry(PTE_TO_PFN(PdeEntry)); - - /* Check if this is a legacy allocation */ - if (MI_IS_ROS_PFN(Page)) - { - /* Free it using the legacy API */ - MmReleasePageMemoryConsumer(MC_SYSTEM, PTE_TO_PFN(PdeEntry)); - } - else - { - OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock); - - /* Free it using the ARM3 API */ - MI_SET_PFN_DELETED(Page); - MiDecrementShareCount(Page, PTE_TO_PFN(PdeEntry)); - - KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql); - } + Page = MiGetPfnEntry(PointerPde->u.Hard.PageFrameNumber); + + /* This should not be a legacy allocation*/ + ASSERT(MI_IS_ROS_PFN(Page) == FALSE); + + OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock); + + /* Free it using the ARM3 API */ + MI_SET_PFN_DELETED(Page); + MiDecrementShareCount(Page, PointerPde->u.Hard.PageFrameNumber); + + KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql); } VOID NTAPI MmDeleteProcessPageDirectory(PEPROCESS Process) { - PULONG PageDir; + PMMPDE PdeBase, PointerPde; ULONG PdeOffset; + KIRQL OldIrql; /* Map the page directory in hyperspace */ - PageDir = MmCreateHyperspaceMapping(PTE_TO_PFN(Process->Pcb.DirectoryTableBase[0])); + PdeBase = MiMapPageInHyperSpace(PsGetCurrentProcess(), + Process->Pcb.DirectoryTableBase[0] >> PAGE_SHIFT, + &OldIrql); /* Loop the user land page directory */ - for (PdeOffset = 0; PdeOffset < ADDR_TO_PDE_OFFSET(MmSystemRangeStart); PdeOffset++) - { + for (PdeOffset = 0; PdeOffset < MiGetPdeOffset(MmSystemRangeStart); PdeOffset++) + { + PointerPde = PdeBase + PdeOffset; /* Check if a valid PDE exists here */ - if (PageDir[PdeOffset] != 0) + if (PointerPde->u.Hard.Valid) { /* Free the page that backs it */ - MmDeletePageDirectoryEntry(PageDir[PdeOffset]); + MmDeletePageDirectoryEntry(PointerPde); } } /* Free the hyperspace mapping page (ARM3) */ - MmDeletePageDirectoryEntry(PageDir[ADDR_TO_PDE_OFFSET(HYPERSPACE)]); + MmDeletePageDirectoryEntry(PdeBase + MiGetPdeOffset(HYPERSPACE)); /* Delete the hyperspace mapping */ - MmDeleteHyperspaceMapping(PageDir); + MiUnmapPageInHyperSpace(PsGetCurrentProcess(), PdeBase, OldIrql); /* Free the PDE page itself (ARM3) */ - MmDeletePageDirectoryEntry(Process->Pcb.DirectoryTableBase[0]); -} + MmDeletePageDirectoryEntry((PMMPDE)&Process->Pcb.DirectoryTableBase[0]); +} + +/* Taken from ARM3/pagfault.c */ +BOOLEAN +FORCEINLINE +MiSynchronizeSystemPde(PMMPDE PointerPde) +{ + MMPDE SystemPde; + ULONG Index; + + /* Get the Index from the PDE */ + Index = ((ULONG_PTR)PointerPde & (SYSTEM_PD_SIZE - 1)) / sizeof(MMPTE); + + /* Copy the PDE from the double-mapped system page directory */ + SystemPde = MmSystemPagePtes[Index]; + *PointerPde = SystemPde; + + /* Make sure we re-read the PDE and PTE */ + KeMemoryBarrierWithoutFence(); + + /* Return, if we had success */ + return (BOOLEAN)SystemPde.u.Hard.Valid; +} + +NTSTATUS +NTAPI +MiResolveDemandZeroFault(IN PVOID Address, + IN ULONG Protection, + IN PEPROCESS Process, + IN KIRQL OldIrql); +VOID +NTAPI +MiFillSystemPageDirectory(IN PVOID Base, + IN SIZE_T NumberOfBytes); static PULONG MmGetPageTableForProcess(PEPROCESS Process, PVOID Address, BOOLEAN Create) { - ULONG PdeOffset = ADDR_TO_PDE_OFFSET(Address); - NTSTATUS Status; PFN_NUMBER Pfn; - ULONG Entry; - PULONG Pt, PageDir; + PULONG Pt; + PMMPDE PointerPde; if (Address < MmSystemRangeStart) { @@ -274,39 +301,28 @@ if(Process != PsGetCurrentProcess()) { - PageDir = MmCreateHyperspaceMapping(PTE_TO_PFN(Process->Pcb.DirectoryTableBase[0])); - if (PageDir == NULL) + PMMPDE PdeBase; + ULONG PdeOffset = MiGetPdeOffset(Address); + + PdeBase = MmCreateHyperspaceMapping(PTE_TO_PFN(Process->Pcb.DirectoryTableBase[0])); + if (PdeBase == NULL) { KeBugCheck(MEMORY_MANAGEMENT); } - if (0 == InterlockedCompareExchangePte(&PageDir[PdeOffset], 0, 0)) + PointerPde = PdeBase + PdeOffset; + if (PointerPde->u.Hard.Valid == 0) { - if (Create == FALSE) - { - MmDeleteHyperspaceMapping(PageDir); - return NULL; - } - MI_SET_USAGE(MI_USAGE_LEGACY_PAGE_DIRECTORY); - - MI_SET_PROCESS2(Process->ImageFileName); - - Status = MmRequestPageMemoryConsumer(MC_SYSTEM, FALSE, &Pfn); - if (!NT_SUCCESS(Status) || Pfn == 0) - { - KeBugCheck(MEMORY_MANAGEMENT); - } - Entry = InterlockedCompareExchangePte(&PageDir[PdeOffset], PFN_TO_PTE(Pfn) | PA_PRESENT | PA_READWRITE | PA_USER, 0); - if (Entry != 0) - { - MmReleasePageMemoryConsumer(MC_SYSTEM, Pfn); - Pfn = PTE_TO_PFN(Entry); - } + /* Nobody but page fault should ask for creating the PDE, + * Which imples that Process is the current one */ + ASSERT(Create == FALSE); + MmDeleteHyperspaceMapping(PdeBase); + return NULL; } else { - Pfn = PTE_TO_PFN(PageDir[PdeOffset]); + Pfn = PointerPde->u.Hard.PageFrameNumber; } - MmDeleteHyperspaceMapping(PageDir); + MmDeleteHyperspaceMapping(PdeBase); Pt = MmCreateHyperspaceMapping(Pfn); if (Pt == NULL) { @@ -315,59 +331,38 @@ return Pt + MiAddressToPteOffset(Address); } /* This is for our process */ - PageDir = (PULONG)MiAddressToPde(Address); - if (0 == InterlockedCompareExchangePte(PageDir, 0, 0)) + PointerPde = MiAddressToPde(Address); + Pt = (PULONG)MiAddressToPte(Address); + if (PointerPde->u.Hard.Valid == 0) { if (Create == FALSE) { return NULL; } - MI_SET_USAGE(MI_USAGE_LEGACY_PAGE_DIRECTORY); - MI_SET_PROCESS2(Process->ImageFileName); - - Status = MmRequestPageMemoryConsumer(MC_SYSTEM, FALSE, &Pfn); - if (!NT_SUCCESS(Status) || Pfn == 0) - { - KeBugCheck(MEMORY_MANAGEMENT); - } - Entry = InterlockedCompareExchangePte(PageDir, PFN_TO_PTE(Pfn) | PA_PRESENT | PA_READWRITE | PA_USER, 0); - if (Entry != 0) - { - MmReleasePageMemoryConsumer(MC_SYSTEM, Pfn); - } + MiResolveDemandZeroFault(Pt, + MM_READWRITE, + Process, + MM_NOIRQL); + ASSERT(PointerPde->u.Hard.Valid == 1); } return (PULONG)MiAddressToPte(Address); } /* This is for kernel land address */ - PageDir = (PULONG)MiAddressToPde(Address); - if (0 == InterlockedCompareExchangePte(PageDir, 0, 0)) - { - if (0 == InterlockedCompareExchangePte(&MmGlobalKernelPageDirectory[PdeOffset], 0, 0)) - { - if (Create == FALSE) - { + PointerPde = MiAddressToPde(Address); + Pt = (PULONG)MiAddressToPte(Address); + if (PointerPde->u.Hard.Valid == 0) + { + /* Let ARM3 synchronize the PDE */ + if(!MiSynchronizeSystemPde(PointerPde)) + { + /* PDE (still) not valid, let ARM3 allocate one if asked */ + if(Create == FALSE) return NULL; - } - MI_SET_USAGE(MI_USAGE_LEGACY_PAGE_DIRECTORY); - if (Process) MI_SET_PROCESS2(Process->ImageFileName); - if (!Process) MI_SET_PROCESS2("Kernel Legacy"); - Status = MmRequestPageMemoryConsumer(MC_SYSTEM, FALSE, &Pfn); - if (!NT_SUCCESS(Status) || Pfn == 0) - { - KeBugCheck(MEMORY_MANAGEMENT); - } - Entry = PFN_TO_PTE(Pfn) | PA_PRESENT | PA_READWRITE; - if(0 != InterlockedCompareExchangePte(&MmGlobalKernelPageDirectory[PdeOffset], Entry, 0)) - { - MmReleasePageMemoryConsumer(MC_SYSTEM, Pfn); - } - InterlockedExchangePte(PageDir, MmGlobalKernelPageDirectory[PdeOffset]); - return (PULONG)MiAddressToPte(Address); - } - InterlockedExchangePte(PageDir, MmGlobalKernelPageDirectory[PdeOffset]); - } - return (PULONG)MiAddressToPte(Address); + MiFillSystemPageDirectory(Address, PAGE_SIZE); + } + } + return Pt; } BOOLEAN MmUnmapPageTable(PULONG Pt) @@ -599,19 +594,18 @@ } BOOLEAN -Mmi386MakeKernelPageTableGlobal(PVOID PAddress) -{ - PULONG Pt, Pde; - Pde = (PULONG)MiAddressToPde(PAddress); - if (*Pde == 0) - { - Pt = MmGetPageTableForProcess(NULL, PAddress, FALSE); - if (Pt != NULL) - { - return TRUE; - } - } - return(FALSE); +Mmi386MakeKernelPageTableGlobal(PVOID Address) +{ + PMMPDE PointerPde = MiAddressToPde(Address); + PMMPTE PointerPte = MiAddressToPte(Address); + + if (PointerPde->u.Hard.Valid == 0) + { + if(!MiSynchronizeSystemPde(PointerPde)) + return FALSE; + return PointerPte->u.Hard.Valid; + } + return FALSE; } BOOLEAN @@ -1033,20 +1027,7 @@ NTAPI MmInitGlobalKernelPageDirectory(VOID) { - ULONG i; - PULONG CurrentPageDirectory = (PULONG)PAGEDIRECTORY_MAP; - - DPRINT("MmInitGlobalKernelPageDirectory()\n"); - - for (i = ADDR_TO_PDE_OFFSET(MmSystemRangeStart); i < 1024; i++) - { - if (i != ADDR_TO_PDE_OFFSET(PAGETABLE_MAP) && - i != ADDR_TO_PDE_OFFSET(HYPERSPACE) && - 0 == MmGlobalKernelPageDirectory[i] && 0 != CurrentPageDirectory[i]) - { - MmGlobalKernelPageDirectory[i] = CurrentPageDirectory[i]; - } - } + /* Nothing to do here */ } /* EOF */
12 years, 7 months
1
0
0
0
[spetreolle] 55630: [CSRSRV] Fix rbuild file.
by spetreolle@svn.reactos.org
Author: spetreolle Date: Thu Feb 16 09:13:20 2012 New Revision: 55630 URL:
http://svn.reactos.org/svn/reactos?rev=55630&view=rev
Log: [CSRSRV] Fix rbuild file. Modified: trunk/reactos/subsystems/win32/csrss/csrsrv/csrsrv.rbuild Modified: trunk/reactos/subsystems/win32/csrss/csrsrv/csrsrv.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/csr…
============================================================================== --- trunk/reactos/subsystems/win32/csrss/csrsrv/csrsrv.rbuild [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/csrsrv/csrsrv.rbuild [iso-8859-1] Thu Feb 16 09:13:20 2012 @@ -19,6 +19,6 @@ <file>thredsup.c</file> <file>init.c</file> <file>wait.c</file> - <file>session.c</file + <file>session.c</file> <pch>srv.h</pch> </module>
12 years, 7 months
1
0
0
0
[dgorbachev] 55629: [EXPLORER-NEW] Do not define GUID which is already defined in PSDK.
by dgorbachev@svn.reactos.org
Author: dgorbachev Date: Thu Feb 16 07:42:28 2012 New Revision: 55629 URL:
http://svn.reactos.org/svn/reactos?rev=55629&view=rev
Log: [EXPLORER-NEW] Do not define GUID which is already defined in PSDK. Modified: trunk/reactos/base/shell/explorer-new/explorer.c Modified: trunk/reactos/base/shell/explorer-new/explorer.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer-new/ex…
============================================================================== --- trunk/reactos/base/shell/explorer-new/explorer.c [iso-8859-1] (original) +++ trunk/reactos/base/shell/explorer-new/explorer.c [iso-8859-1] Thu Feb 16 07:42:28 2012 @@ -32,9 +32,6 @@ WORD wCodePage; } LANGCODEPAGE, *PLANGCODEPAGE; -/* undoc GUID */ -DEFINE_GUID(CLSID_RebarBandSite, 0xECD4FC4D, 0x521C, 0x11D0, 0xB7, 0x92, 0x00, 0xA0, 0xC9, 0x03, 0x12, 0xE1); - LONG SetWindowStyle(IN HWND hWnd, IN LONG dwStyleMask,
12 years, 7 months
1
0
0
0
[dgorbachev] 55628: [WIN32K] Use local labels in the inline asm code to avoid a clash when building with link-time code generation. [PSEH] Do not push memory operands with ESP as the base register ...
by dgorbachev@svn.reactos.org
Author: dgorbachev Date: Thu Feb 16 07:37:27 2012 New Revision: 55628 URL:
http://svn.reactos.org/svn/reactos?rev=55628&view=rev
Log: [WIN32K] Use local labels in the inline asm code to avoid a clash when building with link-time code generation. [PSEH] Do not push memory operands with ESP as the base register (can happen when compiling with some GCC options), load arguments into registers. Fix formatting. Modified: trunk/reactos/lib/pseh/i386/framebased-gcchack.c trunk/reactos/subsystems/win32/win32k/dib/dib16bpp.c trunk/reactos/subsystems/win32/win32k/dib/dib24bpp.c Modified: trunk/reactos/lib/pseh/i386/framebased-gcchack.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/pseh/i386/framebased-g…
============================================================================== --- trunk/reactos/lib/pseh/i386/framebased-gcchack.c [iso-8859-1] (original) +++ trunk/reactos/lib/pseh/i386/framebased-gcchack.c [iso-8859-1] Thu Feb 16 07:37:27 2012 @@ -94,13 +94,14 @@ { __asm__ __volatile__ ( - "push %%ebp\n" - "push $0\n" - "push $0\n" - "push $Return%=\n" - "push %[target]\n" + "push %%ebp\n\t" + "push $0\n\t" + "push $0\n\t" + "push $Return%=\n\t" + "push %[target]\n\t" "call %c[RtlUnwind]\n" - "Return%=: pop %%ebp\n" : + "Return%=:\n\t" + "pop %%ebp" : : [target] "g" (target), [RtlUnwind] "g" (&RtlUnwind) : "eax", "ebx", "ecx", "edx", "esi", "edi", "flags", "memory" @@ -131,13 +132,13 @@ __asm__ __volatile__ ( - "push %[ep]\n" - "push %[frame]\n" - "call *%[filter]\n" - "pop %%edx\n" - "pop %%edx\n" : + "push %[ep]\n\t" + "push %[frame]\n\t" + "call *%[filter]\n\t" + "pop %%edx\n\t" + "pop %%edx" : [ret] "=a" (ret) : - "c" (context), [filter] "r" (filter), [frame] "g" (frame), [ep] "g" (ep) : + "c" (context), [filter] "r" (filter), [frame] "r" (frame), [ep] "r" (ep) : "edx", "flags", "memory" ); @@ -158,7 +159,7 @@ body = _SEHFunctionFromTrampoline((_SEHTrampoline_t *)body); } - __asm__ __volatile__("call *%1\n" : : "c" (context), "r" (body) : "eax", "edx", "flags", "memory"); + __asm__ __volatile__("call *%1" : : "c" (context), "r" (body) : "eax", "edx", "flags", "memory"); } } Modified: trunk/reactos/subsystems/win32/win32k/dib/dib16bpp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/di…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/dib/dib16bpp.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/dib/dib16bpp.c [iso-8859-1] Thu Feb 16 07:37:27 2012 @@ -413,24 +413,24 @@ for (DestY = DestRect->top; DestY< DestRect->bottom; DestY++) { __asm__ __volatile__ ( - " cld\n" - " mov %1,%%ebx\n" - " mov %2,%%edi\n" - " test $0x03, %%edi\n" /* Align to fullword boundary */ - " jz .FL1\n" - " stosw\n" - " dec %%ebx\n" - " jz .FL2\n" - ".FL1:\n" - " mov %%ebx,%%ecx\n" /* Setup count of fullwords to fill */ - " shr $1,%%ecx\n" - " rep stosl\n" /* The actual fill */ - " test $0x01, %%ebx\n" /* One left to do at the right side? */ - " jz .FL2\n" - " stosw\n" - ".FL2:\n" + "cld\n\t" + "mov %1,%%ebx\n\t" + "mov %2,%%edi\n\t" + "test $0x03, %%edi\n\t" /* Align to fullword boundary */ + "jz 1f\n\t" + "stosw\n\t" + "dec %%ebx\n\t" + "jz 2f\n" + "1:\n\t" + "mov %%ebx,%%ecx\n\t" /* Setup count of fullwords to fill */ + "shr $1,%%ecx\n\t" + "rep stosl\n\t" /* The actual fill */ + "test $0x01, %%ebx\n\t" /* One left to do at the right side? */ + "jz 2f\n\t" + "stosw\n" + "2:" : - : "a" (color), "r" (width), "m" (pos) + : "a" (color), "r" (width), "m" (pos) : "%ecx", "%ebx", "%edi"); pos =(PULONG)((ULONG_PTR)pos + delta); } Modified: trunk/reactos/subsystems/win32/win32k/dib/dib24bpp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/di…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/dib/dib24bpp.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/dib/dib24bpp.c [iso-8859-1] Thu Feb 16 07:37:27 2012 @@ -344,37 +344,37 @@ * So, taking endianness into account again, we need to fill with these * ULONGs: CABC BCAB ABCA */ - /* This is about 30% faster than the generic C code below */ - __asm__ __volatile__ ( -" movl %1, %%ecx\n" -" andl $0xffffff, %%ecx\n" /* 0ABC */ -" movl %%ecx, %%ebx\n" /* Construct BCAB in ebx */ -" shrl $8, %%ebx\n" -" movl %%ecx, %%eax\n" -" shll $16, %%eax\n" -" orl %%eax, %%ebx\n" -" movl %%ecx, %%edx\n" /* Construct ABCA in edx */ -" shll $8, %%edx\n" -" movl %%ecx, %%eax\n" -" shrl $16, %%eax\n" -" orl %%eax, %%edx\n" -" movl %%ecx, %%eax\n" /* Construct CABC in eax */ -" shll $24, %%eax\n" -" orl %%ecx, %%eax\n" -" movl %2, %%ecx\n" /* Load count */ -" shr $2, %%ecx\n" -" movl %3, %%edi\n" /* Load dest */ -".FL1:\n" -" movl %%eax, (%%edi)\n" /* Store 4 pixels, 12 bytes */ -" movl %%ebx, 4(%%edi)\n" -" movl %%edx, 8(%%edi)\n" -" addl $12, %%edi\n" -" dec %%ecx\n" -" jnz .FL1\n" -" movl %%edi, %0\n" - : "=m"(addr) - : "m"(color), "m"(Count), "m"(addr) - : "%eax", "%ebx", "%ecx", "%edx", "%edi"); + /* This is about 30% faster than the generic C code below */ + __asm__ __volatile__ ( + "movl %1, %%ecx\n\t" + "andl $0xffffff, %%ecx\n\t" /* 0ABC */ + "movl %%ecx, %%ebx\n\t" /* Construct BCAB in ebx */ + "shrl $8, %%ebx\n\t" + "movl %%ecx, %%eax\n\t" + "shll $16, %%eax\n\t" + "orl %%eax, %%ebx\n\t" + "movl %%ecx, %%edx\n\t" /* Construct ABCA in edx */ + "shll $8, %%edx\n\t" + "movl %%ecx, %%eax\n\t" + "shrl $16, %%eax\n\t" + "orl %%eax, %%edx\n\t" + "movl %%ecx, %%eax\n\t" /* Construct CABC in eax */ + "shll $24, %%eax\n\t" + "orl %%ecx, %%eax\n\t" + "movl %2, %%ecx\n\t" /* Load count */ + "shr $2, %%ecx\n\t" + "movl %3, %%edi\n" /* Load dest */ + "1:\n\t" + "movl %%eax, (%%edi)\n\t" /* Store 4 pixels, 12 bytes */ + "movl %%ebx, 4(%%edi)\n\t" + "movl %%edx, 8(%%edi)\n\t" + "addl $12, %%edi\n\t" + "dec %%ecx\n\t" + "jnz 1b\n\t" + "movl %%edi, %0" + : "=m"(addr) + : "m"(color), "m"(Count), "m"(addr) + : "%eax", "%ebx", "%ecx", "%edx", "%edi"); Count = Count & 0x03; while (0 != Count--) {
12 years, 7 months
1
0
0
0
← Newer
1
...
28
29
30
31
32
33
34
...
58
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
Results per page:
10
25
50
100
200