Commit graph

42624 commits

Author SHA1 Message Date
Sir Richard bf8a146243 [HAL]: Implement HalpGetPciBridgeConfig to detect PCI-to-PCI/CardBus bridges, warn if they are found.
[HAL]: Modify the debug messages to be more accurate as to what exactly is unsupported.

svn path=/trunk/; revision=47665
2010-06-07 16:44:12 +00:00
Sir Richard f098f2ae2b [HAL]: Implement partly HalpFixupPciSupportedRanges to detect PCI Bridges, and PCI-to-PCI Bridges. The point is we want buses to be cramped down to the addresses supported by the parent bus/bridge. This is NOT currently done, so we warn users of these systems.
svn path=/trunk/; revision=47664
2010-06-07 16:15:01 +00:00
Sir Richard 9ef2a02386 [HAL]: Detect, check for, and warn about, chipset hacks that need to be applied for the machine.
svn path=/trunk/; revision=47662
2010-06-07 15:34:35 +00:00
Sir Richard 2031c565df [NTOS]: Check registry for our CardList, check if the PCI hardware matches any entry in there that specifies it has full/extended address decoding, and write the registry flag for it.
svn path=/trunk/; revision=47660
2010-06-07 15:09:44 +00:00
Sir Richard 83c3c7abb2 [HAL]: Detect IDE controllers. Their interrupts should not be masked.
svn path=/trunk/; revision=47659
2010-06-07 15:02:49 +00:00
Michael Martin 7c5fd856ee [win32k]
- Change the number of windowless timers from 1024 to 32768.
- When destroying windowless timers, clear the bit number (IDEvent) in the bitmap so the bit number can be reused.
- Only create a windowless timer if there is no windowless timer matching IDEvent.
- Fixes case where applications create too many windowless timers and/or run out of windowless timers.

svn path=/trunk/; revision=47658
2010-06-07 13:37:43 +00:00
Cameron Gutman b2c96e402d [MSAFD]
- Fix a bug in GetSocketStructure that resulted in us missing the last entry of the list
- Remove an "optimization" which was supposed to find an unused socket entry (which it almost never did) but now just corrupts the linked list by trashing our NextSocket pointer

svn path=/trunk/; revision=47656
2010-06-07 05:40:08 +00:00
Sir Richard adc324f5c9 [HAL]: Detect, initialize, and create bus handlers for, all PCI buses that are found on the machine.
[HAL]: Detect PCI-to-PCI Bridges, Extended CardBus Addressing, read Chipset Hacks from Registry, and scan for IRQ lines used by PCI Devices. Scan for PCI-IDE controllers, broken Intel PCI Bridges/Controllers. Scan for OHCI and UHCI USB controllers. Warn the user that if any of these are found, the current HAL does not handle certain types of these devices (these checks are based on the ones the Legacy Windows HAL makes).

svn path=/trunk/; revision=47655
2010-06-07 03:23:48 +00:00
Sir Richard 07b14e926d [HAL]: Add missing PCI Bus Handler support functions, used on non-ACPI systems (ISA-PCI support and such).
svn path=/trunk/; revision=47654
2010-06-07 03:19:20 +00:00
Sir Richard e2d5c9d92b [HAL]: Kill debug spew.
svn path=/trunk/; revision=47653
2010-06-07 03:18:51 +00:00
Cameron Gutman e91cc9349b [MSAFD]
- Fix 2 more callers who don't pass a valid lpErrno pointer
- Check the return value of WSPSocket
- Return WSAEWOULDBLOCK if there are no connections that can be accepted instead of silently returning 0 which is not INVALID_SOCKET so the caller treats it as a valid socket pointer and passes it to other functions which caused wide-spread mayhem since we never checked whether the socket handle the caller passed was valid until my last commit

svn path=/trunk/; revision=47652
2010-06-07 01:50:26 +00:00
Cameron Gutman d19620d1ab [AFD]
- It is legal to send a NULL event object pointer to AFD (this is sent by msafd to cancel an existing event select)

svn path=/trunk/; revision=47651
2010-06-07 01:38:15 +00:00
Cameron Gutman 88c29ff4f2 [MSAFD]
- Validate that we found the corresponding socket information in our socket information list
- Fixes a crash in Firefox 2 when it tries to call accept() with a closed socket

svn path=/trunk/; revision=47650
2010-06-07 01:24:15 +00:00
Sir Richard ad1721c016 [HAL]: Bus support in the HAL actually creates a further wedge between the different x86 HALs: There are actually two dinstinct implementations. On the ACPI HAL, the system is assumed not to have things like special ISA, MCA, EISA buses, and a PCI driver is used in combination with the ACPI Interface for PCI Bus support. On non-ACPI systems, the legacy "Bus Handler" library is used, and the HAL provides a core set of CMOS, EISA, ISA, MCA and PCI bus handlers, each with their own routines and specific code. Additionally, PCI IRQ Routing and other PCI bus internals are handled directly by the HAL -- on the ACPI HAL, the PCI Bus support is implemented through a "Fake"/static bus handler, just to keep the functions shared. On ReactOS, both the ACPI and non-ACPI HAL were currently using a mix of both HAL bus handling types, mostly implemented the "ACPI way" (with a fake PCI bus handler and such).
As a result, none of the Hal*Bus HALDISPATCH routines were implemented, which bus drivers expect to find when they're not on ACPI systems (ReactOS today). eVb's new PCI driver was crashing, for example.
       Furthermore, legacy systems suffer, because the ACPI HAL Bus routines (that we currently have) expect perfect ACPI-style-compliant systems, not the legacy crap from the early 90ies. This works fine in VMs and new hardware, but old hardware is left behind.
       This patch basically corrects the first part of the problem, by making the bus handling support separate between ACPI and non-ACPI HALs. For now, the code remains 100% the same in functionality between both.
       However, I have started adding the first few elements:
[HAL]: Implement HalRegisterBusHandler HALDISPATCH routine.
[HAL]: On legacy HALs, register the CMOS, ISA, SYSTEM handlers.
[HAL]: Add cmosbus.c. Stub all bus-specific bus handler routines in the xxxbus.c files.
No real functionality change occurs with this patch, yet.

svn path=/trunk/; revision=47649
2010-06-07 01:09:41 +00:00
Sir Richard af870b6e47 [DHCP/FTP]: Fix building on OS X hosts.
svn path=/trunk/; revision=47648
2010-06-07 00:58:55 +00:00
Cameron Gutman 9cf2124763 I hate making the same mistake twice in one day
svn path=/trunk/; revision=47647
2010-06-07 00:44:00 +00:00
Cameron Gutman e0549f6100 [MSAFD]
- Use a linked list to store the socket information instead of allocating a massive array (1024 elements!) for each process in DllMain to hold all of the pointers
- Fix a massive memory leak (free the socket information which we leaked for every socket we allocated)
- This improves performance because we don't have to look through an array of stale socket information pointers (which we never actually removed from the socket information array in the old code) and the new code queues the socket information at the head of the list which makes newer sockets faster to access

svn path=/trunk/; revision=47646
2010-06-07 00:24:27 +00:00
Cameron Gutman 0b3f90dce4 Remove an unintended change
svn path=/trunk/; revision=47645
2010-06-06 23:49:27 +00:00
Daniel Reimer 8404cbb540 Add Opera 9 to rapps.
Update OOo to 3.2.1 and the last time... fix the FF2 link.

svn path=/trunk/; revision=47644
2010-06-06 23:45:20 +00:00
Cameron Gutman fbc1db9487 [MSAFD]
- Fix many times where we wait for an operation but don't update our status and return if it failed
- Fix the overlapped pending case in writing which was completely broken (callers would detect an error but GetLastError would return 0 because we didn't store the error in the lpErrno variable)
- Fix many times where we pass a pointer to an event that we close without waiting
- Fix a bug in WSPEnumNetworkEvents when we would set WSAEINVAL in the lpErrno variable but not return SOCKET_ERROR so the error got ignored

svn path=/trunk/; revision=47643
2010-06-06 23:07:26 +00:00
Cameron Gutman 444eec4511 [NDIS]
- Hold the miniport lock when we work with the timer queue
- Use the return value of KeSetTimer(Ex) to determine whether we need to queue the timer in our queue, otherwise we just use the entry that is already there
- Add more assertions

svn path=/trunk/; revision=47642
2010-06-06 22:08:40 +00:00
Cameron Gutman 6e1d1db7af Forgot to remove this ASSERT for r47636
svn path=/trunk/; revision=47639
2010-06-06 21:31:58 +00:00
Gregor Schneider 928accdc2c [WIN32K]
- Use TAG_KEYBOARD for keyboard layouts
- Free TAG_ACCEL and TAG_DRIVER allocations with their tags

svn path=/trunk/; revision=47637
2010-06-06 19:29:20 +00:00
Cameron Gutman c01132e4ff [NDIS]
- Only dequeue the timer in the DPC if the Period is 0 (which means that it's NOT a periodic timer so we only get called once)
- Attempt to dequeue the timer before inserting it so we don't end up with multiple copies of the same timer on the timer queue if somebody calls NdisMSet(Periodic)Timer twice

svn path=/trunk/; revision=47636
2010-06-06 19:18:19 +00:00
Gregor Schneider a4aeb090df [WIN32K]
- Use TAG_PALETTE for palette entries
- Remove mapping codes, the functions from pre r9000 don't even exist anymore

svn path=/trunk/; revision=47635
2010-06-06 19:11:52 +00:00
Gregor Schneider 218cfae51d [WIN32K] Use TAG_GDIICM tag for ICM allocations
svn path=/trunk/; revision=47634
2010-06-06 18:51:43 +00:00
Stefan Ginsberg 622c4a0919 [NTOS] Inline writing to PTEs through MI_WRITE_VALID/INVALID_PTE.
svn path=/trunk/; revision=47633
2010-06-06 18:45:46 +00:00
Gregor Schneider d607e811d9 [WIN32K] Free allocations with the tag that was used to allocate them
svn path=/trunk/; revision=47632
2010-06-06 18:34:57 +00:00
Gregor Schneider dd3d52b5ed [WIN32K] assert -> ASSERT
svn path=/trunk/; revision=47631
2010-06-06 18:32:57 +00:00
Cameron Gutman f44eee190b [NDIS]
- Implement miniport timer queuing
- Add some BUGCODE_ID_DRIVER bug check cases for missing interrupt deregistration, missing timer cancellation, and invalid IRQL when calling NdisMAllocateSharedMemory

svn path=/trunk/; revision=47630
2010-06-06 18:09:25 +00:00
Sir Richard d7372c2dc4 [NTOS]: Enable usage of ARM3 paged pool, up until Mm Phase 2.
[NTOS]: Re-arrange some of the init code, now that we have access to ARM3 paged pool early-on. Move more code to ARM3::INIT in its right place.
[NTOS]: Enable using the ARM3 PFN Database, getting rid of the old ReactOS PFN database. Should reduce physical memory usage now that we don't have two copies anymore.
[NTOS]: Fix the ARM3 PFN Datbase initialization code.
[NTOS]: Get rid of MiInitializePageList, use MiGetPfnEntryOffset instead of hard-coded pointer math in freelist.c.
This is the last big low-level Mm/ARM3 patch for a long, long time.

svn path=/trunk/; revision=47627
2010-06-06 15:59:42 +00:00
Sir Richard 55e7a4b5bf [COMPBATT]: Remove useless function.
svn path=/trunk/; revision=47626
2010-06-06 15:49:54 +00:00
Stefan Ginsberg 8e367dfc1b - Fix a comment and remove a superfluous extern.
svn path=/trunk/; revision=47625
2010-06-06 14:42:03 +00:00
Sir Richard 5867b89ee6 [NTOS]: Another one bites the dust, another one bites the dust. And another one gone and another one gone. Another one bites the dust, yeah. Out of the doorway the bullets rip, Repeating to the sound of the beat.
svn path=/trunk/; revision=47624
2010-06-06 14:24:18 +00:00
Sir Richard aa574a3c90 [NTOS]: A PFN entry is not necessarily physical only if it is higher than MmHighestPhysicalPage. It can also be physical if it lies in a memory hole within the min-max physical page range. We can detect this by using our PFN Bitmap. So replace all "Is this an I/O mapping?" checks with a check on whether or not the PFN Database entry is NULL (which will check for us both of these statements). This ought to be a macro...
svn path=/trunk/; revision=47623
2010-06-06 14:15:18 +00:00
Sir Richard abefb827e7 [NTOS]: Don't use MmAllocPage for the first paged pool PDE, instead, use MiRemoveZeroPage.
[NTOS]: Use MiInitializePfnForOtherProcess to setup the first paged pool PDE.

svn path=/trunk/; revision=47622
2010-06-06 14:13:35 +00:00
Sir Richard 49448736a2 [NTOS]: Implement MiRemoveZeroPage and MiZeroPhysicalPage.
Not yet used.

svn path=/trunk/; revision=47621
2010-06-06 14:12:28 +00:00
Sir Richard 08b2876a25 [NTOS]: Fix a loop off-by-one when saving the page table index in contigious memory allocation PFNs. Spotted by Stefan100.
svn path=/trunk/; revision=47620
2010-06-06 13:42:19 +00:00
Timo Kreuzer ebd10beb1f Add /KDSERIAL to the command line, to make sysreg able to bt in first stage.
svn path=/trunk/; revision=47615
2010-06-06 07:52:32 +00:00
Timo Kreuzer f301a8c2d3 [NTOSKNRL]
Add the possibility to break on all first chance exceptions, by passing /FIRSTCHANCE on the command line. Enable it temporary to get some more information from the sysreg crash.

svn path=/trunk/; revision=47614
2010-06-06 07:35:21 +00:00
Michael Martin 5e130771e7 [rtl]
- Fix a overlooked change needed due to mbstowcs fix. Use the number of WCHARs vice number of bytes to calculate end of xmlbuf. 


svn path=/trunk/; revision=47613
2010-06-06 07:21:53 +00:00
Sir Richard 854ff3471b [NTOS]: Clean up /mm a bit, move sysldr.c into ARM3.
svn path=/trunk/; revision=47608
2010-06-06 04:38:51 +00:00
Sir Richard 01194e41b9 [NTOS]: Silence more debug spew.
svn path=/trunk/; revision=47607
2010-06-06 04:37:53 +00:00
Sir Richard 143221853b [NTOS]: Fix for the the bug that broke ARM3 paged pool (and has been corrupting ReactOS paged pool behind the scenes for years):
When a KCB (key stuff) is allocated, the key name associated with it receives an NCB (name stuff). In case this name is already used, a cache exists, and an existing NCB is grabbed, and its reference count is increased. When the KCB goes away, its NCB loses a reference. When all references are gone, the NCB is destroyed. Simple enough.
        It turns out that what was currently happening is that an NCB would get dereferenced to 0, deleted, but still remained attached to a valid KCB (shouldn't happen). When that KCB went away, the NCB's reference count was dropped to... -1, and then -2, -3, -4, etc. Remember this is a FREED NCB. In other words, freed pool, that might now belong to someone else, was getting "-1" operations on it. So any value stored in that freed pool would get decremented by one. In ARM3 paged pool, because the allocator keeps a linked list, what would happen is that the FLINK pointer would be 0xE0F01234 instead of 0xE1A01234. What happened is that "0xE1A0" was treated as the reference count of the freed NCB, and it kept getting dereferenced down to 0xE0F0.
        Proving this was easy, by adding an ASSERT(Ncb->RefCount >= 1) to the routine that dereferences NCBs. Obviously, we should not try to dereference an NCB that has a reference count of 0, because that NCB is now gone. Adding this ASSERT immediately caught the error, regardless of which pool implementation was being used, so this was a problem in ReactOS today, right now.
        My first thought was that we were taking references to NCBs without incrementing the reference count. The NCB gets referenced in two places: when it gets created, and everytime a cached NCB is re-used for a new KCB (all this in CmpGetNameControlBlock).
	After adding some tracing code, I discovered that CmpGetNameControlBlock would sometimes return an NCB that was cached, but without referencing it. I did not understand why, since the code says "if (Found) Ncb->RefCount++".
        Further analysis showed that what would happen, on this particular instance, is that NCB "Foo" was being Found, but NCB "Bar" was returned instead. Therefore, causing some serious issues: First, NCB Foo was receiving too many references. Secondly, NCB Bar was not being referenced.
        Worse though, it turns out this would happen when "Foo" was the CORRECT NCB, and "Bar" was an INCORRECT NCB. What do we mean by correct and incorrect? Well, because NCBs are hashed, it's possible for two NCB hashes to be VERY SIMILAR, but only ONE OF THOSE NCBs will be the right one -- for example, HKLM\Software\Hello vs HKLM\Software\Hell.
        In our case, when a KCB for "Hello" was searching for the "Hello" NCB, the "Hello NCB would get a reference, but the "Hell" NCB would be returned. In other words, whenever a HASH COLLISION happened, the incorrect NCB was returned, probably messing up registry code in the process. Subsequently, when the KCB was dereferneced, it was attached to this incorrect, under-referenced NCB.
        Since in ANY hash collision with "Hell", in our example, the "Hell" NCB would come first, subsequent searches for "Hellmaster", "Hellboy", "Hello World" would all still return "Hell". Eventually when all these KCBs would go away, the "Hell" NCB would reach even -18 references.
        The simple solution? When the CORRECT NCB is found, STOP SEARCHING! By adding a simple "break" statement. Otherwise, even after the correct NCB is found, further, incorrect, collided NCBs are found, and eventually the last one ("Hell", in our example) got returned, and under-referenced, while "Hellmaster" and "Hellboy" were not returned, but LEAKED REFERENCES.
        There you have it folks, MEMORY CORRUPTION (USE-AFTER-FREE), INCORRECT REGISTRY NAME PARSHING, REFERENCE LEAKS and REFERENCE UNDERRUNS, all due to ONE missing "break;".
        -r

svn path=/trunk/; revision=47605
2010-06-06 01:04:03 +00:00
Sir Richard 570567b87e [NTOS]: Kill some debug spew.
svn path=/trunk/; revision=47604
2010-06-06 00:49:26 +00:00
Sir Richard c28fc63bf4 [NTOS]: Even after allowing ARM3 paged pool, we should still use the old allocator to free allocations made by the old allocator!
svn path=/trunk/; revision=47601
2010-06-05 19:32:46 +00:00
Sir Richard 5f1255ce5b [NTOS]: Fix up POOL_PREV_BLOCK based on suggestion by hpoussin.
[NTOS]: Fix up NTAPI location in function definition.
[NTOS]: Implement even more stringent header checks: ExpCheckPoolHeader and ExpCheckPoolBlocks. Normally we would only want this on a DBG build, but I am enabling them for now until I can fix paged pool. If your machine crashes, reverting this commit is NOT the solution (boots for me).
[NTOS]: Add a AllowPagedPool BOOLEAN that will allow us to selectively enable when the ARM3 pool can be used, playing around with the situation that causes the corruption, and perhaps making it easier to find/fix.

svn path=/trunk/; revision=47600
2010-06-05 19:19:28 +00:00
Sir Richard ed9f4ad2de [NTOS]: Kill debug spew.
svn path=/trunk/; revision=47599
2010-06-05 19:17:21 +00:00
Sir Richard 5d77839f4f [NTOS]: Fix Exp*PoolList macros. Also make then non-inlined, so we can see who called them in a stack trace.
[NTOS]: Enable them.
This boots on my system -- if it doesn't boot on yours, someone is corrupting your nonpaged pool. Reverting this patch is NOT the solution to your woes.

svn path=/trunk/; revision=47598
2010-06-05 18:26:15 +00:00
Jeffrey Morlan ffce25e515 [WIN32CSR]
- Implement basic support for history in line editing
- Reorganize code to reflect that line input is more coupled to history than it is to character input

svn path=/trunk/; revision=47597
2010-06-05 18:17:42 +00:00