Commit graph

44586 commits

Author SHA1 Message Date
Timo Kreuzer d731a4b9f1 [WIN32K]
Fix use of XFORMOBJ. Should fix gdi32_winetest clipping regression and release breakage.

svn path=/trunk/; revision=50349
2011-01-09 23:23:42 +00:00
Roel Messiant aed1ae8698 [NTOS]
Complete rewrite reserving and releasing of System PTEs.

The previous algorithm, in a nutshell, worked as follows:
- PTE clusters are in a singly linked list, ordered by their base address.
- All PTEs in the clusters are zeroed (except for cluster list bookkeeping).
- Upon reservation: Walk the list to get the first cluster that's large enough, cut the requested amount of PTEs off its tail and return them.
- Upon release: Create a new cluster using the PTEs to release, and merge it together with possible adjacent clusters.

Problems with the previous algorithm:
- While the idea is that all PTEs in clusters are zeroed, which requesters rely on, cluster bookkeeping isn't zeroed on merges.
  The side effect of this was that PTEs that weren't really zeroed were randomly delivered to requesters.
- 99% of the time, allocations are serviced using the first cluster in the list, which is virtually always the first suitable cluster.
  This is so because the ordering is based on the base address of the clusters, and allocations are serviced using the cluster tail.
  Because the first cluster starts out as the whole pool, and the pool is quite sizable, it can deal with virtually allocations.. for a while.
- A corollary of the previous point is *massive fragmentation* because: as long as an allocation isn't released back into the pool,
  the space of previous allocations that have been released isn't reused because the first cluster can't suck them up, and enough allocations remain in use.
- The combined effect of the previous two points: a first cluster that effectively shrinks mostly, with small clusters forming behind it.
  Once the first cluster has shrunk far enough (which of course takes a long time), 90% of the space may still be free, scattered in mostly small clusters.
  This would make decent sized allocations fail because of the heavy fragmentation.
- An implementation detail that caused the head of the list to be treated as a genuine cluster when the first cluster in the list was too small.
  The algorithm (as explained above) made this case quite unlikely until your system has been running for a while, after which it could happily
  corrupt list heads of other pools, depending on where the list head is with respect to its own pool.

Empirically obtained data revealed that after just *booting to the desktop*, the pool for System Pte Space entries
contained roughly 70 (unusable) clusters, blocking 15 to 20% of the pool. These figures increased to roughly 100
clusters and 30 to 35% after opening a foxy browser and using it to visit a mathematically inspired search engine.

The same data also showed that over 95% of allocations requested just a single PTE, and a noticable allocation spike
also occured in the range of 65-128 PTEs.  It should be clear optimizing for small allocations is a good idea,
and preferably encourage reuse the same PTEs for such allocations.

And the new algorithm was born:
- PTE clusters are in a singly linked list, ordered by increasing cluster size.
- All PTEs in the clusters are zeroed (except for cluster list bookkeeping) .. really this time!
- Upon reservation: Walk the list to get the first cluster that's large enough, cut the requested amount of PTEs off its tail and return them.
- Upon release: Create a new cluster using the PTEs to release, and merge it together with possible adjacent clusters.
- Both in the reservation and release actions, insertions into the list preserve the increasing cluster size order.

Empirically obtained data now revealed that after just booting to the desktop, the pool for System Pte Space entries
contained exactly 2 clusters.  This increased to 10 clusters after some minor internet browsing and watching a 5 minute video using a media player.


svn path=/trunk/; revision=50347
2011-01-09 20:52:22 +00:00
Timo Kreuzer 9cf739ac6f [WIN32K]
Cleanup pooltags a little, use official tags where known and applicable.

svn path=/trunk/; revision=50345
2011-01-09 19:51:06 +00:00
Timo Kreuzer c2c492d850 [WIN32K]
In GreCreateBitmapEx handle allocation failure in the rle hack path and set LastError, when failed to allocate bitmap bits.

svn path=/trunk/; revision=50344
2011-01-09 18:53:58 +00:00
Timo Kreuzer 39b87b357f [WIN32K]
- In BitmapFormat, allow intermediate bpp values, use ULONG as parameter type, instead of WORD and DWORD
- In NtGdiCreateBitmap get the real bpp value from the gajBitsPerFormat array
- Add back check of too large nWidth (needed to make sure, cjWidthBytes didn't overflow)
- Merge all parameter checks
- Check cPlanes and cBitsPixel paramters explicitly
- Use GreCreateBitmapEx
- Remove BITMAP_GetRealBitsPixel

svn path=/trunk/; revision=50343
2011-01-09 18:38:41 +00:00
Timo Kreuzer 3ecc17156e [WIN32K]
Improve NtGdiStretchDIBitsInternal, use _SEH2_YIELT instead of saving an NTSTATUS and handle the fast path in place instead of setting a BOOL variable. Fixes warnings about uninitialized variables.

svn path=/trunk/; revision=50342
2011-01-09 18:11:44 +00:00
Dmitry Gorbachev e6182247f6 [FREELDR]
Delete a duplicate line.

svn path=/trunk/; revision=50339
2011-01-09 15:11:49 +00:00
Timo Kreuzer 907aab7488 {GDI32]
Check paramters in CombineTransform

svn path=/trunk/; revision=50332
2011-01-08 19:24:29 +00:00
Timo Kreuzer c265d7532b [GDI32_APITEST]
Remove the stuff that shouldn't have been comitted.

svn path=/trunk/; revision=50331
2011-01-08 19:20:20 +00:00
Timo Kreuzer ae1bdd5334 [GDI32]
- Move EFLOAT handling in seperate file, its x86 specific
- Implement CombineTransform fully in usermode instead of forwarding to NtGdiCombineTransform
- Implement MatrixToXForm
- Implement GdiTransformPoints

svn path=/trunk/; revision=50330
2011-01-08 19:06:38 +00:00
Timo Kreuzer 281dd88c8c [GDI32_APITEST]
Add tests for CombineTransform and MaskBlt

svn path=/trunk/; revision=50329
2011-01-08 18:56:38 +00:00
Timo Kreuzer 7cea632244 [GDI32]
Implement GdiGetDcAttr. Just for convenience / cleaner code.

svn path=/trunk/; revision=50321
2011-01-08 12:19:23 +00:00
Aleksey Bragin 1e3d9c9a96 [HEAP]
- Peer review rocks.

svn path=/trunk/; revision=50319
2011-01-08 11:32:55 +00:00
Timo Kreuzer c413c22ddf [CRT]
Fix _flsbuf return value

svn path=/trunk/; revision=50314
2011-01-07 21:15:35 +00:00
Amine Khaldi 7f7729cb6c [CMAKE]
- Add ntdll apitest to build.

svn path=/trunk/; revision=50312
2011-01-07 20:31:56 +00:00
Timo Kreuzer b58a3e9752 [NTDLL_APITEST]
Convert asm to GAS/ML compatible format

svn path=/trunk/; revision=50311
2011-01-07 20:11:56 +00:00
Aleksey Bragin a3647b9727 [HEAP]
- Fix a typo (assignment) in the ASSERT, spotted by Johannes Anderwald.

svn path=/trunk/; revision=50309
2011-01-07 15:33:46 +00:00
Timo Kreuzer ca4ebe1b55 [WIN32K]
- Use if, instead of switch to handle flags in XFORMOBJ_bXformFixPoints
- Define XFORMOBJ to EXFORMOBJ, a stack object that links to the matrix
- There is no spoon.

svn path=/trunk/; revision=50307
2011-01-06 22:00:26 +00:00
Jérôme Gardou 38bbc45b31 [APITESTS:GDI32]
Add missing \n

svn path=/trunk/; revision=50306
2011-01-06 19:03:09 +00:00
Michael Martin 686accee7c [usb/usbehci]:
- EhciDefferedRoutine: Only free Mdl if one was created when the request was added to the queue.
- Dont assume that three transfer descriptors need to be freed, use a while moving to each linked and free instead.
- Yabba Dabba Doo added to increase size of message. :)


svn path=/trunk/; revision=50304
2011-01-06 18:45:18 +00:00
Michael Martin e11ab1740c [usb/usbehci]:
- Implement URB_FUNCTION_SELECT_INTERFACE.
- Add missing IoMarkIrpPending before calling SubmitControlRequest.
- Now use BuildSetupPacketFromURB for creating the CtrlSetup data structure.
- When selecting configuration, make the ConfigurationHandle from the related UsbDevice instead of always the RootHub device.
- Fix typo that caused all pipes to be marked as interrupt type.
- Change CompletePendingURBRequest to only complete one SCE request Irp.

svn path=/trunk/; revision=50303
2011-01-06 18:29:52 +00:00
Michael Martin 748ea2de6c [usb/usbehci]:
- Fix bug in InitializeUsbDevice that caused endpoints to be duplicated in internal config structure.
- Fix implementation of UsbRemoveDevice.
- Implement SetDeviceHandleData and RestoreUsbDevice.
- SubmitControlTransfer: Not all control request need data, in which case dont create a MDL and a PID_CODE_IN_TOKEN TD Descriptor.
- Fix bug in ReleaseMemory that caused memory not to be marked as free.
- Fix incorrect memory header size that resulted in memory corruption.

svn path=/trunk/; revision=50302
2011-01-06 17:46:59 +00:00
Daniel Reimer 6d1907d27b Update rapps database
svn path=/trunk/; revision=50297
2011-01-06 12:44:01 +00:00
Timo Kreuzer 506c53833e [WIN32K]
Fix a bug in FLOATOBJ_DivLong

svn path=/trunk/; revision=50296
2011-01-06 00:19:40 +00:00
Timo Kreuzer 2f04a69915 [CRT]
Fix build

svn path=/trunk/; revision=50291
2011-01-04 22:29:43 +00:00
Timo Kreuzer 79ec14277f [CRT]
- Rewrite broken _flsbuf and implement _flswbuf
- use _flswbuf in wstreamout
- Fixes broken text output in dwnl etc

svn path=/trunk/; revision=50290
2011-01-04 22:22:13 +00:00
Sylvain Petreolle 6ea6bad914 TRANSLATION: Fix browseui bulgarian resource filename.
svn path=/trunk/; revision=50289
2011-01-04 22:19:45 +00:00
Timo Kreuzer 768bb41032 [WIN32K]
- Fix type of DCLEVEL::prgnClip / prgnMeta (PVOID -> PREGION)
- Move NtGdiGetRandomRgn to dcobjs.c

svn path=/trunk/; revision=50288
2011-01-04 18:18:28 +00:00
Johannes Anderwald 00b94dd55a [CRT]
- Fix build

svn path=/trunk/; revision=50287
2011-01-04 17:52:34 +00:00
Johannes Anderwald 2a21adaff0 [CRT]
- Set errno when a overflow occurs in strtoull
- Fixes 2 wine tests failures in msvcrt:string

svn path=/trunk/; revision=50286
2011-01-04 17:29:10 +00:00
Johannes Anderwald 14baaa8cb2 [MSVCRT_WINETEST]
- Revert 50283

svn path=/trunk/; revision=50285
2011-01-04 17:27:57 +00:00
Roel Messiant 7b455367ff [KERNEL32]
- ReadDirectoryChangesW: Treat the OVERLAPPED structure as an IO_STATUS_BLOCK, not one of its fields.

svn path=/trunk/; revision=50284
2011-01-04 17:26:25 +00:00
Timo Kreuzer ca2b0ca3a7 [WIN32K]
- Simplify error checks, by reordering code in NtGdiScaleViewportExtEx
- Simplify exception handling, use _SEH2_YIELD
- Change function order
- Minor code improvements

svn path=/trunk/; revision=50283
2011-01-04 16:53:23 +00:00
Johannes Anderwald 131fb32a3c [MSVCRT_WINETEST]
- Comment out test which fails in WinXP SP3

svn path=/trunk/; revision=50282
2011-01-04 16:45:03 +00:00
Timo Kreuzer 53d46bda12 [WIN32K]
- Access the DC member directly instead of using IntGdiGetDCOrg
- Remove unused IntGdiGetDCOrg, GdiSetDCOrg, GdiGetDCOrgEx

svn path=/trunk/; revision=50281
2011-01-04 15:52:59 +00:00
Timo Kreuzer c855b45934 [WIN32K]
Implement NtGdiGetBoundsRect and NtGdiSetBoundsRect. Patch by Samuel Serapion with modifications by me.

svn path=/trunk/; revision=50280
2011-01-04 12:36:19 +00:00
Timo Kreuzer 391de4dea7 fix build
svn path=/trunk/; revision=50279
2011-01-03 20:00:25 +00:00
Timo Kreuzer 316a3efbac [CRT]
Fix a number of errors in floating point output.

svn path=/trunk/; revision=50278
2011-01-03 19:39:17 +00:00
Sylvain Petreolle 6d8a71b4a4 [CMAKE]
Add apitests and pseh2_test.


svn path=/trunk/; revision=50277
2011-01-03 11:24:54 +00:00
Timo Kreuzer 09f4598c1d [CRT]
Enable new printf implementation.

svn path=/trunk/; revision=50276
2011-01-03 11:22:46 +00:00
Timo Kreuzer a457cc5898 [CRT]
Fix a bug in _ecvt that makes msvcrt_winetest::printf crash

svn path=/trunk/; revision=50275
2011-01-03 11:00:28 +00:00
Timo Kreuzer 6cdeeb6a1e [CRT]
Fix several bugs in new printf implementation.

svn path=/trunk/; revision=50274
2011-01-03 10:33:58 +00:00
Timo Kreuzer 92487266d8 [CRT]
Improve new printf implementation:
- remove duplicated code and implement a generic function for all (v)s(w)(n)printf
- don't call _flsbuf for string streams, while this works on windows, it doesn't work correctly on reactos (bug!)
- Fix return error codes

svn path=/trunk/; revision=50273
2011-01-03 01:07:54 +00:00
Roel Messiant 916ec376d6 [SETUPAPI]
- SetupDiClassNameFromGuidExW: Simplify interaction with registry.
- SetupDiCreateDeviceInfoW: Check for correct error value.
- SetupDiGetClassDescriptionExW: Rewrite to return the correct required size and prevent WCHAR sized buffer overflow.
- SetupDiGetClassDevsExW: Return INVALID_HANDLE_VALUE instead of NULL in failure case.

svn path=/trunk/; revision=50272
2011-01-03 00:45:34 +00:00
Timo Kreuzer 1cd9389032 [MSVCRT]
Apply a hack to msvcrt spec file to avoid duplicate definition of atexit. Mingw-w64 has an identical hack.

svn path=/trunk/; revision=50270
2011-01-02 21:17:03 +00:00
Timo Kreuzer 0f4c9e54a4 [MINGW]
Revert r50267 

svn path=/trunk/; revision=50269
2011-01-02 21:14:58 +00:00
Timo Kreuzer 1e9ed4c977 [MSVCRT_WINETEST]
Link explicitly to msvcrt, instead of importing half of the functions from ntdll.

svn path=/trunk/; revision=50268
2011-01-02 20:39:40 +00:00
Timo Kreuzer ad11d9e21a [MINGW]
Don't compile atonexit.c. atexit is exported from msvcrt.

svn path=/trunk/; revision=50267
2011-01-02 20:38:42 +00:00
Timo Kreuzer d8b80d9d78 [MSVCRT]
Don't export _matherr

svn path=/trunk/; revision=50266
2011-01-02 20:15:14 +00:00
Eric Kohl 4176a64858 [RBUILD]
Fix "format not a string literal and no format arguments" build warnings.

svn path=/trunk/; revision=50265
2011-01-02 20:04:53 +00:00