reactos/ntoskrnl/ntoskrnl-generic.rbuild

512 lines
12 KiB
Plaintext
Raw Normal View History

<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../tools/rbuild/project.dtd">
<group xmlns:xi="http://www.w3.org/2001/XInclude">
<bootstrap installbase="$(CDOUTPUT)" />
<importlibrary definition="ntoskrnl.pspec" />
<define name="__NTOSKRNL__" />
<define name="_NTOSKRNL_" />
<define name="_NTSYSTEM_" />
<define name="_IN_KERNEL_" />
<define name="NTDDI_VERSION">0x05020400</define>
<if property="_WINKD_" value="1">
<define name="_WINKD_" />
</if>
<if property="_ELF_" value="1">
<define name="_ELF_" />
</if>
<include base="cmlib">.</include>
<include base="ntoskrnl">include</include>
<include base="ntoskrnl" root="intermediate"></include>
<include base="ntoskrnl" root="intermediate">include</include>
<include base="ntoskrnl" root="intermediate">include/internal</include>
<include base="ReactOS">include/reactos/drivers</include>
<library>csq</library>
<library>hal</library>
<library>pseh</library>
<library>cmlib</library>
<library>rtl</library>
<library>rossym</library>
<library>libcntpr</library>
<library>kdcom</library>
<library>bootvid</library>
<library>wdmguid</library>
<dependency>bugcodes</dependency>
<directory name="include">
<pch>ntoskrnl.h</pch>
</directory>
<directory name="ke">
<if property="ARCH" value="i386">
<directory name="i386">
<file>abios.c</file>
<file>cpu.c</file>
<file>context.c</file>
<file>ctxswitch.S</file>
<file>exp.c</file>
<file>irqobj.c</file>
<file>kiinit.c</file>
<file>ldt.c</file>
<file>mtrr.c</file>
<file>patpge.c</file>
<file>thrdini.c</file>
<file>trap.s</file>
Trap Handlers in C Patch 1 of X (Patch by Sir_Richard <ros.arm@reactos.org>): [NTOS]: The kernel normally does not save FPU state during Ring 0 transitions since the FPU should not be used. The one exception is when a kernel debugger is attached. Unfortunately, the latter check in ReactOS results in even "print on the serial line" to count as "debugger attached", and thus FPU state was almost always saved, slowing down traps significantly. [NTOS]: The kernel also does not typically save DRx (debug) registers unless they were in use. During an exception dispatch, they are zeroed out, and later during trap exit, if any debug register is set, DR7 is updated to enable that hardware breakpoint. Unfortunately, the code to clear the debug registers had a bug: DR2 was never cleared. Because DR2 ended up being a random stack value during trap frame generation, this caused a bogus address to be added to DR2, and DR7 would then enable the 2nd hardware breakpoint. This caused the kernel to always save DRx state, which is slow, and worse, could cause random hardware breakpoints to fire. [NTOS]: Start implementing trap handling in C. ASM trap handlers will now only be 5 lines of assembly including a function call to a C handler. All C handling code uses maximum two arguments and is all FASTCALL for efficiency. [NTOS]: Implement C versions of TRAP_PROLOG and TRAP_EPILOG. Implement C version of Ki386EoiHelper. Implement C version of CommonDispatchException (and helper) and KiFatalSystemException. Implement C version of CHECK_FOR_APC_DELIVER. Implement trap debugging checks as a separate entity instead of always doing them. [NTOS]: Add missing intrinsics for DS/ES/GS segment query. The kernel is now ready for some trap handling to be done in C. Due to the FPU/Debug fixes and relaxation of paranoid debug checks, the C code will likely be faster than the original assembly. svn path=/trunk/; revision=45000
2010-01-08 15:04:19 +00:00
<file>traphdlr.c</file>
<file>usercall_asm.S</file>
<file>usercall.c</file>
<file>v86vdm.c</file>
</directory>
</if>
<if property="ARCH" value="arm">
<directory name="arm">
<file first="true">boot.s</file>
<file>cpu.c</file>
<file>ctxswtch.s</file>
<file>exp.c</file>
<file>kiinit.c</file>
<file>stubs_asm.s</file>
<file>thrdini.c</file>
<file>trap.s</file>
<file>trapc.c</file>
- Rewrite the low-level trap/exception/system call code from the ground up: - Do not corrupt the stack anymore - Use a consistent trap frame layout (enable OldIrql and PreviousMode, and set the 0xBADB0D00 debug mark) - Use slower but more correct trap prolog/epilog code for now. - Generalize all prolog/epilog code into macros just like on x86. As a result, traps are now 6 lines of code. - Rewrite the system call interface from the ground up: - System calls didn't actually work: a debug print made the stack layout magical enough so that they didn't normally crush, but only slowly ate the stack. - Copying arguments from caller to system call was, as the comment on the original code so aptly put it, "total shit". - Due to ABI concerns, and to provide an actual template on how you're -supposed- to implement something like system calls on RISC processors, we now use a model similar to BSD, but about ten times better (with that much less code too). We'll document it later on the RosPSG Wiki. - This code probably contains some of the most vile-yet-elegant macro magic ever written for such low-level code as system call dispatching. - The result of all this is that we're at the same place as before (RamdiskAddDevice needs to be implemented by the Ramdisk guys) but with a sane low-level backend that isn't slowly eating away the stack, corrupting data, and basically working through random chance. - Move timebase code from stubs.c to its own file, time.c. - Silence multiple debug prints and fix a corrupted debug print in KiSystemStartup. svn path=/trunk/; revision=34366
2008-07-08 09:11:44 +00:00
<file>usercall.c</file>
</directory>
</if>
<if property="ARCH" value="powerpc">
<directory name="powerpc">
<file first="true">main_asm.S</file>
<file>cpu.c</file>
<file>exp.c</file>
<file>kiinit.c</file>
<file>ppc_irq.c</file>
<file>stubs.c</file>
<file>systimer.c</file>
<file>thrdini.c</file>
<file>ctxswitch.c</file>
<file>ctxhelp.S</file>
</directory>
</if>
<file>apc.c</file>
<file>balmgr.c</file>
<file>bug.c</file>
<file>clock.c</file>
<file>config.c</file>
<file>devqueue.c</file>
<file>dpc.c</file>
<file>eventobj.c</file>
<file>except.c</file>
<file>freeldr.c</file>
<file>freeze.c</file>
<file>gate.c</file>
<file>gmutex.c</file>
<file>ipi.c</file>
<file>krnlinit.c</file>
<file>mutex.c</file>
<file>procobj.c</file>
<file>profobj.c</file>
<file>queue.c</file>
<file>semphobj.c</file>
<file>spinlock.c</file>
<file>time.c</file>
<file>thrdschd.c</file>
<file>thrdobj.c</file>
<file>timerobj.c</file>
<file>wait.c</file>
</directory>
<directory name="cc">
<file>cacheman.c</file>
<file>copy.c</file>
<file>fs.c</file>
<file>mdl.c</file>
<file>pin.c</file>
<file>view.c</file>
</directory>
<directory name="config">
<if property="ARCH" value="i386">
<directory name="i386">
<file>cmhardwr.c</file>
</directory>
</if>
<if property="ARCH" value="arm">
<directory name="arm">
<file>cmhardwr.c</file>
</directory>
</if>
<if property="ARCH" value="powerpc">
<directory name="powerpc">
<file>cmhardwr.c</file>
</directory>
</if>
<file>cmalloc.c</file>
<file>cmapi.c</file>
<file>cmboot.c</file>
<file>cmcheck.c</file>
<file>cmcontrl.c</file>
<file>cmconfig.c</file>
<file>cmdata.c</file>
<file>cmdelay.c</file>
<file>cmindex.c</file>
<file>cminit.c</file>
<file>cmhvlist.c</file>
<file>cmhook.c</file>
<file>cmkcbncb.c</file>
<file>cmkeydel.c</file>
<file>cmlazy.c</file>
<file>cmmapvw.c</file>
<file>cmname.c</file>
<file>cmnotify.c</file>
<file>cmparse.c</file>
<file>cmquota.c</file>
<file>cmse.c</file>
<file>cmsecach.c</file>
<file>cmsysini.c</file>
<file>cmvalue.c</file>
<file>cmvalche.c</file>
<file>cmwraprs.c</file>
<file>ntapi.c</file>
</directory>
<directory name="dbgk">
<file>dbgkutil.c</file>
<file>dbgkobj.c</file>
</directory>
<directory name="ex" root="intermediate">
<file>zw.S</file>
</directory>
<directory name="ex">
<if property="ARCH" value="i386">
<directory name="i386">
<file>interlck_asm.S</file>
<file>fastinterlck_asm.S</file>
<file>ioport.S</file>
</directory>
</if>
<file>atom.c</file>
<file>callback.c</file>
<file>dbgctrl.c</file>
<file>efi.c</file>
<file>event.c</file>
<file>evtpair.c</file>
<file>exintrin.c</file>
<file>fastinterlck.c</file>
<file>fmutex.c</file>
<file>handle.c</file>
<file>harderr.c</file>
<file>hdlsterm.c</file>
<file>init.c</file>
<file>keyedevt.c</file>
<file>locale.c</file>
<file>lookas.c</file>
<file>mutant.c</file>
<file>pushlock.c</file>
<file>profile.c</file>
<file>resource.c</file>
<file>rundown.c</file>
<file>sem.c</file>
<file>shutdown.c</file>
<file>sysinfo.c</file>
<file>time.c</file>
<file>timer.c</file>
<file>uuid.c</file>
<file>win32k.c</file>
<file>work.c</file>
<file>xipdisp.c</file>
<file>zone.c</file>
</directory>
<directory name="fsrtl">
<file>dbcsname.c</file>
<file>fastio.c</file>
<file>faulttol.c</file>
<file>filelock.c</file>
<file>filter.c</file>
<file>filtrctx.c</file>
<file>fsfilter.c</file>
<file>fsrtlpc.c</file>
<file>largemcb.c</file>
<file>name.c</file>
<file>notify.c</file>
<file>oplock.c</file>
<file>pnp.c</file>
<file>stackovf.c</file>
<file>tunnel.c</file>
<file>unc.c</file>
</directory>
<directory name="fstub">
<file>disksup.c</file>
<file>fstubex.c</file>
<file>halstub.c</file>
</directory>
<directory name="inbv">
<file>inbv.c</file>
</directory>
<directory name="io">
<directory name="iomgr">
<file>adapter.c</file>
<file>arcname.c</file>
<file>bootlog.c</file>
<file>controller.c</file>
<file>device.c</file>
<file>deviface.c</file>
<file>driver.c</file>
<file>drvrlist.c</file>
<file>error.c</file>
<file>file.c</file>
<file>iocomp.c</file>
<file>ioevent.c</file>
<file>iofunc.c</file>
<file>iomdl.c</file>
<file>iomgr.c</file>
<file>iorsrce.c</file>
<file>iotimer.c</file>
<file>iowork.c</file>
<file>irp.c</file>
<file>irq.c</file>
<file>ramdisk.c</file>
<file>rawfs.c</file>
<file>remlock.c</file>
<file>util.c</file>
<file>symlink.c</file>
<file>volume.c</file>
</directory>
<directory name="pnpmgr">
<file>plugplay.c</file>
<file>pnpdma.c</file>
<file>pnpmgr.c</file>
<file>pnpnotify.c</file>
<file>pnpreport.c</file>
<file>pnproot.c</file>
</directory>
</directory>
<if property="_WINKD_" value="0">
<directory name="kd">
<if property="ARCH" value="i386">
<directory name="i386">
<file>kdmemsup.c</file>
</directory>
</if>
</directory>
</if>
<if property="_WINKD_" value="0">
<directory name="kdbg">
<if property="ARCH" value="i386">
<directory name="i386">
<if property="KDBG" value="1">
<group>
<file>i386-dis.c</file>
<file>kdb_help.S</file>
<file>longjmp.S</file>
<file>setjmp.S</file>
</group>
</if>
</directory>
</if>
<if property="KDBG" value="1">
<file>kdb.c</file>
<file>kdb_cli.c</file>
<file>kdb_expr.c</file>
<file>kdb_keyboard.c</file>
<file>kdb_serial.c</file>
</if>
<if property="DBG_OR_KDBG" value="true">
<file>kdb_symbols.c</file>
</if>
</directory>
<directory name="kd">
<directory name="wrappers">
<file>bochs.c</file>
<if property="ARCH" value="i386">
<file>gdbstub.c</file>
</if>
<if property="ARCH" value="powerpc">
<file>gdbstub_powerpc.c</file>
</if>
<file>kdbg.c</file>
</directory>
<file>kdinit.c</file>
<file>kdio.c</file>
<file>kdmain.c</file>
</directory>
</if>
<if property="_WINKD_" value ="1">
<directory name="kd64">
<if property="ARCH" value="i386">
<directory name="i386">
<file>kdx86.c</file>
</directory>
</if>
<if property="ARCH" value="amd64">
<directory name="amd64">
<file>kdx64.c</file>
</directory>
</if>
<if property="ARCH" value="arm">
<directory name="arm">
<file>kdarm.c</file>
</directory>
</if>
<file>kdapi.c</file>
<file>kdbreak.c</file>
<file>kddata.c</file>
<file>kdinit.c</file>
<file>kdlock.c</file>
<file>kdprint.c</file>
<file>kdtrap.c</file>
</directory>
</if>
<directory name="lpc">
<file>close.c</file>
<file>complete.c</file>
<file>connect.c</file>
<file>create.c</file>
<file>listen.c</file>
<file>port.c</file>
<file>reply.c</file>
<file>send.c</file>
</directory>
<directory name="mm">
<if property="ARCH" value="i386">
<directory name="i386">
<file>page.c</file>
</directory>
</if>
<if property="ARCH" value="arm">
<directory name="arm">
<file>page.c</file>
</directory>
</if>
<if property="ARCH" value="powerpc">
<directory name="powerpc">
<file>pfault.c</file>
<file>page.c</file>
</directory>
</if>
<directory name="ARM3">
<if property="ARCH" value="i386">
<directory name="i386">
<file>init.c</file>
</directory>
</if>
<if property="ARCH" value="arm">
<directory name="arm">
<file>init.c</file>
</directory>
</if>
- Reimplement MmAllocateContiguousMemory, MmAllocateContiguousMemorySpecifyCache, MmFreeContiguousMemory, MmFreeContiguousMemorySpecifyCache: - Use a smarter algorithm (as described here: http://www.microsoft.com/whdc/Driver/tips/ContigMem.mspx) to first try to satisfy the allocation by a simple nonpaged pool allocation (for cached requests only). - This range is then checked for physical continuity, since it's not guaranteed for non-initial-pool allocations (and right now in ReactOS, it never is). - As a fallback, Windows NT then attempts to scan free nonpaged pool pages. This is not yet implemented since the ReactOS nonpaged pool is not usually contiguous (to the level that NT's is). - When the ARM pool is implemented and replaces nonpaged pool, this code path will have to be implemented. - As a last resort, the actual PFN database is scanned for contiguous free pages. - ReactOS used MmGetContiguousPages for this, which blindly scanned the PFN database. New MiFindContinuousPages will scan the physical memory descriptor block recently implemented, which avoids going over pages we already know are going to be unusable. - The ReactOS function also held the PFN lock for the entire duration of the scan, which is significant on systems with large memory. Instead, we make an initial unsafe scan first, and only lock when we think we've found a correct range (and we'll then reconfirm the ranges). - Finally, the older function actually did a double-scan to try to avoid using memory ranges under 16MB, which was useless on today's systems and also rather inefficient. - Other than that, the actual setup of the PFN entry is copy-pasted from the old ReactOS function, so nothing's changed there -- the page still looks the same, but the selection algorithm is faster and more accurate. - Once the pages are found, we piggyback on the new I/O mapping mechanism (which uses System PTEs) instead of doing it all over by hand as before. - Since the underlying support is still System PTEs, once again, optimizations to that component will yield significant improvements here too. svn path=/trunk/; revision=41657
2009-06-28 05:43:12 +00:00
<file>contmem.c</file>
<file>drvmgmt.c</file>
<file>dynamic.c</file>
<file>expool.c</file>
<file>hypermap.c</file>
<file>iosup.c</file>
- Major rewrite of Memory Descriptor List (MDL) implementation (moving it towards using System PTEs). - MmCreateMdl, MmSizeOfMdl: No Change. - MmBuildMdlForNonPagedPool: Do not use MmGetPfnForProcess, just normal PMMPTE manipulation. - This seems to cause issues in certain scenarios, because in ReactOS, nonpaged pool, a resident and guaranteed resources, does not always have its PDEs mapped! - By calling MmGetPfnForProcess, this wound up in the annals of ReactOS mm code, which lazy-remapped the PDE. We detected this issue specifically in the cache manager, and fixed it there. It should not appear anywhere else. - MmAllocatePagesForMdl, MmAllocatePagesForMdlEx, MmFreePagesFromMdl: - The *Ex function is now implemented. - Allocating pages now uses MiAllocatePagesForMdl, which is based on the older MmAllocPagesSpecifyRange. - The code is cleaner, better commented, and better handles partial MDLs. - Cache flags are still ignored (so the Ex functionality isn't really there). - MmMapLockedPages, MmMapLockedPagesSpecifyCache, MmUnmapLockedPages: - These functions now use System PTEs for the mappings, instead of the hacked-up "MDL Mapping Space". - This frees up 256MB of Kernel Virtual Address Space. - Takes advantage of all System PTE functionality. - Once again, optimizations in the System PTE code will be felt here. - For user-space mappings however, the old code is still kept and used. - MiMapLockedPagesInUserSpace and MiUnMapLockedPagesInUserSpace are now in virtual.c and provide this. - MmProbeAndLockPages, MmUnlockPages: - The pages are actually probed now, in SEH. This did not seem to happen before (did someone misread the function's name?) - Probe for write is only done for write access to user pages (as documented). - We do not probe/check for write access for kernel requests (force Operation to be IoReadAccess). - Proper locking is used now: Address Space lock for user mappings, PFN lock for kernel mappings. - Faulting in pages (to make them available before locking) is now done outside the address space/PFN lock. - You don't want to be holding a spinlock/mutex while doing disk I/O! - For write/modify access, if the PTE is not writable, fail the request since the PTE protection overrides. - However, if the PTE is writable but also copy on write, then we'll fault the page in for write access, which is a legitimate operation for certain user-mode scenarios. - The old version always provided the CopyOnWrite behavior, even for non-CopyOnWrite pages! - Reference and lock every valid page that has a PFN entry (non-I/O Pages). - The older code did not seem to lock pages that had to be faulted in (weren't already valid). - Cleanup the cleanup code (no pun intended). Because we now mark the pages as locked early-on, and because of changes in MmUnlockPages, we can simply use MmUnlockPages in case of error, since it will be able to fully back-out and references/locks that we did. - Previous code attempted to do this on its own, in a pretty inconsistent manner, which would leave page leaks (both in references and lock count). - In MmUnlockPages, not as many changes, but we now: - Still make sure that an I/O Mapping MDL doesn't have valid PFN database pages (non-I/O). - An MDL can cover pages that are both I/O mapped and RAM mapped, so we have to unlock/dereference the latter instead of skipping them as the old code did. - Use the PFN lock when checking pages and unlocking/dereferencing them. - Overall, non-complete MDLs are now marked by having a -1 PFN, and the MDL code has been updated to early-break out of page-scanning loops and/or ignore such pages, which can happen in a sparse MDL. - Implementation has been tested on VMWare and QEMU for a variety of tasks and was found to be reliable and stable. svn path=/trunk/; revision=41707
2009-06-30 08:29:22 +00:00
<file>mdlsup.c</file>
<file>mminit.c</file>
<file>mmsup.c</file>
<file>ncache.c</file>
<file>pagfault.c</file>
<file>pfnlist.c</file>
<file>pool.c</file>
<file>procsup.c</file>
<file>syspte.c</file>
- Multiple Virtual Memory API fixes: - MiDoMappedcopy: The MDL should have 16 pages total, so MI_MAPPED_COPY_PAGES should be 14, not 16, to account for the MDL page itself, and the extra add-on page. - MiDoMappedCopy: Check for working set quota exception. - NtRead/WriteVirtualMemory: Do not attempt to do any work if the size is 0. - NtRead/WriteVirtualMemory: Do not return SEH status if we fail to write the number of bytes read/written -- return the function status. - NtProtectVirtualMemory: Protect the memory while attached to the target process. - NtProtectVirtualMemory: Do not return SEH status if we fail to write the number of bytes protected -- return the function status. - NtLock/UnlockVirtualMemory: Fix incorrect function definition. The last parameter is a bitfield. The middle two parameters are pointers, not values. - VirtualLock/Unlock: Fix calling NtLock/UnlockVirtualMemory with new correct function definitions. Call with MAP_PROCESS. - NtLock/UnlockVirtualMemory: Apply SEH. Validate flags. Validate parameters. - NtLock/UnlockVirtualMemory: Attach to the process while doing the operation. Reference the process. - NtLock/UnlockVirtualMemory: Check for SE_LOCK_MEMORY_PRIVILEGE if MAP_SYSTEM is specified. - Move MAP_SYSTEM and MAP_PROCESS from ntifs.h to mmtypes.h in NDK. - NtLock/UnlockVirtualMemory: Return success and semi-legitimate return values saying nothing was actually done. - NtFlushVirtualMemory: Apply SEH. Validate flags. Validate parameters. Call MmFlushVirtualMemory. - NtFlushVirtualMemory: Reference the process. - NtFlushVirtualMemory: Return success and semi-legitimate return values indicating nothing was flushed. - NtGetWriteWatch: Fix function prototype. - NtGet/ResetWriteWatch: Apply SEH instead of hacked parameter checks. Validate parameters. - NtGet/ResetWriteWatch: Reference the process. - NtGet/ResetWriteWatch: Return semi-legitimate return values indicating nothing was written to. - These APIs are now owned by ARM3. svn path=/trunk/; revision=43480
2009-10-15 16:50:49 +00:00
<file>virtual.c</file>
</directory>
<file>anonmem.c</file>
<file>balance.c</file>
<file>freelist.c</file>
<file>marea.c</file>
<if property="_WINKD_" value ="1">
<file>mmdbg.c</file>
</if>
<file>mmfault.c</file>
<file>mminit.c</file>
<file>mpw.c</file>
<file>pagefile.c</file>
<file>pageop.c</file>
<file>pe.c</file>
<file>ppool.c</file>
<file>procsup.c</file>
<file>region.c</file>
<file>rmap.c</file>
<file>section.c</file>
<file>sysldr.c</file>
<file>virtual.c</file>
<if property="_ELF_" value="1">
<file>elf32.c</file>
<file>elf64.c</file>
</if>
</directory>
<directory name="ob">
<file>obdir.c</file>
<file>obinit.c</file>
<file>obhandle.c</file>
<file>obname.c</file>
<file>oblife.c</file>
<file>obref.c</file>
<file>obsdcach.c</file>
<file>obsecure.c</file>
<file>oblink.c</file>
<file>obwait.c</file>
</directory>
<directory name="po">
<file>events.c</file>
<file>power.c</file>
<file>poshtdwn.c</file>
<file>povolume.c</file>
</directory>
<directory name="ps">
<if property="ARCH" value="i386">
<directory name="i386">
<file>psctx.c</file>
<file>psldt.c</file>
</directory>
</if>
<if property="ARCH" value="arm">
<directory name="arm">
<file>psctx.c</file>
</directory>
</if>
<file>debug.c</file>
<file>job.c</file>
<file>kill.c</file>
<file>psnotify.c</file>
<file>process.c</file>
<file>psmgr.c</file>
<file>query.c</file>
<file>quota.c</file>
<file>security.c</file>
<file>state.c</file>
<file>thread.c</file>
<file>win32.c</file>
</directory>
<directory name="rtl">
<if property="ARCH" value="arm">
<directory name="arm">
<file>rtlexcpt.c</file>
</directory>
</if>
<if property="ARCH" value="i386">
<directory name="i386">
<file>stack.S</file>
</directory>
</if>
<file>libsupp.c</file>
<file>misc.c</file>
</directory>
<directory name="se">
<file>access.c</file>
<file>acl.c</file>
<file>audit.c</file>
<file>lsa.c</file>
<file>priv.c</file>
<file>sd.c</file>
<file>semgr.c</file>
<file>sid.c</file>
<file>token.c</file>
</directory>
<directory name="vdm">
<if property="ARCH" value="i386">
<file>vdmmain.c</file>
<file>vdmexec.c</file>
</if>
</directory>
<directory name="wmi">
<file>wmi.c</file>
</directory>
<file>ntoskrnl.rc</file>
<linkerscript>ntoskrnl_$(ARCH).lnk</linkerscript>
</group>