mirror of
https://github.com/reactos/reactos.git
synced 2025-04-06 05:34:22 +00:00
Added calibration of KeStallExecutionProcessor delay
Corrected compilation bugs in user32 Corrected compilation bugs related to anonymous structs in ndis code Pass commandline from loadros Corrected PIC mask calculation svn path=/trunk/; revision=1326
This commit is contained in:
parent
3b94410c8a
commit
8e0014c64b
28 changed files with 481 additions and 568 deletions
|
@ -1,16 +1,45 @@
|
|||
27/5/00: Fixed issue with closing non-existent or already closed handle
|
||||
2000-08-30 David Welch <welch@cwcom.net>
|
||||
|
||||
26/1/99: ZwCreateProcess now maps ntdll rather than the user-mode code
|
||||
* Added calibration of KeStallExecutionProcessor timing
|
||||
(code from linux 2.2.16).
|
||||
|
||||
* Corrected compilation bugs in user32 library.
|
||||
|
||||
9/6/99: Implemented ZwOpenProcess
|
||||
Partially implemented killing other threads (possible memory
|
||||
leaks)
|
||||
Made a start on a proper implemention of APCs (based on
|
||||
article in NT insider)
|
||||
* Corrected compilation bugs related to anonymous structs
|
||||
in ndis code.
|
||||
|
||||
* Pass command line to kernel from loadros.
|
||||
|
||||
* Corrected PIC mask calculation.
|
||||
|
||||
2000-05-27 David Welch <welch@cwcom.net>
|
||||
|
||||
8/12/98: Corrected bug in shell (Read two keypresses and assumed they
|
||||
where the key going up and down respectively)
|
||||
Corrected race in dpc handling
|
||||
Took out cleanup sections in ZwReadFile (now handled by the APC)
|
||||
Disabled broken code in kernel32
|
||||
* Fixed issue with closing non-existent or already closed
|
||||
handle.
|
||||
|
||||
2000-01-26 David Welch <welch@cwcom.net>
|
||||
|
||||
* ZwCreateProcess now maps ntdll rather than the user-mode
|
||||
code.
|
||||
|
||||
1999-09-06 David Welch <welch@cwcom.net>
|
||||
|
||||
* Implemented ZwOpenProcess.
|
||||
|
||||
* Partially implemented killing other threads (possible memory
|
||||
leaks).
|
||||
|
||||
* Made a start on a proper implemention of APCs (based on
|
||||
article in NT insider).
|
||||
|
||||
1998-12-08 David Welch <welch@cwcom.net>
|
||||
|
||||
* Corrected bug in shell (Read two keypresses and assumed they
|
||||
where the key going up and down respectively).
|
||||
|
||||
* Corrected race in dpc handling.
|
||||
|
||||
* Took out cleanup sections in ZwReadFile (now handled by the
|
||||
APC).
|
||||
|
||||
* Disabled broken code in kernel32.
|
||||
|
|
|
@ -47,7 +47,8 @@ NET_DEVICE_DRIVERS = ne2000
|
|||
KERNEL_SERVICES = $(DEVICE_DRIVERS) $(FS_DRIVERS) $(NET_DRIVERS) $(NET_DEVICE_DRIVERS)
|
||||
|
||||
APPS = args hello shell test cat bench apc shm lpc thread event file gditest \
|
||||
pteb consume dump_shared_data vmtest wstest
|
||||
pteb consume dump_shared_data vmtest
|
||||
# wstest
|
||||
# objdir
|
||||
|
||||
all: buildno $(COMPONENTS) $(DLLS) $(SUBSYS) $(LOADERS) $(KERNEL_SERVICES) $(APPS)
|
||||
|
|
|
@ -32,7 +32,7 @@ typedef struct _MINIPORT_DRIVER {
|
|||
|
||||
/* Information about a logical adapter */
|
||||
typedef struct _LOGICAL_ADAPTER {
|
||||
NDIS_MINIPORT_BLOCK; /* NDIS defined fields */
|
||||
NDIS_MINIPORT_BLOCK NdisMiniportBlock; /* NDIS defined fields */
|
||||
|
||||
KDPC MiniportDpc; /* DPC routine for adapter */
|
||||
BOOLEAN MiniportBusy; /* A MiniportXxx routine is executing */
|
||||
|
|
|
@ -25,7 +25,7 @@ typedef struct _PROTOCOL_BINDING {
|
|||
|
||||
|
||||
typedef struct _ADAPTER_BINDING {
|
||||
NDIS_OPEN_BLOCK; /* NDIS defined fields */
|
||||
NDIS_OPEN_BLOCK NdisOpenBlock; /* NDIS defined fields */
|
||||
|
||||
LIST_ENTRY ListEntry; /* Entry on global list */
|
||||
LIST_ENTRY ProtocolListEntry; /* Entry on protocol binding adapter list */
|
||||
|
|
|
@ -30,26 +30,26 @@ VOID HandleDeferredProcessing(
|
|||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
|
||||
|
||||
KeAcquireSpinLockAtDpcLevel(&Adapter->Lock);
|
||||
KeAcquireSpinLockAtDpcLevel(&Adapter->NdisMiniportBlock.Lock);
|
||||
WasBusy = Adapter->MiniportBusy;
|
||||
Adapter->MiniportBusy = TRUE;
|
||||
KeReleaseSpinLockFromDpcLevel(&Adapter->Lock);
|
||||
KeReleaseSpinLockFromDpcLevel(&Adapter->NdisMiniportBlock.Lock);
|
||||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Before HandleInterruptHandler.\n"));
|
||||
|
||||
/* Call the deferred interrupt service handler for this adapter */
|
||||
(*Adapter->Miniport->Chars.HandleInterruptHandler)(
|
||||
Adapter->MiniportAdapterContext);
|
||||
Adapter->NdisMiniportBlock.MiniportAdapterContext);
|
||||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("After HandleInterruptHandler.\n"));
|
||||
|
||||
KeAcquireSpinLockAtDpcLevel(&Adapter->Lock);
|
||||
KeAcquireSpinLockAtDpcLevel(&Adapter->NdisMiniportBlock.Lock);
|
||||
if ((!WasBusy) && (Adapter->WorkQueueHead)) {
|
||||
KeInsertQueueDpc(&Adapter->MiniportDpc, NULL, NULL);
|
||||
} else {
|
||||
Adapter->MiniportBusy = WasBusy;
|
||||
}
|
||||
KeReleaseSpinLockFromDpcLevel(&Adapter->Lock);
|
||||
KeReleaseSpinLockFromDpcLevel(&Adapter->NdisMiniportBlock.Lock);
|
||||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Leaving.\n"));
|
||||
}
|
||||
|
@ -75,11 +75,11 @@ BOOLEAN ServiceRoutine(
|
|||
|
||||
(*Adapter->Miniport->Chars.ISRHandler)(&InterruptRecognized,
|
||||
&QueueMiniportHandleInterrupt,
|
||||
Adapter->MiniportAdapterContext);
|
||||
Adapter->NdisMiniportBlock.MiniportAdapterContext);
|
||||
|
||||
if (QueueMiniportHandleInterrupt) {
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Queueing DPC.\n"));
|
||||
KeInsertQueueDpc(&Adapter->Interrupt->InterruptDpc, NULL, NULL);
|
||||
KeInsertQueueDpc(&Adapter->NdisMiniportBlock.Interrupt->InterruptDpc, NULL, NULL);
|
||||
}
|
||||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Leaving.\n"));
|
||||
|
@ -361,7 +361,7 @@ NdisMRegisterInterrupt(
|
|||
|
||||
Interrupt->SharedInterrupt = SharedInterrupt;
|
||||
|
||||
Adapter->Interrupt = Interrupt;
|
||||
Adapter->NdisMiniportBlock.Interrupt = Interrupt;
|
||||
|
||||
MappedIRQ = HalGetInterruptVector(Internal, /* Adapter->AdapterType, */
|
||||
0,
|
||||
|
|
|
@ -128,17 +128,17 @@ MiniIndicateData(
|
|||
}
|
||||
#endif /* DBG */
|
||||
|
||||
KeAcquireSpinLock(&Adapter->Lock, &OldIrql);
|
||||
KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &OldIrql);
|
||||
CurrentEntry = Adapter->ProtocolListHead.Flink;
|
||||
while (CurrentEntry != &Adapter->ProtocolListHead) {
|
||||
AdapterBinding = CONTAINING_RECORD(CurrentEntry,
|
||||
ADAPTER_BINDING,
|
||||
AdapterListEntry);
|
||||
|
||||
KeReleaseSpinLock(&Adapter->Lock, OldIrql);
|
||||
KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql);
|
||||
|
||||
(*AdapterBinding->ProtocolBinding->Chars.u4.ReceiveHandler)(
|
||||
AdapterBinding->ProtocolBindingContext,
|
||||
AdapterBinding->NdisOpenBlock.ProtocolBindingContext,
|
||||
MacReceiveContext,
|
||||
HeaderBuffer,
|
||||
HeaderBufferSize,
|
||||
|
@ -146,11 +146,11 @@ MiniIndicateData(
|
|||
LookaheadBufferSize,
|
||||
PacketSize);
|
||||
|
||||
KeAcquireSpinLock(&Adapter->Lock, &OldIrql);
|
||||
KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &OldIrql);
|
||||
|
||||
CurrentEntry = CurrentEntry->Flink;
|
||||
}
|
||||
KeReleaseSpinLock(&Adapter->Lock, OldIrql);
|
||||
KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql);
|
||||
}
|
||||
|
||||
|
||||
|
@ -172,23 +172,23 @@ MiniEthReceiveComplete(
|
|||
|
||||
Adapter = (PLOGICAL_ADAPTER)Filter->Miniport;
|
||||
|
||||
KeAcquireSpinLock(&Adapter->Lock, &OldIrql);
|
||||
KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &OldIrql);
|
||||
CurrentEntry = Adapter->ProtocolListHead.Flink;
|
||||
while (CurrentEntry != &Adapter->ProtocolListHead) {
|
||||
AdapterBinding = CONTAINING_RECORD(CurrentEntry,
|
||||
ADAPTER_BINDING,
|
||||
AdapterListEntry);
|
||||
|
||||
KeReleaseSpinLock(&Adapter->Lock, OldIrql);
|
||||
KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql);
|
||||
|
||||
(*AdapterBinding->ProtocolBinding->Chars.ReceiveCompleteHandler)(
|
||||
AdapterBinding->ProtocolBindingContext);
|
||||
AdapterBinding->NdisOpenBlock.ProtocolBindingContext);
|
||||
|
||||
KeAcquireSpinLock(&Adapter->Lock, &OldIrql);
|
||||
KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &OldIrql);
|
||||
|
||||
CurrentEntry = CurrentEntry->Flink;
|
||||
}
|
||||
KeReleaseSpinLock(&Adapter->Lock, OldIrql);
|
||||
KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql);
|
||||
}
|
||||
|
||||
|
||||
|
@ -256,7 +256,7 @@ MiniSendComplete(
|
|||
AdapterBinding = (PADAPTER_BINDING)Packet->Reserved[0];
|
||||
|
||||
(*AdapterBinding->ProtocolBinding->Chars.u2.SendCompleteHandler)(
|
||||
AdapterBinding->ProtocolBindingContext,
|
||||
AdapterBinding->NdisOpenBlock.ProtocolBindingContext,
|
||||
Packet,
|
||||
Status);
|
||||
}
|
||||
|
@ -283,7 +283,7 @@ MiniTransferDataComplete(
|
|||
NDIS_DbgPrint(DEBUG_MINIPORT, ("Called.\n"));
|
||||
|
||||
(*AdapterBinding->ProtocolBinding->Chars.u3.TransferDataCompleteHandler)(
|
||||
AdapterBinding->ProtocolBindingContext,
|
||||
AdapterBinding->NdisOpenBlock.ProtocolBindingContext,
|
||||
Packet,
|
||||
Status,
|
||||
BytesTransferred);
|
||||
|
@ -320,14 +320,14 @@ MiniAdapterHasAddress(
|
|||
|
||||
/* FIXME: Should handle fragmented packets */
|
||||
|
||||
switch (Adapter->MediaType) {
|
||||
switch (Adapter->NdisMiniportBlock.MediaType) {
|
||||
case NdisMedium802_3:
|
||||
Length = ETH_LENGTH_OF_ADDRESS;
|
||||
/* Destination address is the first field */
|
||||
break;
|
||||
|
||||
default:
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Adapter has unsupported media type (0x%X).\n", Adapter->MediaType));
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Adapter has unsupported media type (0x%X).\n", Adapter->NdisMiniportBlock.MediaType));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -420,7 +420,7 @@ MiniQueryInformation(
|
|||
BytesNeeded = (Size == 0)? Adapter->QueryBufferLength : Size;
|
||||
|
||||
NdisStatus = (*Adapter->Miniport->Chars.QueryInformationHandler)(
|
||||
Adapter->MiniportAdapterContext,
|
||||
Adapter->NdisMiniportBlock.MiniportAdapterContext,
|
||||
Oid,
|
||||
Adapter->QueryBuffer,
|
||||
BytesNeeded,
|
||||
|
@ -445,7 +445,7 @@ MiniQueryInformation(
|
|||
}
|
||||
|
||||
NdisStatus = (*Adapter->Miniport->Chars.QueryInformationHandler)(
|
||||
Adapter->MiniportAdapterContext,
|
||||
Adapter->NdisMiniportBlock.MiniportAdapterContext,
|
||||
Oid,
|
||||
Adapter->QueryBuffer,
|
||||
Size,
|
||||
|
@ -578,12 +578,12 @@ MiniDoRequest(
|
|||
* Status of operation
|
||||
*/
|
||||
{
|
||||
Adapter->MediaRequest = NdisRequest;
|
||||
Adapter->NdisMiniportBlock.MediaRequest = NdisRequest;
|
||||
|
||||
switch (NdisRequest->RequestType) {
|
||||
case NdisRequestQueryInformation:
|
||||
return (*Adapter->Miniport->Chars.QueryInformationHandler)(
|
||||
Adapter->MiniportAdapterContext,
|
||||
Adapter->NdisMiniportBlock.MiniportAdapterContext,
|
||||
NdisRequest->DATA.QUERY_INFORMATION.Oid,
|
||||
NdisRequest->DATA.QUERY_INFORMATION.InformationBuffer,
|
||||
NdisRequest->DATA.QUERY_INFORMATION.InformationBufferLength,
|
||||
|
@ -593,7 +593,7 @@ MiniDoRequest(
|
|||
|
||||
case NdisRequestSetInformation:
|
||||
return (*Adapter->Miniport->Chars.SetInformationHandler)(
|
||||
Adapter->MiniportAdapterContext,
|
||||
Adapter->NdisMiniportBlock.MiniportAdapterContext,
|
||||
NdisRequest->DATA.SET_INFORMATION.Oid,
|
||||
NdisRequest->DATA.SET_INFORMATION.InformationBuffer,
|
||||
NdisRequest->DATA.SET_INFORMATION.InformationBufferLength,
|
||||
|
@ -641,7 +641,7 @@ VOID MiniportDpc(
|
|||
MiniDisplayPacket((PNDIS_PACKET)WorkItemContext);
|
||||
#endif
|
||||
NdisStatus = (*Adapter->Miniport->Chars.u1.SendHandler)(
|
||||
Adapter->MiniportAdapterContext,
|
||||
Adapter->NdisMiniportBlock.MiniportAdapterContext,
|
||||
(PNDIS_PACKET)WorkItemContext,
|
||||
0);
|
||||
if (NdisStatus != NDIS_STATUS_PENDING) {
|
||||
|
@ -822,8 +822,8 @@ NdisMQueryInformationComplete(
|
|||
NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
|
||||
|
||||
(*AdapterBinding->ProtocolBinding->Chars.RequestCompleteHandler)(
|
||||
AdapterBinding->ProtocolBindingContext,
|
||||
Adapter->MediaRequest,
|
||||
AdapterBinding->NdisOpenBlock.ProtocolBindingContext,
|
||||
Adapter->NdisMiniportBlock.MediaRequest,
|
||||
Status);
|
||||
}
|
||||
|
||||
|
@ -867,9 +867,9 @@ DoQueries(
|
|||
return NdisStatus;
|
||||
}
|
||||
|
||||
RtlCopyMemory(&Adapter->MacOptions, Adapter->QueryBuffer, sizeof(UINT));
|
||||
RtlCopyMemory(&Adapter->NdisMiniportBlock.MacOptions, Adapter->QueryBuffer, sizeof(UINT));
|
||||
|
||||
NDIS_DbgPrint(DEBUG_MINIPORT, ("MacOptions (0x%X).\n", Adapter->MacOptions));
|
||||
NDIS_DbgPrint(DEBUG_MINIPORT, ("MacOptions (0x%X).\n", Adapter->NdisMiniportBlock.MacOptions));
|
||||
|
||||
/* Get current hardware address of adapter */
|
||||
NdisStatus = MiniQueryInformation(Adapter,
|
||||
|
@ -1031,7 +1031,7 @@ NdisMRegisterMiniport(
|
|||
FILE_DEVICE_PHYSICAL_NETCARD,
|
||||
0,
|
||||
FALSE,
|
||||
&Adapter->DeviceObject);
|
||||
&Adapter->NdisMiniportBlock.DeviceObject);
|
||||
if (!NT_SUCCESS(Status)) {
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Could not create device object.\n"));
|
||||
ExFreePool(Adapter);
|
||||
|
@ -1040,7 +1040,7 @@ NdisMRegisterMiniport(
|
|||
|
||||
/* Initialize adapter object */
|
||||
|
||||
KeInitializeSpinLock(&Adapter->Lock);
|
||||
KeInitializeSpinLock(&Adapter->NdisMiniportBlock.Lock);
|
||||
|
||||
InitializeListHead(&Adapter->ProtocolListHead);
|
||||
|
||||
|
@ -1050,13 +1050,13 @@ NdisMRegisterMiniport(
|
|||
|
||||
/* Set handlers (some NDIS macros require these) */
|
||||
|
||||
Adapter->EthRxCompleteHandler = MiniEthReceiveComplete;
|
||||
Adapter->EthRxIndicateHandler = MiniEthReceiveIndication;
|
||||
Adapter->NdisMiniportBlock.EthRxCompleteHandler = MiniEthReceiveComplete;
|
||||
Adapter->NdisMiniportBlock.EthRxIndicateHandler = MiniEthReceiveIndication;
|
||||
|
||||
Adapter->SendCompleteHandler = MiniSendComplete;
|
||||
Adapter->SendResourcesHandler = MiniSendResourcesAvailable;
|
||||
Adapter->ResetCompleteHandler = MiniResetComplete;
|
||||
Adapter->TDCompleteHandler = MiniTransferDataComplete;
|
||||
Adapter->NdisMiniportBlock.SendCompleteHandler = MiniSendComplete;
|
||||
Adapter->NdisMiniportBlock.SendResourcesHandler = MiniSendResourcesAvailable;
|
||||
Adapter->NdisMiniportBlock.ResetCompleteHandler = MiniResetComplete;
|
||||
Adapter->NdisMiniportBlock.TDCompleteHandler = MiniTransferDataComplete;
|
||||
|
||||
|
||||
KeInitializeDpc(&Adapter->MiniportDpc, MiniportDpc, (PVOID)Adapter);
|
||||
|
@ -1083,19 +1083,19 @@ NdisMRegisterMiniport(
|
|||
if ((NdisStatus == NDIS_STATUS_SUCCESS) &&
|
||||
(SelectedMediumIndex < MEDIA_ARRAY_SIZE)) {
|
||||
|
||||
Adapter->MediaType = MediaArray[SelectedMediumIndex];
|
||||
Adapter->NdisMiniportBlock.MediaType = MediaArray[SelectedMediumIndex];
|
||||
|
||||
switch (Adapter->MediaType) {
|
||||
switch (Adapter->NdisMiniportBlock.MediaType) {
|
||||
case NdisMedium802_3:
|
||||
Adapter->MediumHeaderSize = 14;
|
||||
AddressOID = OID_802_3_CURRENT_ADDRESS;
|
||||
Adapter->AddressLength = ETH_LENGTH_OF_ADDRESS;
|
||||
|
||||
Adapter->FilterDbs.u.EthDB = ExAllocatePool(NonPagedPool,
|
||||
Adapter->NdisMiniportBlock.FilterDbs.u.EthDB = ExAllocatePool(NonPagedPool,
|
||||
sizeof(ETH_FILTER));
|
||||
if (Adapter->FilterDbs.u.EthDB) {
|
||||
RtlZeroMemory(Adapter->FilterDbs.u.EthDB, sizeof(ETH_FILTER));
|
||||
Adapter->FilterDbs.u.EthDB->Miniport = (PNDIS_MINIPORT_BLOCK)Adapter;
|
||||
if (Adapter->NdisMiniportBlock.FilterDbs.u.EthDB) {
|
||||
RtlZeroMemory(Adapter->NdisMiniportBlock.FilterDbs.u.EthDB, sizeof(ETH_FILTER));
|
||||
Adapter->NdisMiniportBlock.FilterDbs.u.EthDB->Miniport = (PNDIS_MINIPORT_BLOCK)Adapter;
|
||||
} else
|
||||
MemError = TRUE;
|
||||
break;
|
||||
|
@ -1126,7 +1126,7 @@ NdisMRegisterMiniport(
|
|||
if (Adapter->LookaheadBuffer)
|
||||
ExFreePool(Adapter->LookaheadBuffer);
|
||||
|
||||
IoDeleteDevice(Adapter->DeviceObject);
|
||||
IoDeleteDevice(Adapter->NdisMiniportBlock.DeviceObject);
|
||||
ExFreePool(Adapter);
|
||||
return NDIS_STATUS_FAILURE;
|
||||
}
|
||||
|
@ -1205,8 +1205,8 @@ NdisMSetInformationComplete(
|
|||
NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
|
||||
|
||||
(*AdapterBinding->ProtocolBinding->Chars.RequestCompleteHandler)(
|
||||
AdapterBinding->ProtocolBindingContext,
|
||||
Adapter->MediaRequest,
|
||||
AdapterBinding->NdisOpenBlock.ProtocolBindingContext,
|
||||
Adapter->NdisMiniportBlock.MediaRequest,
|
||||
Status);
|
||||
}
|
||||
|
||||
|
@ -1231,9 +1231,9 @@ NdisMSetAttributes(
|
|||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
|
||||
|
||||
Adapter->MiniportAdapterContext = MiniportAdapterContext;
|
||||
Adapter->NdisMiniportBlock.MiniportAdapterContext = MiniportAdapterContext;
|
||||
Adapter->Attributes = BusMaster? NDIS_ATTRIBUTE_BUS_MASTER : 0;
|
||||
Adapter->AdapterType = AdapterType;
|
||||
Adapter->NdisMiniportBlock.AdapterType = AdapterType;
|
||||
Adapter->AttributesSet = TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ ProIndicatePacket(
|
|||
|
||||
NdisQueryPacket(Packet, NULL, NULL, NULL, &Total);
|
||||
|
||||
KeAcquireSpinLock(&Adapter->Lock, &OldIrql);
|
||||
KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &OldIrql);
|
||||
|
||||
Adapter->LoopPacket = Packet;
|
||||
|
||||
|
@ -52,7 +52,7 @@ ProIndicatePacket(
|
|||
0,
|
||||
Adapter->CurLookaheadLength);
|
||||
|
||||
KeReleaseSpinLock(&Adapter->Lock, OldIrql);
|
||||
KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql);
|
||||
|
||||
if (Length > Adapter->MediumHeaderSize) {
|
||||
MiniIndicateData(Adapter,
|
||||
|
@ -72,11 +72,11 @@ ProIndicatePacket(
|
|||
0);
|
||||
}
|
||||
|
||||
KeAcquireSpinLock(&Adapter->Lock, &OldIrql);
|
||||
KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &OldIrql);
|
||||
|
||||
Adapter->LoopPacket = NULL;
|
||||
|
||||
KeReleaseSpinLock(&Adapter->Lock, OldIrql);
|
||||
KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ ProRequest(
|
|||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
|
||||
|
||||
KeAcquireSpinLock(&Adapter->Lock, &OldIrql);
|
||||
KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &OldIrql);
|
||||
Queue = Adapter->MiniportBusy;
|
||||
if (Queue) {
|
||||
MiniQueueWorkItem(Adapter,
|
||||
|
@ -113,16 +113,16 @@ ProRequest(
|
|||
} else {
|
||||
Adapter->MiniportBusy = TRUE;
|
||||
}
|
||||
KeReleaseSpinLock(&Adapter->Lock, OldIrql);
|
||||
KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql);
|
||||
|
||||
if (!Queue) {
|
||||
KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
|
||||
NdisStatus = MiniDoRequest(Adapter, NdisRequest);
|
||||
KeAcquireSpinLockAtDpcLevel(&Adapter->Lock);
|
||||
KeAcquireSpinLockAtDpcLevel(&Adapter->NdisMiniportBlock.Lock);
|
||||
Adapter->MiniportBusy = FALSE;
|
||||
if (Adapter->WorkQueueHead)
|
||||
KeInsertQueueDpc(&Adapter->MiniportDpc, NULL, NULL);
|
||||
KeReleaseSpinLockFromDpcLevel(&Adapter->Lock);
|
||||
KeReleaseSpinLockFromDpcLevel(&Adapter->NdisMiniportBlock.Lock);
|
||||
KeLowerIrql(OldIrql);
|
||||
} else {
|
||||
NdisStatus = NDIS_STATUS_PENDING;
|
||||
|
@ -164,11 +164,11 @@ ProSend(
|
|||
|
||||
Packet->Reserved[0] = (ULONG_PTR)MacBindingHandle;
|
||||
|
||||
KeAcquireSpinLock(&Adapter->Lock, &OldIrql);
|
||||
KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &OldIrql);
|
||||
Queue = Adapter->MiniportBusy;
|
||||
|
||||
/* We may have to loop this packet if miniport cannot */
|
||||
if (Adapter->MacOptions & NDIS_MAC_OPTION_NO_LOOPBACK) {
|
||||
if (Adapter->NdisMiniportBlock.MacOptions & NDIS_MAC_OPTION_NO_LOOPBACK) {
|
||||
if (MiniAdapterHasAddress(Adapter, Packet)) {
|
||||
/* Do software loopback because miniport does not support it */
|
||||
|
||||
|
@ -185,16 +185,16 @@ ProSend(
|
|||
} else {
|
||||
Adapter->MiniportBusy = TRUE;
|
||||
}
|
||||
KeReleaseSpinLock(&Adapter->Lock, OldIrql);
|
||||
KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql);
|
||||
|
||||
if (!Queue) {
|
||||
KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
|
||||
NdisStatus = ProIndicatePacket(Adapter, Packet);
|
||||
KeAcquireSpinLockAtDpcLevel(&Adapter->Lock);
|
||||
KeAcquireSpinLockAtDpcLevel(&Adapter->NdisMiniportBlock.Lock);
|
||||
Adapter->MiniportBusy = FALSE;
|
||||
if (Adapter->WorkQueueHead)
|
||||
KeInsertQueueDpc(&Adapter->MiniportDpc, NULL, NULL);
|
||||
KeReleaseSpinLockFromDpcLevel(&Adapter->Lock);
|
||||
KeReleaseSpinLockFromDpcLevel(&Adapter->NdisMiniportBlock.Lock);
|
||||
KeLowerIrql(OldIrql);
|
||||
return NdisStatus;
|
||||
} else {
|
||||
|
@ -214,19 +214,19 @@ ProSend(
|
|||
} else {
|
||||
Adapter->MiniportBusy = TRUE;
|
||||
}
|
||||
KeReleaseSpinLock(&Adapter->Lock, OldIrql);
|
||||
KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql);
|
||||
|
||||
if (!Queue) {
|
||||
KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
|
||||
NdisStatus = (*Adapter->Miniport->Chars.u1.SendHandler)(
|
||||
Adapter->MiniportAdapterContext,
|
||||
Adapter->NdisMiniportBlock.MiniportAdapterContext,
|
||||
Packet,
|
||||
0);
|
||||
KeAcquireSpinLockAtDpcLevel(&Adapter->Lock);
|
||||
KeAcquireSpinLockAtDpcLevel(&Adapter->NdisMiniportBlock.Lock);
|
||||
Adapter->MiniportBusy = FALSE;
|
||||
if (Adapter->WorkQueueHead)
|
||||
KeInsertQueueDpc(&Adapter->MiniportDpc, NULL, NULL);
|
||||
KeReleaseSpinLockFromDpcLevel(&Adapter->Lock);
|
||||
KeReleaseSpinLockFromDpcLevel(&Adapter->NdisMiniportBlock.Lock);
|
||||
KeLowerIrql(OldIrql);
|
||||
} else {
|
||||
NdisStatus = NDIS_STATUS_PENDING;
|
||||
|
@ -285,7 +285,7 @@ ProTransferData(
|
|||
return (*Adapter->Miniport->Chars.u2.TransferDataHandler)(
|
||||
Packet,
|
||||
BytesTransferred,
|
||||
Adapter->MiniportAdapterContext,
|
||||
Adapter->NdisMiniportBlock.MiniportAdapterContext,
|
||||
MacReceiveContext,
|
||||
ByteOffset,
|
||||
BytesToTransfer);
|
||||
|
@ -316,9 +316,9 @@ NdisCloseAdapter(
|
|||
KeReleaseSpinLock(&AdapterBinding->ProtocolBinding->Lock, OldIrql);
|
||||
|
||||
/* Remove protocol from adapter's bound protocols list */
|
||||
KeAcquireSpinLock(&AdapterBinding->Adapter->Lock, &OldIrql);
|
||||
KeAcquireSpinLock(&AdapterBinding->Adapter->NdisMiniportBlock.Lock, &OldIrql);
|
||||
RemoveEntryList(&AdapterBinding->AdapterListEntry);
|
||||
KeReleaseSpinLock(&AdapterBinding->Adapter->Lock, OldIrql);
|
||||
KeReleaseSpinLock(&AdapterBinding->Adapter->NdisMiniportBlock.Lock, OldIrql);
|
||||
|
||||
ExFreePool(AdapterBinding);
|
||||
|
||||
|
@ -404,7 +404,7 @@ NdisOpenAdapter(
|
|||
/* Find the media type in the list provided by the protocol driver */
|
||||
Found = FALSE;
|
||||
for (i = 0; i < MediumArraySize; i++) {
|
||||
if (Adapter->MediaType == MediumArray[i]) {
|
||||
if (Adapter->NdisMiniportBlock.MediaType == MediumArray[i]) {
|
||||
*SelectedMediumIndex = i;
|
||||
Found = TRUE;
|
||||
break;
|
||||
|
@ -428,18 +428,18 @@ NdisOpenAdapter(
|
|||
|
||||
AdapterBinding->ProtocolBinding = Protocol;
|
||||
AdapterBinding->Adapter = Adapter;
|
||||
AdapterBinding->ProtocolBindingContext = ProtocolBindingContext;
|
||||
AdapterBinding->NdisOpenBlock.ProtocolBindingContext = ProtocolBindingContext;
|
||||
|
||||
/* Set fields required by some NDIS macros */
|
||||
AdapterBinding->MacBindingHandle = (NDIS_HANDLE)AdapterBinding;
|
||||
AdapterBinding->NdisOpenBlock.MacBindingHandle = (NDIS_HANDLE)AdapterBinding;
|
||||
|
||||
/* Set handlers (some NDIS macros require these) */
|
||||
|
||||
AdapterBinding->RequestHandler = ProRequest;
|
||||
AdapterBinding->ResetHandler = ProReset;
|
||||
AdapterBinding->u1.SendHandler = ProSend;
|
||||
AdapterBinding->SendPacketsHandler = ProSendPackets;
|
||||
AdapterBinding->TransferDataHandler = ProTransferData;
|
||||
AdapterBinding->NdisOpenBlock.RequestHandler = ProRequest;
|
||||
AdapterBinding->NdisOpenBlock.ResetHandler = ProReset;
|
||||
AdapterBinding->NdisOpenBlock.u1.SendHandler = ProSend;
|
||||
AdapterBinding->NdisOpenBlock.SendPacketsHandler = ProSendPackets;
|
||||
AdapterBinding->NdisOpenBlock.TransferDataHandler = ProTransferData;
|
||||
|
||||
/* Put on protocol's bound adapters list */
|
||||
ExInterlockedInsertTailList(&Protocol->AdapterListHead,
|
||||
|
@ -449,7 +449,7 @@ NdisOpenAdapter(
|
|||
/* Put protocol on adapter's bound protocols list */
|
||||
ExInterlockedInsertTailList(&Adapter->ProtocolListHead,
|
||||
&AdapterBinding->AdapterListEntry,
|
||||
&Adapter->Lock);
|
||||
&Adapter->NdisMiniportBlock.Lock);
|
||||
|
||||
*NdisBindingHandle = (NDIS_HANDLE)AdapterBinding;
|
||||
|
||||
|
|
|
@ -9,6 +9,6 @@ cp ntoskrnl/ntoskrnl.exe $1
|
|||
cp services/fs/vfat/vfatfs.sys $1
|
||||
cp services/dd/ide/ide.sys $1
|
||||
#cp services/dd/floppy/floppy.sys $1
|
||||
cp ntoskrnl/ntoskrnl.exe $1/reactos/system32/
|
||||
cp services/fs/vfat/vfatfs.sys $1/reactos/system32/drivers/
|
||||
cp services/dd/ide/ide.sys $1/reactos/system32/drivers/
|
||||
#cp ntoskrnl/ntoskrnl.exe $1/reactos/system32/
|
||||
#cp services/fs/vfat/vfatfs.sys $1/reactos/system32/drivers/
|
||||
#cp services/dd/ide/ide.sys $1/reactos/system32/drivers/
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
* please read EDIT.TODO (and update it when you change things)
|
||||
*/
|
||||
|
||||
#include <ntos/minmax.h>
|
||||
|
||||
#include <windows.h>
|
||||
#include <user32/win.h>
|
||||
#include <user32/class.h>
|
||||
|
@ -820,7 +822,7 @@ static void EDIT_BuildLineDefs_ML(WND *wnd, EDITSTATE *es)
|
|||
current_def->length = current_def->net_length;
|
||||
break;
|
||||
}
|
||||
es->text_width = MAX(es->text_width, current_def->width);
|
||||
es->text_width = max(es->text_width, current_def->width);
|
||||
start += current_def->length;
|
||||
*previous_next = current_def;
|
||||
previous_next = ¤t_def->next;
|
||||
|
@ -973,8 +975,8 @@ static INT EDIT_CharFromPos(WND *wnd, EDITSTATE *es, INT x, INT y, LPBOOL after_
|
|||
*/
|
||||
static void EDIT_ConfinePoint(WND *wnd, EDITSTATE *es, LPINT x, LPINT y)
|
||||
{
|
||||
*x = MIN(MAX(*x, es->format_rect.left), es->format_rect.right - 1);
|
||||
*y = MIN(MAX(*y, es->format_rect.top), es->format_rect.bottom - 1);
|
||||
*x = min(max(*x, es->format_rect.left), es->format_rect.right - 1);
|
||||
*y = min(max(*y, es->format_rect.top), es->format_rect.bottom - 1);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1183,14 +1185,14 @@ static BOOL EDIT_MakeFit(WND *wnd, EDITSTATE *es, INT size)
|
|||
EDIT_UnlockBuffer(wnd, es, TRUE);
|
||||
if (es->text) {
|
||||
if ((es->text = HeapReAlloc(es->heap, 0, es->text, size + 1)))
|
||||
es->buffer_size = MIN(HeapSize(es->heap, 0, es->text) - 1, es->buffer_limit);
|
||||
es->buffer_size = min(HeapSize(es->heap, 0, es->text) - 1, es->buffer_limit);
|
||||
else
|
||||
es->buffer_size = 0;
|
||||
} else if (es->hloc) {
|
||||
if ((hNew = LocalReAlloc(es->hloc, size + 1, 0))) {
|
||||
DPRINT( "Old bit handle %08x, new handle %08x\n", es->hloc, hNew);
|
||||
es->hloc = hNew;
|
||||
es->buffer_size = MIN(LocalSize(es->hloc) - 1, es->buffer_limit);
|
||||
es->buffer_size = min(LocalSize(es->hloc) - 1, es->buffer_limit);
|
||||
}
|
||||
}
|
||||
if (es->buffer_size < size) {
|
||||
|
@ -1522,8 +1524,8 @@ static void EDIT_PaintLine(WND *wnd, EDITSTATE *es, HDC dc, INT line, BOOL rev)
|
|||
s = es->selection_start;
|
||||
e = es->selection_end;
|
||||
ORDER_INT(s, e);
|
||||
s = MIN(li + ll, MAX(li, s));
|
||||
e = MIN(li + ll, MAX(li, e));
|
||||
s = min(li + ll, max(li, s));
|
||||
e = min(li + ll, max(li, e));
|
||||
if (rev && (s != e) &&
|
||||
((es->flags & EF_FOCUSED) || (es->style & ES_NOHIDESEL))) {
|
||||
x += EDIT_PaintText(wnd, es, dc, x, y, line, 0, s - li, FALSE);
|
||||
|
@ -1622,10 +1624,10 @@ static void EDIT_SetRectNP(WND *wnd, EDITSTATE *es, LPRECT rc)
|
|||
}
|
||||
es->format_rect.left += es->left_margin;
|
||||
es->format_rect.right -= es->right_margin;
|
||||
es->format_rect.right = MAX(es->format_rect.right, es->format_rect.left + es->char_width);
|
||||
es->format_rect.right = max(es->format_rect.right, es->format_rect.left + es->char_width);
|
||||
if (es->style & ES_MULTILINE)
|
||||
es->format_rect.bottom = es->format_rect.top +
|
||||
MAX(1, (es->format_rect.bottom - es->format_rect.top) / es->line_height) * es->line_height;
|
||||
max(1, (es->format_rect.bottom - es->format_rect.top) / es->line_height) * es->line_height;
|
||||
else
|
||||
es->format_rect.bottom = es->format_rect.top + es->line_height;
|
||||
if ((es->style & ES_MULTILINE) && !(es->style & ES_AUTOHSCROLL))
|
||||
|
@ -1808,7 +1810,7 @@ static HLOCAL EDIT_EM_GetHandle(WND *wnd, EDITSTATE *es)
|
|||
DPRINT( "could not allocate new bit buffer\n");
|
||||
return 0;
|
||||
}
|
||||
newSize = MIN(LocalSize(newBuf) - 1, es->buffer_limit);
|
||||
newSize = min(LocalSize(newBuf) - 1, es->buffer_limit);
|
||||
if (!(newText = LocalLock(newBuf))) {
|
||||
DPRINT( "could not lock new bit buffer\n");
|
||||
LocalFree(newBuf);
|
||||
|
@ -1848,7 +1850,7 @@ static INT EDIT_EM_GetLine(WND *wnd, EDITSTATE *es, INT line, LPSTR lpch)
|
|||
line = 0;
|
||||
i = EDIT_EM_LineIndex(wnd, es, line);
|
||||
src = es->text + i;
|
||||
len = MIN(*(WORD *)lpch, EDIT_EM_LineLength(wnd, es, i));
|
||||
len = min(*(WORD *)lpch, EDIT_EM_LineLength(wnd, es, i));
|
||||
for (i = 0 ; i < len ; i++) {
|
||||
*lpch = *src;
|
||||
src++;
|
||||
|
@ -1912,7 +1914,7 @@ static INT EDIT_EM_LineFromChar(WND *wnd, EDITSTATE *es, INT index)
|
|||
if (index > lstrlenA(es->text))
|
||||
return es->line_count - 1;
|
||||
if (index == -1)
|
||||
index = MIN(es->selection_start, es->selection_end);
|
||||
index = min(es->selection_start, es->selection_end);
|
||||
|
||||
line = 0;
|
||||
line_def = es->first_line_def;
|
||||
|
@ -2013,7 +2015,7 @@ static BOOL EDIT_EM_LineScroll(WND *wnd, EDITSTATE *es, INT dx, INT dy)
|
|||
dx = -es->x_offset;
|
||||
if (dx > es->text_width - es->x_offset)
|
||||
dx = es->text_width - es->x_offset;
|
||||
nyoff = MAX(0, es->y_offset + dy);
|
||||
nyoff = max(0, es->y_offset + dy);
|
||||
if (nyoff >= es->line_count)
|
||||
nyoff = es->line_count - 1;
|
||||
dy = (es->y_offset - nyoff) * es->line_height;
|
||||
|
@ -2051,7 +2053,7 @@ static LRESULT EDIT_EM_PosFromChar(WND *wnd, EDITSTATE *es, INT index, BOOL afte
|
|||
HFONT old_font = 0;
|
||||
SIZE size;
|
||||
|
||||
index = MIN(index, len);
|
||||
index = min(index, len);
|
||||
dc = GetDC(wnd->hwndSelf);
|
||||
if (es->font)
|
||||
old_font = SelectObject(dc, es->font);
|
||||
|
@ -2368,12 +2370,12 @@ static void EDIT_EM_SetLimitText(WND *wnd, EDITSTATE *es, INT limit)
|
|||
{
|
||||
if (es->style & ES_MULTILINE) {
|
||||
if (limit)
|
||||
es->buffer_limit = MIN(limit, BUFLIMIT_MULTI);
|
||||
es->buffer_limit = min(limit, BUFLIMIT_MULTI);
|
||||
else
|
||||
es->buffer_limit = BUFLIMIT_MULTI;
|
||||
} else {
|
||||
if (limit)
|
||||
es->buffer_limit = MIN(limit, BUFLIMIT_SINGLE);
|
||||
es->buffer_limit = min(limit, BUFLIMIT_SINGLE);
|
||||
else
|
||||
es->buffer_limit = BUFLIMIT_SINGLE;
|
||||
}
|
||||
|
@ -2459,8 +2461,8 @@ static void EDIT_EM_SetSel(WND *wnd, EDITSTATE *es, UINT start, UINT end, BOOL a
|
|||
start = es->selection_end;
|
||||
end = es->selection_end;
|
||||
} else {
|
||||
start = MIN(start, len);
|
||||
end = MIN(end, len);
|
||||
start = min(start, len);
|
||||
end = min(end, len);
|
||||
}
|
||||
es->selection_start = start;
|
||||
es->selection_end = end;
|
||||
|
@ -3347,7 +3349,7 @@ static void EDIT_WM_Paint(WND *wnd, EDITSTATE *es)
|
|||
GetClipBox(dc, &rcRgn);
|
||||
if (es->style & ES_MULTILINE) {
|
||||
INT vlc = (es->format_rect.bottom - es->format_rect.top) / es->line_height;
|
||||
for (i = es->y_offset ; i <= MIN(es->y_offset + vlc, es->y_offset + es->line_count - 1) ; i++) {
|
||||
for (i = es->y_offset ; i <= min(es->y_offset + vlc, es->y_offset + es->line_count - 1) ; i++) {
|
||||
EDIT_GetLineRect(wnd, es, i, 0, -1, &rcLine);
|
||||
if (IntersectRect(&rc, &rcRgn, &rcLine))
|
||||
EDIT_PaintLine(wnd, es, dc, i, rev);
|
||||
|
|
|
@ -4,6 +4,10 @@
|
|||
* Copyright 1996 Alexandre Julliard
|
||||
*/
|
||||
|
||||
#include <ntos/minmax.h>
|
||||
#define MIN min
|
||||
#define MAX max
|
||||
|
||||
#include <string.h>
|
||||
#include <windows.h>
|
||||
#include <user32/win.h>
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
* This is probably not the meaning this style has in MS-Windows.
|
||||
*/
|
||||
|
||||
#include <ntos/minmax.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
|
|
|
@ -5,6 +5,10 @@
|
|||
* Copyright 1994, 1996 Alexandre Julliard
|
||||
*/
|
||||
|
||||
#include <ntos/minmax.h>
|
||||
#define MAX max
|
||||
#define MIN min
|
||||
|
||||
#include <windows.h>
|
||||
#include <user32/sysmetr.h>
|
||||
#include <user32/scroll.h>
|
||||
|
|
|
@ -5,6 +5,10 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <ntos/minmax.h>
|
||||
#define MIN min
|
||||
#define MAX max
|
||||
|
||||
#include <windows.h>
|
||||
#include <user32/win.h>
|
||||
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
#include <ntos/minmax.h>
|
||||
#define MIN min
|
||||
#define MAX max
|
||||
|
||||
#include <windows.h>
|
||||
#include <user32/dce.h>
|
||||
#include <user32/win.h>
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
#include <ntos/minmax.h>
|
||||
#define MAX max
|
||||
#define MIN min
|
||||
|
||||
#include <windows.h>
|
||||
#include <stdlib.h>
|
||||
#include <user32/nc.h>
|
||||
|
@ -2313,4 +2317,4 @@ WINBOOL STDCALL FastWindowFrame( HDC hdc, const RECT *rect,
|
|||
rect->bottom - rect->top - height, rop );
|
||||
SelectObject( hdc, hbrush );
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,11 @@
|
|||
* Copyright 1993, 1994, 1995 Alexandre Julliard
|
||||
* 1995, 1996 Alex Korobka
|
||||
*/
|
||||
|
||||
#include <ntos/minmax.h>
|
||||
#define MIN min
|
||||
#define MAX max
|
||||
|
||||
#include <windows.h>
|
||||
#include <string.h>
|
||||
#include <user32/sysmetr.h>
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
#include <ntos/minmax.h>
|
||||
#define MIN min
|
||||
#define MAX max
|
||||
|
||||
#define UNICODE
|
||||
#include <windows.h>
|
||||
#include <user32/win.h>
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
#include <ntos/minmax.h>
|
||||
#define MIN min
|
||||
#define MAX max
|
||||
|
||||
#include <windows.h>
|
||||
#include <user32/nc.h>
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ org 100h
|
|||
;
|
||||
BITS 16
|
||||
|
||||
;%define NDEBUG 1
|
||||
%define NDEBUG 1
|
||||
|
||||
%macro DPRINT 1+
|
||||
%ifndef NDEBUG
|
||||
|
@ -123,14 +123,40 @@ entry:
|
|||
; Set the address of the start of kernel code
|
||||
;
|
||||
mov [_start_kernel],ebx
|
||||
|
||||
|
||||
;
|
||||
; Setup various variables
|
||||
;
|
||||
mov bx,ds
|
||||
movzx eax,bx
|
||||
shl eax,4
|
||||
add [gdt_base],eax
|
||||
|
||||
;
|
||||
; Make the argument list into a c string
|
||||
;
|
||||
mov di,081h
|
||||
mov si,_kernel_parameters
|
||||
l21:
|
||||
mov al,[di]
|
||||
mov [si],al
|
||||
cmp byte [di],0dh
|
||||
je l22
|
||||
inc di
|
||||
inc si
|
||||
jmp l21
|
||||
l22:
|
||||
mov byte [di], 0
|
||||
mov byte [si], 0
|
||||
mov [end_cmd_line], di
|
||||
|
||||
;
|
||||
; Make the argument list into a c string
|
||||
;
|
||||
mov di,081h
|
||||
l1:
|
||||
cmp byte [di],0dh
|
||||
je l2
|
||||
cmp byte [di], 0
|
||||
je l2
|
||||
cmp byte [di],' '
|
||||
jne l12
|
||||
mov byte [di],0
|
||||
|
@ -138,18 +164,31 @@ l12:
|
|||
inc di
|
||||
jmp l1
|
||||
l2:
|
||||
mov byte [di],0
|
||||
mov [end_cmd_line],di
|
||||
|
||||
|
||||
;
|
||||
; Check if we want to skip the first character
|
||||
;
|
||||
cmp byte [081h],0
|
||||
jne l32
|
||||
mov dx,082h
|
||||
l14:
|
||||
jmp l14
|
||||
l32:
|
||||
mov dx,081h
|
||||
|
||||
;
|
||||
; Check if we have reached the end of the string
|
||||
;
|
||||
l14:
|
||||
mov bx,dx
|
||||
cmp byte [bx],0
|
||||
je l16
|
||||
|
||||
;
|
||||
; Process the arguments
|
||||
; Process the arguments
|
||||
;
|
||||
cmp byte [di], '/'
|
||||
je l15
|
||||
|
||||
mov di,loading_msg
|
||||
call print_string
|
||||
mov di,dx
|
||||
|
@ -770,6 +809,58 @@ DPRINT 'next load base %A', 13, 10, 0
|
|||
call print_string
|
||||
jmp exit
|
||||
|
||||
;
|
||||
; copy 'ecx' bytes from 'es:esi' to logical address 'edi'
|
||||
; 'eax' is destroyed
|
||||
;
|
||||
himem_copy:
|
||||
push ds
|
||||
|
||||
;
|
||||
; load gdt
|
||||
;
|
||||
lgdt [gdt_descr]
|
||||
|
||||
;
|
||||
; Enter pmode and clear prefetch queue
|
||||
;
|
||||
mov eax,cr0
|
||||
or eax,0x1
|
||||
mov cr0,eax
|
||||
jmp himem_copy_next
|
||||
himem_copy_next:
|
||||
|
||||
;
|
||||
; Load the ds register with a segment suitable for accessing
|
||||
; logical addresses
|
||||
;
|
||||
mov ax, KERNEL_DS
|
||||
mov ds, ax
|
||||
|
||||
;
|
||||
; Copy the data
|
||||
;
|
||||
himem_copy_l1:
|
||||
mov al, [es:si]
|
||||
mov [ds:edi], al
|
||||
dec ecx
|
||||
jnz himem_copy_l1
|
||||
|
||||
;
|
||||
; Exit protected mode
|
||||
;
|
||||
mov eax,cr0
|
||||
and eax,0xfffffffe
|
||||
mov cr0,eax
|
||||
jmp himem_copy_next1
|
||||
himem_copy_next1:
|
||||
|
||||
;
|
||||
; Restore ds
|
||||
;
|
||||
pop ds
|
||||
ret
|
||||
|
||||
;
|
||||
; Handle of the currently open file
|
||||
;
|
||||
|
@ -1005,14 +1096,6 @@ l8:
|
|||
mov eax,[kernel_page_directory_base]
|
||||
mov cr3,eax
|
||||
|
||||
;
|
||||
; Setup various variables
|
||||
;
|
||||
mov bx,ds
|
||||
movzx eax,bx
|
||||
shl eax,4
|
||||
add [gdt_base],eax
|
||||
|
||||
;
|
||||
; Enable the A20 address line (to allow access to over 1mb)
|
||||
;
|
||||
|
@ -1127,21 +1210,6 @@ gdt:
|
|||
dw 0
|
||||
dw 0
|
||||
|
||||
;dw 00000h ; User code descriptor
|
||||
;dw 00000h ; base: 0h limit: 3gb
|
||||
;dw 0fa00h
|
||||
;dw 000cch
|
||||
|
||||
;dw 00000h ; User data descriptor
|
||||
;dw 00000h ; base: 0h limit: 3gb
|
||||
;dw 0f200h
|
||||
;dw 000cch
|
||||
|
||||
;dw 00000h
|
||||
;dw 00000h
|
||||
;dw 00000h
|
||||
;dw 00000h
|
||||
|
||||
dw 0ffffh ; Kernel code descriptor
|
||||
dw 00000h ;
|
||||
dw 09a00h ; base 0h limit 4gb
|
||||
|
@ -1152,9 +1220,6 @@ gdt:
|
|||
dw 09200h ; base 0h limit 4gb
|
||||
dw 000cfh
|
||||
|
||||
|
||||
;times NR_TASKS*8 db 0
|
||||
|
||||
_end:
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: fmutex.c,v 1.1 2000/06/09 20:05:00 ekohl Exp $
|
||||
/* $Id: fmutex.c,v 1.2 2000/08/30 19:33:28 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -18,12 +18,8 @@
|
|||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
VOID
|
||||
FASTCALL
|
||||
EXPORTED
|
||||
ExAcquireFastMutex (
|
||||
PFAST_MUTEX FastMutex
|
||||
)
|
||||
VOID FASTCALL EXPORTED
|
||||
ExAcquireFastMutex (PFAST_MUTEX FastMutex)
|
||||
{
|
||||
KeEnterCriticalRegion();
|
||||
if (InterlockedDecrement(&(FastMutex->Count))==0)
|
||||
|
@ -40,12 +36,8 @@ ExAcquireFastMutex (
|
|||
}
|
||||
|
||||
|
||||
VOID
|
||||
FASTCALL
|
||||
EXPORTED
|
||||
ExReleaseFastMutex (
|
||||
PFAST_MUTEX FastMutex
|
||||
)
|
||||
VOID FASTCALL EXPORTED
|
||||
ExReleaseFastMutex (PFAST_MUTEX FastMutex)
|
||||
{
|
||||
assert(FastMutex->Owner == KeGetCurrentThread());
|
||||
FastMutex->Owner=NULL;
|
||||
|
@ -59,12 +51,8 @@ ExReleaseFastMutex (
|
|||
}
|
||||
|
||||
|
||||
BOOLEAN
|
||||
FASTCALL
|
||||
EXPORTED
|
||||
ExTryToAcquireFastMutex (
|
||||
PFAST_MUTEX FastMutex
|
||||
)
|
||||
BOOLEAN FASTCALL EXPORTED
|
||||
ExTryToAcquireFastMutex (PFAST_MUTEX FastMutex)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: halinit.c,v 1.14 2000/07/24 23:50:13 ekohl Exp $
|
||||
/* $Id: halinit.c,v 1.15 2000/08/30 19:33:28 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -21,17 +21,13 @@
|
|||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
|
||||
BOOLEAN
|
||||
STDCALL
|
||||
HalInitSystem (
|
||||
ULONG BootPhase,
|
||||
PLOADER_PARAMETER_BLOCK LoaderBlock
|
||||
)
|
||||
BOOLEAN STDCALL
|
||||
HalInitSystem (ULONG BootPhase,
|
||||
PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||
{
|
||||
if (BootPhase == 0)
|
||||
{
|
||||
HalInitializeDisplay (LoaderBlock);
|
||||
HalpCalibrateStallExecution ();
|
||||
HalpInitPICs ();
|
||||
}
|
||||
else
|
||||
|
|
|
@ -81,9 +81,9 @@ static VOID HiSwitchIrql(KIRQL oldIrql)
|
|||
{
|
||||
unsigned int current_mask = 0;
|
||||
|
||||
for (i=(CurrentIrql-DISPATCH_LEVEL);i>DISPATCH_LEVEL;i--)
|
||||
for (i=CurrentIrql; i>DISPATCH_LEVEL; i--)
|
||||
{
|
||||
set_bit(NR_DEVICE_SPECIFIC_LEVELS - i,¤t_mask);
|
||||
current_mask = current_mask | (1 << (HIGH_LEVEL - i));
|
||||
}
|
||||
|
||||
HiSetCurrentPICMask(current_mask);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: udelay.c,v 1.1 2000/04/08 19:08:50 ekohl Exp $
|
||||
/* $Id: udelay.c,v 1.2 2000/08/30 19:33:28 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -20,64 +20,149 @@
|
|||
|
||||
/* GLOBALS ******************************************************************/
|
||||
|
||||
#define MICROSECONDS_PER_TICK (54945)
|
||||
#define TICKS_TO_CALIBRATE (1)
|
||||
#define CALIBRATE_PERIOD (MICROSECONDS_PER_TICK * TICKS_TO_CALIBRATE)
|
||||
#define SYSTEM_TIME_UNITS_PER_MSEC (10000)
|
||||
static unsigned int delay_count = 1;
|
||||
|
||||
static unsigned int loops_per_microsecond = 100;
|
||||
#define MILLISEC (10)
|
||||
#define FREQ (1000/MILLISEC)
|
||||
|
||||
//extern ULONGLONG KiTimerTicks;
|
||||
#define PRECISION (8)
|
||||
|
||||
#define TMR_CTRL 0x43 /* I/O for control */
|
||||
#define TMR_CNT0 0x40 /* I/O for counter 0 */
|
||||
#define TMR_CNT1 0x41 /* I/O for counter 1 */
|
||||
#define TMR_CNT2 0x42 /* I/O for counter 2 */
|
||||
|
||||
#define TMR_SC0 0 /* Select channel 0 */
|
||||
#define TMR_SC1 0x40 /* Select channel 1 */
|
||||
#define TMR_SC2 0x80 /* Select channel 2 */
|
||||
|
||||
#define TMR_LOW 0x10 /* RW low byte only */
|
||||
#define TMR_HIGH 0x20 /* RW high byte only */
|
||||
#define TMR_BOTH 0x30 /* RW both bytes */
|
||||
|
||||
#define TMR_MD0 0 /* Mode 0 */
|
||||
#define TMR_MD1 0x2 /* Mode 1 */
|
||||
#define TMR_MD2 0x4 /* Mode 2 */
|
||||
#define TMR_MD3 0x6 /* Mode 3 */
|
||||
#define TMR_MD4 0x8 /* Mode 4 */
|
||||
#define TMR_MD5 0xA /* Mode 5 */
|
||||
|
||||
#define TMR_BCD 1 /* BCD mode */
|
||||
|
||||
#define TMR_LATCH 0 /* Latch command */
|
||||
|
||||
#define TMR_READ 0xF0 /* Read command */
|
||||
#define TMR_CNT 0x20 /* CNT bit (Active low, subtract it) */
|
||||
#define TMR_STAT 0x10 /* Status bit (Active low, subtract it) */
|
||||
#define TMR_CH2 0x8 /* Channel 2 bit */
|
||||
#define TMR_CH1 0x4 /* Channel 1 bit */
|
||||
#define TMR_CH0 0x2 /* Channel 0 bit */
|
||||
|
||||
/* FUNCTIONS **************************************************************/
|
||||
|
||||
void init_pit(float h, unsigned char channel)
|
||||
{
|
||||
unsigned int temp=0;
|
||||
|
||||
temp = 1193180/h;
|
||||
|
||||
// WRITE_PORT_UCHAR((PUCHAR)TMR_CTRL,
|
||||
// (channel*0x40) + TMR_BOTH + TMR_MD3);
|
||||
WRITE_PORT_UCHAR((PUCHAR)TMR_CTRL,
|
||||
(channel*0x40) + TMR_BOTH + TMR_MD2);
|
||||
WRITE_PORT_UCHAR((PUCHAR)(0x40+channel),
|
||||
(unsigned char) temp);
|
||||
WRITE_PORT_UCHAR((PUCHAR)(0x40+channel),
|
||||
(unsigned char) (temp>>8));
|
||||
}
|
||||
|
||||
VOID STDCALL
|
||||
__KeStallExecutionProcessor(ULONG Loops)
|
||||
{
|
||||
unsigned int i;
|
||||
for (i=0; i<Loops;i++);
|
||||
}
|
||||
|
||||
VOID STDCALL KeStallExecutionProcessor(ULONG Microseconds)
|
||||
{
|
||||
return(__KeStallExecutionProcessor((delay_count*(Microseconds/1000))));
|
||||
}
|
||||
|
||||
#define HZ (100)
|
||||
#define CLOCK_TICK_RATE (1193180)
|
||||
#define LATCH ((CLOCK_TICK_RATE + HZ/2) / HZ)
|
||||
|
||||
VOID HalpCalibrateStallExecution(VOID)
|
||||
{
|
||||
// unsigned int start_tick;
|
||||
// unsigned int end_tick;
|
||||
// unsigned int nr_ticks;
|
||||
// unsigned int i;
|
||||
// unsigned int microseconds;
|
||||
unsigned int prevtick;
|
||||
unsigned int i;
|
||||
unsigned int calib_bit;
|
||||
extern volatile ULONG KiRawTicks;
|
||||
|
||||
DbgPrint("Calibrating delay loop... [");
|
||||
|
||||
/* Initialise timer interrupt with MILLISECOND ms interval */
|
||||
//init_pit(FREQ, 0);
|
||||
WRITE_PORT_UCHAR((PUCHAR)0x43, 0x34); /* binary, mode 2, LSB/MSB, ch 0 */
|
||||
WRITE_PORT_UCHAR((PUCHAR)0x40, LATCH & 0xff); /* LSB */
|
||||
WRITE_PORT_UCHAR((PUCHAR)0x40, LATCH >> 8); /* MSB */
|
||||
|
||||
/* Stage 1: Coarse calibration */
|
||||
|
||||
do {
|
||||
delay_count <<= 1; /* Next delay count to try */
|
||||
|
||||
prevtick=KiRawTicks; /* Wait for the start of the next */
|
||||
while(prevtick==KiRawTicks); /* timer tick */
|
||||
|
||||
prevtick=KiRawTicks; /* Start measurement now */
|
||||
__KeStallExecutionProcessor(delay_count); /* Do the delay */
|
||||
} while(prevtick == KiRawTicks); /* Until delay is just too big */
|
||||
|
||||
delay_count >>= 1; /* Get bottom value for delay */
|
||||
|
||||
/* Stage 2: Fine calibration */
|
||||
|
||||
calib_bit = delay_count; /* Which bit are we going to test */
|
||||
|
||||
for(i=0;i<PRECISION;i++) {
|
||||
calib_bit >>= 1; /* Next bit to calibrate */
|
||||
if(!calib_bit) break; /* If we have done all bits, stop */
|
||||
|
||||
delay_count |= calib_bit; /* Set the bit in delay_count */
|
||||
|
||||
prevtick=KiRawTicks; /* Wait for the start of the next */
|
||||
while(prevtick==KiRawTicks); /* timer tick */
|
||||
|
||||
prevtick=KiRawTicks; /* Start measurement now */
|
||||
__KeStallExecutionProcessor(delay_count); /* Do the delay */
|
||||
|
||||
if(prevtick != KiRawTicks) /* If a tick has passed, turn the */
|
||||
delay_count &= ~calib_bit; /* calibrated bit back off */
|
||||
}
|
||||
|
||||
/* We're finished: Do the finishing touches */
|
||||
|
||||
delay_count /= MILLISEC; /* Calculate delay_count for 1ms */
|
||||
|
||||
DbgPrint("]\n");
|
||||
DbgPrint("delay_count: %d\n", delay_count);
|
||||
DbgPrint("CPU speed: %d\n", delay_count/500);
|
||||
#if 0
|
||||
for (i=0;i<20;i++)
|
||||
DbgPrint("About to start delay loop test\n");
|
||||
for (i = 0; i < (10*1000*20); i++)
|
||||
{
|
||||
start_tick = KiTimerTicks;
|
||||
microseconds = 0;
|
||||
while (start_tick == KiTimerTicks);
|
||||
while (KiTimerTicks == (start_tick+TICKS_TO_CALIBRATE))
|
||||
{
|
||||
KeStallExecutionProcessor(1);
|
||||
microseconds++;
|
||||
};
|
||||
|
||||
// DbgPrint("microseconds %d\n",microseconds);
|
||||
|
||||
if (microseconds > (CALIBRATE_PERIOD+1000))
|
||||
{
|
||||
loops_per_microsecond = loops_per_microsecond + 1;
|
||||
}
|
||||
if (microseconds < (CALIBRATE_PERIOD-1000))
|
||||
{
|
||||
loops_per_microsecond = loops_per_microsecond - 1;
|
||||
}
|
||||
// DbgPrint("loops_per_microsecond %d\n",loops_per_microsecond);
|
||||
KeStallExecutionProcessor(50);
|
||||
}
|
||||
// for(;;);
|
||||
DbgPrint("Waiting for five minutes...");
|
||||
KeStallExecutionProcessor(5*60*1000*1000);
|
||||
for (i = 0; i < (5*60*1000*20); i++)
|
||||
{
|
||||
KeStallExecutionProcessor(50);
|
||||
}
|
||||
DbgPrint("finished\n");
|
||||
for(;;);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
STDCALL
|
||||
KeStallExecutionProcessor(ULONG MicroSeconds)
|
||||
{
|
||||
unsigned int i;
|
||||
for (i=0; i<(loops_per_microsecond*MicroSeconds) ;i++)
|
||||
{
|
||||
__asm__("nop\n\t");
|
||||
}
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: kdebug.c,v 1.13 2000/08/12 19:33:21 dwelch Exp $
|
||||
/* $Id: kdebug.c,v 1.14 2000/08/30 19:33:28 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -43,7 +43,7 @@ KdDebuggerNotPresent = TRUE; /* EXPORTED */
|
|||
|
||||
static BOOLEAN KdpBreakPending = FALSE;
|
||||
static BOOLEAN KdpBreakRecieved = FALSE;
|
||||
static ULONG KdpDebugType = BochsDebug;
|
||||
static ULONG KdpDebugType = ScreenDebug | BochsDebug;
|
||||
|
||||
|
||||
/* PRIVATE FUNCTIONS ********************************************************/
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
/* GLOBALS *******************************************************************/
|
||||
|
||||
static ULONG HardwareMathSupport;
|
||||
static ULONG x;
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
|
@ -43,11 +42,8 @@ VOID KiCheckFPU(VOID)
|
|||
return;
|
||||
}
|
||||
/* FIXME: Do fsetpm */
|
||||
DbgPrint("Detected FPU\n");
|
||||
HardwareMathSupport = 1;
|
||||
|
||||
DbgPrint("Testing FPU\n");
|
||||
x = x * 6.789456;
|
||||
}
|
||||
|
||||
VOID KeInit1(VOID)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: main.c,v 1.59 2000/08/25 15:54:11 ekohl Exp $
|
||||
/* $Id: main.c,v 1.60 2000/08/30 19:33:28 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -23,13 +23,12 @@
|
|||
#include <internal/ps.h>
|
||||
#include <internal/hal.h>
|
||||
#include <internal/ke.h>
|
||||
#include <internal/io.h>
|
||||
|
||||
#include <internal/mmhal.h>
|
||||
#include <internal/i386/segment.h>
|
||||
#include <napi/shared_data.h>
|
||||
|
||||
#define NDEBUG
|
||||
//#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
/* DATA *********************************************************************/
|
||||
|
@ -41,311 +40,21 @@ LOADER_PARAMETER_BLOCK EXPORTED KeLoaderBlock;
|
|||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
static VOID
|
||||
CreateSystemRootLink (PCSZ ParameterLine)
|
||||
static VOID CreateSystemRootLink (LPWSTR Device)
|
||||
{
|
||||
UNICODE_STRING LinkName;
|
||||
UNICODE_STRING DeviceName;
|
||||
UNICODE_STRING ArcName;
|
||||
UNICODE_STRING BootPath;
|
||||
PCHAR ParamBuffer;
|
||||
PWCHAR ArcNameBuffer;
|
||||
PCHAR p;
|
||||
NTSTATUS Status;
|
||||
ULONG Length;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
HANDLE Handle;
|
||||
|
||||
/* create local parameter line copy */
|
||||
ParamBuffer = ExAllocatePool (PagedPool, 256);
|
||||
strcpy (ParamBuffer, (char *)ParameterLine);
|
||||
|
||||
DPRINT("%s\n", ParamBuffer);
|
||||
/* Format: <arc_name>\<path> [options...] */
|
||||
|
||||
/* cut options off */
|
||||
p = strchr (ParamBuffer, ' ');
|
||||
if (p)
|
||||
*p = 0;
|
||||
DPRINT("%s\n", ParamBuffer);
|
||||
|
||||
/* extract path */
|
||||
p = strchr (ParamBuffer, '\\');
|
||||
if (p)
|
||||
{
|
||||
DPRINT("Boot path: %s\n", p);
|
||||
RtlCreateUnicodeStringFromAsciiz (&BootPath, p);
|
||||
*p = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
DPRINT("Boot path: %s\n", "\\");
|
||||
RtlCreateUnicodeStringFromAsciiz (&BootPath, "\\");
|
||||
}
|
||||
DPRINT("Arc name: %s\n", ParamBuffer);
|
||||
|
||||
/* Only arc name left - build full arc name */
|
||||
ArcNameBuffer = ExAllocatePool (PagedPool, 256 * sizeof(WCHAR));
|
||||
swprintf (ArcNameBuffer,
|
||||
L"\\ArcName\\%S", ParamBuffer);
|
||||
RtlInitUnicodeString (&ArcName, ArcNameBuffer);
|
||||
DPRINT("Arc name: %wZ\n", &ArcName);
|
||||
|
||||
/* free ParamBuffer */
|
||||
ExFreePool (ParamBuffer);
|
||||
|
||||
/* allocate device name string */
|
||||
DeviceName.Length = 0;
|
||||
DeviceName.MaximumLength = 256 * sizeof(WCHAR);
|
||||
DeviceName.Buffer = ExAllocatePool (PagedPool, 256 * sizeof(WCHAR));
|
||||
|
||||
InitializeObjectAttributes (&ObjectAttributes,
|
||||
&ArcName,
|
||||
0,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
Status = NtOpenSymbolicLinkObject (&Handle,
|
||||
SYMBOLIC_LINK_ALL_ACCESS,
|
||||
&ObjectAttributes);
|
||||
RtlFreeUnicodeString (&ArcName);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
RtlFreeUnicodeString (&BootPath);
|
||||
RtlFreeUnicodeString (&DeviceName);
|
||||
DbgPrint("NtOpenSymbolicLinkObject() failed (Status %x)\n",
|
||||
Status);
|
||||
|
||||
KeBugCheck (0x0);
|
||||
}
|
||||
|
||||
Status = NtQuerySymbolicLinkObject (Handle,
|
||||
&DeviceName,
|
||||
&Length);
|
||||
NtClose (Handle);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
RtlFreeUnicodeString (&BootPath);
|
||||
RtlFreeUnicodeString (&DeviceName);
|
||||
DbgPrint("NtQuerySymbolicObject() failed (Status %x)\n",
|
||||
Status);
|
||||
|
||||
KeBugCheck (0x0);
|
||||
}
|
||||
DPRINT("Length: %lu DeviceName: %wZ\n", Length, &DeviceName);
|
||||
|
||||
RtlAppendUnicodeStringToString (&DeviceName,
|
||||
&BootPath);
|
||||
|
||||
RtlFreeUnicodeString (&BootPath);
|
||||
DPRINT("DeviceName: %wZ\n", &DeviceName);
|
||||
|
||||
/* create the '\SystemRoot' link */
|
||||
RtlInitUnicodeString (&LinkName,
|
||||
L"\\SystemRoot");
|
||||
|
||||
Status = IoCreateSymbolicLink (&LinkName,
|
||||
&DeviceName);
|
||||
RtlFreeUnicodeString (&DeviceName);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DbgPrint("IoCreateSymbolicLink() failed (Status %x)\n",
|
||||
Status);
|
||||
RtlInitUnicodeString (&DeviceName,
|
||||
Device);
|
||||
|
||||
KeBugCheck (0x0);
|
||||
}
|
||||
|
||||
/*
|
||||
* FIXME: test if '\SystemRoot' (LinkName)can be opened,
|
||||
* otherwise crash it!
|
||||
*/
|
||||
IoCreateSymbolicLink (&LinkName,
|
||||
&DeviceName);
|
||||
}
|
||||
|
||||
|
||||
static VOID
|
||||
InitSystemSharedUserPage (PCSZ ParameterLine)
|
||||
{
|
||||
PKUSER_SHARED_DATA SharedPage;
|
||||
|
||||
UNICODE_STRING ArcDeviceName;
|
||||
UNICODE_STRING ArcName;
|
||||
UNICODE_STRING BootPath;
|
||||
UNICODE_STRING DriveDeviceName;
|
||||
UNICODE_STRING DriveName;
|
||||
WCHAR DriveNameBuffer[20];
|
||||
PCHAR ParamBuffer;
|
||||
PWCHAR ArcNameBuffer;
|
||||
PCHAR p;
|
||||
NTSTATUS Status;
|
||||
ULONG Length;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
HANDLE Handle;
|
||||
ULONG i;
|
||||
BOOLEAN BootDriveFound;
|
||||
|
||||
SharedPage = (PKUSER_SHARED_DATA)KERNEL_SHARED_DATA_BASE;
|
||||
SharedPage->DosDeviceMap = 0;
|
||||
SharedPage->NtProductType = NtProductWinNt;
|
||||
for (i = 0; i < 32; i++)
|
||||
{
|
||||
SharedPage->DosDeviceDriveType[i] = 0;
|
||||
}
|
||||
|
||||
BootDriveFound = FALSE;
|
||||
|
||||
/*
|
||||
* Retrieve the current dos system path
|
||||
* (e.g.: C:\reactos) from the given arc path
|
||||
* (e.g.: multi(0)disk(0)rdisk(0)partititon(1)\reactos)
|
||||
* Format: "<arc_name>\<path> [options...]"
|
||||
*/
|
||||
|
||||
/* create local parameter line copy */
|
||||
ParamBuffer = ExAllocatePool (PagedPool, 256);
|
||||
strcpy (ParamBuffer, (char *)ParameterLine);
|
||||
DPRINT("%s\n", ParamBuffer);
|
||||
|
||||
/* cut options off */
|
||||
p = strchr (ParamBuffer, ' ');
|
||||
if (p)
|
||||
{
|
||||
*p = 0;
|
||||
}
|
||||
DPRINT("%s\n", ParamBuffer);
|
||||
|
||||
/* extract path */
|
||||
p = strchr (ParamBuffer, '\\');
|
||||
if (p)
|
||||
{
|
||||
DPRINT("Boot path: %s\n", p);
|
||||
RtlCreateUnicodeStringFromAsciiz (&BootPath, p);
|
||||
*p = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
DPRINT("Boot path: %s\n", "\\");
|
||||
RtlCreateUnicodeStringFromAsciiz (&BootPath, "\\");
|
||||
}
|
||||
DPRINT("Arc name: %s\n", ParamBuffer);
|
||||
|
||||
/* Only arc name left - build full arc name */
|
||||
ArcNameBuffer = ExAllocatePool (PagedPool, 256 * sizeof(WCHAR));
|
||||
swprintf (ArcNameBuffer, L"\\ArcName\\%S", ParamBuffer);
|
||||
RtlInitUnicodeString (&ArcName, ArcNameBuffer);
|
||||
DPRINT("Arc name: %wZ\n", &ArcName);
|
||||
|
||||
/* free ParamBuffer */
|
||||
ExFreePool (ParamBuffer);
|
||||
|
||||
/* allocate arc device name string */
|
||||
ArcDeviceName.Length = 0;
|
||||
ArcDeviceName.MaximumLength = 256 * sizeof(WCHAR);
|
||||
ArcDeviceName.Buffer = ExAllocatePool (PagedPool, 256 * sizeof(WCHAR));
|
||||
|
||||
InitializeObjectAttributes (&ObjectAttributes,
|
||||
&ArcName,
|
||||
0,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
Status = NtOpenSymbolicLinkObject (&Handle,
|
||||
SYMBOLIC_LINK_ALL_ACCESS,
|
||||
&ObjectAttributes);
|
||||
RtlFreeUnicodeString (&ArcName);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
RtlFreeUnicodeString (&BootPath);
|
||||
RtlFreeUnicodeString (&ArcDeviceName);
|
||||
DbgPrint("NtOpenSymbolicLinkObject() failed (Status %x)\n",
|
||||
Status);
|
||||
|
||||
KeBugCheck (0x0);
|
||||
}
|
||||
|
||||
Status = NtQuerySymbolicLinkObject (Handle,
|
||||
&ArcDeviceName,
|
||||
&Length);
|
||||
NtClose (Handle);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
RtlFreeUnicodeString (&BootPath);
|
||||
RtlFreeUnicodeString (&ArcDeviceName);
|
||||
DbgPrint("NtQuerySymbolicObject() failed (Status %x)\n",
|
||||
Status);
|
||||
|
||||
KeBugCheck (0x0);
|
||||
}
|
||||
DPRINT("Length: %lu ArcDeviceName: %wZ\n", Length, &ArcDeviceName);
|
||||
|
||||
|
||||
/* allocate device name string */
|
||||
DriveDeviceName.Length = 0;
|
||||
DriveDeviceName.MaximumLength = 256 * sizeof(WCHAR);
|
||||
DriveDeviceName.Buffer = ExAllocatePool (PagedPool, 256 * sizeof(WCHAR));
|
||||
|
||||
for (i = 0; i < 26; i++)
|
||||
{
|
||||
swprintf (DriveNameBuffer, L"\\??\\%C:", 'A' + i);
|
||||
RtlInitUnicodeString (&DriveName,
|
||||
DriveNameBuffer);
|
||||
|
||||
InitializeObjectAttributes (&ObjectAttributes,
|
||||
&DriveName,
|
||||
0,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
Status = NtOpenSymbolicLinkObject (&Handle,
|
||||
SYMBOLIC_LINK_ALL_ACCESS,
|
||||
&ObjectAttributes);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("Failed to open link %wZ\n",
|
||||
&DriveName);
|
||||
continue;
|
||||
}
|
||||
|
||||
Status = NtQuerySymbolicLinkObject (Handle,
|
||||
&DriveDeviceName,
|
||||
&Length);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("Failed query open link %wZ\n",
|
||||
&DriveName);
|
||||
continue;
|
||||
}
|
||||
DPRINT("Opened link: %wZ ==> %wZ\n",
|
||||
&DriveName, &DriveDeviceName);
|
||||
|
||||
if (!RtlCompareUnicodeString (&ArcDeviceName, &DriveDeviceName, FALSE))
|
||||
{
|
||||
DPRINT("DOS Boot path: %c:%wZ\n", 'A' + i, &BootPath);
|
||||
swprintf (SharedPage->NtSystemRoot,
|
||||
L"%C:%wZ", 'A' + i, &BootPath);
|
||||
|
||||
BootDriveFound = TRUE;
|
||||
}
|
||||
|
||||
NtClose (Handle);
|
||||
|
||||
/* set bit in dos drives bitmap (drive available) */
|
||||
SharedPage->DosDeviceMap |= (1<<i);
|
||||
}
|
||||
|
||||
RtlFreeUnicodeString (&BootPath);
|
||||
RtlFreeUnicodeString (&DriveDeviceName);
|
||||
RtlFreeUnicodeString (&ArcDeviceName);
|
||||
|
||||
DPRINT("DosDeviceMap: 0x%x\n", SharedPage->DosDeviceMap);
|
||||
|
||||
if (BootDriveFound == FALSE)
|
||||
{
|
||||
DbgPrint("No system drive found!\n");
|
||||
KeBugCheck (0x0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void _main (PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||
/*
|
||||
* FUNCTION: Called by the boot loader to start the kernel
|
||||
|
@ -369,8 +78,7 @@ void _main (PLOADER_PARAMETER_BLOCK LoaderBlock)
|
|||
* Initializes the kernel parameter line.
|
||||
* This should be done by the boot loader.
|
||||
*/
|
||||
strcpy (KeLoaderBlock.kernel_parameters,
|
||||
"multi(0)disk(0)rdisk(0)partition(1)\\reactos /DEBUGPORT=SCREEN");
|
||||
// strcpy (KeLoaderBlock.kernel_parameters, "/DEBUGPORT=SCREEN");
|
||||
|
||||
/*
|
||||
* Initialization phase 0
|
||||
|
@ -378,7 +86,10 @@ void _main (PLOADER_PARAMETER_BLOCK LoaderBlock)
|
|||
HalInitSystem (0, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
|
||||
KeInit1();
|
||||
KeLowerIrql(DISPATCH_LEVEL);
|
||||
|
||||
|
||||
DbgPrint("kernel_parameters %s\n",
|
||||
KeLoaderBlock.kernel_parameters);
|
||||
|
||||
/*
|
||||
* Display version number and copyright/warranty message
|
||||
*/
|
||||
|
@ -437,33 +148,34 @@ void _main (PLOADER_PARAMETER_BLOCK LoaderBlock)
|
|||
*/
|
||||
DPRINT1("%d files loaded\n",KeLoaderBlock.nr_files);
|
||||
|
||||
/* Pass 1: load registry chunks passed in */
|
||||
start = KERNEL_BASE + PAGE_ROUND_UP(KeLoaderBlock.module_length[0]);
|
||||
for (i = 1; i < KeLoaderBlock.nr_files; i++)
|
||||
{
|
||||
if (!strcmp ((PCHAR) start, "REGEDIT4"))
|
||||
{
|
||||
DPRINT1("process registry chunk at %08lx\n", start);
|
||||
CmImportHive((PCHAR) start);
|
||||
}
|
||||
start = start + KeLoaderBlock.module_length[i];
|
||||
}
|
||||
/* Pass 1: load registry chunks passed in */
|
||||
start = KERNEL_BASE + PAGE_ROUND_UP(KeLoaderBlock.module_length[0]);
|
||||
for (i = 1; i < KeLoaderBlock.nr_files; i++)
|
||||
{
|
||||
if (!strcmp ((PCHAR) start, "REGEDIT4"))
|
||||
{
|
||||
DPRINT1("process registry chunk at %08lx\n", start);
|
||||
CmImportHive((PCHAR) start);
|
||||
}
|
||||
start = start + KeLoaderBlock.module_length[i];
|
||||
}
|
||||
|
||||
/* Pass 2: process boot loaded drivers */
|
||||
start = KERNEL_BASE + PAGE_ROUND_UP(KeLoaderBlock.module_length[0]);
|
||||
start1 = start + KeLoaderBlock.module_length[1];
|
||||
for (i=1;i<KeLoaderBlock.nr_files;i++)
|
||||
{
|
||||
if (strcmp ((PCHAR) start, "REGEDIT4"))
|
||||
{
|
||||
DPRINT1("process module at %08lx\n", start);
|
||||
LdrProcessDriver((PVOID)start);
|
||||
}
|
||||
start = start + KeLoaderBlock.module_length[i];
|
||||
}
|
||||
/* Pass 2: process boot loaded drivers */
|
||||
start = KERNEL_BASE + PAGE_ROUND_UP(KeLoaderBlock.module_length[0]);
|
||||
start1 = start + KeLoaderBlock.module_length[1];
|
||||
for (i=1;i<KeLoaderBlock.nr_files;i++)
|
||||
{
|
||||
if (strcmp ((PCHAR) start, "REGEDIT4"))
|
||||
{
|
||||
DPRINT1("process module at %08lx\n", start);
|
||||
LdrProcessDriver((PVOID)start);
|
||||
}
|
||||
start = start + KeLoaderBlock.module_length[i];
|
||||
}
|
||||
|
||||
/* Create the SystemRoot symbolic link */
|
||||
CreateSystemRootLink (KeLoaderBlock.kernel_parameters);
|
||||
/* Hardcoded to 'C:\reactos' but this will change. */
|
||||
CreateSystemRootLink (L"\\Device\\Harddisk0\\Partition1\\reactos");
|
||||
|
||||
/*
|
||||
* Load Auto configured drivers
|
||||
|
@ -478,11 +190,12 @@ void _main (PLOADER_PARAMETER_BLOCK LoaderBlock)
|
|||
NULL,
|
||||
NULL);
|
||||
|
||||
/*
|
||||
* Initialize shared user page:
|
||||
* - set dos system path, dos device map, etc.
|
||||
*/
|
||||
InitSystemSharedUserPage (KeLoaderBlock.kernel_parameters);
|
||||
/* set system root in shared user page */
|
||||
wcscpy (((PKUSER_SHARED_DATA)KERNEL_SHARED_DATA_BASE)->NtSystemRoot,
|
||||
L"C:\\reactos");
|
||||
|
||||
((PKUSER_SHARED_DATA)KERNEL_SHARED_DATA_BASE)->NtProductType = NtProductWinNt;
|
||||
|
||||
|
||||
/*
|
||||
* Launch initial process
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: timer.c,v 1.33 2000/07/19 14:23:37 dwelch Exp $
|
||||
/* $Id: timer.c,v 1.34 2000/08/30 19:33:28 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -61,6 +61,7 @@ static unsigned long long system_time = 0;
|
|||
* Number of timer interrupts since initialisation
|
||||
*/
|
||||
volatile ULONGLONG KiTimerTicks;
|
||||
volatile ULONG KiRawTicks = 0;
|
||||
|
||||
/*
|
||||
* The increment in the system clock every timer tick (in system time units)
|
||||
|
@ -443,6 +444,8 @@ VOID KiUpdateSystemTime (VOID)
|
|||
// extern ULONG PiNrThreads;
|
||||
// extern ULONG MiNrFreePages;
|
||||
|
||||
KiRawTicks++;
|
||||
|
||||
if (TimerInitDone == FALSE)
|
||||
{
|
||||
return;
|
||||
|
@ -498,9 +501,12 @@ VOID KeInitializeTimerImpl(VOID)
|
|||
{
|
||||
TIME_FIELDS TimeFields;
|
||||
LARGE_INTEGER SystemBootTime;
|
||||
extern VOID HalpCalibrateStallExecution (VOID);
|
||||
|
||||
DPRINT("KeInitializeTimerImpl()\n");
|
||||
|
||||
HalpCalibrateStallExecution ();
|
||||
|
||||
InitializeListHead(&TimerListHead);
|
||||
KeInitializeSpinLock(&TimerListLock);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: mminit.c,v 1.6 2000/08/20 17:02:08 dwelch Exp $
|
||||
/* $Id: mminit.c,v 1.7 2000/08/30 19:33:28 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -145,7 +145,6 @@ VOID MmInitVirtualMemory(PLOADER_PARAMETER_BLOCK bp, ULONG LastKernelAddress)
|
|||
0,
|
||||
&kernel_pool_desc);
|
||||
|
||||
DPRINT1("Creating shared data page\n");
|
||||
BaseAddress = (PVOID)KERNEL_SHARED_DATA_BASE;
|
||||
Length = PAGESIZE;
|
||||
MmCreateMemoryArea(NULL,
|
||||
|
@ -166,7 +165,6 @@ VOID MmInitVirtualMemory(PLOADER_PARAMETER_BLOCK bp, ULONG LastKernelAddress)
|
|||
KeBugCheck(0);
|
||||
}
|
||||
((PKUSER_SHARED_DATA)KERNEL_SHARED_DATA_BASE)->TickCountLow = 0xdeadbeef;
|
||||
DPRINT1("Finished creating shared data page\n");
|
||||
|
||||
// MmDumpMemoryAreas();
|
||||
DPRINT("MmInitVirtualMemory() done\n");
|
||||
|
|
Loading…
Reference in a new issue