From 909e90acebc3cfcb26e0f944433ec6cc2ff074ac Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 2 Jan 2010 20:03:49 +0000 Subject: [PATCH 001/121] [HAL] - Use spinlock.h from ntoskrnl, instead of duplicating the definitions - Use one spinlock.c, but compiled for 2 static libs (hal_generic_up and hal_generic_mp) - Move HalpAcquireSystemHardwareSpinLock and HalpReleaseCmosSpinLock to spinlock.c and use the inline functions for the kernel to make Arch happy. svn path=/branches/ros-amd64-bringup/; revision=44894 --- reactos/hal/halx86/directory.rbuild | 1 + reactos/hal/halx86/generic/cmos.c | 44 ---- reactos/hal/halx86/{up => generic}/spinlock.c | 137 ++++-------- reactos/hal/halx86/hal_generic_mp.rbuild | 18 ++ reactos/hal/halx86/hal_generic_up.rbuild | 4 +- reactos/hal/halx86/halmps.rbuild | 2 +- reactos/hal/halx86/mp/i386/spinlock.c | 201 ------------------ 7 files changed, 67 insertions(+), 340 deletions(-) rename reactos/hal/halx86/{up => generic}/spinlock.c (70%) create mode 100644 reactos/hal/halx86/hal_generic_mp.rbuild delete mode 100644 reactos/hal/halx86/mp/i386/spinlock.c diff --git a/reactos/hal/halx86/directory.rbuild b/reactos/hal/halx86/directory.rbuild index 4d5a2199bd5..e10afdc1dc9 100644 --- a/reactos/hal/halx86/directory.rbuild +++ b/reactos/hal/halx86/directory.rbuild @@ -4,6 +4,7 @@ + diff --git a/reactos/hal/halx86/generic/cmos.c b/reactos/hal/halx86/generic/cmos.c index abcf18f970a..fcede5dac6d 100644 --- a/reactos/hal/halx86/generic/cmos.c +++ b/reactos/hal/halx86/generic/cmos.c @@ -16,54 +16,10 @@ /* GLOBALS *******************************************************************/ -KSPIN_LOCK HalpSystemHardwareLock; UCHAR HalpCmosCenturyOffset; -ULONG HalpSystemHardwareFlags; /* PRIVATE FUNCTIONS *********************************************************/ -VOID -NTAPI -HalpAcquireSystemHardwareSpinLock(VOID) -{ - ULONG Flags; - - /* Get flags and disable interrupts */ - Flags = __readeflags(); - _disable(); - - /* Try to acquire the lock */ - while (InterlockedBitTestAndSet((PLONG)&HalpSystemHardwareLock, 0)) - { - /* Lock is held, spin until it's free */ - while (*(volatile ULONG*)HalpSystemHardwareLock & 1) - YieldProcessor(); - } - - /* We have the lock, save the flags now */ - HalpSystemHardwareFlags = Flags; -} - -VOID -NTAPI -HalpReleaseCmosSpinLock(VOID) -{ - ULONG Flags; - - /* Get the flags */ - Flags = HalpSystemHardwareFlags; - - /* Release lock and check if we owned it */ - if (!InterlockedBitTestAndReset((PLONG)&HalpSystemHardwareLock, 0)) - { - /* The spin lock was not owned! */ - KeBugCheckEx(SPIN_LOCK_NOT_OWNED, 0, 0, 0, 0); - } - - /* Restore the flags */ - __writeeflags(Flags); -} - FORCEINLINE UCHAR HalpReadCmos(IN UCHAR Reg) diff --git a/reactos/hal/halx86/up/spinlock.c b/reactos/hal/halx86/generic/spinlock.c similarity index 70% rename from reactos/hal/halx86/up/spinlock.c rename to reactos/hal/halx86/generic/spinlock.c index ef0672688fc..6febfdafcd0 100644 --- a/reactos/hal/halx86/up/spinlock.c +++ b/reactos/hal/halx86/generic/spinlock.c @@ -4,6 +4,7 @@ * FILE: hal/halx86/up/spinlock.c * PURPOSE: Spinlock and Queued Spinlock Support * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) + * Timo Kreuzer (timo.kreuzer@reactos.org) */ /* INCLUDES ******************************************************************/ @@ -15,106 +16,20 @@ #define NDEBUG #include +#include + #undef KeAcquireSpinLock #undef KeReleaseSpinLock -// -// This is duplicated from ke_x.h -// -#ifdef CONFIG_SMP -// -// Spinlock Acquisition at IRQL >= DISPATCH_LEVEL -// -FORCEINLINE -VOID -KxAcquireSpinLock(IN PKSPIN_LOCK SpinLock) -{ - /* Make sure that we don't own the lock already */ - if (((KSPIN_LOCK)KeGetCurrentThread() | 1) == *SpinLock) - { - /* We do, bugcheck! */ - KeBugCheckEx(SPIN_LOCK_ALREADY_OWNED, (ULONG_PTR)SpinLock, 0, 0, 0); - } +/* GLOBALS *******************************************************************/ - for (;;) - { - /* Try to acquire it */ - if (InterlockedBitTestAndSet((PLONG)SpinLock, 0)) - { - /* Value changed... wait until it's locked */ - while (*(volatile KSPIN_LOCK *)SpinLock == 1) - { -#ifdef DBG - /* On debug builds, we use a much slower but useful routine */ - //Kii386SpinOnSpinLock(SpinLock, 5); - - /* FIXME: Do normal yield for now */ - YieldProcessor(); -#else - /* Otherwise, just yield and keep looping */ - YieldProcessor(); -#endif - } - } - else - { -#ifdef DBG - /* On debug builds, we OR in the KTHREAD */ - *SpinLock = (KSPIN_LOCK)KeGetCurrentThread() | 1; -#endif - /* All is well, break out */ - break; - } - } -} - -// -// Spinlock Release at IRQL >= DISPATCH_LEVEL -// -FORCEINLINE -VOID -KxReleaseSpinLock(IN PKSPIN_LOCK SpinLock) -{ -#ifdef DBG - /* Make sure that the threads match */ - if (((KSPIN_LOCK)KeGetCurrentThread() | 1) != *SpinLock) - { - /* They don't, bugcheck */ - KeBugCheckEx(SPIN_LOCK_NOT_OWNED, (ULONG_PTR)SpinLock, 0, 0, 0); - } -#endif - /* Clear the lock */ - InterlockedAnd((PLONG)SpinLock, 0); -} - -#else - -// -// Spinlock Acquire at IRQL >= DISPATCH_LEVEL -// -FORCEINLINE -VOID -KxAcquireSpinLock(IN PKSPIN_LOCK SpinLock) -{ - /* On UP builds, spinlocks don't exist at IRQL >= DISPATCH */ - UNREFERENCED_PARAMETER(SpinLock); -} - -// -// Spinlock Release at IRQL >= DISPATCH_LEVEL -// -FORCEINLINE -VOID -KxReleaseSpinLock(IN PKSPIN_LOCK SpinLock) -{ - /* On UP builds, spinlocks don't exist at IRQL >= DISPATCH */ - UNREFERENCED_PARAMETER(SpinLock); -} - -#endif +ULONG HalpSystemHardwareFlags; +KSPIN_LOCK HalpSystemHardwareLock; /* FUNCTIONS *****************************************************************/ +#ifdef _M_IX86 + /* * @implemented */ @@ -347,3 +262,39 @@ KeLowerIrql(KIRQL NewIrql) /* Call the fastcall function */ KfLowerIrql(NewIrql); } + +#endif + +VOID +NTAPI +HalpAcquireSystemHardwareSpinLock(VOID) +{ + ULONG Flags; + + /* Get flags and disable interrupts */ + Flags = __readeflags(); + _disable(); + + /* Acquire the lock */ + KxAcquireSpinLock(&HalpSystemHardwareLock); + + /* We have the lock, save the flags now */ + HalpSystemHardwareFlags = Flags; +} + +VOID +NTAPI +HalpReleaseCmosSpinLock(VOID) +{ + ULONG Flags; + + /* Get the flags */ + Flags = HalpSystemHardwareFlags; + + /* Release the lock */ + KxReleaseSpinLock(&HalpSystemHardwareLock); + + /* Restore the flags */ + __writeeflags(Flags); +} + diff --git a/reactos/hal/halx86/hal_generic_mp.rbuild b/reactos/hal/halx86/hal_generic_mp.rbuild new file mode 100644 index 00000000000..ef15e7dcaa6 --- /dev/null +++ b/reactos/hal/halx86/hal_generic_mp.rbuild @@ -0,0 +1,18 @@ + + + + + include + include + + + + spinlock.c + + + + irq.S + + + + diff --git a/reactos/hal/halx86/hal_generic_up.rbuild b/reactos/hal/halx86/hal_generic_up.rbuild index 81f8e7e5457..b9c40a2b4b0 100644 --- a/reactos/hal/halx86/hal_generic_up.rbuild +++ b/reactos/hal/halx86/hal_generic_up.rbuild @@ -5,11 +5,13 @@ include include + + spinlock.c + processor.c irq.S - spinlock.c diff --git a/reactos/hal/halx86/halmps.rbuild b/reactos/hal/halx86/halmps.rbuild index 35c2556ba2e..c462e7911a6 100644 --- a/reactos/hal/halx86/halmps.rbuild +++ b/reactos/hal/halx86/halmps.rbuild @@ -9,6 +9,7 @@ hal_generic + hal_generic_mp ntoskrnl apic.c @@ -22,7 +23,6 @@ mps.S mpsboot.asm - spinlock.c diff --git a/reactos/hal/halx86/mp/i386/spinlock.c b/reactos/hal/halx86/mp/i386/spinlock.c deleted file mode 100644 index 40be47d6daa..00000000000 --- a/reactos/hal/halx86/mp/i386/spinlock.c +++ /dev/null @@ -1,201 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/hal/x86/spinlock.c - * PURPOSE: Implements spinlocks - * PROGRAMMER: David Welch (welch@cwcom.net) - * Eric Kohl (ekohl@rz-online.de) - * UPDATE HISTORY: - * 09/06/2000 Created - */ - -/* - * NOTE: On a uniprocessor machine spinlocks are implemented by raising - * the irq level - */ - -/* INCLUDES ****************************************************************/ - -#include -#define NDEBUG -#include - -/* Hmm, needed for KDBG := 1. Why? */ -#undef KeGetCurrentIrql - -/* FUNCTIONS ***************************************************************/ - -#undef KeAcquireSpinLock -VOID NTAPI -KeAcquireSpinLock ( - PKSPIN_LOCK SpinLock, - PKIRQL OldIrql - ) -/* - * FUNCTION: Acquires a spinlock - * ARGUMENTS: - * SpinLock = Spinlock to acquire - * OldIrql (OUT) = Caller supplied storage for the previous irql - */ -{ - *OldIrql = KfAcquireSpinLock(SpinLock); -} - -KIRQL FASTCALL -KeAcquireSpinLockRaiseToSynch ( - PKSPIN_LOCK SpinLock - ) -{ - KIRQL OldIrql; - - OldIrql = KfRaiseIrql(CLOCK2_LEVEL); - KiAcquireSpinLock(SpinLock); - - return OldIrql; -} - -#undef KeReleaseSpinLock -VOID NTAPI -KeReleaseSpinLock ( - PKSPIN_LOCK SpinLock, - KIRQL NewIrql - ) -/* - * FUNCTION: Releases a spinlock - * ARGUMENTS: - * SpinLock = Spinlock to release - * NewIrql = Irql level before acquiring the spinlock - */ -{ - KfReleaseSpinLock(SpinLock, NewIrql); -} - -LOGICAL -FASTCALL -KeTryToAcquireQueuedSpinLock( - KSPIN_LOCK_QUEUE_NUMBER LockNumber, - PKIRQL OldIrql) -{ - UNIMPLEMENTED; - - return FALSE; -} - - -BOOLEAN -FASTCALL -KeTryToAcquireQueuedSpinLockRaiseToSynch( - KSPIN_LOCK_QUEUE_NUMBER LockNumber, - PKIRQL OldIrql) -{ - UNIMPLEMENTED; - - return FALSE; -} - -KIRQL FASTCALL -KfAcquireSpinLock ( - PKSPIN_LOCK SpinLock - ) -{ - KIRQL OldIrql; - - ASSERT(KeGetCurrentIrql() <= DISPATCH_LEVEL); - - OldIrql = KfRaiseIrql(DISPATCH_LEVEL); - KiAcquireSpinLock(SpinLock); - - return OldIrql; -} - -VOID FASTCALL -KfReleaseSpinLock ( - PKSPIN_LOCK SpinLock, - KIRQL NewIrql - ) -/* - * FUNCTION: Releases a spinlock - * ARGUMENTS: - * SpinLock = Spinlock to release - * NewIrql = Irql level before acquiring the spinlock - */ -{ - ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL || KeGetCurrentIrql() == SYNCH_LEVEL); - KiReleaseSpinLock(SpinLock); - KfLowerIrql(NewIrql); -} - - -/* - * @unimplemented - */ -VOID -FASTCALL -KeAcquireInStackQueuedSpinLock( - IN PKSPIN_LOCK SpinLock, - IN PKLOCK_QUEUE_HANDLE LockHandle - ) -{ - UNIMPLEMENTED; -} - -/* - * @unimplemented - */ -VOID -FASTCALL -KeAcquireInStackQueuedSpinLockRaiseToSynch( - IN PKSPIN_LOCK SpinLock, - IN PKLOCK_QUEUE_HANDLE LockHandle - ) -{ - UNIMPLEMENTED; -} - - -/* - * @unimplemented - */ -VOID -FASTCALL -KeReleaseInStackQueuedSpinLock( - IN PKLOCK_QUEUE_HANDLE LockHandle - ) -{ - UNIMPLEMENTED; -} - -/* - * @unimplemented - */ -KIRQL -FASTCALL -KeAcquireQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER Number) -{ - UNIMPLEMENTED; - return 0; -} - -/* - * @unimplemented - */ -KIRQL -FASTCALL -KeAcquireQueuedSpinLockRaiseToSynch(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber) -{ - UNIMPLEMENTED; - return 0; -} - -/* - * @unimplemented - */ -VOID -FASTCALL -KeReleaseQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER Number, - IN KIRQL OldIrql) -{ - UNIMPLEMENTED; -} - -/* EOF */ From 3db737a2985252cd5e00af2a0fc904f30215a612 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 2 Jan 2010 20:07:14 +0000 Subject: [PATCH 002/121] [KE] Add a comment to Kii386SpinOnSpinLock that it might be called from HAL with interrupts disabled svn path=/branches/ros-amd64-bringup/; revision=44895 --- reactos/ntoskrnl/ke/spinlock.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/reactos/ntoskrnl/ke/spinlock.c b/reactos/ntoskrnl/ke/spinlock.c index 0a98b330fd0..36ac6ab0e77 100644 --- a/reactos/ntoskrnl/ke/spinlock.c +++ b/reactos/ntoskrnl/ke/spinlock.c @@ -467,6 +467,8 @@ Kii386SpinOnSpinLock(PKSPIN_LOCK SpinLock, ULONG Flags) while (*(volatile KSPIN_LOCK *)SpinLock & 1) { // FIXME: Check for timeout + // Warning: this function might be called from HAL with interrupts + // disabled. /* Yield and keep looping */ YieldProcessor(); From 1ee5ad30ab87803b496f90928e8eb980aab21419 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Mon, 4 Jan 2010 22:12:18 +0000 Subject: [PATCH 003/121] [HAL] Implement HalInitializeBios, x86BiosAllocateBuffer, x86BiosFreeBuffer, x86BiosReadMemory and x86BiosWriteMemory Halfplement x86BiosCall (We don't have the necessary emulator yet) svn path=/branches/ros-amd64-bringup/; revision=44934 --- reactos/hal/halx86/generic/x86bios.c | 284 +++++++++++++++++++++++++-- 1 file changed, 266 insertions(+), 18 deletions(-) diff --git a/reactos/hal/halx86/generic/x86bios.c b/reactos/hal/halx86/generic/x86bios.c index d47ecff47c5..129119d9ec8 100644 --- a/reactos/hal/halx86/generic/x86bios.c +++ b/reactos/hal/halx86/generic/x86bios.c @@ -3,7 +3,7 @@ * LICENSE: See COPYING in the top level directory * FILE: hal/halamd64/generic/x86bios.c * PURPOSE: - * PROGRAMMERS: + * PROGRAMMERS: Timo Kreuzer (timo.kreuzer@reactos.org) */ /* INCLUDES ******************************************************************/ @@ -12,6 +12,78 @@ //#define NDEBUG #include +/* This page serves as fallback for pages used by Mm */ +#define DEFAULT_PAGE 0x21 + +/* GLOBALS *******************************************************************/ + +BOOLEAN x86BiosIsInitialized; +LONG x86BiosBufferIsAllocated = 0; +PUCHAR x86BiosMemoryMapping; + +VOID +NTAPI +HalInitializeBios(ULONG Unknown, PLOADER_PARAMETER_BLOCK LoaderBlock) +{ + PPFN_NUMBER PfnArray; + PFN_NUMBER Pfn, Last; + PMEMORY_ALLOCATION_DESCRIPTOR Descriptor; + PLIST_ENTRY ListEntry; + PMDL Mdl; + + /* Allocate an MDL for 1MB */ + Mdl = IoAllocateMdl(NULL, 0x100000, FALSE, FALSE, NULL); + if (!Mdl) + { + ASSERT(FALSE); + } + + /* Get pointer to the pfn array */ + PfnArray = MmGetMdlPfnArray(Mdl); + + /* Fill the array with low memory PFNs */ + for (Pfn = 0; Pfn < 0x100; Pfn++) + { + PfnArray[Pfn] = Pfn; + } + + /* Loop the memory descriptors */ + for (ListEntry = LoaderBlock->MemoryDescriptorListHead.Flink; + ListEntry != &LoaderBlock->MemoryDescriptorListHead; + ListEntry = ListEntry->Flink) + { + /* Get the memory descriptor */ + Descriptor = CONTAINING_RECORD(ListEntry, + MEMORY_ALLOCATION_DESCRIPTOR, + ListEntry); + + /* Check if the memory is in the low range */ + if (Descriptor->BasePage < 0x100) + { + /* Check if the memory type is firmware */ + if (Descriptor->MemoryType != LoaderFirmwarePermanent && + Descriptor->MemoryType != LoaderFirmwarePermanent) + { + /* It's something else, so don't use it! */ + Last = min(Descriptor->BasePage + Descriptor->PageCount, 0x100); + for (Pfn = Descriptor->BasePage; Pfn < Last; Pfn++) + { + /* Set each page to the default page */ + PfnArray[Pfn] = DEFAULT_PAGE; + } + } + } + } + + /* Map the MDL to system space */ + x86BiosMemoryMapping = MmGetSystemAddressForMdlSafe(Mdl, HighPagePriority); + ASSERT(x86BiosMemoryMapping); + + DPRINT1("memory: %p, %p\n", *(PVOID*)x86BiosMemoryMapping, *(PVOID*)(x86BiosMemoryMapping + 8)); + + x86BiosIsInitialized = TRUE; +} + NTSTATUS NTAPI x86BiosAllocateBuffer ( @@ -19,19 +91,26 @@ x86BiosAllocateBuffer ( USHORT *Segment, USHORT *Offset) { - UNIMPLEMENTED; - return STATUS_UNSUCCESSFUL;; + /* Check if the system is initialized and the buffer is large enough */ + if (!x86BiosIsInitialized || *Size > PAGE_SIZE) + { + /* Something was wrong, fail! */ + return STATUS_INSUFFICIENT_RESOURCES; + } -} + /* Check if the buffer is already allocated */ + if (InterlockedBitTestAndSet(&x86BiosBufferIsAllocated, 0)) + { + /* Buffer was already allocated, fail */ + return STATUS_INSUFFICIENT_RESOURCES; + } -BOOLEAN -NTAPI -x86BiosCall ( - ULONG InterruptNumber, - X86_BIOS_REGISTERS *Registers) -{ - UNIMPLEMENTED; - return FALSE; + /* The buffer is sufficient, return hardcoded address and size */ + *Size = PAGE_SIZE; + *Segment = 0x2000; + *Offset = 0; + + return STATUS_SUCCESS;; } NTSTATUS @@ -40,19 +119,49 @@ x86BiosFreeBuffer ( USHORT Segment, USHORT Offset) { - UNIMPLEMENTED; - return STATUS_UNSUCCESSFUL;; + /* Check if the system is initialized and if the address matches */ + if (!x86BiosIsInitialized || Segment != 0x2000 || Offset != 0) + { + /* Something was wrong, fail */ + return STATUS_INVALID_PARAMETER; + } + + /* Check if the buffer was allocated */ + if (!InterlockedBitTestAndReset(&x86BiosBufferIsAllocated, 0)) + { + /* It was not, fail */ + return STATUS_INVALID_PARAMETER; + } + + /* Buffer is freed, nothing more to do */ + return STATUS_SUCCESS;; } NTSTATUS +NTAPI x86BiosReadMemory ( USHORT Segment, USHORT Offset, PVOID Buffer, ULONG Size) { - UNIMPLEMENTED; - return STATUS_UNSUCCESSFUL;; + ULONG_PTR Address; + + /* Calculate the physical address */ + Address = (Segment << 4) + Offset; + + /* Check if it's valid */ + if (!x86BiosIsInitialized || Address + Size > 0x100000) + { + /* Invalid */ + return STATUS_INVALID_PARAMETER; + } + + /* Copy the memory to the buffer */ + RtlCopyMemory(Buffer, x86BiosMemoryMapping + Address, Size); + + /* Return success */ + return STATUS_SUCCESS; } NTSTATUS @@ -63,7 +172,146 @@ x86BiosWriteMemory ( PVOID Buffer, ULONG Size) { - UNIMPLEMENTED; - return STATUS_UNSUCCESSFUL;; + ULONG_PTR Address; + + /* Calculate the physical address */ + Address = (Segment << 4) + Offset; + + /* Check if it's valid */ + if (!x86BiosIsInitialized || Address + Size > 0x100000) + { + /* Invalid */ + return STATUS_INVALID_PARAMETER; + } + + /* Copy the memory from the buffer */ + RtlCopyMemory(x86BiosMemoryMapping + Address, Buffer, Size); + + /* Return success */ + return STATUS_SUCCESS; +} + +typedef struct +{ + union + { + ULONG Eax; + USHORT Ax; + struct + { + UCHAR Al; + UCHAR Ah; + }; + }; + union + { + ULONG Ecx; + USHORT Cx; + struct + { + UCHAR Cl; + UCHAR Ch; + }; + }; + union + { + ULONG Edx; + USHORT Dx; + struct + { + UCHAR Dl; + UCHAR Dh; + }; + }; + union + { + ULONG Ebx; + USHORT Bx; + struct + { + UCHAR Bl; + UCHAR Bh; + }; + }; + ULONG Ebp; + ULONG Esi; + ULONG Edi; + USHORT SegDs; + USHORT SegEs; + + /* Extended */ + union + { + ULONG Eip; + USHORT Ip; + }; + + union + { + ULONG Esp; + USHORT Sp; + }; + +} X86_REGISTERS, *PX86_REGISTERS; + +enum +{ + X86_VMFLAGS_RETURN_ON_IRET = 1, +}; + +typedef struct +{ + union + { + X86_BIOS_REGISTERS BiosRegisters; + X86_REGISTERS Registers; + }; + + struct + { + ULONG ReturnOnIret:1; + } Flags; + + PVOID MemBuffer; +} X86_VM_STATE, *PX86_VM_STATE; + +BOOLEAN +NTAPI +x86BiosCall ( + ULONG InterruptNumber, + X86_BIOS_REGISTERS *Registers) +{ + X86_VM_STATE VmState; + + /* Zero the VmState */ + RtlZeroMemory(&VmState, sizeof(VmState)); + + /* Copy the registers */ + VmState.BiosRegisters = *Registers; + + /* Set the physical memory buffer */ + VmState.MemBuffer = x86BiosMemoryMapping; + + /* Initialize IP from the interrupt vector table */ + VmState.Registers.Ip = ((PUSHORT)x86BiosMemoryMapping)[InterruptNumber]; + + /* Make the function return on IRET */ + VmState.Flags.ReturnOnIret = 1; + + /* Call the x86 emulator */ +// x86Emulator(&VmState); + + /* Copy registers back to caller */ + *Registers = VmState.BiosRegisters; + + return TRUE; +} + +BOOLEAN +NTAPI +HalpBiosDisplayReset(VOID) +{ + UNIMPLEMENTED; + return TRUE; } From 77c52a8a4b0559bc4dc9eb8ba59570c0c2c4ecf7 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Mon, 4 Jan 2010 22:51:34 +0000 Subject: [PATCH 004/121] compile x86Bios functions only for amd64 svn path=/branches/ros-amd64-bringup/; revision=44935 --- reactos/hal/halx86/hal_generic.rbuild | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/hal/halx86/hal_generic.rbuild b/reactos/hal/halx86/hal_generic.rbuild index b2acc9bc052..562e6d7c14b 100644 --- a/reactos/hal/halx86/hal_generic.rbuild +++ b/reactos/hal/halx86/hal_generic.rbuild @@ -24,7 +24,6 @@ reboot.c sysinfo.c timer.c - x86bios.c bios.c halinit.c @@ -37,6 +36,7 @@ + x86bios.c halinit.c irq.s From ff2823e54347a468a79e43b86b7ca8b31100c50f Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Mon, 4 Jan 2010 22:54:12 +0000 Subject: [PATCH 005/121] [HAL] Remove hacks svn path=/branches/ros-amd64-bringup/; revision=44936 --- reactos/hal/halx86/generic/amd64/halinit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reactos/hal/halx86/generic/amd64/halinit.c b/reactos/hal/halx86/generic/amd64/halinit.c index 5c91dbd16ed..1d867bc6338 100644 --- a/reactos/hal/halx86/generic/amd64/halinit.c +++ b/reactos/hal/halx86/generic/amd64/halinit.c @@ -121,9 +121,9 @@ HalInitSystem(IN ULONG BootPhase, HalQuerySystemInformation = HaliQuerySystemInformation; HalSetSystemInformation = HaliSetSystemInformation; HalInitPnpDriver = NULL; // FIXME: TODO -// HalGetDmaAdapter = HalpGetDmaAdapter; + HalGetDmaAdapter = HalpGetDmaAdapter; HalGetInterruptTranslator = NULL; // FIXME: TODO -// HalResetDisplay = HalpBiosDisplayReset; + HalResetDisplay = HalpBiosDisplayReset; DPRINT1("HalInitSystem 4\n"); From bcc7857700ad9ba4c2469498f66d475aeb8c15f8 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Mon, 4 Jan 2010 23:00:35 +0000 Subject: [PATCH 006/121] [KE] Improve KiDoubleFaultAbort svn path=/branches/ros-amd64-bringup/; revision=44937 --- reactos/ntoskrnl/ke/amd64/trap.S | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/reactos/ntoskrnl/ke/amd64/trap.S b/reactos/ntoskrnl/ke/amd64/trap.S index 32c5153df50..7cbfacf0c6a 100644 --- a/reactos/ntoskrnl/ke/amd64/trap.S +++ b/reactos/ntoskrnl/ke/amd64/trap.S @@ -33,6 +33,9 @@ _MsgUnexpectedInterrupt: _MsgInvalidOpcodeFault: .ascii "General protection fault at %p!\n\0" +_MsgDoubleFault: +.ascii "Double fault at %p, rbp=%p!\n\0" + _MsgTrapInfo: .ascii "Trap: %s at %p\n\0" @@ -430,20 +433,23 @@ KiDebugTrapOrFaultKMode: push 0 .allocstack 0x8 - /* Reserve stack space for parameters */ - sub rsp, 0x28 - .allocstack 0x28 + ENTER_TRAP_FRAME TRAPFLAG_ALL + + lea rcx, _MsgDoubleFault[rip] + mov rdx, [rbp + KTRAP_FRAME_FaultAddress] + mov r8, rbp + call _FrLdrDbgPrint[rip] /* Bugcheck code UNEXPECTED_KERNEL_MODE_TRAP */ mov rcx, 0x0000007F /* Set double fault parameters */ - mov rdx, 0x00000008 + mov rdx, 0x00000008 // EXCEPTION_DOUBLE_FAULT mov r8, 0 mov r9, 0 - mov qword ptr [rsp + 0x20], 0 - - call _KeBugCheckEx + mov [rbp + KTRAP_FRAME_P5], rbp // trap frame (HACKY) + push 0 + call _KeBugCheckWithTf jmp $ .endproc @@ -773,9 +779,14 @@ PageFaultReturn: .proc KiUnexpectedInterrupt .pushframe 0 + /* Push pseudo error code */ push 0 .allocstack 0x8 + cli + + ENTER_TRAP_FRAME TRAPFLAG_ALL + lea rcx, _MsgUnexpectedInterrupt[rip] call _FrLdrDbgPrint[rip] From 0926f419e763c9f20d945c68d2ae312672472e84 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 5 Jan 2010 00:14:07 +0000 Subject: [PATCH 007/121] [HAL] Include the correct architecture specific headers svn path=/branches/ros-amd64-bringup/; revision=44939 --- reactos/hal/halx86/include/hal.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/reactos/hal/halx86/include/hal.h b/reactos/hal/halx86/include/hal.h index 3cd6fcb5ae2..2efb0a59372 100644 --- a/reactos/hal/halx86/include/hal.h +++ b/reactos/hal/halx86/include/hal.h @@ -30,11 +30,13 @@ /* Internal kernel headers */ #include "internal/pci.h" #define KeGetCurrentThread _KeGetCurrentThread -#include -#include #ifdef _M_AMD64 +#include +#include #include "internal/amd64/intrin_i.h" #else +#include +#include #include "internal/i386/intrin_i.h" #endif From d79f73c174e822ae10d7e50eb10a59a2a28fd7b1 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 5 Jan 2010 00:24:03 +0000 Subject: [PATCH 008/121] [MM] Add missing MmHyperspaceEnd, remove some unused variables svn path=/branches/ros-amd64-bringup/; revision=44940 --- reactos/ntoskrnl/mm/amd64/init.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/reactos/ntoskrnl/mm/amd64/init.c b/reactos/ntoskrnl/mm/amd64/init.c index 2f59aeabba9..f81af5ba6fd 100644 --- a/reactos/ntoskrnl/mm/amd64/init.c +++ b/reactos/ntoskrnl/mm/amd64/init.c @@ -60,6 +60,7 @@ PVOID MmNonPagedSystemStart; // FFFFFAA000000000 PVOID MmNonPagedPoolStart; PVOID MmNonPagedPoolExpansionStart; PVOID MmNonPagedPoolEnd = MI_NONPAGED_POOL_END; // 0xFFFFFAE000000000 +PVOID MmHyperSpaceEnd = (PVOID)HYPER_SPACE_END; PPHYSICAL_MEMORY_DESCRIPTOR MmPhysicalMemoryBlock; ULONG MmNumberOfPhysicalPages, MmHighestPhysicalPage, MmLowestPhysicalPage = -1; // FIXME: ULONG64 @@ -367,7 +368,6 @@ MiInitializePageTable() { ULONG64 PageFrameOffset; MMPTE TmplPte, *Pte; - PFN_NUMBER PageCount; /* HACK: don't use freeldr debug print anymore */ FrLdrDbgPrint = NoDbgPrint; @@ -592,13 +592,13 @@ VOID NTAPI MiBuildPhysicalMemoryBlock(IN PLOADER_PARAMETER_BLOCK LoaderBlock) { - PPHYSICAL_MEMORY_DESCRIPTOR Buffer, NewBuffer; + PPHYSICAL_MEMORY_DESCRIPTOR Buffer; PMEMORY_ALLOCATION_DESCRIPTOR MdBlock; PLIST_ENTRY ListEntry; PFN_NUMBER NextPage = -1; PULONG Bitmap; ULONG Runs = 0; - ULONG Size, i; + ULONG Size; /* Calculate size for the PFN bitmap */ Size = ROUND_UP(MmHighestPhysicalPage + 1, sizeof(ULONG)); @@ -676,8 +676,6 @@ MiBuildPagedPool(VOID) { PMMPTE Pte; MMPTE TmplPte; - PFN_NUMBER PageFrameIndex; - KIRQL OldIrql; ULONG Size, BitMapSize; /* Default size for paged pool is 4 times non paged pool */ @@ -823,10 +821,6 @@ MmArmInitSystem(IN ULONG Phase, } else if (Phase == 1) { - PMMPTE Pte; - ULONG OldCount; - PPHYSICAL_MEMORY_RUN Run; - /* The PFN database was created, restore the free descriptor */ *MxFreeDescriptor = MxOldFreeDescriptor; From 1f27265ceb44b9cca04ac022319e228cb9c4224d Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 5 Jan 2010 00:26:54 +0000 Subject: [PATCH 009/121] [LSALIB] Fix ULONG -> pointer cast svn path=/branches/ros-amd64-bringup/; revision=44941 --- reactos/lib/lsalib/lsa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reactos/lib/lsalib/lsa.c b/reactos/lib/lsalib/lsa.c index 94cd6af8e16..31c2aeb197f 100644 --- a/reactos/lib/lsalib/lsa.c +++ b/reactos/lib/lsalib/lsa.c @@ -264,8 +264,8 @@ LsaLogonUser(HANDLE LsaHandle, 0, Reply->d.LogonUserReply.ProfileBufferLength); memcpy(*ProfileBuffer, - (PVOID)((ULONG)Reply->d.LogonUserReply.Data + - (ULONG)Reply->d.LogonUserReply.ProfileBuffer), + (PVOID)((ULONG_PTR)Reply->d.LogonUserReply.Data + + (ULONG_PTR)Reply->d.LogonUserReply.ProfileBuffer), Reply->d.LogonUserReply.ProfileBufferLength); *LogonId = Reply->d.LogonUserReply.LogonId; *Token = Reply->d.LogonUserReply.Token; From 4289213dc71794d9bd18c66959c33f794c3b5a54 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 5 Jan 2010 00:59:00 +0000 Subject: [PATCH 010/121] [HAL] Move x86bios.c into amd64 folder svn path=/branches/ros-amd64-bringup/; revision=44942 --- reactos/hal/halx86/generic/{ => amd64}/x86bios.c | 0 reactos/hal/halx86/hal_generic.rbuild | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename reactos/hal/halx86/generic/{ => amd64}/x86bios.c (100%) diff --git a/reactos/hal/halx86/generic/x86bios.c b/reactos/hal/halx86/generic/amd64/x86bios.c similarity index 100% rename from reactos/hal/halx86/generic/x86bios.c rename to reactos/hal/halx86/generic/amd64/x86bios.c diff --git a/reactos/hal/halx86/hal_generic.rbuild b/reactos/hal/halx86/hal_generic.rbuild index 562e6d7c14b..a3e87073d2e 100644 --- a/reactos/hal/halx86/hal_generic.rbuild +++ b/reactos/hal/halx86/hal_generic.rbuild @@ -36,7 +36,6 @@ - x86bios.c halinit.c irq.s @@ -44,6 +43,7 @@ pic.c systimer.S usage.c + x86bios.c From 74f902bf27e631a79f6571f711adb798accc3ffb Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 5 Jan 2010 20:42:07 +0000 Subject: [PATCH 011/121] Reduce differences to trunk svn path=/branches/ros-amd64-bringup/; revision=44962 --- reactos/include/reactos/win32k/ntuser.h | 4 ++-- reactos/subsystems/win32/csrss/api/handle.c | 11 +++++----- .../win32/win32k/include/msgqueue.h | 2 +- reactos/subsystems/win32/win32k/ldr/loader.c | 4 ++-- .../subsystems/win32/win32k/ntuser/callback.c | 4 ++-- .../subsystems/win32/win32k/ntuser/class.c | 2 +- .../win32/win32k/ntuser/clipboard.c | 20 +++++++++---------- reactos/subsystems/win32/win32k/ntuser/hook.c | 2 +- .../subsystems/win32/win32k/ntuser/keyboard.c | 2 +- .../subsystems/win32/win32k/ntuser/message.c | 4 ++-- reactos/subsystems/win32/win32k/win32k.pspec | 1 + 11 files changed, 28 insertions(+), 28 deletions(-) diff --git a/reactos/include/reactos/win32k/ntuser.h b/reactos/include/reactos/win32k/ntuser.h index 87317ebbf24..29d09fcbc41 100644 --- a/reactos/include/reactos/win32k/ntuser.h +++ b/reactos/include/reactos/win32k/ntuser.h @@ -1709,7 +1709,7 @@ NtUserGetClassName(HWND hWnd, PUNICODE_STRING ClassName); #endif -DWORD_PTR +HANDLE NTAPI NtUserGetClipboardData( UINT uFormat, @@ -2881,7 +2881,7 @@ BOOL NTAPI NtUserTranslateMessage( LPMSG lpMsg, - UINT Flags ); + HKL dwhkl ); BOOL NTAPI diff --git a/reactos/subsystems/win32/csrss/api/handle.c b/reactos/subsystems/win32/csrss/api/handle.c index 6bcd61a70ca..391896ed28f 100644 --- a/reactos/subsystems/win32/csrss/api/handle.c +++ b/reactos/subsystems/win32/csrss/api/handle.c @@ -77,8 +77,7 @@ CsrGetObject( Object_t **Object, DWORD Access ) { - ULONG_PTR h = (ULONG_PTR)Handle >> 2; - DPRINT("CsrGetObject, Object: %x, %x, %x\n", Object, Handle, ProcessData ? ProcessData->HandleTableSize : 0); + ULONG_PTR h = (ULONG_PTR)Handle >> 2; DPRINT("CsrGetObject, Object: %x, %x, %x\n", Object, Handle, ProcessData ? ProcessData->HandleTableSize : 0); @@ -131,8 +130,8 @@ CsrReleaseObject( PCSRSS_PROCESS_DATA ProcessData, HANDLE Handle) { - ULONG_PTR h = (ULONG_PTR)Handle >> 2; - Object_t *Object; + ULONG_PTR h = (ULONG_PTR)Handle >> 2; + Object_t *Object; RtlEnterCriticalSection(&ProcessData->HandleTableLock); if (h >= ProcessData->HandleTableSize @@ -188,7 +187,7 @@ CsrInsertObject( ProcessData->HandleTable[i].Object = Object; ProcessData->HandleTable[i].Access = Access; ProcessData->HandleTable[i].Inheritable = Inheritable; - *Handle = ULongToHandle(((i << 2) | 0x3)); + *Handle = UlongToHandle((i << 2) | 0x3); _InterlockedIncrement( &Object->ReferenceCount ); RtlLeaveCriticalSection(&ProcessData->HandleTableLock); return(STATUS_SUCCESS); @@ -240,7 +239,7 @@ CsrVerifyObject( PCSRSS_PROCESS_DATA ProcessData, HANDLE Handle) { - ULONG_PTR h = (ULONG_PTR)Handle >> 2; + ULONG_PTR h = (ULONG_PTR)Handle >> 2; if (h >= ProcessData->HandleTableSize || ProcessData->HandleTable[h].Object == NULL) diff --git a/reactos/subsystems/win32/win32k/include/msgqueue.h b/reactos/subsystems/win32/win32k/include/msgqueue.h index 5094b7f1d67..234d0b59eeb 100644 --- a/reactos/subsystems/win32/win32k/include/msgqueue.h +++ b/reactos/subsystems/win32/win32k/include/msgqueue.h @@ -188,7 +188,7 @@ co_IntSendMessageTimeout(HWND hWnd, LRESULT FASTCALL IntDispatchMessage(MSG* Msg); BOOL FASTCALL -IntTranslateKbdMessage(LPMSG lpMsg, UINT flags); +IntTranslateKbdMessage(LPMSG lpMsg, HKL dwhkl); VOID FASTCALL co_MsqPostKeyboardMessage(UINT uMsg, WPARAM wParam, LPARAM lParam); diff --git a/reactos/subsystems/win32/win32k/ldr/loader.c b/reactos/subsystems/win32/win32k/ldr/loader.c index 33b9e078bd5..9803c8d4009 100644 --- a/reactos/subsystems/win32/win32k/ldr/loader.c +++ b/reactos/subsystems/win32/win32k/ldr/loader.c @@ -258,7 +258,7 @@ EngUnloadImage ( IN HANDLE hModule ) ExFreePool(DriverInfo->DriverName.Buffer); RemoveEntryList(&DriverInfo->ListEntry); ExFreePool(DriverInfo); - } - } + } +} /* EOF */ diff --git a/reactos/subsystems/win32/win32k/ntuser/callback.c b/reactos/subsystems/win32/win32k/ntuser/callback.c index ff7af45e727..9a8de743c54 100644 --- a/reactos/subsystems/win32/win32k/ntuser/callback.c +++ b/reactos/subsystems/win32/win32k/ntuser/callback.c @@ -640,7 +640,7 @@ co_IntCallEventProc(HWINEVENTHOOK hook, UserEnterCo(); IntCbFreeMemory(Argument); - + if (!NT_SUCCESS(Status)) { return 0; @@ -700,7 +700,7 @@ co_IntCallLoadMenu( HINSTANCE hModule, Result = *(LRESULT*)ResultPointer; IntCbFreeMemory(Argument); - + if (!NT_SUCCESS(Status)) { return 0; diff --git a/reactos/subsystems/win32/win32k/ntuser/class.c b/reactos/subsystems/win32/win32k/ntuser/class.c index 46508f7a4a4..71da6b97ec0 100644 --- a/reactos/subsystems/win32/win32k/ntuser/class.c +++ b/reactos/subsystems/win32/win32k/ntuser/class.c @@ -551,7 +551,7 @@ IntGetClassForDesktop(IN OUT PCLS BaseClass, Class->pclsClone = NULL; Class->pclsBase = BaseClass; Class->pclsNext = BaseClass->pclsClone; - (void)InterlockedExchangePointer((VOID*)&BaseClass->pclsClone, + (void)InterlockedExchangePointer((PVOID*)&BaseClass->pclsClone, Class); } } diff --git a/reactos/subsystems/win32/win32k/ntuser/clipboard.c b/reactos/subsystems/win32/win32k/ntuser/clipboard.c index 52b54d5e99b..3d1f1af316e 100644 --- a/reactos/subsystems/win32/win32k/ntuser/clipboard.c +++ b/reactos/subsystems/win32/win32k/ntuser/clipboard.c @@ -581,10 +581,10 @@ NtUserEmptyClipboard(VOID) return ret; } -DWORD_PTR APIENTRY +HANDLE APIENTRY NtUserGetClipboardData(UINT uFormat, PVOID pBuffer) { - DWORD_PTR ret = 0; + HANDLE ret = NULL; UserEnterShared(); @@ -607,7 +607,7 @@ NtUserGetClipboardData(UINT uFormat, PVOID pBuffer) co_IntSendMessage(ClipboardOwnerWindow->hSelf, WM_RENDERFORMAT, (WPARAM)uFormat, 0); data = intIsFormatAvailable(uFormat); ASSERT(data->size); - ret = data->size; + ret = (HANDLE)(ULONG_PTR)data->size; } } else @@ -618,12 +618,12 @@ NtUserGetClipboardData(UINT uFormat, PVOID pBuffer) } } - ret = data->size; + ret = (HANDLE)(ULONG_PTR)data->size; } else { /* there is no data in this format */ - //ret = FALSE; + //ret = (HANDLE)FALSE; } } else @@ -646,12 +646,12 @@ NtUserGetClipboardData(UINT uFormat, PVOID pBuffer) PCLIPBOARDELEMENT data = intIsFormatAvailable(CF_DIB); if (data) { - ret = (DWORD_PTR)renderBITMAPfromDIB(data->hData); + ret = renderBITMAPfromDIB(data->hData); } } else { - ret = (DWORD_PTR)pBuffer; + ret = (HANDLE)pBuffer; _SEH2_TRY { @@ -660,7 +660,7 @@ NtUserGetClipboardData(UINT uFormat, PVOID pBuffer) } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { - ret = 0; + ret = NULL; } _SEH2_END @@ -669,7 +669,7 @@ NtUserGetClipboardData(UINT uFormat, PVOID pBuffer) } else { - ret = (DWORD_PTR)pBuffer; + ret = (HANDLE)pBuffer; _SEH2_TRY { @@ -678,7 +678,7 @@ NtUserGetClipboardData(UINT uFormat, PVOID pBuffer) } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { - ret = 0; + ret = NULL; } _SEH2_END } diff --git a/reactos/subsystems/win32/win32k/ntuser/hook.c b/reactos/subsystems/win32/win32k/ntuser/hook.c index 6ece97e43d1..a59444b9f60 100644 --- a/reactos/subsystems/win32/win32k/ntuser/hook.c +++ b/reactos/subsystems/win32/win32k/ntuser/hook.c @@ -298,7 +298,7 @@ IntCallLowLevelHook(PHOOK Hook, INT Code, WPARAM wParam, LPARAM lParam) /* FIXME should get timeout from * HKEY_CURRENT_USER\Control Panel\Desktop\LowLevelHooksTimeout */ Status = co_MsqSendMessage(((PTHREADINFO)Hook->Thread->Tcb.Win32Thread)->MessageQueue, - (HWND)(UINT_PTR)Code, + IntToPtr(Code), Hook->HookId, wParam, lParam, diff --git a/reactos/subsystems/win32/win32k/ntuser/keyboard.c b/reactos/subsystems/win32/win32k/ntuser/keyboard.c index 1c46c4a73f2..443919cbb99 100644 --- a/reactos/subsystems/win32/win32k/ntuser/keyboard.c +++ b/reactos/subsystems/win32/win32k/ntuser/keyboard.c @@ -419,7 +419,7 @@ CLEANUP: BOOL FASTCALL IntTranslateKbdMessage(LPMSG lpMsg, - UINT Flags) + HKL dwhkl) { PTHREADINFO pti; static INT dead_char = 0; diff --git a/reactos/subsystems/win32/win32k/ntuser/message.c b/reactos/subsystems/win32/win32k/ntuser/message.c index bef05ad3c02..d137eada2b2 100644 --- a/reactos/subsystems/win32/win32k/ntuser/message.c +++ b/reactos/subsystems/win32/win32k/ntuser/message.c @@ -2195,7 +2195,7 @@ NtUserDispatchMessage(PMSG UnsafeMsgInfo) BOOL APIENTRY NtUserTranslateMessage(LPMSG lpMsg, - UINT flags) + HKL dwhkl) { NTSTATUS Status; MSG SafeMsg; @@ -2211,7 +2211,7 @@ NtUserTranslateMessage(LPMSG lpMsg, RETURN( FALSE); } - RETURN( IntTranslateKbdMessage(&SafeMsg, flags)); + RETURN( IntTranslateKbdMessage(&SafeMsg, dwhkl)); CLEANUP: DPRINT("Leave NtUserTranslateMessage: ret=%i\n",_ret_); diff --git a/reactos/subsystems/win32/win32k/win32k.pspec b/reactos/subsystems/win32/win32k/win32k.pspec index 6afc3715489..bd2a06eb746 100644 --- a/reactos/subsystems/win32/win32k/win32k.pspec +++ b/reactos/subsystems/win32/win32k/win32k.pspec @@ -1,3 +1,4 @@ +#include "include/reactos/msvctarget.h" #undef i386 @ stdcall -arch=i386 FLOATOBJ_AddFloatObj(ptr ptr) FLOATOBJ_Add From 519d3fe61a3a5467b4924cd12222dbe72e63ed2f Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 5 Jan 2010 21:18:17 +0000 Subject: [PATCH 012/121] add global allowwarning="true" and unhack the other rbuild files svn path=/branches/ros-amd64-bringup/; revision=44964 --- reactos/ReactOS-amd64.rbuild | 2 +- reactos/dll/win32/gdi32/gdi32.rbuild | 2 +- reactos/dll/win32/imagehlp/imagehlp.rbuild | 2 +- reactos/dll/win32/kernel32/kernel32.rbuild | 2 +- reactos/dll/win32/msafd/msafd.rbuild | 2 +- reactos/dll/win32/ws2_32/ws2_32.rbuild | 2 +- reactos/dll/win32/ws2help/ws2help.rbuild | 2 +- reactos/drivers/filesystems/ext2/ext2.rbuild | 2 +- reactos/lib/3rdparty/icu4ros/icu4ros.rbuild | 2 +- reactos/lib/drivers/oskittcp/oskittcp.rbuild | 2 +- reactos/ntoskrnl/ntoskrnl.rbuild | 2 +- reactos/subsystems/win32/win32k/win32k.rbuild | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/reactos/ReactOS-amd64.rbuild b/reactos/ReactOS-amd64.rbuild index 9d299caafb8..c2b0e711477 100644 --- a/reactos/ReactOS-amd64.rbuild +++ b/reactos/ReactOS-amd64.rbuild @@ -1,6 +1,6 @@ - + diff --git a/reactos/dll/win32/gdi32/gdi32.rbuild b/reactos/dll/win32/gdi32/gdi32.rbuild index a6917608cca..063b53221d8 100644 --- a/reactos/dll/win32/gdi32/gdi32.rbuild +++ b/reactos/dll/win32/gdi32/gdi32.rbuild @@ -1,4 +1,4 @@ - + include diff --git a/reactos/dll/win32/imagehlp/imagehlp.rbuild b/reactos/dll/win32/imagehlp/imagehlp.rbuild index 17b35984ff0..0fa31aa6db8 100644 --- a/reactos/dll/win32/imagehlp/imagehlp.rbuild +++ b/reactos/dll/win32/imagehlp/imagehlp.rbuild @@ -1,4 +1,4 @@ - + . diff --git a/reactos/dll/win32/kernel32/kernel32.rbuild b/reactos/dll/win32/kernel32/kernel32.rbuild index 3fbd6197484..d72472ec693 100644 --- a/reactos/dll/win32/kernel32/kernel32.rbuild +++ b/reactos/dll/win32/kernel32/kernel32.rbuild @@ -1,6 +1,6 @@ - + . . diff --git a/reactos/dll/win32/msafd/msafd.rbuild b/reactos/dll/win32/msafd/msafd.rbuild index 47f2bbdbb2c..bc657128668 100644 --- a/reactos/dll/win32/msafd/msafd.rbuild +++ b/reactos/dll/win32/msafd/msafd.rbuild @@ -1,4 +1,4 @@ - + . include diff --git a/reactos/dll/win32/ws2_32/ws2_32.rbuild b/reactos/dll/win32/ws2_32/ws2_32.rbuild index 9bff5a25803..f23493b027e 100644 --- a/reactos/dll/win32/ws2_32/ws2_32.rbuild +++ b/reactos/dll/win32/ws2_32/ws2_32.rbuild @@ -1,4 +1,4 @@ - + include include/reactos/wine diff --git a/reactos/dll/win32/ws2help/ws2help.rbuild b/reactos/dll/win32/ws2help/ws2help.rbuild index b802793480a..045c924e7ff 100644 --- a/reactos/dll/win32/ws2help/ws2help.rbuild +++ b/reactos/dll/win32/ws2help/ws2help.rbuild @@ -1,4 +1,4 @@ - + . include/reactos/winsock diff --git a/reactos/drivers/filesystems/ext2/ext2.rbuild b/reactos/drivers/filesystems/ext2/ext2.rbuild index 567666e5bd5..fc092a308c7 100644 --- a/reactos/drivers/filesystems/ext2/ext2.rbuild +++ b/reactos/drivers/filesystems/ext2/ext2.rbuild @@ -1,6 +1,6 @@ - + inc /wd4003 diff --git a/reactos/lib/3rdparty/icu4ros/icu4ros.rbuild b/reactos/lib/3rdparty/icu4ros/icu4ros.rbuild index 5666c76b9d9..93e7cd8d94d 100644 --- a/reactos/lib/3rdparty/icu4ros/icu4ros.rbuild +++ b/reactos/lib/3rdparty/icu4ros/icu4ros.rbuild @@ -1,6 +1,6 @@ - + 1 diff --git a/reactos/lib/drivers/oskittcp/oskittcp.rbuild b/reactos/lib/drivers/oskittcp/oskittcp.rbuild index 726ccd5ac11..f67e415b006 100644 --- a/reactos/lib/drivers/oskittcp/oskittcp.rbuild +++ b/reactos/lib/drivers/oskittcp/oskittcp.rbuild @@ -1,6 +1,6 @@ - + include/freebsd diff --git a/reactos/ntoskrnl/ntoskrnl.rbuild b/reactos/ntoskrnl/ntoskrnl.rbuild index 4b2624658c4..e2347f10ea7 100644 --- a/reactos/ntoskrnl/ntoskrnl.rbuild +++ b/reactos/ntoskrnl/ntoskrnl.rbuild @@ -7,7 +7,7 @@ - + diff --git a/reactos/subsystems/win32/win32k/win32k.rbuild b/reactos/subsystems/win32/win32k/win32k.rbuild index cf75e347749..eaefbff9ee0 100644 --- a/reactos/subsystems/win32/win32k/win32k.rbuild +++ b/reactos/subsystems/win32/win32k/win32k.rbuild @@ -1,7 +1,7 @@ - + pseh ntoskrnl From 51a5da9298de348a748ce736dea279c7974cc63f Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 5 Jan 2010 22:12:20 +0000 Subject: [PATCH 013/121] [RTL] Reduce difference to trunk (wtf happened to actctx.c?) svn path=/branches/ros-amd64-bringup/; revision=44966 --- reactos/lib/rtl/actctx.c | 78 ++++++++++++++++++------------------- reactos/lib/rtl/exception.c | 6 +-- 2 files changed, 40 insertions(+), 44 deletions(-) diff --git a/reactos/lib/rtl/actctx.c b/reactos/lib/rtl/actctx.c index 7f8d10e2611..4508876b4fe 100644 --- a/reactos/lib/rtl/actctx.c +++ b/reactos/lib/rtl/actctx.c @@ -25,14 +25,14 @@ #define QUERY_ACTCTX_FLAG_ACTIVE (0x00000001) #define ACTCTX_FLAGS_ALL (\ - ACTCTX_FLAG_PROCESSOR_ARCHITECTURE_VALID |\ - ACTCTX_FLAG_LANGID_VALID |\ - ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID |\ - ACTCTX_FLAG_RESOURCE_NAME_VALID |\ - ACTCTX_FLAG_SET_PROCESS_DEFAULT |\ - ACTCTX_FLAG_APPLICATION_NAME_VALID |\ - ACTCTX_FLAG_SOURCE_IS_ASSEMBLYREF |\ - ACTCTX_FLAG_HMODULE_VALID ) + ACTCTX_FLAG_PROCESSOR_ARCHITECTURE_VALID |\ + ACTCTX_FLAG_LANGID_VALID |\ + ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID |\ + ACTCTX_FLAG_RESOURCE_NAME_VALID |\ + ACTCTX_FLAG_SET_PROCESS_DEFAULT |\ + ACTCTX_FLAG_APPLICATION_NAME_VALID |\ + ACTCTX_FLAG_SOURCE_IS_ASSEMBLYREF |\ + ACTCTX_FLAG_HMODULE_VALID ) #define ACTCTX_MAGIC 0xC07E3E11 @@ -1602,7 +1602,7 @@ static NTSTATUS get_manifest_in_module( struct actctx_loader* acl, struct assemb DPRINT( "looking for res %s in module %p %s\n", debugstr_w(resname), hModule, debugstr_w(nameW.Buffer) ); RtlFreeUnicodeString( &nameW ); -} + } else DPRINT( "looking for res %s in module %p %s\n", debugstr_w(resname), hModule, debugstr_w(filename) ); } @@ -1613,10 +1613,10 @@ static NTSTATUS get_manifest_in_module( struct actctx_loader* acl, struct assemb info.Type = (ULONG_PTR)RT_MANIFEST; info.Language = lang; if (!((ULONG_PTR)resname >> 16)) -{ + { info.Name = (ULONG_PTR)resname; status = LdrFindResource_U(hModule, &info, 3, &entry); -} + } else if (resname[0] == '#') { ULONG value; @@ -1680,7 +1680,7 @@ static NTSTATUS get_manifest_in_pe_file( struct actctx_loader* acl, struct assem { HANDLE module = (HMODULE)((ULONG_PTR)base | 1); /* make it a LOAD_LIBRARY_AS_DATAFILE handle */ status = get_manifest_in_module( acl, ai, filename, directory, shared, module, resname, lang ); -} + } else status = STATUS_INVALID_IMAGE_FORMAT; NtUnmapViewOfSection( NtCurrentProcess(), base ); @@ -1737,7 +1737,7 @@ static NTSTATUS get_manifest_in_manifest_file( struct actctx_loader* acl, struct /* try to load the .manifest file associated to the file */ static NTSTATUS get_manifest_in_associated_manifest( struct actctx_loader* acl, struct assembly_identity* ai, LPCWSTR filename, LPCWSTR directory, HMODULE module, LPCWSTR resname ) - { +{ static const WCHAR fmtW[] = { '.','%','l','u',0 }; WCHAR *buffer; NTSTATUS status; @@ -1760,7 +1760,7 @@ static NTSTATUS get_manifest_in_associated_manifest( struct actctx_loader* acl, if (!RtlDosPathNameToNtPathName_U( name.Buffer, &nameW, NULL, NULL )) status = STATUS_RESOURCE_DATA_NOT_FOUND; RtlFreeUnicodeString( &name ); - } + } if (status) return status; } else @@ -1960,7 +1960,7 @@ static NTSTATUS lookup_assembly(struct actctx_loader* acl, * appdir\name.manifest * appdir\name\name.dll * appdir\name\name.manifest - */ + */ strcpyW( buffer, acl->actctx->appdir.info ); p = buffer + strlenW(buffer); for (i = 0; i < 2; i++) @@ -2085,7 +2085,7 @@ static NTSTATUS find_dll_redirection(ACTIVATION_CONTEXT* actctx, const UNICODE_S struct dll_redirect *dll = &assembly->dlls[j]; if (!strncmpiW(section_name->Buffer, dll->name, snlen) && !dll->name[snlen]) return fill_keyed_data(data, dll, assembly, i); -} + } } return STATUS_SXS_KEY_NOT_FOUND; } @@ -2118,7 +2118,7 @@ static NTSTATUS find_window_class(ACTIVATION_CONTEXT* actctx, const UNICODE_STRI static NTSTATUS find_string(ACTIVATION_CONTEXT* actctx, ULONG section_kind, const UNICODE_STRING *section_name, DWORD flags, PACTCTX_SECTION_KEYED_DATA data) - { +{ NTSTATUS status; switch (section_kind) @@ -2209,7 +2209,7 @@ NTSTATUS WINAPI RtlCreateActivationContext( HANDLE *handle, void *ptr ) if ((p = strrchrW( dir.Buffer, '\\' ))) p[1] = 0; actctx->appdir.info = dir.Buffer; -} + } nameW.Buffer = NULL; if (pActCtx->lpSource) @@ -2314,7 +2314,7 @@ NTAPI RtlActivateActivationContext( ULONG unknown, HANDLE handle, PULONG_PTR coo *cookie = (ULONG_PTR)frame; DPRINT( "%p cookie=%lx\n", handle, *cookie ); - return STATUS_SUCCESS; + return STATUS_SUCCESS; } @@ -2348,7 +2348,7 @@ RtlDeactivateActivationContext( ULONG flags, ULONG_PTR cookie ) top = frame; } - return STATUS_SUCCESS; + return STATUS_SUCCESS; } VOID @@ -2363,7 +2363,7 @@ NTAPI RtlFreeThreadActivationContextStack(void) RtlReleaseActivationContext( frame->ActivationContext ); RtlFreeHeap( RtlGetProcessHeap(), 0, frame ); frame = prev; -} + } NtCurrentTeb()->ActivationContextStackPointer->ActiveFrame = NULL; } @@ -2375,7 +2375,7 @@ NTAPI RtlGetActiveActivationContext( HANDLE *handle ) { *handle = NtCurrentTeb()->ActivationContextStackPointer->ActiveFrame->ActivationContext; RtlAddRefActivationContext( *handle ); -} + } else *handle = 0; @@ -2420,11 +2420,11 @@ RtlQueryInformationActivationContext( ULONG flags, HANDLE handle, PVOID subinst, info->hActCtx = handle; info->dwFlags = 0; /* FIXME */ if (!(flags & QUERY_ACTCTX_FLAG_NO_ADDREF)) RtlAddRefActivationContext( handle ); -} + } break; case ActivationContextDetailedInformation: -{ + { ACTIVATION_CONTEXT_DETAILED_INFORMATION *acdi = buffer; struct assembly *assembly = NULL; SIZE_T len, manifest_len = 0, config_len = 0, appdir_len = 0; @@ -2433,7 +2433,7 @@ RtlQueryInformationActivationContext( ULONG flags, HANDLE handle, PVOID subinst, if (!(actctx = check_actctx(handle))) return STATUS_INVALID_PARAMETER; if (actctx->num_assemblies) assembly = actctx->assemblies; - + if (assembly && assembly->manifest.info) manifest_len = strlenW(assembly->manifest.info) + 1; if (actctx->config.info) config_len = strlenW(actctx->config.info) + 1; @@ -2454,30 +2454,30 @@ RtlQueryInformationActivationContext( ULONG flags, HANDLE handle, PVOID subinst, acdi->ulAppDirPathChars = actctx->appdir.info ? appdir_len - 1 : 0; ptr = (LPWSTR)(acdi + 1); if (manifest_len) - { + { acdi->lpRootManifestPath = ptr; memcpy(ptr, assembly->manifest.info, manifest_len * sizeof(WCHAR)); ptr += manifest_len; } else acdi->lpRootManifestPath = NULL; if (config_len) - { + { acdi->lpRootConfigurationPath = ptr; memcpy(ptr, actctx->config.info, config_len * sizeof(WCHAR)); ptr += config_len; - } + } else acdi->lpRootConfigurationPath = NULL; if (appdir_len) - { + { acdi->lpAppDirPath = ptr; memcpy(ptr, actctx->appdir.info, appdir_len * sizeof(WCHAR)); - } + } else acdi->lpAppDirPath = NULL; - } + } break; case AssemblyDetailedInformationInActivationContext: - { + { ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION *afdi = buffer; struct assembly *assembly; WCHAR *assembly_id; @@ -2505,10 +2505,10 @@ RtlQueryInformationActivationContext( ULONG flags, HANDLE handle, PVOID subinst, if (retlen) *retlen = len; if (!buffer || bufsize < len) - { + { RtlFreeHeap( RtlGetProcessHeap(), 0, assembly_id ); return STATUS_BUFFER_TOO_SMALL; - } + } afdi->ulFlags = 0; /* FIXME */ afdi->ulEncodedAssemblyIdentityLength = (id_len - 1) * sizeof(WCHAR); @@ -2529,7 +2529,7 @@ RtlQueryInformationActivationContext( ULONG flags, HANDLE handle, PVOID subinst, memcpy( ptr, assembly_id, id_len * sizeof(WCHAR) ); ptr += id_len; if (path_len) - { + { afdi->lpAssemblyManifestPath = ptr; memcpy(ptr, assembly->manifest.info, path_len * sizeof(WCHAR)); ptr += path_len; @@ -2540,7 +2540,7 @@ RtlQueryInformationActivationContext( ULONG flags, HANDLE handle, PVOID subinst, afdi->lpAssemblyDirectoryName = ptr; memcpy(ptr, assembly->directory, ad_len * sizeof(WCHAR)); ptr += ad_len; - } + } else afdi->lpAssemblyDirectoryName = NULL; RtlFreeHeap( RtlGetProcessHeap(), 0, assembly_id ); } @@ -2573,7 +2573,7 @@ RtlQueryInformationActivationContext( ULONG flags, HANDLE handle, PVOID subinst, { if (retlen) *retlen = len; return STATUS_BUFFER_TOO_SMALL; - } + } if (retlen) *retlen = 0; /* yes that's what native does !! */ afdi->ulFlags = ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION; afdi->ulFilenameLength = dll_len ? (dll_len - 1) * sizeof(WCHAR) : 0; @@ -2585,7 +2585,7 @@ RtlQueryInformationActivationContext( ULONG flags, HANDLE handle, PVOID subinst, memcpy( ptr, dll->name, dll_len * sizeof(WCHAR) ); } else afdi->lpFileName = NULL; afdi->lpFilePath = NULL; /* FIXME */ - } + } break; default: @@ -2599,7 +2599,7 @@ NTSTATUS NTAPI RtlFindActivationContextSectionString( ULONG flags, const GUID *guid, ULONG section_kind, UNICODE_STRING *section_name, PVOID ptr ) - { +{ PACTCTX_SECTION_KEYED_DATA data = ptr; NTSTATUS status = STATUS_SXS_KEY_NOT_FOUND; diff --git a/reactos/lib/rtl/exception.c b/reactos/lib/rtl/exception.c index e0970d182e7..d4462e32111 100644 --- a/reactos/lib/rtl/exception.c +++ b/reactos/lib/rtl/exception.c @@ -17,7 +17,7 @@ /* FUNCTIONS ***************************************************************/ -#if !defined(_M_IX86) && !defined(_M_AMD64) +#if !defined(_M_IX86) /* * @implemented @@ -63,10 +63,6 @@ RtlRaiseException(IN PEXCEPTION_RECORD ExceptionRecord) RtlRaiseStatus(Status); } -#endif - -#if !defined(_M_IX86) - #ifdef _MSC_VER #pragma warning(push) #pragma warning(disable:4717) // RtlRaiseStatus is recursive by design From 7894b5b5229493825999a3169893f7a9ec203ffc Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 5 Jan 2010 22:58:45 +0000 Subject: [PATCH 014/121] revert changes to exception.x from 44966 svn path=/branches/ros-amd64-bringup/; revision=44967 --- reactos/lib/rtl/exception.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/reactos/lib/rtl/exception.c b/reactos/lib/rtl/exception.c index d4462e32111..e0970d182e7 100644 --- a/reactos/lib/rtl/exception.c +++ b/reactos/lib/rtl/exception.c @@ -17,7 +17,7 @@ /* FUNCTIONS ***************************************************************/ -#if !defined(_M_IX86) +#if !defined(_M_IX86) && !defined(_M_AMD64) /* * @implemented @@ -63,6 +63,10 @@ RtlRaiseException(IN PEXCEPTION_RECORD ExceptionRecord) RtlRaiseStatus(Status); } +#endif + +#if !defined(_M_IX86) + #ifdef _MSC_VER #pragma warning(push) #pragma warning(disable:4717) // RtlRaiseStatus is recursive by design From ef9b8f7942baf51797c2c726216bf4b3e441e958 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 5 Jan 2010 23:02:08 +0000 Subject: [PATCH 015/121] [RTL] Patch by Stefan Ginsberg: Don't use double in rtl's sprintf / swprintf, use double_t union instead. Minor modifications by me. svn path=/branches/ros-amd64-bringup/; revision=44968 --- reactos/lib/rtl/sprintf.c | 68 ++++++++++++++----------------------- reactos/lib/rtl/swprintf.c | 69 ++++++++++++++------------------------ 2 files changed, 52 insertions(+), 85 deletions(-) diff --git a/reactos/lib/rtl/sprintf.c b/reactos/lib/rtl/sprintf.c index 0b6b8ca77d4..c6d651af98d 100644 --- a/reactos/lib/rtl/sprintf.c +++ b/reactos/lib/rtl/sprintf.c @@ -27,43 +27,35 @@ #define SPECIAL 32 /* 0x */ #define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */ #define REMOVEHEX 256 /* use 256 as remve 0x frim BASE 16 */ -typedef struct { - unsigned int mantissal:32; - unsigned int mantissah:20; - unsigned int exponent:11; - unsigned int sign:1; +typedef union { + struct { + unsigned int mantissal:32; + unsigned int mantissah:20; + unsigned int exponent:11; + unsigned int sign:1; + }; + long long AsLongLong; } double_t; -#if 0 +/* We depend on this being true */ +C_ASSERT(sizeof(double_t) == sizeof(double)); + static __inline int -_isinf(double __x) +_isinf(double_t x) { - union - { - double* __x; - double_t* x; - } x; - - x.__x = &__x; - return ( x.x->exponent == 0x7ff && ( x.x->mantissah == 0 && x.x->mantissal == 0 )); + return ( x.exponent == 0x7ff && ( x.mantissah == 0 && x.mantissal == 0 )); } static __inline int -_isnan(double __x) +_isnan(double_t x) { - union - { - double* __x; - double_t* x; - } x; - x.__x = &__x; - return ( x.x->exponent == 0x7ff && ( x.x->mantissah != 0 || x.x->mantissal != 0 )); + return ( x.exponent == 0x7ff && ( x.mantissah != 0 || x.mantissal != 0 )); } -#endif + static __inline @@ -180,16 +172,14 @@ number(char * buf, char * end, long long num, int base, int size, int precision, return buf; } -#if 0 static char * -numberf(char * buf, char * end, double num, int base, int size, int precision, int type) +numberf(char * buf, char * end, double_t num, int base, int size, int precision, int type) { char c,sign,tmp[66]; const char *digits; const char *small_digits = "0123456789abcdefghijklmnopqrstuvwxyz"; const char *large_digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; int i; - long long x; /* FIXME the float version of number is direcly copy of number @@ -203,9 +193,9 @@ numberf(char * buf, char * end, double num, int base, int size, int precision, i c = (type & ZEROPAD) ? '0' : ' '; sign = 0; if (type & SIGN) { - if (num < 0) { + if (num.sign) { sign = '-'; - num = -num; + num.sign = 0; size--; } else if (type & PLUS) { sign = '+'; @@ -222,15 +212,11 @@ numberf(char * buf, char * end, double num, int base, int size, int precision, i size--; } i = 0; - if (num == 0) + if (num.AsLongLong == 0) tmp[i++] = '0'; - else while (num != 0) + else while (num.AsLongLong != 0) { - x = num; - tmp[i++] = digits[do_div(&x,base)]; -#ifndef _M_ARM // Missing __floatdidf in CeGCC 0.55 -- GCC 4.4 - num=x; -#endif + tmp[i++] = digits[do_div(&num.AsLongLong,base)]; } if (i > precision) precision = i; @@ -285,7 +271,6 @@ numberf(char * buf, char * end, double num, int base, int size, int precision, i } return buf; } -#endif static char* string(char* buf, char* end, const char* s, int len, int field_width, int precision, int flags) @@ -392,7 +377,7 @@ int __cdecl _vsnprintf(char *buf, size_t cnt, const char *fmt, va_list args) { int len; unsigned long long num; -// double _double; + double_t _double; int base; char *str, *end; @@ -597,14 +582,13 @@ int __cdecl _vsnprintf(char *buf, size_t cnt, const char *fmt, va_list args) } continue; -#if 0 /* float number formats - set up the flags and "break" */ case 'e': case 'E': case 'f': case 'g': case 'G': - _double = (double)va_arg(args, double); + _double = va_arg(args, double_t); if ( _isnan(_double) ) { s = "Nan"; len = 3; @@ -635,11 +619,11 @@ int __cdecl _vsnprintf(char *buf, size_t cnt, const char *fmt, va_list args) } else { if ( precision == -1 ) precision = 6; - str = numberf(str, end, (int)_double, base, field_width, precision, flags); + str = numberf(str, end, _double, base, field_width, precision, flags); } continue; -#endif + /* integer number formats - set up the flags and "break" */ case 'o': diff --git a/reactos/lib/rtl/swprintf.c b/reactos/lib/rtl/swprintf.c index e6823e4d729..8ac75cad4e9 100644 --- a/reactos/lib/rtl/swprintf.c +++ b/reactos/lib/rtl/swprintf.c @@ -27,42 +27,35 @@ #define SPECIAL 32 /* 0x */ #define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */ #define REMOVEHEX 256 /* use 256 as remve 0x frim BASE 16 */ -typedef struct { - unsigned int mantissal:32; - unsigned int mantissah:20; - unsigned int exponent:11; - unsigned int sign:1; +typedef union { + struct { + unsigned int mantissal:32; + unsigned int mantissah:20; + unsigned int exponent:11; + unsigned int sign:1; + }; + long long AsLongLong; } double_t; -#if 0 + +/* We depend on this being true */ +C_ASSERT(sizeof(double_t) == sizeof(double)); + static __inline int -_isinf(double __x) +_isinf(double_t x) { - union - { - double* __x; - double_t* x; - } x; - - x.__x = &__x; - return ( x.x->exponent == 0x7ff && ( x.x->mantissah == 0 && x.x->mantissal == 0 )); + return ( x.exponent == 0x7ff && ( x.mantissah == 0 && x.mantissal == 0 )); } static __inline int -_isnan(double __x) +_isnan(double_t x) { - union - { - double* __x; - double_t* x; - } x; - x.__x = &__x; - return ( x.x->exponent == 0x7ff && ( x.x->mantissah != 0 || x.x->mantissal != 0 )); + return ( x.exponent == 0x7ff && ( x.mantissah != 0 || x.mantissal != 0 )); } -#endif + static __inline @@ -178,16 +171,14 @@ number(wchar_t * buf, wchar_t * end, long long num, int base, int size, int prec return buf; } -#if 0 static wchar_t * -numberf(wchar_t * buf, wchar_t * end, double num, int base, int size, int precision, int type) +numberf(wchar_t * buf, wchar_t * end, double_t num, int base, int size, int precision, int type) { wchar_t c, sign, tmp[66]; const wchar_t *digits; const wchar_t *small_digits = L"0123456789abcdefghijklmnopqrstuvwxyz"; const wchar_t *large_digits = L"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; int i; - long long x; /* FIXME the float version of number is direcly copy of number @@ -202,9 +193,9 @@ numberf(wchar_t * buf, wchar_t * end, double num, int base, int size, int precis c = (type & ZEROPAD) ? L'0' : L' '; sign = 0; if (type & SIGN) { - if (num < 0) { + if (num.sign) { sign = L'-'; - num = -num; + num.sign = 0; size--; } else if (type & PLUS) { sign = L'+'; @@ -221,15 +212,11 @@ numberf(wchar_t * buf, wchar_t * end, double num, int base, int size, int precis size--; } i = 0; - if (num == 0) + if (num.AsLongLong == 0) tmp[i++] = L'0'; - else while (num != 0) + else while (num.AsLongLong != 0) { - x = num; - tmp[i++] = digits[do_div(&x,base)]; -#ifndef _M_ARM // Missing __floatdidf in CeGCC 0.55 -- GCC 4.4 - num = x; -#endif + tmp[i++] = digits[do_div(&num.AsLongLong,base)]; } if (i > precision) precision = i; @@ -284,7 +271,6 @@ numberf(wchar_t * buf, wchar_t * end, double num, int base, int size, int precis } return buf; } -#endif static wchar_t* string(wchar_t* buf, wchar_t* end, const char* s, int len, int field_width, int precision, int flags) @@ -395,10 +381,8 @@ int __cdecl _vsnwprintf(wchar_t *buf, size_t cnt, const wchar_t *fmt, va_list ar wchar_t * str, * end; const char *s; const wchar_t *sw; -#if 0 const wchar_t *ss; - double _double; -#endif + double_t _double; int flags; /* flags to number() */ @@ -595,14 +579,13 @@ int __cdecl _vsnwprintf(wchar_t *buf, size_t cnt, const wchar_t *fmt, va_list ar *ip = (str - buf); } continue; -#if 0 /* float number formats - set up the flags and "break" */ case 'e': case 'E': case 'f': case 'g': case 'G': - _double = (double)va_arg(args, double); + _double = va_arg(args, double_t); if ( _isnan(_double) ) { ss = L"Nan"; @@ -638,7 +621,7 @@ int __cdecl _vsnwprintf(wchar_t *buf, size_t cnt, const wchar_t *fmt, va_list ar } continue; -#endif + /* integer number formats - set up the flags and "break" */ From 042bc809cfe6e0be68423eaa4c54f324fbb5ab09 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Wed, 6 Jan 2010 22:53:31 +0000 Subject: [PATCH 016/121] Some work on Mm initialization, added a call to HalInitializeBios, so we have a mapped bios now. svn path=/branches/ros-amd64-bringup/; revision=44982 --- reactos/ntoskrnl/mm/amd64/init.c | 145 +++++++++++++++++++------------ 1 file changed, 90 insertions(+), 55 deletions(-) diff --git a/reactos/ntoskrnl/mm/amd64/init.c b/reactos/ntoskrnl/mm/amd64/init.c index f81af5ba6fd..59a1fcb9b20 100644 --- a/reactos/ntoskrnl/mm/amd64/init.c +++ b/reactos/ntoskrnl/mm/amd64/init.c @@ -1,5 +1,5 @@ /* - * COPYRIGHT: See COPYING in the top level directory + * COPYRIGHT: GPL, See COPYING in the top level directory * PROJECT: ReactOS kernel * FILE: ntoskrnl/mm/amd64/init.c * PURPOSE: Memory Manager Initialization for amd64 @@ -20,6 +20,10 @@ extern PMMPTE MmDebugPte; #endif +VOID +NTAPI +HalInitializeBios(ULONG Unknown, PLOADER_PARAMETER_BLOCK LoaderBlock); + /* GLOBALS *****************************************************************/ /* Sizes */ @@ -76,15 +80,16 @@ ULONG64 MxPfnSizeInBytes; PMEMORY_ALLOCATION_DESCRIPTOR MxFreeDescriptor; MEMORY_ALLOCATION_DESCRIPTOR MxOldFreeDescriptor; ULONG MiNumberDescriptors = 0; +PFN_NUMBER MiSystemPages = 0; BOOLEAN MiIncludeType[LoaderMaximum]; PFN_NUMBER MxFreePageBase; ULONG64 MxFreePageCount = 0; -ULONG MxPhase = 0; PFN_NUMBER MmSystemPageDirectory; PFN_NUMBER MmSizeOfPagedPoolInPages = MI_MIN_INIT_PAGED_POOLSIZE / PAGE_SIZE; +BOOLEAN MiPfnsInitialized = FALSE; /* FUNCTIONS *****************************************************************/ @@ -98,7 +103,7 @@ VOID NTAPI MiEvaluateMemoryDescriptors(IN PLOADER_PARAMETER_BLOCK LoaderBlock) { - PMEMORY_ALLOCATION_DESCRIPTOR MdBlock; + PMEMORY_ALLOCATION_DESCRIPTOR Descriptor; PLIST_ENTRY ListEntry; PFN_NUMBER LastPage; ULONG i; @@ -120,31 +125,31 @@ MiEvaluateMemoryDescriptors(IN PLOADER_PARAMETER_BLOCK LoaderBlock) ListEntry = ListEntry->Flink) { /* Get the memory descriptor */ - MdBlock = CONTAINING_RECORD(ListEntry, - MEMORY_ALLOCATION_DESCRIPTOR, - ListEntry); + Descriptor = CONTAINING_RECORD(ListEntry, + MEMORY_ALLOCATION_DESCRIPTOR, + ListEntry); /* Count it */ MiNumberDescriptors++; /* Skip pages that are not part of the PFN database */ - if (!MiIncludeType[MdBlock->MemoryType]) + if (!MiIncludeType[Descriptor->MemoryType]) { continue; } /* Add this to the total of pages */ - MmNumberOfPhysicalPages += MdBlock->PageCount; + MmNumberOfPhysicalPages += Descriptor->PageCount; /* Check if this is the new lowest page */ - if (MdBlock->BasePage < MmLowestPhysicalPage) + if (Descriptor->BasePage < MmLowestPhysicalPage) { /* Update the lowest page */ - MmLowestPhysicalPage = MdBlock->BasePage; + MmLowestPhysicalPage = Descriptor->BasePage; } /* Check if this is the new highest page */ - LastPage = MdBlock->BasePage + MdBlock->PageCount - 1; + LastPage = Descriptor->BasePage + Descriptor->PageCount - 1; if (LastPage > MmHighestPhysicalPage) { /* Update the highest page */ @@ -152,29 +157,39 @@ MiEvaluateMemoryDescriptors(IN PLOADER_PARAMETER_BLOCK LoaderBlock) } /* Check if this is currently free memory */ - if ((MdBlock->MemoryType == LoaderFree) || - (MdBlock->MemoryType == LoaderLoadedProgram) || - (MdBlock->MemoryType == LoaderFirmwareTemporary) || - (MdBlock->MemoryType == LoaderOsloaderStack)) + if ((Descriptor->MemoryType == LoaderFree) || + (Descriptor->MemoryType == LoaderLoadedProgram) || + (Descriptor->MemoryType == LoaderFirmwareTemporary) || + (Descriptor->MemoryType == LoaderOsloaderStack)) { /* Check if this is the largest memory descriptor */ - if (MdBlock->PageCount > MxFreePageCount) + if (Descriptor->PageCount > MxFreePageCount) { /* For now, it is */ - MxFreeDescriptor = MdBlock; - MxFreePageBase = MdBlock->BasePage; - MxFreePageCount = MdBlock->PageCount; + MxFreeDescriptor = Descriptor; + MxFreePageBase = Descriptor->BasePage; + MxFreePageCount = Descriptor->PageCount; } } + else + { + /* Add it to the amount of system used pages */ + MiSystemPages += Descriptor->PageCount; + } } } PFN_NUMBER NTAPI -MxAllocEarlyPage() +MiEarlyAllocPage() { PFN_NUMBER Pfn; + if (MiPfnsInitialized) + { + return MmAllocPage(MC_SYSTEM, 0); + } + /* Make sure we have enough pages */ if (!MxFreePageCount) { @@ -193,13 +208,6 @@ MxAllocEarlyPage() return Pfn; } -PFN_NUMBER -NTAPI -MxAllocPage() -{ - return (MxPhase == 0) ? MxAllocEarlyPage() : MmAllocPage(MC_SYSTEM, 0); -} - PMMPTE NTAPI MxGetPte(PVOID Address) @@ -217,8 +225,11 @@ MxGetPte(PVOID Address) if (!Pte->u.Hard.Valid) { /* It's not valid, map it! */ - TmplPte.u.Hard.PageFrameNumber = MxAllocPage(); + TmplPte.u.Hard.PageFrameNumber = MiEarlyAllocPage(); *Pte = TmplPte; + + /* Zero the page */ + RtlZeroMemory(MiPteToAddress(Pte), PAGE_SIZE); } /* Get a pointer to the PPE */ @@ -226,8 +237,11 @@ MxGetPte(PVOID Address) if (!Pte->u.Hard.Valid) { /* It's not valid, map it! */ - TmplPte.u.Hard.PageFrameNumber = MxAllocPage(); + TmplPte.u.Hard.PageFrameNumber = MiEarlyAllocPage(); *Pte = TmplPte; + + /* Zero the page */ + RtlZeroMemory(MiPteToAddress(Pte), PAGE_SIZE); } /* Get a pointer to the PDE */ @@ -235,8 +249,11 @@ MxGetPte(PVOID Address) if (!Pte->u.Hard.Valid) { /* It's not valid, map it! */ - TmplPte.u.Hard.PageFrameNumber = MxAllocPage(); + TmplPte.u.Hard.PageFrameNumber = MiEarlyAllocPage(); *Pte = TmplPte; + + /* Zero the page */ + RtlZeroMemory(MiPteToAddress(Pte), PAGE_SIZE); } /* Get a pointer to the PTE */ @@ -254,7 +271,7 @@ MxMapPage(PVOID Address) TmplPte.u.Long = 0; TmplPte.u.Flush.Valid = 1; TmplPte.u.Flush.Write = 1; - TmplPte.u.Hard.PageFrameNumber = MxAllocPage(); + TmplPte.u.Hard.PageFrameNumber = MiEarlyAllocPage(); /* Get the PTE for that page */ Pte = MxGetPte(Address); @@ -281,7 +298,7 @@ VOID NTAPI MiPreparePfnDatabse(IN PLOADER_PARAMETER_BLOCK LoaderBlock) { - PMEMORY_ALLOCATION_DESCRIPTOR MdBlock; + PMEMORY_ALLOCATION_DESCRIPTOR Descriptor; PLIST_ENTRY ListEntry; PUCHAR Page, FirstPage; SIZE_T Size; @@ -299,16 +316,16 @@ MiPreparePfnDatabse(IN PLOADER_PARAMETER_BLOCK LoaderBlock) ListEntry = ListEntry->Flink) { /* Get the memory descriptor */ - MdBlock = CONTAINING_RECORD(ListEntry, - MEMORY_ALLOCATION_DESCRIPTOR, - ListEntry); + Descriptor = CONTAINING_RECORD(ListEntry, + MEMORY_ALLOCATION_DESCRIPTOR, + ListEntry); /* Skip pages that are not part of the PFN database */ - if (MiIncludeType[MdBlock->MemoryType]) + if (MiIncludeType[Descriptor->MemoryType]) { /* Get the base and size of this pfn database entry */ - FirstPage = PAGE_ALIGN(&MmPfnDatabase[MdBlock->BasePage]); - Size = ROUND_TO_PAGES(MdBlock->PageCount * sizeof(MMPFN)); + FirstPage = PAGE_ALIGN(&MmPfnDatabase[Descriptor->BasePage]); + Size = ROUND_TO_PAGES(Descriptor->PageCount * sizeof(MMPFN)); /* Loop the pages of this Pfn database entry */ for (Page = FirstPage; Page < FirstPage + Size; Page += PAGE_SIZE) @@ -318,6 +335,7 @@ MiPreparePfnDatabse(IN PLOADER_PARAMETER_BLOCK LoaderBlock) { /* It's not, map it now */ MxMapPage(Page); + RtlZeroMemory(Page, PAGE_SIZE); } } @@ -384,6 +402,9 @@ MiInitializePageTable() __writecr4(__readcr4() | CR4_PGE); ASSERT(__readcr4() & CR4_PGE); + /* Enable no execute */ + __writemsr(X86_MSR_EFER, __readmsr(X86_MSR_EFER) | EFER_NXE); + /* Loop the user mode PXEs */ for (Pte = MiAddressToPxe(0); Pte <= MiAddressToPxe(MmHighestUserAddress); @@ -414,7 +435,7 @@ MiInitializePageTable() if (!Pte->u.Hard.Valid) { /* It's not Initialize it */ - TmplPte.u.Flush.PageFrameNumber = MxAllocPage(); + TmplPte.u.Flush.PageFrameNumber = MiEarlyAllocPage(0); *Pte = TmplPte; /* Zero the page. The PXE is the PTE for the PDPT. */ @@ -593,7 +614,7 @@ NTAPI MiBuildPhysicalMemoryBlock(IN PLOADER_PARAMETER_BLOCK LoaderBlock) { PPHYSICAL_MEMORY_DESCRIPTOR Buffer; - PMEMORY_ALLOCATION_DESCRIPTOR MdBlock; + PMEMORY_ALLOCATION_DESCRIPTOR Descriptor; PLIST_ENTRY ListEntry; PFN_NUMBER NextPage = -1; PULONG Bitmap; @@ -632,35 +653,35 @@ MiBuildPhysicalMemoryBlock(IN PLOADER_PARAMETER_BLOCK LoaderBlock) ListEntry = ListEntry->Flink) { /* Get the memory descriptor */ - MdBlock = CONTAINING_RECORD(ListEntry, - MEMORY_ALLOCATION_DESCRIPTOR, - ListEntry); + Descriptor = CONTAINING_RECORD(ListEntry, + MEMORY_ALLOCATION_DESCRIPTOR, + ListEntry); /* Skip pages that are not part of the PFN database */ - if (!MiIncludeType[MdBlock->MemoryType]) + if (!MiIncludeType[Descriptor->MemoryType]) { continue; } /* Does the memory block begin where the last ended? */ - if (MdBlock->BasePage == NextPage) + if (Descriptor->BasePage == NextPage) { /* Add it to the current run */ - Buffer->Run[Runs - 1].PageCount += MdBlock->PageCount; + Buffer->Run[Runs - 1].PageCount += Descriptor->PageCount; } else { /* Create a new run */ Runs++; - Buffer->Run[Runs - 1].BasePage = MdBlock->BasePage; - Buffer->Run[Runs - 1].PageCount = MdBlock->PageCount; + Buffer->Run[Runs - 1].BasePage = Descriptor->BasePage; + Buffer->Run[Runs - 1].PageCount = Descriptor->PageCount; } /* Set the bits in the PFN bitmap */ - RtlSetBits(&MiPfnBitMap, MdBlock->BasePage, MdBlock->PageCount); + RtlSetBits(&MiPfnBitMap, Descriptor->BasePage, Descriptor->PageCount); /* Set the next page */ - NextPage = MdBlock->BasePage + MdBlock->PageCount; + NextPage = Descriptor->BasePage + Descriptor->PageCount; } // FIXME: allocate a buffer of better size @@ -728,14 +749,14 @@ MiBuildPagedPool(VOID) if (!Pte->u.Flush.Valid) { /* Map it! */ - TmplPte.u.Flush.PageFrameNumber = MxAllocPage(); + TmplPte.u.Flush.PageFrameNumber = MiEarlyAllocPage(); *Pte = TmplPte; } } /* Create and map the first PTE for paged pool */ Pte = MxGetPte(MmPagedPoolStart); - TmplPte.u.Flush.PageFrameNumber = MxAllocPage(); + TmplPte.u.Flush.PageFrameNumber = MiEarlyAllocPage(); *Pte = TmplPte; /* Save the first and last paged pool PTE */ @@ -801,9 +822,15 @@ MmArmInitSystem(IN ULONG Phase, { if (Phase == 0) { - /* Parse memory descriptors */ + MmBootImageSize = KeLoaderBlock->Extension->LoaderPagesSpanned * PAGE_SIZE; + MmBootImageSize = ROUND_UP(MmBootImageSize, PAGE_SIZE); + + /* Parse memory descriptors, find free pages */ MiEvaluateMemoryDescriptors(LoaderBlock); + /* Start PFN database at hardcoded address */ + MmPfnDatabase = MI_PFN_DATABASE; + /* Prepare PFN database mappings */ MiPreparePfnDatabse(LoaderBlock); @@ -824,8 +851,8 @@ MmArmInitSystem(IN ULONG Phase, /* The PFN database was created, restore the free descriptor */ *MxFreeDescriptor = MxOldFreeDescriptor; - /* Switch to phase 1 */ - MxPhase = 1; + /* The pfn database is ready now */ + MiPfnsInitialized = TRUE; /* Initialize the nonpaged pool */ MiBuildNonPagedPool(); @@ -838,6 +865,14 @@ MmArmInitSystem(IN ULONG Phase, /* Size up paged pool and build the shadow system page directory */ MiBuildPagedPool(); + + // This is the old stuff: + MmPagedPoolBase = (PVOID)((PCHAR)MmPagedPoolEnd + 1); + MmPagedPoolSize = MM_PAGED_POOL_SIZE; + ASSERT((PCHAR)MmPagedPoolBase + MmPagedPoolSize < (PCHAR)MmNonPagedSystemStart); + + + HalInitializeBios(0, LoaderBlock); } return STATUS_SUCCESS; From f6bd1f70d84aea2e2f76cbc96dc7a7a720208d95 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Wed, 6 Jan 2010 23:03:19 +0000 Subject: [PATCH 017/121] [HAL] - comment out an ASSERT for now - add Mdl flag MDL_PAGES_LOCKED - remove obsolete DriverEntry svn path=/branches/ros-amd64-bringup/; revision=44983 --- reactos/hal/halx86/generic/amd64/halinit.c | 11 ----------- reactos/hal/halx86/generic/amd64/misc.c | 2 +- reactos/hal/halx86/generic/amd64/x86bios.c | 6 ++++-- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/reactos/hal/halx86/generic/amd64/halinit.c b/reactos/hal/halx86/generic/amd64/halinit.c index 1d867bc6338..13724c06819 100644 --- a/reactos/hal/halx86/generic/amd64/halinit.c +++ b/reactos/hal/halx86/generic/amd64/halinit.c @@ -40,17 +40,6 @@ HalpGetParameters(IN PLOADER_PARAMETER_BLOCK LoaderBlock) /* FUNCTIONS *****************************************************************/ -NTSTATUS -NTAPI -DriverEntry( - PDRIVER_OBJECT DriverObject, - PUNICODE_STRING RegistryPath) -{ - UNIMPLEMENTED; - - return STATUS_SUCCESS; -} - /* * @implemented */ diff --git a/reactos/hal/halx86/generic/amd64/misc.c b/reactos/hal/halx86/generic/amd64/misc.c index a591c14f803..fd33325d976 100644 --- a/reactos/hal/halx86/generic/amd64/misc.c +++ b/reactos/hal/halx86/generic/amd64/misc.c @@ -156,7 +156,7 @@ KeQueryPerformanceCounter( { LARGE_INTEGER Result; - ASSERT(HalpPerformanceFrequency.QuadPart != 0); +// ASSERT(HalpPerformanceFrequency.QuadPart != 0); /* Does the caller want the frequency? */ if (PerformanceFrequency) diff --git a/reactos/hal/halx86/generic/amd64/x86bios.c b/reactos/hal/halx86/generic/amd64/x86bios.c index 129119d9ec8..250c5ccc759 100644 --- a/reactos/hal/halx86/generic/amd64/x86bios.c +++ b/reactos/hal/halx86/generic/amd64/x86bios.c @@ -1,7 +1,7 @@ /* * PROJECT: ReactOS HAL - * LICENSE: See COPYING in the top level directory - * FILE: hal/halamd64/generic/x86bios.c + * LICENSE: GPL, See COPYING in the top level directory + * FILE: hal/halx86/generic/amd64/x86bios.c * PURPOSE: * PROGRAMMERS: Timo Kreuzer (timo.kreuzer@reactos.org) */ @@ -75,6 +75,8 @@ HalInitializeBios(ULONG Unknown, PLOADER_PARAMETER_BLOCK LoaderBlock) } } + Mdl->MdlFlags = MDL_PAGES_LOCKED; + /* Map the MDL to system space */ x86BiosMemoryMapping = MmGetSystemAddressForMdlSafe(Mdl, HighPagePriority); ASSERT(x86BiosMemoryMapping); From 4f3a2dfc7e17db860ea451b1d9a73d12821ece05 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Mon, 11 Jan 2010 19:29:16 +0000 Subject: [PATCH 018/121] [HAL] - Move x86 emulator definitions into their own header - Fix handling of the real mode IDT in x86BiosCall - Implement HalpBiosDisplayReset - Fix a copy paste error svn path=/branches/ros-amd64-bringup/; revision=45047 --- reactos/hal/halx86/generic/amd64/x86bios.c | 156 ++++++--------- reactos/hal/halx86/generic/amd64/x86emu.h | 221 +++++++++++++++++++++ 2 files changed, 284 insertions(+), 93 deletions(-) create mode 100644 reactos/hal/halx86/generic/amd64/x86emu.h diff --git a/reactos/hal/halx86/generic/amd64/x86bios.c b/reactos/hal/halx86/generic/amd64/x86bios.c index 250c5ccc759..16e120ff8e0 100644 --- a/reactos/hal/halx86/generic/amd64/x86bios.c +++ b/reactos/hal/halx86/generic/amd64/x86bios.c @@ -12,6 +12,8 @@ //#define NDEBUG #include +#include "x86emu.h" + /* This page serves as fallback for pages used by Mm */ #define DEFAULT_PAGE 0x21 @@ -21,6 +23,24 @@ BOOLEAN x86BiosIsInitialized; LONG x86BiosBufferIsAllocated = 0; PUCHAR x86BiosMemoryMapping; + +VOID +NTAPI +DbgDumpPage(PUCHAR MemBuffer, USHORT Segment) +{ + ULONG x, y, Offset; + + for (y = 0; y < 0x100; y++) + { + for (x = 0; x < 0x10; x++) + { + Offset = Segment * 16 + y * 16 + x; + DbgPrint("%02x ", MemBuffer[Offset]); + } + DbgPrint("\n"); + } +} + VOID NTAPI HalInitializeBios(ULONG Unknown, PLOADER_PARAMETER_BLOCK LoaderBlock) @@ -62,7 +82,7 @@ HalInitializeBios(ULONG Unknown, PLOADER_PARAMETER_BLOCK LoaderBlock) { /* Check if the memory type is firmware */ if (Descriptor->MemoryType != LoaderFirmwarePermanent && - Descriptor->MemoryType != LoaderFirmwarePermanent) + Descriptor->MemoryType != LoaderSpecialMemory) { /* It's something else, so don't use it! */ Last = min(Descriptor->BasePage + Descriptor->PageCount, 0x100); @@ -82,13 +102,16 @@ HalInitializeBios(ULONG Unknown, PLOADER_PARAMETER_BLOCK LoaderBlock) ASSERT(x86BiosMemoryMapping); DPRINT1("memory: %p, %p\n", *(PVOID*)x86BiosMemoryMapping, *(PVOID*)(x86BiosMemoryMapping + 8)); + //DbgDumpPage(x86BiosMemoryMapping, 0xc351); x86BiosIsInitialized = TRUE; + + HalpBiosDisplayReset(); } NTSTATUS NTAPI -x86BiosAllocateBuffer ( +x86BiosAllocateBuffer( ULONG *Size, USHORT *Segment, USHORT *Offset) @@ -117,7 +140,7 @@ x86BiosAllocateBuffer ( NTSTATUS NTAPI -x86BiosFreeBuffer ( +x86BiosFreeBuffer( USHORT Segment, USHORT Offset) { @@ -141,7 +164,7 @@ x86BiosFreeBuffer ( NTSTATUS NTAPI -x86BiosReadMemory ( +x86BiosReadMemory( USHORT Segment, USHORT Offset, PVOID Buffer, @@ -168,7 +191,7 @@ x86BiosReadMemory ( NTSTATUS NTAPI -x86BiosWriteMemory ( +x86BiosWriteMemory( USHORT Segment, USHORT Offset, PVOID Buffer, @@ -193,97 +216,18 @@ x86BiosWriteMemory ( return STATUS_SUCCESS; } -typedef struct -{ - union - { - ULONG Eax; - USHORT Ax; - struct - { - UCHAR Al; - UCHAR Ah; - }; - }; - union - { - ULONG Ecx; - USHORT Cx; - struct - { - UCHAR Cl; - UCHAR Ch; - }; - }; - union - { - ULONG Edx; - USHORT Dx; - struct - { - UCHAR Dl; - UCHAR Dh; - }; - }; - union - { - ULONG Ebx; - USHORT Bx; - struct - { - UCHAR Bl; - UCHAR Bh; - }; - }; - ULONG Ebp; - ULONG Esi; - ULONG Edi; - USHORT SegDs; - USHORT SegEs; - - /* Extended */ - union - { - ULONG Eip; - USHORT Ip; - }; - - union - { - ULONG Esp; - USHORT Sp; - }; - -} X86_REGISTERS, *PX86_REGISTERS; - -enum -{ - X86_VMFLAGS_RETURN_ON_IRET = 1, -}; - -typedef struct -{ - union - { - X86_BIOS_REGISTERS BiosRegisters; - X86_REGISTERS Registers; - }; - - struct - { - ULONG ReturnOnIret:1; - } Flags; - - PVOID MemBuffer; -} X86_VM_STATE, *PX86_VM_STATE; - BOOLEAN NTAPI -x86BiosCall ( +x86BiosCall( ULONG InterruptNumber, X86_BIOS_REGISTERS *Registers) { X86_VM_STATE VmState; + struct + { + USHORT Ip; + USHORT SegCs; + } *InterrupTable; /* Zero the VmState */ RtlZeroMemory(&VmState, sizeof(VmState)); @@ -294,9 +238,18 @@ x86BiosCall ( /* Set the physical memory buffer */ VmState.MemBuffer = x86BiosMemoryMapping; - /* Initialize IP from the interrupt vector table */ - VmState.Registers.Ip = ((PUSHORT)x86BiosMemoryMapping)[InterruptNumber]; + /* Set Eflags */ + VmState.Registers.Eflags.Long = 0; // FIXME + /* Setup stack */ + VmState.Registers.SegSs = 0; // FIXME + VmState.Registers.Sp = 0x2000 - 2; // FIXME + + /* Initialize IP from the interrupt vector table */ + InterrupTable = (PVOID)x86BiosMemoryMapping; + VmState.Registers.SegCs = InterrupTable[InterruptNumber].SegCs; + VmState.Registers.Eip = InterrupTable[InterruptNumber].Ip; + /* Make the function return on IRET */ VmState.Flags.ReturnOnIret = 1; @@ -313,7 +266,24 @@ BOOLEAN NTAPI HalpBiosDisplayReset(VOID) { - UNIMPLEMENTED; + X86_BIOS_REGISTERS Registers; + ULONG OldEflags; + + /* Save flags and disable interrupts */ + OldEflags = __readeflags(); + _disable(); + + /* Set AH = 0 (Set video mode), AL = 0x12 (640x480x16 vga) */ + Registers.Eax = 0x12; + + /* Call INT 0x10 */ + x86BiosCall(0x10, &Registers); + + // FIXME: check result + + /* Restore previous flags */ + __writeeflags(OldEflags); + return TRUE; } diff --git a/reactos/hal/halx86/generic/amd64/x86emu.h b/reactos/hal/halx86/generic/amd64/x86emu.h new file mode 100644 index 00000000000..7e475c1b04f --- /dev/null +++ b/reactos/hal/halx86/generic/amd64/x86emu.h @@ -0,0 +1,221 @@ + +typedef union +{ + USHORT Short; + ULONG Long; + struct + { + ULONG Cf:1; + ULONG Pf:1; + ULONG Af:1; + ULONG Zf:1; + ULONG Sf:1; + ULONG Tf:1; + ULONG If:1; + ULONG Df:1; + ULONG Of:1; + ULONG Iopl:3; + ULONG Nt:1; + ULONG Rf:1; + ULONG Vm:1; + ULONG Ac:1; + ULONG Vif:1; + ULONG Vip:1; + ULONG Id:1; + }; +} EFLAGS; + +typedef union +{ + ULONG Dword; + USHORT Word; + UCHAR Byte; + struct + { + UCHAR Low; + UCHAR High; + }; +} REGU; + +typedef union +{ + struct + { + UCHAR mod:2; + UCHAR reg:3; + UCHAR rm:3; + }; + UCHAR Byte; +} MODRM; + +typedef struct +{ + union + { + ULONG Eax; + USHORT Ax; + struct + { + UCHAR Al; + UCHAR Ah; + }; + }; + union + { + ULONG Ecx; + USHORT Cx; + struct + { + UCHAR Cl; + UCHAR Ch; + }; + }; + union + { + ULONG Edx; + USHORT Dx; + struct + { + UCHAR Dl; + UCHAR Dh; + }; + }; + union + { + ULONG Ebx; + USHORT Bx; + struct + { + UCHAR Bl; + UCHAR Bh; + }; + }; + union + { + ULONG Ebp; + USHORT Bp; + }; + union + { + ULONG Esi; + USHORT Si; + }; + union + { + ULONG Edi; + USHORT Di; + }; + union + { + struct + { + ULONG ReservedDsMBZ:4; + ULONG SegDs:16; + }; + ULONG ShiftedDs; + }; + union + { + struct + { + ULONG ReservedEsMBZ:4; + ULONG SegEs:16; + }; + ULONG ShiftedEs; + }; + + /* Extended */ + union + { + struct + { + ULONG ReservedCsMBZ:4; + ULONG SegCs:16; + }; + ULONG ShiftedCs; + }; + union + { + struct + { + ULONG ReservedSsMBZ:4; + ULONG SegSs:16; + }; + ULONG ShiftedSs; + }; + + union + { + struct + { + ULONG ReservedMsMBZ:4; + ULONG SegMs:16; + }; + ULONG ShiftedMs; + }; + + union + { + ULONG Eip; + USHORT Ip; + }; + + union + { + ULONG Esp; + USHORT Sp; + }; + + EFLAGS Eflags; + +} X86_REGISTERS, *PX86_REGISTERS; + +enum +{ + X86_VMFLAGS_RETURN_ON_IRET = 1, +}; + +typedef struct +{ + union + { + X86_BIOS_REGISTERS BiosRegisters; + X86_REGISTERS Registers; + REGU IndexedRegisters[8]; + }; + + struct + { + ULONG ReturnOnIret:1; + } Flags; + + PVOID MemBuffer; + +#if 1 + PCHAR Mnemonic; + PCHAR DstReg; + PCHAR SrcReg; + ULONG SrcEncodung; + ULONG DstEncoding; + ULONG Length; +#endif +} X86_VM_STATE, *PX86_VM_STATE; + +enum +{ + PREFIX_SIZE_OVERRIDE = 0x010001, + PREFIX_ADDRESS_OVERRIDE = 0x020002, + PREFIX_SEGMENT_CS = 0x040004, + PREFIX_SEGMENT_DS = 0x040008, + PREFIX_SEGMENT_ES = 0x040010, + PREFIX_SEGMNET_FS = 0x040020, + PREFIX_SEGMENT_GS = 0x040040, + PREFIX_SEGMENT_SS = 0x040080, + PREFIX_LOCK = 0x080100, + PREFIX_REP = 0x100200, +} PREFIX_STATE; + + +VOID +NTAPI +x86Emulator(PX86_VM_STATE VmState); From cffde6eb86916393a3c2be8240ef92369ec698d0 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 12 Jan 2010 20:09:38 +0000 Subject: [PATCH 019/121] [CRT] __wine_push_frame and __wine_pop_frame are only used in x86 specific code in cppexcept.c. Move them there instead of trying to implement them for other architectures. svn path=/branches/ros-amd64-bringup/; revision=45053 --- reactos/lib/sdk/crt/except/cppexcept.c | 13 ++++++++++ .../sdk/crt/include/internal/wine/cppexcept.h | 26 ------------------- 2 files changed, 13 insertions(+), 26 deletions(-) diff --git a/reactos/lib/sdk/crt/except/cppexcept.c b/reactos/lib/sdk/crt/except/cppexcept.c index f84682d61e9..34d14a7c15d 100644 --- a/reactos/lib/sdk/crt/except/cppexcept.c +++ b/reactos/lib/sdk/crt/except/cppexcept.c @@ -39,6 +39,19 @@ DWORD CDECL cxx_frame_handler( PEXCEPTION_RECORD rec, cxx_exception_frame* frame const cxx_function_descr *descr, EXCEPTION_REGISTRATION_RECORD* nested_frame, int nested_trylevel ); +static inline EXCEPTION_REGISTRATION_RECORD *__wine_push_frame( EXCEPTION_REGISTRATION_RECORD *frame ) +{ + frame->Next = (struct _EXCEPTION_REGISTRATION_RECORD *)__readfsdword(0); + __writefsdword(0, (unsigned long)frame); + return frame->Next; +} + +static inline EXCEPTION_REGISTRATION_RECORD *__wine_pop_frame( EXCEPTION_REGISTRATION_RECORD *frame ) +{ + __writefsdword(0, (unsigned long)frame->Next); + return frame->Next; +} + /* call a function with a given ebp */ static inline void *call_ebp_func( void *func, void *ebp ) { diff --git a/reactos/lib/sdk/crt/include/internal/wine/cppexcept.h b/reactos/lib/sdk/crt/include/internal/wine/cppexcept.h index 2471916ecda..0e6c389da19 100644 --- a/reactos/lib/sdk/crt/include/internal/wine/cppexcept.h +++ b/reactos/lib/sdk/crt/include/internal/wine/cppexcept.h @@ -59,32 +59,6 @@ #pragma warning(disable:4733) #endif -static inline EXCEPTION_REGISTRATION_RECORD *__wine_push_frame( EXCEPTION_REGISTRATION_RECORD *frame ) -{ -#if defined(__i386__) - frame->Next = (struct _EXCEPTION_REGISTRATION_RECORD *)__readfsdword(0); - __writefsdword(0, (unsigned long)frame); - return frame->Next; -#else - NT_TIB *teb = (NT_TIB *)NtCurrentTeb(); - frame->Next = teb->ExceptionList; - teb->ExceptionList = frame; - return frame->Next; -#endif -} - -static inline EXCEPTION_REGISTRATION_RECORD *__wine_pop_frame( EXCEPTION_REGISTRATION_RECORD *frame ) -{ -#if defined(__i386__) - __writefsdword(0, (unsigned long)frame->Next); - return frame->Next; -#else - NT_TIB *teb = (NT_TIB *)NtCurrentTeb(); - teb->ExceptionList = frame->Next; - return frame->Next; -#endif -} - #ifdef _MSC_VER #pragma warning(pop) #endif From b4707f7f79d27f03e780f5c1b258f487751dc020 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Wed, 13 Jan 2010 01:10:36 +0000 Subject: [PATCH 020/121] Update file from trunk svn path=/branches/ros-amd64-bringup/; revision=45056 --- reactos/ntoskrnl/fsrtl/fastio.c | 744 ++++++++++++++++---------------- 1 file changed, 372 insertions(+), 372 deletions(-) diff --git a/reactos/ntoskrnl/fsrtl/fastio.c b/reactos/ntoskrnl/fsrtl/fastio.c index 9863b736639..78ac48e57bd 100644 --- a/reactos/ntoskrnl/fsrtl/fastio.c +++ b/reactos/ntoskrnl/fsrtl/fastio.c @@ -74,9 +74,9 @@ FsRtlCopyRead(IN PFILE_OBJECT FileObject, PFAST_IO_DISPATCH FastIoDispatch; PDEVICE_OBJECT Device; BOOLEAN Result = TRUE; - ULONG PageCount = ADDRESS_AND_SIZE_TO_SPAN_PAGES(FileOffset,Length); + ULONG PageCount = ADDRESS_AND_SIZE_TO_SPAN_PAGES(FileOffset, Length); - PAGED_CODE(); + PAGED_CODE(); ASSERT(FileObject); ASSERT(FileObject->FsContext); @@ -91,9 +91,9 @@ FsRtlCopyRead(IN PFILE_OBJECT FileObject, if (Length > MAXLONGLONG - FileOffset->QuadPart) { - IoStatus->Status = STATUS_INVALID_PARAMETER; - IoStatus->Information = 0; - return FALSE; + IoStatus->Status = STATUS_INVALID_PARAMETER; + IoStatus->Information = 0; + return FALSE; } /* Get the offset and FCB header */ @@ -104,7 +104,7 @@ FsRtlCopyRead(IN PFILE_OBJECT FileObject, { /* Use a Resource Acquire */ FsRtlEnterFileSystem(); - CcFastReadWait++; + CcFastReadWait++; ExAcquireResourceSharedLite(FcbHeader->Resource, TRUE); } else @@ -115,9 +115,9 @@ FsRtlCopyRead(IN PFILE_OBJECT FileObject, FsRtlEnterFileSystem(); if (!ExAcquireResourceSharedLite(FcbHeader->Resource, FALSE)) { - FsRtlExitFileSystem(); - FsRtlIncrementCcFastReadResourceMiss(); - return FALSE; + FsRtlExitFileSystem(); + FsRtlIncrementCcFastReadResourceMiss(); + return FALSE; } } @@ -126,8 +126,8 @@ FsRtlCopyRead(IN PFILE_OBJECT FileObject, (FcbHeader->IsFastIoPossible == FastIoIsNotPossible)) { /* It's not, so fail */ - Result = FALSE; - goto Cleanup; + Result = FALSE; + goto Cleanup; } /* Check if we need to find out if fast I/O is available */ @@ -138,7 +138,7 @@ FsRtlCopyRead(IN PFILE_OBJECT FileObject, /* Get the Fast I/O table */ Device = IoGetRelatedDeviceObject(FileObject); - FastIoDispatch = Device->DriverObject->FastIoDispatch; + FastIoDispatch = Device->DriverObject->FastIoDispatch; /* Sanity check */ ASSERT(FastIoDispatch != NULL); @@ -158,7 +158,7 @@ FsRtlCopyRead(IN PFILE_OBJECT FileObject, Result = FALSE; goto Cleanup; } - } + } /* Check if we read too much */ if (Offset.QuadPart > FcbHeader->FileSize.QuadPart) @@ -177,15 +177,15 @@ FsRtlCopyRead(IN PFILE_OBJECT FileObject, } /* Set this as top-level IRP */ - PsGetCurrentThread()->TopLevelIrp = FSRTL_FAST_IO_TOP_LEVEL_IRP; + PsGetCurrentThread()->TopLevelIrp = FSRTL_FAST_IO_TOP_LEVEL_IRP; - _SEH2_TRY - { - /* Make sure the IO and file size is below 4GB */ + _SEH2_TRY + { + /* Make sure the IO and file size is below 4GB */ if (Wait && !(Offset.HighPart | FcbHeader->FileSize.HighPart)) { - /* Call the cache controller */ + /* Call the cache controller */ CcFastCopyRead(FileObject, FileOffset->LowPart, Length, @@ -193,14 +193,14 @@ FsRtlCopyRead(IN PFILE_OBJECT FileObject, Buffer, IoStatus); - /* File was accessed */ - FileObject->Flags |= FO_FILE_FAST_IO_READ; + /* File was accessed */ + FileObject->Flags |= FO_FILE_FAST_IO_READ; if (IoStatus->Status != STATUS_END_OF_FILE) { ASSERT(FcbHeader->FileSize.QuadPart >= FileOffset->QuadPart + IoStatus->Information); - } + } } else { @@ -214,30 +214,30 @@ FsRtlCopyRead(IN PFILE_OBJECT FileObject, IoStatus); /* File was accessed */ - FileObject->Flags |= FO_FILE_FAST_IO_READ; + FileObject->Flags |= FO_FILE_FAST_IO_READ; if (Result == TRUE) { - ASSERT( (IoStatus->Status == STATUS_END_OF_FILE) || + ASSERT((IoStatus->Status == STATUS_END_OF_FILE) || ((LONGLONG)(FileOffset->QuadPart + IoStatus->Information) <= FcbHeader->FileSize.QuadPart)); - } - } + } + } /* Update the current file offset */ if (Result == TRUE) { - FileObject->CurrentByteOffset.QuadPart += IoStatus->Information; - } - } + FileObject->CurrentByteOffset.QuadPart += IoStatus->Information; + } + } _SEH2_EXCEPT(FsRtlIsNtstatusExpected(_SEH2_GetExceptionCode()) ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) - { - Result = FALSE; + { + Result = FALSE; } _SEH2_END; - PsGetCurrentThread()->TopLevelIrp = 0; + PsGetCurrentThread()->TopLevelIrp = 0; /* Return to caller */ Cleanup: @@ -248,7 +248,7 @@ Cleanup: if (Result == FALSE) { CcFastReadNotPossible += 1; - } + } return Result; } @@ -306,11 +306,11 @@ FsRtlCopyWrite(IN PFILE_OBJECT FileObject, /* Nagar p.544. * Check with Cc if we can write and check if the IO > 64kB (WDK macro). */ - if ( (CcCanIWrite(FileObject, Length,Wait, FALSE) == FALSE) || - (CcCopyWriteWontFlush(FileObject,FileOffset,Length) == FALSE) || + if ((CcCanIWrite(FileObject, Length, Wait, FALSE) == FALSE) || + (CcCopyWriteWontFlush(FileObject, FileOffset, Length) == FALSE) || ((FileObject->Flags & FO_WRITE_THROUGH) == TRUE)) { - return FALSE; + return FALSE; } /* No actual read */ @@ -334,12 +334,12 @@ FsRtlCopyWrite(IN PFILE_OBJECT FileObject, if ((FileOffsetAppend == FALSE) && (Offset.LowPart <= FcbHeader->ValidDataLength.LowPart)) { - ExAcquireResourceSharedLite(FcbHeader->Resource,TRUE); - ResourceAquiredShared = TRUE; + ExAcquireResourceSharedLite(FcbHeader->Resource, TRUE); + ResourceAquiredShared = TRUE; } else { - ExAcquireResourceExclusiveLite(FcbHeader->Resource,TRUE); + ExAcquireResourceExclusiveLite(FcbHeader->Resource, TRUE); } /* Nagar p.544/545. @@ -348,15 +348,15 @@ FsRtlCopyWrite(IN PFILE_OBJECT FileObject, */ if (FileOffsetAppend == TRUE) { - Offset.LowPart = FcbHeader->FileSize.LowPart; - NewSize.LowPart = FcbHeader->FileSize.LowPart + Length; - b_4GB = (NewSize.LowPart < FcbHeader->FileSize.LowPart); + Offset.LowPart = FcbHeader->FileSize.LowPart; + NewSize.LowPart = FcbHeader->FileSize.LowPart + Length; + b_4GB = (NewSize.LowPart < FcbHeader->FileSize.LowPart); } else { - Offset.LowPart = FileOffset->LowPart; - NewSize.LowPart = FileOffset->LowPart + Length; + Offset.LowPart = FileOffset->LowPart; + NewSize.LowPart = FileOffset->LowPart + Length; b_4GB = (NewSize.LowPart < FileOffset->LowPart) || (FileOffset->HighPart != 0); } @@ -367,10 +367,10 @@ FsRtlCopyWrite(IN PFILE_OBJECT FileObject, * That we are not extending past the allocated size. * That we are not creating a hole bigger than 8k. * That we are not crossing the 4GB boundary. - */ - if ( (FileObject->PrivateCacheMap != NULL) && - (FcbHeader->IsFastIoPossible != FastIoIsNotPossible) && - (FcbHeader->AllocationSize.LowPart >= NewSize.LowPart) && + */ + if ((FileObject->PrivateCacheMap != NULL) && + (FcbHeader->IsFastIoPossible != FastIoIsNotPossible) && + (FcbHeader->AllocationSize.LowPart >= NewSize.LowPart) && (Offset.LowPart < FcbHeader->ValidDataLength.LowPart + 0x2000) && !b_4GB) { @@ -381,133 +381,133 @@ FsRtlCopyWrite(IN PFILE_OBJECT FileObject, if (ResourceAquiredShared && (NewSize.LowPart > FcbHeader->ValidDataLength.LowPart + 0x2000)) { - /* Then we need to acquire the resource exclusive */ - ExReleaseResourceLite(FcbHeader->Resource); - ExAcquireResourceExclusiveLite(FcbHeader->Resource,TRUE); + /* Then we need to acquire the resource exclusive */ + ExReleaseResourceLite(FcbHeader->Resource); + ExAcquireResourceExclusiveLite(FcbHeader->Resource, TRUE); if (FileOffsetAppend == TRUE) { - Offset.LowPart = FcbHeader->FileSize.LowPart; // ?? - NewSize.LowPart = FcbHeader->FileSize.LowPart + Length; + Offset.LowPart = FcbHeader->FileSize.LowPart; // ?? + NewSize.LowPart = FcbHeader->FileSize.LowPart + Length; - /* Make sure we don't cross the 4GB boundary */ - b_4GB = (NewSize.LowPart < Offset.LowPart); - } + /* Make sure we don't cross the 4GB boundary */ + b_4GB = (NewSize.LowPart < Offset.LowPart); + } /* Recheck some of the conditions since we let the lock go */ - if ( (FileObject->PrivateCacheMap != NULL) && - (FcbHeader->IsFastIoPossible != FastIoIsNotPossible) && - (FcbHeader->AllocationSize.LowPart >= NewSize.LowPart) && - (FcbHeader->AllocationSize.HighPart == 0) && + if ((FileObject->PrivateCacheMap != NULL) && + (FcbHeader->IsFastIoPossible != FastIoIsNotPossible) && + (FcbHeader->AllocationSize.LowPart >= NewSize.LowPart) && + (FcbHeader->AllocationSize.HighPart == 0) && !b_4GB) - { + { /* Do nothing? */ } else - { - goto FailAndCleanup; - } - } + { + goto FailAndCleanup; + } + } } else { - goto FailAndCleanup; + goto FailAndCleanup; } - /* Check if we need to find out if fast I/O is available */ - if (FcbHeader->IsFastIoPossible == FastIoIsQuestionable) - { - IO_STATUS_BLOCK FastIoCheckIfPossibleStatus; + /* Check if we need to find out if fast I/O is available */ + if (FcbHeader->IsFastIoPossible == FastIoIsQuestionable) + { + IO_STATUS_BLOCK FastIoCheckIfPossibleStatus; - /* Sanity check */ - ASSERT(!KeIsExecutingDpc()); + /* Sanity check */ + ASSERT(!KeIsExecutingDpc()); - /* Get the Fast I/O table */ - Device = IoGetRelatedDeviceObject(FileObject); - FastIoDispatch = Device->DriverObject->FastIoDispatch; + /* Get the Fast I/O table */ + Device = IoGetRelatedDeviceObject(FileObject); + FastIoDispatch = Device->DriverObject->FastIoDispatch; - /* Sanity check */ - ASSERT(FastIoDispatch != NULL); - ASSERT(FastIoDispatch->FastIoCheckIfPossible != NULL); + /* Sanity check */ + ASSERT(FastIoDispatch != NULL); + ASSERT(FastIoDispatch->FastIoCheckIfPossible != NULL); - /* Ask the driver if we can do it */ - if (!FastIoDispatch->FastIoCheckIfPossible(FileObject, + /* Ask the driver if we can do it */ + if (!FastIoDispatch->FastIoCheckIfPossible(FileObject, FileOffsetAppend ? &FcbHeader->FileSize : FileOffset, - Length, - TRUE, - LockKey, - FALSE, - &FastIoCheckIfPossibleStatus, - Device)) - { - /* It's not, fail */ - goto FailAndCleanup; - } - } + Length, + TRUE, + LockKey, + FALSE, + &FastIoCheckIfPossibleStatus, + Device)) + { + /* It's not, fail */ + goto FailAndCleanup; + } + } /* If we are going to extend the file then save * the old file size in case the operation fails. - */ + */ if (NewSize.LowPart > FcbHeader->FileSize.LowPart) { - FileSizeModified = TRUE; - OldFileSize.LowPart = FcbHeader->FileSize.LowPart; - OldValidDataLength.LowPart = FcbHeader->ValidDataLength.LowPart; - FcbHeader->FileSize.LowPart = NewSize.LowPart; - } + FileSizeModified = TRUE; + OldFileSize.LowPart = FcbHeader->FileSize.LowPart; + OldValidDataLength.LowPart = FcbHeader->ValidDataLength.LowPart; + FcbHeader->FileSize.LowPart = NewSize.LowPart; + } - /* Set this as top-level IRP */ - PsGetCurrentThread()->TopLevelIrp = FSRTL_FAST_IO_TOP_LEVEL_IRP; + /* Set this as top-level IRP */ + PsGetCurrentThread()->TopLevelIrp = FSRTL_FAST_IO_TOP_LEVEL_IRP; - _SEH2_TRY - { + _SEH2_TRY + { if (Offset.LowPart > FcbHeader->ValidDataLength.LowPart) { - LARGE_INTEGER OffsetVar; - OffsetVar.LowPart = Offset.LowPart; - OffsetVar.HighPart = 0; - CcZeroData(FileObject,&FcbHeader->ValidDataLength,&OffsetVar,TRUE); - } + LARGE_INTEGER OffsetVar; + OffsetVar.LowPart = Offset.LowPart; + OffsetVar.HighPart = 0; + CcZeroData(FileObject, &FcbHeader->ValidDataLength, &OffsetVar, TRUE); + } - /* Call the cache manager */ - CcFastCopyWrite(FileObject,Offset.LowPart,Length,Buffer); - } + /* Call the cache manager */ + CcFastCopyWrite(FileObject, Offset.LowPart, Length, Buffer); + } _SEH2_EXCEPT(FsRtlIsNtstatusExpected(_SEH2_GetExceptionCode()) ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) - { - Result = FALSE; + { + Result = FALSE; } _SEH2_END; /* Remove ourselves at the top level component after the IO is done */ - PsGetCurrentThread()->TopLevelIrp = 0; + PsGetCurrentThread()->TopLevelIrp = 0; - /* Did the operation succeed ? */ + /* Did the operation succeed? */ if (Result == TRUE) { - /* Update the valid file size if necessary */ + /* Update the valid file size if necessary */ if (NewSize.LowPart > FcbHeader->ValidDataLength.LowPart) { - FcbHeader->ValidDataLength.LowPart = NewSize.LowPart ; - } + FcbHeader->ValidDataLength.LowPart = NewSize.LowPart; + } /* Flag the file as modified */ - FileObject->Flags |= FO_FILE_MODIFIED; + FileObject->Flags |= FO_FILE_MODIFIED; - /* Update the strucutres if the file size changed */ + /* Update the strucutres if the file size changed */ if (FileSizeModified) { SharedCacheMap = (PSHARED_CACHE_MAP)FileObject->SectionObjectPointer->SharedCacheMap; SharedCacheMap->FileSize.LowPart = NewSize.LowPart; - FileObject->Flags |= FO_FILE_SIZE_CHANGED; - } + FileObject->Flags |= FO_FILE_SIZE_CHANGED; + } /* Update the file object current file offset */ - FileObject->CurrentByteOffset.QuadPart = NewSize.LowPart; + FileObject->CurrentByteOffset.QuadPart = NewSize.LowPart; } else @@ -515,31 +515,31 @@ FsRtlCopyWrite(IN PFILE_OBJECT FileObject, /* Result == FALSE if we get here */ if (FileSizeModified) { - /* If the file size was modified then restore the old file size */ + /* If the file size was modified then restore the old file size */ if (FcbHeader->PagingIoResource != NULL) { /* Nagar P.544. * Restore the old file size if operation didn't succeed. */ - ExAcquireResourceExclusiveLite(FcbHeader->PagingIoResource,TRUE); - FcbHeader->FileSize.LowPart = OldFileSize.LowPart; - FcbHeader->ValidDataLength.LowPart = OldValidDataLength.LowPart; - ExReleaseResourceLite(FcbHeader->PagingIoResource); + ExAcquireResourceExclusiveLite(FcbHeader->PagingIoResource, TRUE); + FcbHeader->FileSize.LowPart = OldFileSize.LowPart; + FcbHeader->ValidDataLength.LowPart = OldValidDataLength.LowPart; + ExReleaseResourceLite(FcbHeader->PagingIoResource); } else { - /* If there is no lock and do it without */ - FcbHeader->FileSize.LowPart = OldFileSize.LowPart; - FcbHeader->ValidDataLength.LowPart = OldValidDataLength.LowPart; - } - } + /* If there is no lock and do it without */ + FcbHeader->FileSize.LowPart = OldFileSize.LowPart; + FcbHeader->ValidDataLength.LowPart = OldValidDataLength.LowPart; + } + } else { /* Do nothing? */ - } + } } - goto Cleanup; + goto Cleanup; } else { @@ -550,126 +550,126 @@ FsRtlCopyWrite(IN PFILE_OBJECT FileObject, OldFileSize.QuadPart = 0; #endif - /* Sanity check */ - ASSERT(!KeIsExecutingDpc()); + /* Sanity check */ + ASSERT(!KeIsExecutingDpc()); /* Nagar P.544. * Check if we need to acquire the resource exclusive. */ - if ( (FileOffsetAppend == FALSE) && + if ((FileOffsetAppend == FALSE) && (FileOffset->QuadPart + Length <= FcbHeader->ValidDataLength.QuadPart)) - { - /* Acquire the resource shared */ + { + /* Acquire the resource shared */ if (!ExAcquireResourceSharedLite(FcbHeader->Resource, Wait)) { - goto LeaveCriticalAndFail; - } - ResourceAquiredShared =TRUE; + goto LeaveCriticalAndFail; + } + ResourceAquiredShared = TRUE; } else { - /* Acquire the resource exclusive */ + /* Acquire the resource exclusive */ if (!ExAcquireResourceExclusiveLite(FcbHeader->Resource, Wait)) { - goto LeaveCriticalAndFail; - } - } + goto LeaveCriticalAndFail; + } + } - /* Check if we are appending */ + /* Check if we are appending */ if (FileOffsetAppend == TRUE) { - Offset.QuadPart = FcbHeader->FileSize.QuadPart; - NewSize.QuadPart = FcbHeader->FileSize.QuadPart + Length; + Offset.QuadPart = FcbHeader->FileSize.QuadPart; + NewSize.QuadPart = FcbHeader->FileSize.QuadPart + Length; } else { - Offset.QuadPart = FileOffset->QuadPart; - NewSize.QuadPart += FileOffset->QuadPart + Length; - } + Offset.QuadPart = FileOffset->QuadPart; + NewSize.QuadPart += FileOffset->QuadPart + Length; + } /* Nagar p.544/545. * Make sure that caching is initated. * That fast are allowed for this file stream. * That we are not extending past the allocated size. * That we are not creating a hole bigger than 8k. - */ - if ( (FileObject->PrivateCacheMap != NULL) && - (FcbHeader->IsFastIoPossible != FastIoIsNotPossible) && + */ + if ((FileObject->PrivateCacheMap != NULL) && + (FcbHeader->IsFastIoPossible != FastIoIsNotPossible) && (FcbHeader->ValidDataLength.QuadPart + 0x2000 > Offset.QuadPart) && (Length <= MAXLONGLONG - Offset.QuadPart) && (FcbHeader->AllocationSize.QuadPart >= NewSize.QuadPart)) - { - /* Check if we can keep the lock shared */ + { + /* Check if we can keep the lock shared */ if (ResourceAquiredShared && (NewSize.QuadPart > FcbHeader->ValidDataLength.QuadPart)) { - ExReleaseResourceLite(FcbHeader->Resource); - if(!ExAcquireResourceExclusiveLite(FcbHeader->Resource,Wait)) - { - goto LeaveCriticalAndFail; - } + ExReleaseResourceLite(FcbHeader->Resource); + if (!ExAcquireResourceExclusiveLite(FcbHeader->Resource, Wait)) + { + goto LeaveCriticalAndFail; + } /* Compute the offset and the new filesize */ if (FileOffsetAppend) { - Offset.QuadPart = FcbHeader->FileSize.QuadPart; - NewSize.QuadPart = FcbHeader->FileSize.QuadPart + Length; - } + Offset.QuadPart = FcbHeader->FileSize.QuadPart; + NewSize.QuadPart = FcbHeader->FileSize.QuadPart + Length; + } - /* Recheck the above points since we released and reacquire the lock */ - if ( (FileObject->PrivateCacheMap != NULL) && - (FcbHeader->IsFastIoPossible != FastIoIsNotPossible) && + /* Recheck the above points since we released and reacquire the lock */ + if ((FileObject->PrivateCacheMap != NULL) && + (FcbHeader->IsFastIoPossible != FastIoIsNotPossible) && (FcbHeader->AllocationSize.QuadPart > NewSize.QuadPart)) - { - /* Do nothing */ + { + /* Do nothing */ } else { - goto FailAndCleanup; - } - } + goto FailAndCleanup; + } + } - /* Check if we need to find out if fast I/O is available */ - if (FcbHeader->IsFastIoPossible == FastIoIsQuestionable) - { - IO_STATUS_BLOCK FastIoCheckIfPossibleStatus; + /* Check if we need to find out if fast I/O is available */ + if (FcbHeader->IsFastIoPossible == FastIoIsQuestionable) + { + IO_STATUS_BLOCK FastIoCheckIfPossibleStatus; - /* Sanity check */ - ASSERT(!KeIsExecutingDpc()); + /* Sanity check */ + ASSERT(!KeIsExecutingDpc()); - /* Get the Fast I/O table */ - Device = IoGetRelatedDeviceObject(FileObject); - FastIoDispatch = Device->DriverObject->FastIoDispatch; + /* Get the Fast I/O table */ + Device = IoGetRelatedDeviceObject(FileObject); + FastIoDispatch = Device->DriverObject->FastIoDispatch; - /* Sanity check */ - ASSERT(FastIoDispatch != NULL); - ASSERT(FastIoDispatch->FastIoCheckIfPossible != NULL); + /* Sanity check */ + ASSERT(FastIoDispatch != NULL); + ASSERT(FastIoDispatch->FastIoCheckIfPossible != NULL); - /* Ask the driver if we can do it */ - if (!FastIoDispatch->FastIoCheckIfPossible(FileObject, + /* Ask the driver if we can do it */ + if (!FastIoDispatch->FastIoCheckIfPossible(FileObject, FileOffsetAppend ? &FcbHeader->FileSize : FileOffset, - Length, - TRUE, - LockKey, - FALSE, - &FastIoCheckIfPossibleStatus, - Device)) - { - /* It's not, fail */ - goto FailAndCleanup; - } - } + Length, + TRUE, + LockKey, + FALSE, + &FastIoCheckIfPossibleStatus, + Device)) + { + /* It's not, fail */ + goto FailAndCleanup; + } + } /* If we are going to modify the filesize, * save the old fs in case the operation fails. */ if (NewSize.QuadPart > FcbHeader->FileSize.QuadPart) { - FileSizeModified = TRUE; - OldFileSize.QuadPart = FcbHeader->FileSize.QuadPart; - OldValidDataLength.QuadPart = FcbHeader->ValidDataLength.QuadPart; + FileSizeModified = TRUE; + OldFileSize.QuadPart = FcbHeader->FileSize.QuadPart; + OldValidDataLength.QuadPart = FcbHeader->ValidDataLength.QuadPart; /* If the high part of the filesize is going * to change, grab the Paging IoResouce. @@ -677,28 +677,28 @@ FsRtlCopyWrite(IN PFILE_OBJECT FileObject, if (NewSize.HighPart != FcbHeader->FileSize.HighPart && FcbHeader->PagingIoResource) { - ExAcquireResourceExclusiveLite(FcbHeader->PagingIoResource, TRUE); - FcbHeader->FileSize.QuadPart = NewSize.QuadPart; - ExReleaseResourceLite(FcbHeader->PagingIoResource); + ExAcquireResourceExclusiveLite(FcbHeader->PagingIoResource, TRUE); + FcbHeader->FileSize.QuadPart = NewSize.QuadPart; + ExReleaseResourceLite(FcbHeader->PagingIoResource); } else { - FcbHeader->FileSize.QuadPart = NewSize.QuadPart; - } - } + FcbHeader->FileSize.QuadPart = NewSize.QuadPart; + } + } /* Nagar p.544. * Set ourselves as top component. */ - PsGetCurrentThread()->TopLevelIrp = FSRTL_FAST_IO_TOP_LEVEL_IRP; + PsGetCurrentThread()->TopLevelIrp = FSRTL_FAST_IO_TOP_LEVEL_IRP; - _SEH2_TRY - { - BOOLEAN CallCc = TRUE; + _SEH2_TRY + { + BOOLEAN CallCc = TRUE; /* Check if there is a gap between the end of the file * and the offset. If yes, then we have to zero the data. - */ + */ if (Offset.QuadPart > FcbHeader->ValidDataLength.QuadPart) { if (!(Result = CcZeroData(FileObject, @@ -708,92 +708,92 @@ FsRtlCopyWrite(IN PFILE_OBJECT FileObject, { /* If this operation fails, then we have to exit. We can jump * outside the SEH, so I a using a variable to exit normally. - */ - CallCc = FALSE; - } - } + */ + CallCc = FALSE; + } + } /* Unless the CcZeroData failed, call the cache manager */ if (CallCc) { - Result = CcCopyWrite(FileObject,&Offset,Length, Wait, Buffer); - } + Result = CcCopyWrite(FileObject, &Offset, Length, Wait, Buffer); + } } _SEH2_EXCEPT(FsRtlIsNtstatusExpected(_SEH2_GetExceptionCode()) ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) - { - Result = FALSE; + { + Result = FALSE; } _SEH2_END; /* Reset the top component */ - PsGetCurrentThread()->TopLevelIrp = FSRTL_FAST_IO_TOP_LEVEL_IRP; + PsGetCurrentThread()->TopLevelIrp = FSRTL_FAST_IO_TOP_LEVEL_IRP; /* Did the operation suceeded */ if (Result) { - /* Check if we need to update the filesize */ + /* Check if we need to update the filesize */ if (NewSize.QuadPart > FcbHeader->ValidDataLength.QuadPart) { if (NewSize.HighPart != FcbHeader->ValidDataLength.HighPart && FcbHeader->PagingIoResource) { - ExAcquireResourceExclusiveLite(FcbHeader->PagingIoResource, TRUE); - FcbHeader->ValidDataLength.QuadPart = NewSize.QuadPart; - ExReleaseResourceLite(FcbHeader->PagingIoResource); + ExAcquireResourceExclusiveLite(FcbHeader->PagingIoResource, TRUE); + FcbHeader->ValidDataLength.QuadPart = NewSize.QuadPart; + ExReleaseResourceLite(FcbHeader->PagingIoResource); } else { - FcbHeader->ValidDataLength.QuadPart = NewSize.QuadPart; - } - } + FcbHeader->ValidDataLength.QuadPart = NewSize.QuadPart; + } + } /* Flag the file as modified */ - FileObject->Flags |= FO_FILE_MODIFIED; + FileObject->Flags |= FO_FILE_MODIFIED; - /* Check if the filesize has changed */ + /* Check if the filesize has changed */ if (FileSizeModified) { - /* Update the file sizes */ + /* Update the file sizes */ SharedCacheMap = (PSHARED_CACHE_MAP)FileObject->SectionObjectPointer->SharedCacheMap; SharedCacheMap->FileSize.QuadPart = NewSize.QuadPart; - FileObject->Flags |= FO_FILE_SIZE_CHANGED; - } + FileObject->Flags |= FO_FILE_SIZE_CHANGED; + } - /* Update the current FO byte offset */ - FileObject->CurrentByteOffset.QuadPart = NewSize.QuadPart; - } - else - { + /* Update the current FO byte offset */ + FileObject->CurrentByteOffset.QuadPart = NewSize.QuadPart; + } + else + { /* The operation did not succeed. * Reset the file size to what it should be. - */ + */ if (FileSizeModified) { if (FcbHeader->PagingIoResource) { - ExAcquireResourceExclusiveLite(FcbHeader->PagingIoResource, TRUE); - FcbHeader->FileSize.QuadPart = OldFileSize.QuadPart; - FcbHeader->ValidDataLength.QuadPart = OldValidDataLength.QuadPart; - ExReleaseResourceLite(FcbHeader->PagingIoResource); + ExAcquireResourceExclusiveLite(FcbHeader->PagingIoResource, TRUE); + FcbHeader->FileSize.QuadPart = OldFileSize.QuadPart; + FcbHeader->ValidDataLength.QuadPart = OldValidDataLength.QuadPart; + ExReleaseResourceLite(FcbHeader->PagingIoResource); } else { - FcbHeader->FileSize.QuadPart = OldFileSize.QuadPart; - FcbHeader->ValidDataLength.QuadPart = OldValidDataLength.QuadPart; - } - } - } + FcbHeader->FileSize.QuadPart = OldFileSize.QuadPart; + FcbHeader->ValidDataLength.QuadPart = OldValidDataLength.QuadPart; + } + } + } - goto Cleanup; + goto Cleanup; } else { - goto FailAndCleanup; - } - } + goto FailAndCleanup; + } + } LeaveCriticalAndFail: @@ -818,7 +818,7 @@ Cleanup: */ NTSTATUS NTAPI -FsRtlGetFileSize(IN PFILE_OBJECT FileObject, +FsRtlGetFileSize(IN PFILE_OBJECT FileObject, IN OUT PLARGE_INTEGER FileSize) { FILE_STANDARD_INFORMATION Info; @@ -840,8 +840,8 @@ FsRtlGetFileSize(IN PFILE_OBJECT FileObject, /* Check if we support Fast Calls, and check FastIoQueryStandardInfo. * Call the function and see if it succeeds. */ - if ( !FastDispatch || - !FastDispatch->FastIoQueryStandardInfo || + if (!FastDispatch || + !FastDispatch->FastIoQueryStandardInfo || !FastDispatch->FastIoQueryStandardInfo(FileObject, TRUE, &Info, @@ -851,10 +851,10 @@ FsRtlGetFileSize(IN PFILE_OBJECT FileObject, /* If any of the above failed, then we are going to send an * IRP to the device object. Initialize the event for the IO. */ - KeInitializeEvent(&Event,NotificationEvent,FALSE); + KeInitializeEvent(&Event, NotificationEvent, FALSE); /* Allocate the IRP */ - Irp = IoAllocateIrp(DeviceObject->StackSize,FALSE); + Irp = IoAllocateIrp(DeviceObject->StackSize, FALSE); if (Irp == NULL) { @@ -885,12 +885,12 @@ FsRtlGetFileSize(IN PFILE_OBJECT FileObject, FileStandardInformation; /* Send the IRP to the related device object */ - Status = IoCallDriver(DeviceObject,Irp); + Status = IoCallDriver(DeviceObject, Irp); /* Standard DDK IRP result processing */ if (Status == STATUS_PENDING) { - KeWaitForSingleObject(&Event,Executive,KernelMode,FALSE,NULL); + KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL); } /* If there was a synchronous error, signal it */ @@ -905,7 +905,7 @@ FsRtlGetFileSize(IN PFILE_OBJECT FileObject, /* Check the sync/async IO result */ if (NT_SUCCESS(IoStatus.Status)) { - /* Was the request for a directory ? */ + /* Was the request for a directory? */ if (Info.Directory) { IoStatus.Status = STATUS_FILE_IS_A_DIRECTORY; @@ -1012,8 +1012,8 @@ FsRtlMdlReadComplete(IN PFILE_OBJECT FileObject, /* * @implemented */ - BOOLEAN - NTAPI +BOOLEAN +NTAPI FsRtlMdlReadCompleteDev(IN PFILE_OBJECT FileObject, IN PMDL MemoryDescriptorList, IN PDEVICE_OBJECT DeviceObject) @@ -1133,8 +1133,8 @@ FsRtlMdlReadDev(IN PFILE_OBJECT FileObject, _SEH2_EXCEPT(FsRtlIsNtstatusExpected(_SEH2_GetExceptionCode()) ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) - { - Result = FALSE; + { + Result = FALSE; } _SEH2_END; @@ -1208,11 +1208,11 @@ FsRtlMdlWriteCompleteDev(IN PFILE_OBJECT FileObject, { if (FileObject->Flags & FO_WRITE_THROUGH) { - return FALSE; + return FALSE; } /* Call the Cache Manager */ - CcMdlWriteComplete2(FileObject,FileOffset,MdlChain); + CcMdlWriteComplete2(FileObject, FileOffset, MdlChain); return TRUE; } @@ -1315,9 +1315,9 @@ FsRtlPrepareMdlWriteDev(IN PFILE_OBJECT FileObject, * Check with Cc if we can write. */ if (!CcCanIWrite(FileObject, Length, TRUE, FALSE) || - (FileObject->Flags & FO_WRITE_THROUGH)) + (FileObject->Flags & FO_WRITE_THROUGH)) { - return FALSE; + return FALSE; } IoStatus->Status = STATUS_SUCCESS; @@ -1332,213 +1332,213 @@ FsRtlPrepareMdlWriteDev(IN PFILE_OBJECT FileObject, FsRtlEnterFileSystem(); /* Check we are going to extend the file */ - if ( (FileOffsetAppend == FALSE) && + if ((FileOffsetAppend == FALSE) && (FileOffset->QuadPart + Length <= FcbHeader->ValidDataLength.QuadPart)) - { - /* Acquire the resource shared */ - ExAcquireResourceSharedLite(FcbHeader->Resource,TRUE); - ResourceAquiredShared =TRUE; + { + /* Acquire the resource shared */ + ExAcquireResourceSharedLite(FcbHeader->Resource, TRUE); + ResourceAquiredShared = TRUE; } else - { - /* Acquire the resource exclusive */ - ExAcquireResourceExclusiveLite(FcbHeader->Resource,TRUE); - } + { + /* Acquire the resource exclusive */ + ExAcquireResourceExclusiveLite(FcbHeader->Resource, TRUE); + } - /* Check if we are appending */ + /* Check if we are appending */ if (FileOffsetAppend == TRUE) { - Offset.QuadPart = FcbHeader->FileSize.QuadPart; - NewSize.QuadPart = FcbHeader->FileSize.QuadPart + Length; + Offset.QuadPart = FcbHeader->FileSize.QuadPart; + NewSize.QuadPart = FcbHeader->FileSize.QuadPart + Length; } else - { - Offset.QuadPart = FileOffset->QuadPart; - NewSize.QuadPart = FileOffset->QuadPart + Length; - } + { + Offset.QuadPart = FileOffset->QuadPart; + NewSize.QuadPart = FileOffset->QuadPart + Length; + } - if ( (FileObject->PrivateCacheMap) && - (FcbHeader->IsFastIoPossible) && + if ((FileObject->PrivateCacheMap) && + (FcbHeader->IsFastIoPossible) && (Length <= MAXLONGLONG - FileOffset->QuadPart) && - (NewSize.QuadPart <= FcbHeader->AllocationSize.QuadPart) ) + (NewSize.QuadPart <= FcbHeader->AllocationSize.QuadPart)) { /* Check if we can keep the lock shared */ if (ResourceAquiredShared && (NewSize.QuadPart > FcbHeader->ValidDataLength.QuadPart)) { - ExReleaseResourceLite(FcbHeader->Resource); - ExAcquireResourceExclusiveLite(FcbHeader->Resource,TRUE); + ExReleaseResourceLite(FcbHeader->Resource); + ExAcquireResourceExclusiveLite(FcbHeader->Resource, TRUE); /* Compute the offset and the new filesize */ if (FileOffsetAppend) { - Offset.QuadPart = FcbHeader->FileSize.QuadPart; - NewSize.QuadPart = FcbHeader->FileSize.QuadPart + Length; - } + Offset.QuadPart = FcbHeader->FileSize.QuadPart; + NewSize.QuadPart = FcbHeader->FileSize.QuadPart + Length; + } - /* Recheck the above points since we released and reacquire the lock */ - if ( (FileObject->PrivateCacheMap != NULL) && - (FcbHeader->IsFastIoPossible != FastIoIsNotPossible) && + /* Recheck the above points since we released and reacquire the lock */ + if ((FileObject->PrivateCacheMap != NULL) && + (FcbHeader->IsFastIoPossible != FastIoIsNotPossible) && (FcbHeader->AllocationSize.QuadPart > NewSize.QuadPart)) - { - /* Do nothing */ + { + /* Do nothing */ } else { - goto FailAndCleanup; - } - } + goto FailAndCleanup; + } + } - /* Check if we need to find out if fast I/O is available */ - if (FcbHeader->IsFastIoPossible == FastIoIsQuestionable) - { - /* Sanity check */ - /* ASSERT(!KeIsExecutingDpc()); */ + /* Check if we need to find out if fast I/O is available */ + if (FcbHeader->IsFastIoPossible == FastIoIsQuestionable) + { + /* Sanity check */ + /* ASSERT(!KeIsExecutingDpc()); */ - /* Get the Fast I/O table */ - Device = IoGetRelatedDeviceObject(FileObject); - FastIoDispatch = Device->DriverObject->FastIoDispatch; + /* Get the Fast I/O table */ + Device = IoGetRelatedDeviceObject(FileObject); + FastIoDispatch = Device->DriverObject->FastIoDispatch; - /* Sanity check */ - ASSERT(FastIoDispatch != NULL); - ASSERT(FastIoDispatch->FastIoCheckIfPossible != NULL); + /* Sanity check */ + ASSERT(FastIoDispatch != NULL); + ASSERT(FastIoDispatch->FastIoCheckIfPossible != NULL); - /* Ask the driver if we can do it */ - if (!FastIoDispatch->FastIoCheckIfPossible(FileObject, - FileOffset, - Length, - TRUE, - LockKey, - FALSE, - IoStatus, - Device)) - { - /* It's not, fail */ - goto FailAndCleanup; - } - } + /* Ask the driver if we can do it */ + if (!FastIoDispatch->FastIoCheckIfPossible(FileObject, + FileOffset, + Length, + TRUE, + LockKey, + FALSE, + IoStatus, + Device)) + { + /* It's not, fail */ + goto FailAndCleanup; + } + } /* If we are going to modify the filesize, * save the old fs in case the operation fails. */ - if (NewSize.QuadPart > FcbHeader->FileSize.QuadPart) - { - FileSizeModified = TRUE; - OldFileSize.QuadPart = FcbHeader->FileSize.QuadPart; - OldValidDataLength.QuadPart = FcbHeader->ValidDataLength.QuadPart; + if (NewSize.QuadPart > FcbHeader->FileSize.QuadPart) + { + FileSizeModified = TRUE; + OldFileSize.QuadPart = FcbHeader->FileSize.QuadPart; + OldValidDataLength.QuadPart = FcbHeader->ValidDataLength.QuadPart; /* If the high part of the filesize is going * to change, grab the Paging IoResouce. */ if (NewSize.HighPart != FcbHeader->FileSize.HighPart && FcbHeader->PagingIoResource) - { - ExAcquireResourceExclusiveLite(FcbHeader->PagingIoResource, TRUE); - FcbHeader->FileSize.QuadPart = NewSize.QuadPart; - ExReleaseResourceLite(FcbHeader->PagingIoResource); + { + ExAcquireResourceExclusiveLite(FcbHeader->PagingIoResource, TRUE); + FcbHeader->FileSize.QuadPart = NewSize.QuadPart; + ExReleaseResourceLite(FcbHeader->PagingIoResource); } else { - FcbHeader->FileSize.QuadPart = NewSize.QuadPart; - } - } + FcbHeader->FileSize.QuadPart = NewSize.QuadPart; + } + } /* Nagar p.544. * Set ourselves as top component. */ - PsGetCurrentThread()->TopLevelIrp = FSRTL_FAST_IO_TOP_LEVEL_IRP; - _SEH2_TRY - { + PsGetCurrentThread()->TopLevelIrp = FSRTL_FAST_IO_TOP_LEVEL_IRP; + _SEH2_TRY + { /* Check if there is a gap between the end of the file and the offset. * If yes, then we have to zero the data. - */ + */ if (Offset.QuadPart > FcbHeader->ValidDataLength.QuadPart) { Result = CcZeroData(FileObject, &FcbHeader->ValidDataLength, &Offset, TRUE); - if (Result) - { + if (Result) + { CcPrepareMdlWrite(FileObject, &Offset, Length, MdlChain, IoStatus); - } + } } else { - CcPrepareMdlWrite(FileObject,&Offset,Length,MdlChain,IoStatus); - } + CcPrepareMdlWrite(FileObject, &Offset, Length, MdlChain, IoStatus); + } } _SEH2_EXCEPT(FsRtlIsNtstatusExpected(_SEH2_GetExceptionCode()) ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) - { - Result = FALSE; + { + Result = FALSE; } _SEH2_END; /* Reset the top component */ - PsGetCurrentThread()->TopLevelIrp = 0; + PsGetCurrentThread()->TopLevelIrp = 0; /* Did the operation suceeded */ if (Result) { - /* Check if we need to update the filesize */ + /* Check if we need to update the filesize */ if (NewSize.QuadPart > FcbHeader->ValidDataLength.QuadPart) { if (NewSize.HighPart != FcbHeader->ValidDataLength.HighPart && FcbHeader->PagingIoResource) { - ExAcquireResourceExclusiveLite(FcbHeader->PagingIoResource, TRUE); - FcbHeader->ValidDataLength.QuadPart = NewSize.QuadPart; - ExReleaseResourceLite(FcbHeader->PagingIoResource); + ExAcquireResourceExclusiveLite(FcbHeader->PagingIoResource, TRUE); + FcbHeader->ValidDataLength.QuadPart = NewSize.QuadPart; + ExReleaseResourceLite(FcbHeader->PagingIoResource); } else { - FcbHeader->ValidDataLength.QuadPart = NewSize.QuadPart; - } - } + FcbHeader->ValidDataLength.QuadPart = NewSize.QuadPart; + } + } /* Flag the file as modified */ - FileObject->Flags |= FO_FILE_MODIFIED; + FileObject->Flags |= FO_FILE_MODIFIED; - /* Check if the filesize has changed */ + /* Check if the filesize has changed */ if (FileSizeModified) { SharedCacheMap = (PSHARED_CACHE_MAP)FileObject->SectionObjectPointer->SharedCacheMap; SharedCacheMap->FileSize.QuadPart = NewSize.QuadPart; - FileObject->Flags |= FO_FILE_SIZE_CHANGED; - } - } - else - { + FileObject->Flags |= FO_FILE_SIZE_CHANGED; + } + } + else + { /* The operation did not succeed. * Reset the file size to what it should be. - */ + */ if (FileSizeModified) { if (FcbHeader->PagingIoResource) { - ExAcquireResourceExclusiveLite(FcbHeader->PagingIoResource, TRUE); - FcbHeader->FileSize.QuadPart = OldFileSize.QuadPart; - FcbHeader->ValidDataLength.QuadPart = OldValidDataLength.QuadPart; - ExReleaseResourceLite(FcbHeader->PagingIoResource); + ExAcquireResourceExclusiveLite(FcbHeader->PagingIoResource, TRUE); + FcbHeader->FileSize.QuadPart = OldFileSize.QuadPart; + FcbHeader->ValidDataLength.QuadPart = OldValidDataLength.QuadPart; + ExReleaseResourceLite(FcbHeader->PagingIoResource); } else { - FcbHeader->FileSize.QuadPart = OldFileSize.QuadPart; - FcbHeader->ValidDataLength.QuadPart = OldValidDataLength.QuadPart; - } - } - } + FcbHeader->FileSize.QuadPart = OldFileSize.QuadPart; + FcbHeader->ValidDataLength.QuadPart = OldValidDataLength.QuadPart; + } + } + } - goto Cleanup; + goto Cleanup; } else { From 49c5dfc4fe10c9d5d3c8e571399d557bb7e25248 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Wed, 13 Jan 2010 23:05:26 +0000 Subject: [PATCH 021/121] remove diff to trunk svn path=/branches/ros-amd64-bringup/; revision=45067 --- reactos/ntoskrnl/se/semgr.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/reactos/ntoskrnl/se/semgr.c b/reactos/ntoskrnl/se/semgr.c index 04b1fe0db33..fdee0973027 100644 --- a/reactos/ntoskrnl/se/semgr.c +++ b/reactos/ntoskrnl/se/semgr.c @@ -350,14 +350,14 @@ SeSetSecurityAccessMask(IN SECURITY_INFORMATION SecurityInformation, BOOLEAN NTAPI SepAccessCheck(IN PSECURITY_DESCRIPTOR SecurityDescriptor, - IN PSECURITY_SUBJECT_CONTEXT SubjectSecurityContext, - IN BOOLEAN SubjectContextLocked, - IN ACCESS_MASK DesiredAccess, - IN ACCESS_MASK PreviouslyGrantedAccess, - OUT PPRIVILEGE_SET* Privileges, - IN PGENERIC_MAPPING GenericMapping, - IN KPROCESSOR_MODE AccessMode, - OUT PACCESS_MASK GrantedAccess, + IN PSECURITY_SUBJECT_CONTEXT SubjectSecurityContext, + IN BOOLEAN SubjectContextLocked, + IN ACCESS_MASK DesiredAccess, + IN ACCESS_MASK PreviouslyGrantedAccess, + OUT PPRIVILEGE_SET* Privileges, + IN PGENERIC_MAPPING GenericMapping, + IN KPROCESSOR_MODE AccessMode, + OUT PACCESS_MASK GrantedAccess, OUT PNTSTATUS AccessStatus, SECURITY_IMPERSONATION_LEVEL LowestImpersonationLevel) { @@ -721,14 +721,14 @@ NtAccessCheck(IN PSECURITY_DESCRIPTOR SecurityDescriptor, /* Now perform the access check */ SepAccessCheck(SecurityDescriptor, - &SubjectSecurityContext, - TRUE, - DesiredAccess, - 0, - &PrivilegeSet, //FIXME - GenericMapping, - PreviousMode, - GrantedAccess, + &SubjectSecurityContext, + TRUE, + DesiredAccess, + 0, + &PrivilegeSet, //FIXME + GenericMapping, + PreviousMode, + GrantedAccess, AccessStatus, SecurityIdentification); From 85441000ae6e7befc175842d52610366bdb663f7 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Thu, 14 Jan 2010 00:45:11 +0000 Subject: [PATCH 022/121] Fix wrong positioned #else svn path=/branches/ros-amd64-bringup/; revision=45069 --- reactos/ntoskrnl/kd/kdmain.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/reactos/ntoskrnl/kd/kdmain.c b/reactos/ntoskrnl/kd/kdmain.c index 07e06e8a8b4..95402c32072 100644 --- a/reactos/ntoskrnl/kd/kdmain.c +++ b/reactos/ntoskrnl/kd/kdmain.c @@ -191,14 +191,13 @@ KdpEnterDebuggerException(IN PKTRAP_FRAME TrapFrame, /* Bump EIP to the instruction following the int 2C and return */ Context->Eip += 2; #elif _AMD64_ -#else /* Warn about it */ DbgPrint("\n!!! Assertion Failure at Address 0x%p !!!\n\n", (PVOID)Context->Rip); /* Bump RIP to the instruction following the int 2C and return */ Context->Rip += 2; - +#else #error Unknown Architecture #endif return TRUE; From e76849d9afd9ce3c4bfc11df1f08f2a5902603af Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Thu, 14 Jan 2010 07:53:23 +0000 Subject: [PATCH 023/121] reduce differences to trunk svn path=/branches/ros-amd64-bringup/; revision=45071 --- reactos/ntoskrnl/include/internal/probe.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/reactos/ntoskrnl/include/internal/probe.h b/reactos/ntoskrnl/include/internal/probe.h index ccc0b11fc76..4956e047888 100644 --- a/reactos/ntoskrnl/include/internal/probe.h +++ b/reactos/ntoskrnl/include/internal/probe.h @@ -63,7 +63,7 @@ DefaultQueryInfoBufferCheck(ULONG Class, PVOID Buffer, ULONG BufferLength, PULONG ReturnLength, - PULONG_PTR ReturnLengthLong, + PULONG_PTR ReturnLengthPtr, KPROCESSOR_MODE PreviousMode) { NTSTATUS Status = STATUS_SUCCESS; @@ -100,9 +100,9 @@ DefaultQueryInfoBufferCheck(ULONG Class, { ProbeForWriteUlong(ReturnLength); } - if (ReturnLengthLong != NULL) + if (ReturnLengthPtr != NULL) { - ProbeForWrite(ReturnLengthLong, sizeof(ULONG_PTR), sizeof(ULONG_PTR)); + ProbeForWrite(ReturnLengthPtr, sizeof(ULONG_PTR), sizeof(ULONG_PTR)); } } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) From df461e55cc0b211d00f451eb25c1e301b9132ac4 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Thu, 14 Jan 2010 07:56:34 +0000 Subject: [PATCH 024/121] [HAL] add HalInitializeBios to amd64 exports svn path=/branches/ros-amd64-bringup/; revision=45072 --- reactos/hal/hal.pspec | 1 + 1 file changed, 1 insertion(+) diff --git a/reactos/hal/hal.pspec b/reactos/hal/hal.pspec index 68060f1e293..786372d9e3d 100644 --- a/reactos/hal/hal.pspec +++ b/reactos/hal/hal.pspec @@ -101,3 +101,4 @@ @ stdcall -arch=i386,arm WRITE_PORT_UCHAR(ptr long) @ stdcall -arch=i386,arm WRITE_PORT_ULONG(ptr long) @ stdcall -arch=i386,arm WRITE_PORT_USHORT(ptr long) +@ stdcall -arch=x86_64 HalInitializeBios(long ptr) From 3f1658e7441b2feaffea752b831e0c714e2ac95e Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Thu, 14 Jan 2010 08:40:16 +0000 Subject: [PATCH 025/121] [NTOS] Add KeGetContextSwitches macro for amd64 svn path=/branches/ros-amd64-bringup/; revision=45073 --- reactos/ntoskrnl/include/internal/amd64/ke.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/reactos/ntoskrnl/include/internal/amd64/ke.h b/reactos/ntoskrnl/include/internal/amd64/ke.h index fc5417189ba..3ca4fef73a9 100644 --- a/reactos/ntoskrnl/include/internal/amd64/ke.h +++ b/reactos/ntoskrnl/include/internal/amd64/ke.h @@ -109,6 +109,13 @@ extern ULONG KeI386CpuStep; (PKTRAP_FRAME)((ULONG_PTR)((Thread)->InitialStack) - \ sizeof(KTRAP_FRAME)) +// +// Macro to get context switches from the PRCB +// All architectures but x86 have it in the PRCB's KeContextSwitches +// +#define KeGetContextSwitches(Prcb) \ + (Prcb->KeContextSwitches) + #define KeGetExceptionFrame(Thread) \ (PKEXCEPTION_FRAME)((ULONG_PTR)KeGetTrapFrame(Thread) - \ sizeof(KEXCEPTION_FRAME)) From 55dd5f17c9a7751eea5831339f969b797290e406 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Thu, 14 Jan 2010 09:36:06 +0000 Subject: [PATCH 026/121] [MESA32] - define GL_NO_STDCALL for non-x86 builds svn path=/branches/ros-amd64-bringup/; revision=45075 --- reactos/dll/3rdparty/mesa32/mesa32.rbuild | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/reactos/dll/3rdparty/mesa32/mesa32.rbuild b/reactos/dll/3rdparty/mesa32/mesa32.rbuild index 2cefd2f5065..d160a8df692 100644 --- a/reactos/dll/3rdparty/mesa32/mesa32.rbuild +++ b/reactos/dll/3rdparty/mesa32/mesa32.rbuild @@ -16,8 +16,10 @@ + + + - include src src/main From 7af355b0e98c89b6ccc67f8a99b6aa3f5b4e9dac Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Thu, 14 Jan 2010 09:47:01 +0000 Subject: [PATCH 027/121] reduce difference to trunk svn path=/branches/ros-amd64-bringup/; revision=45077 --- reactos/lib/pseh/framebased.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/lib/pseh/framebased.c b/reactos/lib/pseh/framebased.c index b74b174ecfc..121cb90d9e0 100644 --- a/reactos/lib/pseh/framebased.c +++ b/reactos/lib/pseh/framebased.c @@ -94,7 +94,7 @@ extern unsigned long __cdecl DbgPrint(const char * format, ...); } \ } -#ifdef __i386__ +#ifdef _X86_ #define _SEH_TRACE_CONTEXT(FRAME_, CONTEXT_) \ { \ if((FRAME_)->SPF_Tracing & _SEH_DO_TRACE_CONTEXT) \ From 52c5ac7be7718781f53c505095db9c366e1dc997 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Thu, 14 Jan 2010 09:53:02 +0000 Subject: [PATCH 028/121] Fix merge artifacts svn path=/branches/ros-amd64-bringup/; revision=45078 --- reactos/ntoskrnl/ex/init.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/reactos/ntoskrnl/ex/init.c b/reactos/ntoskrnl/ex/init.c index f1feaad1a7f..d2794a4b52f 100644 --- a/reactos/ntoskrnl/ex/init.c +++ b/reactos/ntoskrnl/ex/init.c @@ -1726,7 +1726,7 @@ Phase1InitializationDiscard(IN PVOID Context) KeyValuePartialInformation, &KeyPartialInfo, sizeof(KeyPartialInfo), - &Size); + &Length); if (!NT_SUCCESS(Status)) AlternateShell = FALSE; } @@ -1878,17 +1878,17 @@ Phase1InitializationDiscard(IN PVOID Context) ZwClose(ProcessInfo->ProcessHandle); /* Free the initial process environment */ - Length = 0; + Size = 0; ZwFreeVirtualMemory(NtCurrentProcess(), (PVOID*)&Environment, - &Length, + &Size, MEM_RELEASE); /* Free the initial process parameters */ - Length = 0; + Size = 0; ZwFreeVirtualMemory(NtCurrentProcess(), (PVOID*)&ProcessParameters, - &Length, + &Size, MEM_RELEASE); /* Increase init phase */ From b2e87768af73e397073d8469b4f3976bd225e380 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Fri, 15 Jan 2010 00:13:38 +0000 Subject: [PATCH 029/121] [NTOS] Implement InterruptDispatchTable, containing 256 dispatch stubs, that push the Vector on the stack and then jump to KiUnexpectedInterrupt. This way we have the vector as ErrorCode on the stack and we can report it with KeBugCheckWithTf. svn path=/branches/ros-amd64-bringup/; revision=45082 --- reactos/ntoskrnl/ke/amd64/except.c | 4 +++- reactos/ntoskrnl/ke/amd64/trap.S | 34 ++++++++++++++++++------------ 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/reactos/ntoskrnl/ke/amd64/except.c b/reactos/ntoskrnl/ke/amd64/except.c index ccd9ee59121..ba5a35491aa 100644 --- a/reactos/ntoskrnl/ke/amd64/except.c +++ b/reactos/ntoskrnl/ke/amd64/except.c @@ -13,6 +13,8 @@ #define NDEBUG #include +extern ULONG64 InterruptDispatchTable[256]; + /* GLOBALS *******************************************************************/ KIDT_INIT KiInterruptInitTable[] = @@ -73,7 +75,7 @@ KeInitExceptions(VOID) } else { - Offset = (ULONG64)KiUnexpectedInterrupt; + Offset = (ULONG64)&InterruptDispatchTable[i]; KiIdt[i].Dpl = 0; KiIdt[i].IstIndex = 0; } diff --git a/reactos/ntoskrnl/ke/amd64/trap.S b/reactos/ntoskrnl/ke/amd64/trap.S index 7cbfacf0c6a..868364d3f43 100644 --- a/reactos/ntoskrnl/ke/amd64/trap.S +++ b/reactos/ntoskrnl/ke/amd64/trap.S @@ -28,10 +28,10 @@ _MsgBreakpointTrap: .ascii "BreakpointTrap at %p\n\0" _MsgUnexpectedInterrupt: -.ascii "UnexpectedInterrupt\n\0" +.ascii "UnexpectedInterrupt Vector=0x%02lx\n\0" _MsgInvalidOpcodeFault: -.ascii "General protection fault at %p!\n\0" +.ascii "Invalid opcode fault at %p!\n\0" _MsgDoubleFault: .ascii "Double fault at %p, rbp=%p!\n\0" @@ -242,6 +242,17 @@ _MsgTrapInfo: .text .code64 +.align 8 +.global _InterruptDispatchTable +_InterruptDispatchTable: +.set Vector, 0 +.rept 256 + push Vector + jmp _KiUnexpectedInterrupt + .align 8 + .set Vector, Vector+1 +.endr + // rbp = TrapFrame, eax = ExceptionCode, edx = NumParams, r9,r10,r11 = params _InternalDispatchException: @@ -779,23 +790,20 @@ PageFaultReturn: .proc KiUnexpectedInterrupt .pushframe 0 - /* Push pseudo error code */ - push 0 - .allocstack 0x8 + + /* The error code is the vector */ cli ENTER_TRAP_FRAME TRAPFLAG_ALL - lea rcx, _MsgUnexpectedInterrupt[rip] - call _FrLdrDbgPrint[rip] - + /* Set bugcheck parameters */ mov ecx, TRAP_CAUSE_UNKNOWN -// mov rdx, // The unexpected interrupt -// mov rdx, // The unknown floating-point exception -// mov r8, // The enabled and asserted status bits - xor r9, r9 // Reserved - mov [rbp + KTRAP_FRAME_P5], rbp // trap frame + mov rdx, [rbp + KTRAP_FRAME_ErrorCode] // the vector + mov r8, 0 // The unknown floating-point exception + mov r9, 0 // The enabled and asserted status bits + sub rsp, 8 + mov [rbp + KTRAP_FRAME_P5 + 8], rbp // trap frame call _KeBugCheckWithTf .endproc From d7a1041c8cdcc058827a06f3bd8af7f5df8b4961 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Fri, 15 Jan 2010 11:27:54 +0000 Subject: [PATCH 030/121] [NTOS] Enable fx save restore support earlier and uncomment it in trap handlers. svn path=/branches/ros-amd64-bringup/; revision=45083 --- reactos/ntoskrnl/ke/amd64/cpu.c | 3 --- reactos/ntoskrnl/ke/amd64/kiinit.c | 3 +++ reactos/ntoskrnl/ke/amd64/trap.S | 24 ++++++++++++------------ 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/reactos/ntoskrnl/ke/amd64/cpu.c b/reactos/ntoskrnl/ke/amd64/cpu.c index 9156bd1dc79..5cab781faca 100644 --- a/reactos/ntoskrnl/ke/amd64/cpu.c +++ b/reactos/ntoskrnl/ke/amd64/cpu.c @@ -277,9 +277,6 @@ KiInitializeCpuFeatures() /* Disable fpu monitoring */ __writecr0(__readcr0() & ~CR0_MP); - /* Enable fx save restore support */ - __writecr4(__readcr4() | CR4_FXSR); - } VOID diff --git a/reactos/ntoskrnl/ke/amd64/kiinit.c b/reactos/ntoskrnl/ke/amd64/kiinit.c index 3dcc2ef9e88..cca6aa8b2e3 100644 --- a/reactos/ntoskrnl/ke/amd64/kiinit.c +++ b/reactos/ntoskrnl/ke/amd64/kiinit.c @@ -679,6 +679,9 @@ KiSystemStartupReal(IN PLOADER_PARAMETER_BLOCK LoaderBlock) /* LDT is unused */ // __lldt(0); + /* Enable fx save restore support */ + __writecr4(__readcr4() | CR4_FXSR); + /* Align stack to 16 bytes */ LoaderBlock->KernelStack &= ~(16 - 1); diff --git a/reactos/ntoskrnl/ke/amd64/trap.S b/reactos/ntoskrnl/ke/amd64/trap.S index 868364d3f43..2a6408ea502 100644 --- a/reactos/ntoskrnl/ke/amd64/trap.S +++ b/reactos/ntoskrnl/ke/amd64/trap.S @@ -117,12 +117,12 @@ _MsgTrapInfo: .if (TRAPFLAGS & TRAPFLAG_XMM) /* Save xmm registers */ -// movdqa [rbp + KTRAP_FRAME_Xmm0], xmm0 -// movdqa [rbp + KTRAP_FRAME_Xmm1], xmm1 -// movdqa [rbp + KTRAP_FRAME_Xmm2], xmm2 -// movdqa [rbp + KTRAP_FRAME_Xmm3], xmm3 -// movdqa [rbp + KTRAP_FRAME_Xmm4], xmm4 -// movdqa [rbp + KTRAP_FRAME_Xmm5], xmm5 + movdqa [rbp + KTRAP_FRAME_Xmm0], xmm0 + movdqa [rbp + KTRAP_FRAME_Xmm1], xmm1 + movdqa [rbp + KTRAP_FRAME_Xmm2], xmm2 + movdqa [rbp + KTRAP_FRAME_Xmm3], xmm3 + movdqa [rbp + KTRAP_FRAME_Xmm4], xmm4 + movdqa [rbp + KTRAP_FRAME_Xmm5], xmm5 .endif .if (TRAPFLAGS & TRAPFLAG_SEGMENTS) @@ -221,12 +221,12 @@ _MsgTrapInfo: .if (TRAPFLAGS & TRAPFLAG_XMM) /* Restore xmm registers */ -// movdqa xmm0, [rbp + KTRAP_FRAME_Xmm0] -// movdqa xmm1, [rbp + KTRAP_FRAME_Xmm1] -// movdqa xmm2, [rbp + KTRAP_FRAME_Xmm2] -// movdqa xmm3, [rbp + KTRAP_FRAME_Xmm3] -// movdqa xmm4, [rbp + KTRAP_FRAME_Xmm4] -// movdqa xmm5, [rbp + KTRAP_FRAME_Xmm5] + movdqa xmm0, [rbp + KTRAP_FRAME_Xmm0] + movdqa xmm1, [rbp + KTRAP_FRAME_Xmm1] + movdqa xmm2, [rbp + KTRAP_FRAME_Xmm2] + movdqa xmm3, [rbp + KTRAP_FRAME_Xmm3] + movdqa xmm4, [rbp + KTRAP_FRAME_Xmm4] + movdqa xmm5, [rbp + KTRAP_FRAME_Xmm5] .endif /* Restore rbp */ From 7185241ed43111ff0b7c10234c8320077f29554e Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Fri, 15 Jan 2010 13:09:00 +0000 Subject: [PATCH 031/121] Reduce difference to trunk svn path=/branches/ros-amd64-bringup/; revision=45084 --- reactos/ntoskrnl/ex/sysinfo.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/reactos/ntoskrnl/ex/sysinfo.c b/reactos/ntoskrnl/ex/sysinfo.c index 185ce0e1116..11da1461f66 100644 --- a/reactos/ntoskrnl/ex/sysinfo.c +++ b/reactos/ntoskrnl/ex/sysinfo.c @@ -1004,9 +1004,9 @@ QSI_DEF(SystemModuleInformation) /* Call the generic handler with the system module list */ Status = ExpQueryModuleInformation(&PsLoadedModuleList, &MmLoadedUserImageList, - (PRTL_PROCESS_MODULES)Buffer, - Size, - ReqSize); + (PRTL_PROCESS_MODULES)Buffer, + Size, + ReqSize); /* Release list lock and return status */ ExReleaseResourceLite(&PsLoadedModuleResource); @@ -1238,7 +1238,6 @@ QSI_DEF(SystemPoolTagInformation) QSI_DEF(SystemInterruptInformation) { PKPRCB Prcb; - PKPCR Pcr; LONG i; ULONG ti; PSYSTEM_INTERRUPT_INFORMATION sii = (PSYSTEM_INTERRUPT_INFORMATION)Buffer; @@ -1253,16 +1252,7 @@ QSI_DEF(SystemInterruptInformation) for (i = 0; i < KeNumberProcessors; i++) { Prcb = KiProcessorBlock[i]; -#ifdef _M_AMD64 - Pcr = CONTAINING_RECORD(Prcb, KPCR, CurrentPrcb); -#else - Pcr = CONTAINING_RECORD(Prcb, KPCR, Prcb); -#endif -#ifdef _M_ARM // This code should probably be done differently - sii->ContextSwitches = Pcr->ContextSwitches; -#else - sii->ContextSwitches = ((PKIPCR)Pcr)->ContextSwitches; -#endif + sii->ContextSwitches = KeGetContextSwitches(Prcb); sii->DpcCount = Prcb->DpcData[0].DpcCount; sii->DpcRate = Prcb->DpcRequestRate; sii->TimeIncrement = ti; @@ -1382,11 +1372,11 @@ SSI_DEF(SystemUnloadGdiDriverInformation) PVOID SectionPointer = Buffer; /* Validate size */ - if(Size != sizeof(PVOID)) + if (Size != sizeof(PVOID)) { /* Incorrect length, fail */ return STATUS_INFO_LENGTH_MISMATCH; - } + } /* Only kernel mode can call this function */ if (ExGetPreviousMode() != KernelMode) return STATUS_PRIVILEGE_NOT_HELD; @@ -1394,7 +1384,7 @@ SSI_DEF(SystemUnloadGdiDriverInformation) /* Unload the image */ MmUnloadSystemImage(SectionPointer); return STATUS_SUCCESS; - } +} /* Class 28 - Time Adjustment Information */ QSI_DEF(SystemTimeAdjustmentInformation) From 8a429f3d780fad4fed5fa099ef2986896da13bab Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 16 Jan 2010 04:36:56 +0000 Subject: [PATCH 032/121] [NTOS] - Implement KiInitializeCpuFeatures amd call it early in the boot process - fix KeProcessorArchitecture - sumplify KiGetCpuVendor - fix and enable __lldt - remove some legacy code svn path=/branches/ros-amd64-bringup/; revision=45095 --- .../include/internal/amd64/intrin_i.h | 4 +- reactos/ntoskrnl/ke/amd64/cpu.c | 44 +- reactos/ntoskrnl/ke/amd64/kiinit.c | 413 +++--------------- reactos/ntoskrnl/ke/amd64/thrdini.c | 62 +-- 4 files changed, 98 insertions(+), 425 deletions(-) diff --git a/reactos/ntoskrnl/include/internal/amd64/intrin_i.h b/reactos/ntoskrnl/include/internal/amd64/intrin_i.h index 9b5611553c3..5b33aa811c7 100644 --- a/reactos/ntoskrnl/include/internal/amd64/intrin_i.h +++ b/reactos/ntoskrnl/include/internal/amd64/intrin_i.h @@ -72,9 +72,9 @@ static __inline__ __attribute__((always_inline)) void __sgdt(void *Destination) __asm__ __volatile__("sgdt %0" : : "m"(*(short*)Destination) : "memory"); } -static __inline__ __attribute__((always_inline)) void __lldt(void *Source) +static __inline__ __attribute__((always_inline)) void __lldt(unsigned short Value) { - __asm__ __volatile__("lldt %0" : : "m"(*(short*)Source)); + __asm__ __volatile__("lldt %0" : : "rm"(Value)); } static __inline__ __attribute__((always_inline)) void __sldt(void *Destination) diff --git a/reactos/ntoskrnl/ke/amd64/cpu.c b/reactos/ntoskrnl/ke/amd64/cpu.c index 5cab781faca..aafd704455b 100644 --- a/reactos/ntoskrnl/ke/amd64/cpu.c +++ b/reactos/ntoskrnl/ke/amd64/cpu.c @@ -33,8 +33,6 @@ ULONG KeProcessorRevision; ULONG KeFeatureBits; ULONG KeI386MachineType; ULONG KeI386NpxPresent = 1; -ULONG KeI386XMMIPresent = 0; -ULONG KeI386FxsrPresent = 0; ULONG KeLargestCacheLine = 0x40; ULONG KiDmaIoCoherency = 0; CHAR KeNumberProcessors = 0; @@ -127,26 +125,15 @@ KiGetCpuVendor(VOID) { PKPRCB Prcb = KeGetCurrentPrcb(); INT Vendor[5]; - ULONG Temp; - - /* Assume no Vendor ID and fail if no CPUID Support. */ - Prcb->VendorString[0] = 0; - if (!Prcb->CpuID) return 0; /* Get the Vendor ID and null-terminate it */ __cpuid(Vendor, 0); - Vendor[4] = 0; - /* Re-arrange vendor string */ - Temp = Vendor[2]; - Vendor[2] = Vendor[3]; - Vendor[3] = Temp; - - /* Copy it to the PRCB and null-terminate it again */ - RtlCopyMemory(Prcb->VendorString, - &Vendor[1], - sizeof(Prcb->VendorString) - sizeof(CHAR)); - Prcb->VendorString[sizeof(Prcb->VendorString) - sizeof(CHAR)] = ANSI_NULL; + /* Copy it to the PRCB and null-terminate it */ + *(ULONG*)&Prcb->VendorString[0] = Vendor[1]; // ebx + *(ULONG*)&Prcb->VendorString[4] = Vendor[3]; // edx + *(ULONG*)&Prcb->VendorString[8] = Vendor[2]; // ecx + *(ULONG*)&Prcb->VendorString[12] = 0; /* Now check the CPU Type */ if (!strcmp((PCHAR)Prcb->VendorString, CmpIntelID)) @@ -223,6 +210,15 @@ KiGetFeatureBits(VOID) if (CpuFeatures & 0x02000000) FeatureBits |= KF_XMMI; if (CpuFeatures & 0x04000000) FeatureBits |= KF_XMMI64; +#if 0 + if (Reg[2] & 0x00000001) FeatureBits |= KF_SSE3NEW; + if (Reg[2] & 0x00000008) FeatureBits |= KF_MONITOR; + if (Reg[2] & 0x00000200) FeatureBits |= KF_SSE3SUP; + if (Reg[2] & 0x00002000) FeatureBits |= KF_CMPXCHG16B; + if (Reg[2] & 0x00080000) FeatureBits |= KF_SSE41; + if (Reg[2] & 0x00800000) FeatureBits |= KF_POPCNT; +#endif + /* Check if the CPU has hyper-threading */ if (CpuFeatures & 0x10000000) { @@ -267,18 +263,6 @@ KiGetFeatureBits(VOID) return FeatureBits; } -VOID -NTAPI -KiInitializeCpuFeatures() -{ - /* Enable Write-Protection */ - __writecr0(__readcr0() | CR0_WP); - - /* Disable fpu monitoring */ - __writecr0(__readcr0() & ~CR0_MP); - -} - VOID NTAPI KiGetCacheInformation(VOID) diff --git a/reactos/ntoskrnl/ke/amd64/kiinit.c b/reactos/ntoskrnl/ke/amd64/kiinit.c index cca6aa8b2e3..adc00253d10 100644 --- a/reactos/ntoskrnl/ke/amd64/kiinit.c +++ b/reactos/ntoskrnl/ke/amd64/kiinit.c @@ -36,19 +36,6 @@ VOID NTAPI KiInitMachineDependent(VOID) { -#if 0 - ULONG Protect; - ULONG CpuCount; - BOOLEAN FbCaching = FALSE; - NTSTATUS Status; - ULONG ReturnLength; - ULONG i, Affinity, Sample = 0; - PFX_SAVE_AREA FxSaveArea; - ULONG MXCsrMask = 0xFFBF; - ULONG Dummy[4]; - KI_SAMPLE_MAP Samples[4]; - PKI_SAMPLE_MAP CurrentSample = Samples; - /* Check for large page support */ if (KeFeatureBits & KF_LARGE_PAGE) { @@ -59,274 +46,25 @@ KiInitMachineDependent(VOID) /* Check for global page support */ if (KeFeatureBits & KF_GLOBAL_PAGE) { - /* Do an IPI to enable it on all CPUs */ - CpuCount = KeNumberProcessors; - KeIpiGenericCall(Ki386EnableGlobalPage, (ULONG_PTR)&CpuCount); + /* FIXME: Support this */ + DPRINT1("Global Page support detected but not yet taken advantage of!\n"); + } + + /* Check if we have MTRR */ + if (KeFeatureBits & KF_MTRR) + { + /* FIXME: Support this */ + DPRINT1("MTRR support detected but not yet taken advantage of!\n"); } /* Check for PAT and/or MTRR support */ - if (KeFeatureBits & (KF_PAT | KF_MTRR)) + if (KeFeatureBits & KF_PAT) { - /* Query the HAL to make sure we can use it */ - Status = HalQuerySystemInformation(HalFrameBufferCachingInformation, - sizeof(BOOLEAN), - &FbCaching, - &ReturnLength); - if ((NT_SUCCESS(Status)) && (FbCaching)) - { - /* We can't, disable it */ - KeFeatureBits &= ~(KF_PAT | KF_MTRR); - } + /* FIXME: Support this */ + DPRINT1("PAT support detected but not yet taken advantage of!\n"); } - /* Check for PAT support and enable it */ - if (KeFeatureBits & KF_PAT) KiInitializePAT(); - /* Assume no errata for now */ - SharedUserData->ProcessorFeatures[PF_FLOATING_POINT_PRECISION_ERRATA] = 0; - - /* Check if we have an NPX */ - if (KeI386NpxPresent) - { - /* Loop every CPU */ - i = KeActiveProcessors; - for (Affinity = 1; i; Affinity <<= 1) - { - /* Check if this is part of the set */ - if (i & Affinity) - { - /* Run on this CPU */ - i &= ~Affinity; - KeSetSystemAffinityThread(Affinity); - - /* Detect FPU errata */ - if (KiIsNpxErrataPresent()) - { - /* Disable NPX support */ - KeI386NpxPresent = FALSE; - SharedUserData-> - ProcessorFeatures[PF_FLOATING_POINT_PRECISION_ERRATA] = - TRUE; - break; - } - } - } - } - - /* If there's no NPX, then we're emulating the FPU */ - SharedUserData->ProcessorFeatures[PF_FLOATING_POINT_EMULATED] = - !KeI386NpxPresent; - - /* Check if there's no NPX, so that we can disable associated features */ - if (!KeI386NpxPresent) - { - /* Remove NPX-related bits */ - KeFeatureBits &= ~(KF_XMMI64 | KF_XMMI | KF_FXSR | KF_MMX); - - /* Disable kernel flags */ - KeI386FxsrPresent = KeI386XMMIPresent = FALSE; - - /* Disable processor features that might've been set until now */ - SharedUserData->ProcessorFeatures[PF_FLOATING_POINT_PRECISION_ERRATA] = - SharedUserData->ProcessorFeatures[PF_XMMI64_INSTRUCTIONS_AVAILABLE] = - SharedUserData->ProcessorFeatures[PF_XMMI_INSTRUCTIONS_AVAILABLE] = - SharedUserData->ProcessorFeatures[PF_3DNOW_INSTRUCTIONS_AVAILABLE] = - SharedUserData->ProcessorFeatures[PF_MMX_INSTRUCTIONS_AVAILABLE] = 0; - } - - /* Check for CR4 support */ - if (KeFeatureBits & KF_CR4) - { - /* Do an IPI call to enable the Debug Exceptions */ - CpuCount = KeNumberProcessors; - KeIpiGenericCall(Ki386EnableDE, (ULONG_PTR)&CpuCount); - } - - /* Check if FXSR was found */ - if (KeFeatureBits & KF_FXSR) - { - /* Do an IPI call to enable the FXSR */ - CpuCount = KeNumberProcessors; - KeIpiGenericCall(Ki386EnableFxsr, (ULONG_PTR)&CpuCount); - - /* Check if XMM was found too */ - if (KeFeatureBits & KF_XMMI) - { - /* Do an IPI call to enable XMMI exceptions */ - CpuCount = KeNumberProcessors; - KeIpiGenericCall(Ki386EnableXMMIExceptions, (ULONG_PTR)&CpuCount); - - /* FIXME: Implement and enable XMM Page Zeroing for Mm */ - - /* Patch the RtlPrefetchMemoryNonTemporal routine to enable it */ - Protect = MmGetPageProtect(NULL, RtlPrefetchMemoryNonTemporal); - MmSetPageProtect(NULL, - RtlPrefetchMemoryNonTemporal, - Protect | PAGE_IS_WRITABLE); - *(PCHAR)RtlPrefetchMemoryNonTemporal = 0x90; - MmSetPageProtect(NULL, RtlPrefetchMemoryNonTemporal, Protect); - } - } - - /* Check for, and enable SYSENTER support */ - KiRestoreFastSyscallReturnState(); - - /* Loop every CPU */ - i = KeActiveProcessors; - for (Affinity = 1; i; Affinity <<= 1) - { - /* Check if this is part of the set */ - if (i & Affinity) - { - /* Run on this CPU */ - i &= ~Affinity; - KeSetSystemAffinityThread(Affinity); - - /* Reset MHz to 0 for this CPU */ - KeGetCurrentPrcb()->MHz = 0; - - /* Check if we can use RDTSC */ - if (KeFeatureBits & KF_RDTSC) - { - /* Start sampling loop */ - for (;;) - { - /* Do a dummy CPUID to start the sample */ - CPUID(Dummy, 0); - - /* Fill out the starting data */ - CurrentSample->PerfStart = KeQueryPerformanceCounter(NULL); - CurrentSample->TSCStart = __rdtsc(); - CurrentSample->PerfFreq.QuadPart = -50000; - - /* Sleep for this sample */ - KeDelayExecutionThread(KernelMode, - FALSE, - &CurrentSample->PerfFreq); - - /* Do another dummy CPUID */ - CPUID(Dummy, 0); - - /* Fill out the ending data */ - CurrentSample->PerfEnd = - KeQueryPerformanceCounter(&CurrentSample->PerfFreq); - CurrentSample->TSCEnd = __rdtsc(); - - /* Calculate the differences */ - CurrentSample->PerfDelta = CurrentSample->PerfEnd.QuadPart - - CurrentSample->PerfStart.QuadPart; - CurrentSample->TSCDelta = CurrentSample->TSCEnd - - CurrentSample->TSCStart; - - /* Compute CPU Speed */ - CurrentSample->MHz = (ULONG)((CurrentSample->TSCDelta * - CurrentSample-> - PerfFreq.QuadPart + 500000) / - (CurrentSample->PerfDelta * - 1000000)); - - /* Check if this isn't the first sample */ - if (Sample) - { - /* Check if we got a good precision within 1MHz */ - if ((CurrentSample->MHz == CurrentSample[-1].MHz) || - (CurrentSample->MHz == CurrentSample[-1].MHz + 1) || - (CurrentSample->MHz == CurrentSample[-1].MHz - 1)) - { - /* We did, stop sampling */ - break; - } - } - - /* Move on */ - CurrentSample++; - Sample++; - - if (Sample == sizeof(Samples) / sizeof(Samples[0])) - { - /* Restart */ - CurrentSample = Samples; - Sample = 0; - } - } - - /* Save the CPU Speed */ - KeGetCurrentPrcb()->MHz = CurrentSample[-1].MHz; - } - - /* Check if we have MTRR */ - if (KeFeatureBits & KF_MTRR) - { - /* Then manually initialize MTRR for the CPU */ - KiInitializeMTRR(i ? FALSE : TRUE); - } - - /* Check if we have AMD MTRR and initialize it for the CPU */ - if (KeFeatureBits & KF_AMDK6MTRR) KiAmdK6InitializeMTRR(); - - /* Check if this is a buggy Pentium and apply the fixup if so */ - if (KiI386PentiumLockErrataPresent) KiI386PentiumLockErrataFixup(); - - /* Check if the CPU supports FXSR */ - if (KeFeatureBits & KF_FXSR) - { - /* Get the current thread NPX state */ - FxSaveArea = (PVOID) - ((ULONG_PTR)KeGetCurrentThread()->InitialStack - - NPX_FRAME_LENGTH); - - /* Clear initial MXCsr mask */ - FxSaveArea->U.FxArea.MXCsrMask = 0; - - /* Save the current NPX State */ -#ifdef __GNUC__ - asm volatile("fxsave %0\n\t" : "=m" (*FxSaveArea)); -#else - __asm fxsave [FxSaveArea] -#endif - /* Check if the current mask doesn't match the reserved bits */ - if (FxSaveArea->U.FxArea.MXCsrMask != 0) - { - /* Then use whatever it's holding */ - MXCsrMask = FxSaveArea->U.FxArea.MXCsrMask; - } - - /* Check if nobody set the kernel-wide mask */ - if (!KiMXCsrMask) - { - /* Then use the one we calculated above */ - KiMXCsrMask = MXCsrMask; - } - else - { - /* Was it set to the same value we found now? */ - if (KiMXCsrMask != MXCsrMask) - { - /* No, something is definitely wrong */ - KEBUGCHECKEX(MULTIPROCESSOR_CONFIGURATION_NOT_SUPPORTED, - KF_FXSR, - KiMXCsrMask, - MXCsrMask, - 0); - } - } - - /* Now set the kernel mask */ - KiMXCsrMask &= MXCsrMask; - } - } - } - - /* Return affinity back to where it was */ - KeRevertToUserAffinityThread(); - - /* NT allows limiting the duration of an ISR with a registry key */ - if (KiTimeLimitIsrMicroseconds) - { - /* FIXME: TODO */ - DPRINT1("ISR Time Limit not yet supported\n"); - } -#endif } VOID @@ -405,6 +143,44 @@ KiInitializePcr(IN PKIPCR Pcr, } +VOID +NTAPI +KiInitializeCpuFeatures(ULONG Cpu) +{ + ULONG FeatureBits; + + /* Get the processor features for this CPU */ + FeatureBits = KiGetFeatureBits(); + + /* Check if we support all needed features */ + if ((FeatureBits & REQUIRED_FEATURE_BITS) != REQUIRED_FEATURE_BITS) + { + /* If not, bugcheck system */ + FrLdrDbgPrint("CPU doesn't have needed features! Has: 0x%x, required: 0x%x\n", + FeatureBits, REQUIRED_FEATURE_BITS); + KeBugCheck(0); + } + + /* Set DEP to always on */ + SharedUserData->NXSupportPolicy = NX_SUPPORT_POLICY_ALWAYSON; + FeatureBits |= KF_NX_ENABLED; + + /* Save feature bits */ + KeGetCurrentPrcb()->FeatureBits = FeatureBits; + + /* Enable fx save restore support */ + __writecr4(__readcr4() | CR4_FXSR); + + /* Enable XMMI exceptions */ + __writecr4(__readcr4() | CR4_XMMEXCPT); + + /* Enable Write-Protection */ + __writecr0(__readcr0() | CR0_WP); + + /* Disable fpu monitoring */ + __writecr0(__readcr0() & ~CR0_MP); +} + VOID NTAPI KiInitializeKernel(IN PKPROCESS InitProcess, @@ -414,7 +190,6 @@ KiInitializeKernel(IN PKPROCESS InitProcess, IN CCHAR Number, IN PLOADER_PARAMETER_BLOCK LoaderBlock) { - ULONG FeatureBits; ULONG PageDirectory[2]; PVOID DpcStack; @@ -424,54 +199,6 @@ KiInitializeKernel(IN PKPROCESS InitProcess, /* Initialize the Power Management Support for this PRCB */ // PoInitializePrcb(Prcb); - /* Get the processor features for the CPU */ - FeatureBits = KiGetFeatureBits(); - - /* Check if we support all needed features */ - if ((FeatureBits & REQUIRED_FEATURE_BITS) != REQUIRED_FEATURE_BITS) - { - /* If not, bugcheck system */ - DPRINT1("CPU doesn't have needed features! Has: 0x%x, required: 0x%x\n", - FeatureBits, REQUIRED_FEATURE_BITS); - KeBugCheck(0); - } - - /* Set the default NX policy (opt-in) */ - SharedUserData->NXSupportPolicy = NX_SUPPORT_POLICY_OPTIN; - - /* Check if NPX is always on */ - if (strstr(KeLoaderBlock->LoadOptions, "NOEXECUTE=ALWAYSON")) - { - /* Set it always on */ - SharedUserData->NXSupportPolicy = NX_SUPPORT_POLICY_ALWAYSON; - FeatureBits |= KF_NX_ENABLED; - } - else if (strstr(KeLoaderBlock->LoadOptions, "NOEXECUTE=OPTOUT")) - { - /* Set it in opt-out mode */ - SharedUserData->NXSupportPolicy = NX_SUPPORT_POLICY_OPTOUT; - FeatureBits |= KF_NX_ENABLED; - } - else if ((strstr(KeLoaderBlock->LoadOptions, "NOEXECUTE=OPTIN")) || - (strstr(KeLoaderBlock->LoadOptions, "NOEXECUTE"))) - { - /* Set the feature bits */ - FeatureBits |= KF_NX_ENABLED; - } - else if ((strstr(KeLoaderBlock->LoadOptions, "NOEXECUTE=ALWAYSOFF")) || - (strstr(KeLoaderBlock->LoadOptions, "EXECUTE"))) - { - /* Set disabled mode */ - SharedUserData->NXSupportPolicy = NX_SUPPORT_POLICY_ALWAYSOFF; - FeatureBits |= KF_NX_DISABLED; - } - - /* Save feature bits */ - Prcb->FeatureBits = FeatureBits; - - /* Initialize the CPU features */ - KiInitializeCpuFeatures(); - /* Save CPU state */ KiSaveProcessorControlState(&Prcb->ProcessorState); @@ -490,15 +217,9 @@ KiInitializeKernel(IN PKPROCESS InitProcess, KeNodeBlock[0]->ProcessorMask = Prcb->SetMember; /* Set boot-level flags */ - KeI386NpxPresent = TRUE; - KeI386CpuType = Prcb->CpuType; - KeI386CpuStep = Prcb->CpuStep; - KeProcessorArchitecture = PROCESSOR_ARCHITECTURE_INTEL; + KeProcessorArchitecture = PROCESSOR_ARCHITECTURE_AMD64; KeProcessorLevel = (USHORT)Prcb->CpuType; if (Prcb->CpuID) KeProcessorRevision = Prcb->CpuStep; - KeFeatureBits = FeatureBits; - KeI386FxsrPresent = (KeFeatureBits & KF_FXSR) ? TRUE : FALSE; - KeI386XMMIPresent = (KeFeatureBits & KF_XMMI) ? TRUE : FALSE; /* Set the current MP Master KPRCB to the Boot PRCB */ Prcb->MultiThreadSetMaster = Prcb; @@ -646,10 +367,7 @@ KiSystemStartupReal(IN PLOADER_PARAMETER_BLOCK LoaderBlock) KeLoaderBlock = LoaderBlock; /* Get the current CPU number */ - Cpu = KeNumberProcessors++; - - /* Set active processors */ - KeActiveProcessors |= 1 << Cpu; + Cpu = KeNumberProcessors++; // FIXME /* LoaderBlock initialization for Cpu 0 */ if (Cpu == 0) @@ -677,10 +395,7 @@ KiSystemStartupReal(IN PLOADER_PARAMETER_BLOCK LoaderBlock) Ke386SetFs(KGDT_32_R3_TEB | RPL_MASK); /* LDT is unused */ -// __lldt(0); - - /* Enable fx save restore support */ - __writecr4(__readcr4() | CR4_FXSR); + __lldt(0); /* Align stack to 16 bytes */ LoaderBlock->KernelStack &= ~(16 - 1); @@ -698,6 +413,9 @@ KiSystemStartupReal(IN PLOADER_PARAMETER_BLOCK LoaderBlock) /* Initialize the PCR */ KiInitializePcr(Pcr, Cpu, InitialThread, KiDoubleFaultStack); + /* Initialize the CPU features */ + KiInitializeCpuFeatures(Cpu); + /* Initial setup for the boot CPU */ if (Cpu == 0) { @@ -721,21 +439,26 @@ KiSystemStartupReal(IN PLOADER_PARAMETER_BLOCK LoaderBlock) while (!KdPollBreakIn()); DbgBreakPointWithStatus(DBG_STATUS_CONTROL_C); #endif - } DPRINT("Pcr = %p, Gdt = %p, Idt = %p, Tss = %p\n", Pcr, Pcr->GdtBase, Pcr->IdtBase, Pcr->TssBase); + /* Acquire lock */ + while (InterlockedBitTestAndSet64((PLONG64)&KiFreezeExecutionLock, 0)) + { + /* Loop until lock is free */ + while ((*(volatile KSPIN_LOCK*)&KiFreezeExecutionLock) & 1); + } + /* Initialize the Processor with HAL */ HalInitializeProcessor(Cpu, KeLoaderBlock); - /* Loop until we can release the freeze lock */ - do - { - /* Loop until execution can continue */ - while (*(volatile PKSPIN_LOCK*)&KiFreezeExecutionLock == (PVOID)1); - } while(InterlockedBitTestAndSet64((PLONG64)&KiFreezeExecutionLock, 0)); + /* Set processor as active */ + KeActiveProcessors |= 1 << Cpu; + + /* Release lock */ + InterlockedAnd64((PLONG64)&KiFreezeExecutionLock, 0); /* Raise to HIGH_LEVEL */ KfRaiseIrql(HIGH_LEVEL); diff --git a/reactos/ntoskrnl/ke/amd64/thrdini.c b/reactos/ntoskrnl/ke/amd64/thrdini.c index c98bba3d557..616cd303264 100644 --- a/reactos/ntoskrnl/ke/amd64/thrdini.c +++ b/reactos/ntoskrnl/ke/amd64/thrdini.c @@ -81,9 +81,6 @@ KiInitializeContextThread(IN PKTHREAD Thread, /* Setup the Fx Area */ //FxSaveArea = &InitFrame->FxSaveArea; - /* Check if we support FXsr */ -// if (KeI386FxsrPresent) -// { // /* Get the FX Save Format Area */ // FxSaveFormat = (PFXSAVE_FORMAT)Context->ExtendedRegisters; // @@ -96,41 +93,19 @@ KiInitializeContextThread(IN PKTHREAD Thread, // FxSaveFormat->DataOffset = 0; // FxSaveFormat->DataSelector = 0; // FxSaveFormat->MXCsr = 0x1F80; -// } -// else -// { -// /* Setup the regular save area */ -// Context->FloatSave.ControlWord = 0x27F; -// Context->FloatSave.StatusWord = 0; -// Context->FloatSave.TagWord = -1; -// Context->FloatSave.ErrorOffset = 0; -// Context->FloatSave.ErrorSelector = 0; -// Context->FloatSave.DataOffset =0; -// Context->FloatSave.DataSelector = 0; -// } - /* Check if the CPU has NPX */ - if (KeI386NpxPresent) - { - /* Set an intial NPX State */ - //Context->FloatSave.Cr0NpxState = 0; - //FxSaveArea->Cr0NpxState = 0; - //FxSaveArea->NpxSavedCpu = 0; + /* Set an intial NPX State */ + //Context->FloatSave.Cr0NpxState = 0; + //FxSaveArea->Cr0NpxState = 0; + //FxSaveArea->NpxSavedCpu = 0; - /* Now set the context flags depending on XMM support */ - //ContextFlags |= (KeI386FxsrPresent) ? CONTEXT_EXTENDED_REGISTERS : - // CONTEXT_FLOATING_POINT; + /* Now set the context flags depending on XMM support */ + //ContextFlags |= (KeI386FxsrPresent) ? CONTEXT_EXTENDED_REGISTERS : + // CONTEXT_FLOATING_POINT; - /* Set the Thread's NPX State */ - Thread->NpxState = 0xA; - Thread->DispatcherHeader.NpxIrql = PASSIVE_LEVEL; - } - else - { - /* We'll use emulation */ - //FxSaveArea->Cr0NpxState = CR0_EM; - Thread->NpxState = 0xA &~ CR0_MP; - } + /* Set the Thread's NPX State */ + Thread->NpxState = 0xA; + Thread->DispatcherHeader.NpxIrql = PASSIVE_LEVEL; /* Disable any debug regiseters */ Context->ContextFlags &= ~CONTEXT_DEBUG_REGISTERS; @@ -179,19 +154,10 @@ KiInitializeContextThread(IN PKTHREAD Thread, //RtlZeroMemory(FxSaveArea, sizeof(FX_SAVE_AREA)); /* Check if we have Fxsr support */ - if (KeI386FxsrPresent) - { - DPRINT1("FxsrPresent but did nothing\n"); -// /* Set the stub FX area */ -// FxSaveArea->U.FxArea.ControlWord = 0x27F; -// FxSaveArea->U.FxArea.MXCsr = 0x1F80; -// } -// else -// { -// /* Set the stub FN area */ -// FxSaveArea->U.FnArea.ControlWord = 0x27F; -// FxSaveArea->U.FnArea.TagWord = -1; - } + DPRINT1("FxsrPresent but did nothing\n"); +// /* Set the stub FX area */ +// FxSaveArea->U.FxArea.ControlWord = 0x27F; +// FxSaveArea->U.FxArea.MXCsr = 0x1F80; /* No NPX State */ Thread->NpxState = 0xA; From f1ca0f6da808320df66bd767ec38b8f3b3876954 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 16 Jan 2010 19:21:37 +0000 Subject: [PATCH 033/121] [KE] - Save extended xmm registers and in the ExceptionFrame - Restore registeres from the ExceptionFrame svn path=/branches/ros-amd64-bringup/; revision=45112 --- reactos/ntoskrnl/ke/amd64/trap.S | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/reactos/ntoskrnl/ke/amd64/trap.S b/reactos/ntoskrnl/ke/amd64/trap.S index 2a6408ea502..471ea2330db 100644 --- a/reactos/ntoskrnl/ke/amd64/trap.S +++ b/reactos/ntoskrnl/ke/amd64/trap.S @@ -139,7 +139,7 @@ _MsgTrapInfo: /* Save previous mode and swap gs when it was UserMode */ mov ax, [rbp + KTRAP_FRAME_SegCs] - and ax, 1 + and al, 1 mov [rbp + KTRAP_FRAME_PreviousMode], al jz 1f swapgs @@ -282,6 +282,16 @@ _InternalDispatchException: mov [rsp + KEXCEPTION_FRAME_R13], r13 mov [rsp + KEXCEPTION_FRAME_R14], r14 mov [rsp + KEXCEPTION_FRAME_R15], r15 + movdqa [rsp + KEXCEPTION_FRAME_Xmm6], xmm6 + movdqa [rsp + KEXCEPTION_FRAME_Xmm7], xmm7 + movdqa [rsp + KEXCEPTION_FRAME_Xmm8], xmm8 + movdqa [rsp + KEXCEPTION_FRAME_Xmm9], xmm9 + movdqa [rsp + KEXCEPTION_FRAME_Xmm10], xmm10 + movdqa [rsp + KEXCEPTION_FRAME_Xmm11], xmm11 + movdqa [rsp + KEXCEPTION_FRAME_Xmm12], xmm12 + movdqa [rsp + KEXCEPTION_FRAME_Xmm13], xmm13 + movdqa [rsp + KEXCEPTION_FRAME_Xmm14], xmm14 + movdqa [rsp + KEXCEPTION_FRAME_Xmm15], xmm15 mov qword ptr [rsp + KEXCEPTION_FRAME_Return], 0 /* Call KiDispatchException */ @@ -292,6 +302,22 @@ _InternalDispatchException: mov byte ptr [rsp + KEXCEPTION_FRAME_P5], 1 // FirstChance call _KiDispatchException + /* Restore registers */ + mov r12, [rsp + KEXCEPTION_FRAME_R12] + mov r13, [rsp + KEXCEPTION_FRAME_R13] + mov r14, [rsp + KEXCEPTION_FRAME_R14] + mov r15, [rsp + KEXCEPTION_FRAME_R15] + movdqa xmm6, [rsp + KEXCEPTION_FRAME_Xmm6] + movdqa xmm7, [rsp + KEXCEPTION_FRAME_Xmm7] + movdqa xmm8, [rsp + KEXCEPTION_FRAME_Xmm8] + movdqa xmm9, [rsp + KEXCEPTION_FRAME_Xmm9] + movdqa xmm10, [rsp + KEXCEPTION_FRAME_Xmm10] + movdqa xmm11, [rsp + KEXCEPTION_FRAME_Xmm11] + movdqa xmm12, [rsp + KEXCEPTION_FRAME_Xmm12] + movdqa xmm13, [rsp + KEXCEPTION_FRAME_Xmm13] + movdqa xmm14, [rsp + KEXCEPTION_FRAME_Xmm14] + movdqa xmm15, [rsp + KEXCEPTION_FRAME_Xmm15] + add rsp, SIZE_EXCEPTION_RECORD + SIZE_KEXCEPTION_FRAME ret From 66062a3d7f0e1fd45412f3cb3a7a9c7d101d1b08 Mon Sep 17 00:00:00 2001 From: Samuel Serapion Date: Sun, 17 Jan 2010 07:20:26 +0000 Subject: [PATCH 034/121] [KDBG] - Fix issue were prompt was unresponsive after first command. - Enable x86_64 disassembly and default to intel syntax - Print addresses with %p so that their full 64bit glory is shown. - Fix a warning. svn path=/branches/ros-amd64-bringup/; revision=45114 --- reactos/ntoskrnl/kdbg/amd64/i386-dis.c | 10 +++++----- reactos/ntoskrnl/kdbg/amd64/kdb_help.S | 12 ++++++------ reactos/ntoskrnl/kdbg/kdb.c | 2 +- reactos/ntoskrnl/kdbg/kdb_cli.c | 8 ++++---- reactos/ntoskrnl/kdbg/kdb_symbols.c | 4 ++-- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/reactos/ntoskrnl/kdbg/amd64/i386-dis.c b/reactos/ntoskrnl/kdbg/amd64/i386-dis.c index 60dc0246987..72f1317715e 100644 --- a/reactos/ntoskrnl/kdbg/amd64/i386-dis.c +++ b/reactos/ntoskrnl/kdbg/amd64/i386-dis.c @@ -26,7 +26,7 @@ typedef ULONG_PTR bfd_vma; typedef unsigned char bfd_byte; enum bfd_endian { BFD_ENDIAN_BIG, BIG_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN }; typedef void* bfd; -typedef signed int bfd_signed_vma; +typedef LONG_PTR bfd_signed_vma; #define bfd_mach_x86_64_intel_syntax 0 #define bfd_mach_x86_64 1 #define bfd_mach_i386_i386_intel_syntax 2 @@ -36,7 +36,7 @@ typedef signed int bfd_signed_vma; #define _(X) X #define ATTRIBUTE_UNUSED extern int sprintf(char *str, const char *format, ...); -#define sprintf_vma(BUF, VMA) sprintf(BUF, "0x%X", VMA) +#define sprintf_vma(BUF, VMA) sprintf(BUF, "%p", VMA) #define _setjmp setjmp #define _INC_SETJMPEX struct disassemble_info; @@ -82,7 +82,7 @@ KdbpPrintAddressInCode(ULONG_PTR Addr, struct disassemble_info * Ignored) { if (!KdbSymPrintAddress((void*)Addr)) { - DbgPrint("<%08x>", Addr); + DbgPrint("<%p>", Addr); } } @@ -2102,9 +2102,9 @@ print_insn (pc, info) p++; } #else - mode_64bit = 0; + mode_64bit = 1; priv.orig_sizeflag = AFLAG | DFLAG; - /*intel_syntax = 0;*/ + intel_syntax = 1; #endif if (intel_syntax) diff --git a/reactos/ntoskrnl/kdbg/amd64/kdb_help.S b/reactos/ntoskrnl/kdbg/amd64/kdb_help.S index 032602ec9fc..781b5c886b8 100644 --- a/reactos/ntoskrnl/kdbg/amd64/kdb_help.S +++ b/reactos/ntoskrnl/kdbg/amd64/kdb_help.S @@ -30,12 +30,12 @@ _KdbEnter: mov [rsp + KTRAP_FRAME_R11], r11 /* Save xmm registers */ -// movdqa [rsp + KTRAP_FRAME_Xmm0], xmm0 -// movdqa [rsp + KTRAP_FRAME_Xmm1], xmm1 -// movdqa [rsp + KTRAP_FRAME_Xmm2], xmm2 -// movdqa [rsp + KTRAP_FRAME_Xmm3], xmm3 -// movdqa [rsp + KTRAP_FRAME_Xmm4], xmm4 -// movdqa [rsp + KTRAP_FRAME_Xmm5], xmm5 + movdqa [rsp + KTRAP_FRAME_Xmm0], xmm0 + movdqa [rsp + KTRAP_FRAME_Xmm1], xmm1 + movdqa [rsp + KTRAP_FRAME_Xmm2], xmm2 + movdqa [rsp + KTRAP_FRAME_Xmm3], xmm3 + movdqa [rsp + KTRAP_FRAME_Xmm4], xmm4 + movdqa [rsp + KTRAP_FRAME_Xmm5], xmm5 /* Save cs and previous mode */ mov ax, cs diff --git a/reactos/ntoskrnl/kdbg/kdb.c b/reactos/ntoskrnl/kdbg/kdb.c index 9a8d815ec48..65d61349844 100644 --- a/reactos/ntoskrnl/kdbg/kdb.c +++ b/reactos/ntoskrnl/kdbg/kdb.c @@ -461,7 +461,7 @@ KdbpStepIntoInstruction( } /* Get the interrupt descriptor */ - if (!NT_SUCCESS(KdbpSafeReadMemory(IntDesc, (PVOID)(ULONG_PTR)(Idtr.Base + (IntVect * 8)), sizeof (IntDesc)))) + if (!NT_SUCCESS(KdbpSafeReadMemory(IntDesc, (PVOID)((ULONG_PTR)Idtr.Base + (IntVect * 8)), sizeof (IntDesc)))) { /*KdbpPrint("Couldn't access memory at 0x%p\n", (ULONG_PTR)Idtr.Base + (IntVect * 8));*/ return FALSE; diff --git a/reactos/ntoskrnl/kdbg/kdb_cli.c b/reactos/ntoskrnl/kdbg/kdb_cli.c index b5e48180b8f..179e2398472 100644 --- a/reactos/ntoskrnl/kdbg/kdb_cli.c +++ b/reactos/ntoskrnl/kdbg/kdb_cli.c @@ -548,7 +548,7 @@ KdbpCmdDisassembleX( while (Count > 0) { if (!KdbSymPrintAddress((PVOID)Address)) - KdbpPrint("<%x>:", Address); + KdbpPrint("<%p>:", Address); else KdbpPrint(":"); @@ -574,7 +574,7 @@ KdbpCmdDisassembleX( while (Count-- > 0) { if (!KdbSymPrintAddress((PVOID)Address)) - KdbpPrint("<%x>: ", Address); + KdbpPrint("<%p>: ", Address); else KdbpPrint(": "); @@ -2722,7 +2722,7 @@ KdbpReadCommand( NextKey = '\0'; } - if ((ULONG)(Buffer - Orig) >= (Size - 1)) + if ((ULONG_PTR)(Buffer - Orig) >= (Size - 1)) { /* Buffer is full, accept only newlines */ if (Key != '\n') @@ -3258,4 +3258,4 @@ KdpPrompt(IN LPSTR InString, /* Return the length */ return OutStringLength; -} \ No newline at end of file +} diff --git a/reactos/ntoskrnl/kdbg/kdb_symbols.c b/reactos/ntoskrnl/kdbg/kdb_symbols.c index 6caf0fd6df9..1da26151fe2 100644 --- a/reactos/ntoskrnl/kdbg/kdb_symbols.c +++ b/reactos/ntoskrnl/kdbg/kdb_symbols.c @@ -142,12 +142,12 @@ KdbSymPrintAddress( FunctionName); if (NT_SUCCESS(Status)) { - DbgPrint("<%wZ:%x (%s:%d (%s))>", + DbgPrint("<%wZ:%p (%s:%d (%s))>", &LdrEntry->BaseDllName, RelativeAddress, FileName, LineNumber, FunctionName); } else { - DbgPrint("<%wZ:%x>", &LdrEntry->BaseDllName, RelativeAddress); + DbgPrint("<%wZ:%p>", &LdrEntry->BaseDllName, RelativeAddress); } return TRUE; From adc81bcec945a9e201a7b147d305324d5a600373 Mon Sep 17 00:00:00 2001 From: Samuel Serapion Date: Sun, 17 Jan 2010 07:31:35 +0000 Subject: [PATCH 035/121] Fix building in compilers without __int64 svn path=/branches/ros-amd64-bringup/; revision=45115 --- reactos/tools/rsym/rsym64.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/reactos/tools/rsym/rsym64.h b/reactos/tools/rsym/rsym64.h index 521b55cbad9..f4d371cc91c 100644 --- a/reactos/tools/rsym/rsym64.h +++ b/reactos/tools/rsym/rsym64.h @@ -4,7 +4,13 @@ //C_ASSERT(sizeof(ULONG) == 4); typedef unsigned char UBYTE; +#if defined(_MSC_VER) || defined(__MINGW32__) typedef unsigned __int64 ULONG64; +#else +#include +typedef uint64_t ULONG64; +#endif + #define IMAGE_FILE_MACHINE_AMD64 0x8664 #define IMAGE_DIRECTORY_ENTRY_IMPORT 1 From 6e80066aadbc922295ade0a8c0d0a04649345274 Mon Sep 17 00:00:00 2001 From: Samuel Serapion Date: Sun, 17 Jan 2010 07:56:11 +0000 Subject: [PATCH 036/121] [HAL] Fix mp and mps builds. svn path=/branches/ros-amd64-bringup/; revision=45116 --- reactos/hal/halx86/hal_generic.rbuild | 2 +- reactos/hal/halx86/hal_generic_mp.rbuild | 10 +++-- reactos/hal/halx86/halmps.rbuild | 7 ---- reactos/hal/halx86/mp/mpsirql.c | 50 ------------------------ 4 files changed, 8 insertions(+), 61 deletions(-) diff --git a/reactos/hal/halx86/hal_generic.rbuild b/reactos/hal/halx86/hal_generic.rbuild index a3e87073d2e..5e8cb2df60a 100644 --- a/reactos/hal/halx86/hal_generic.rbuild +++ b/reactos/hal/halx86/hal_generic.rbuild @@ -38,7 +38,7 @@ halinit.c - irq.s + irq.S misc.c pic.c systimer.S diff --git a/reactos/hal/halx86/hal_generic_mp.rbuild b/reactos/hal/halx86/hal_generic_mp.rbuild index ef15e7dcaa6..1a3593c3295 100644 --- a/reactos/hal/halx86/hal_generic_mp.rbuild +++ b/reactos/hal/halx86/hal_generic_mp.rbuild @@ -10,9 +10,13 @@ spinlock.c - - irq.S - + apic.c + halinit_mp.c + ioapic.c + ipi_mp.c + mpconfig.c + processor_mp.c + halmp.rc diff --git a/reactos/hal/halx86/halmps.rbuild b/reactos/hal/halx86/halmps.rbuild index c462e7911a6..0d13b7cd8cb 100644 --- a/reactos/hal/halx86/halmps.rbuild +++ b/reactos/hal/halx86/halmps.rbuild @@ -12,14 +12,7 @@ hal_generic_mp ntoskrnl - apic.c - halinit_mp.c - ioapic.c - ipi_mp.c - mpconfig.c mpsirql.c - processor_mp.c - halmp.rc mps.S mpsboot.asm diff --git a/reactos/hal/halx86/mp/mpsirql.c b/reactos/hal/halx86/mp/mpsirql.c index 9d122d48244..504acd13c2e 100644 --- a/reactos/hal/halx86/mp/mpsirql.c +++ b/reactos/hal/halx86/mp/mpsirql.c @@ -143,30 +143,6 @@ KfLowerIrql (KIRQL NewIrql) HalpLowerIrql (NewIrql, FALSE); } - -/********************************************************************** - * NAME EXPORTED - * KeLowerIrql - * - * DESCRIPTION - * Restores the irq level on the current processor - * - * ARGUMENTS - * NewIrql = Irql to lower to - * - * RETURN VALUE - * None - * - * NOTES - */ -#undef KeLowerIrql -VOID NTAPI -KeLowerIrql (KIRQL NewIrql) -{ - KfLowerIrql (NewIrql); -} - - /********************************************************************** * NAME EXPORTED * KfRaiseIrql @@ -216,32 +192,6 @@ KfRaiseIrql (KIRQL NewIrql) } -/********************************************************************** - * NAME EXPORTED - * KeRaiseIrql - * - * DESCRIPTION - * Raises the hardware priority (irql) - * - * ARGUMENTS - * NewIrql = Irql to raise to - * OldIrql (OUT) = Caller supplied storage for the previous irql - * - * RETURN VALUE - * None - * - * NOTES - * Calls KfRaiseIrql - */ -#undef KeRaiseIrql -VOID NTAPI -KeRaiseIrql (KIRQL NewIrql, - PKIRQL OldIrql) -{ - *OldIrql = KfRaiseIrql (NewIrql); -} - - /********************************************************************** * NAME EXPORTED * KeRaiseIrqlToDpcLevel From 4411501d4e52234685558d9f8c662f9f07cc2905 Mon Sep 17 00:00:00 2001 From: Samuel Serapion Date: Sun, 17 Jan 2010 08:02:52 +0000 Subject: [PATCH 037/121] [KDBG] - Make backtrace addresses also print correctly. svn path=/branches/ros-amd64-bringup/; revision=45117 --- reactos/ntoskrnl/kdbg/kdb_cli.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/reactos/ntoskrnl/kdbg/kdb_cli.c b/reactos/ntoskrnl/kdbg/kdb_cli.c index 179e2398472..37a19ea9535 100644 --- a/reactos/ntoskrnl/kdbg/kdb_cli.c +++ b/reactos/ntoskrnl/kdbg/kdb_cli.c @@ -841,11 +841,15 @@ KdbpCmdBackTrace( } else { +#ifdef _M_AMD64 + KdbpPrint("Rip:\n"); +#else KdbpPrint("Eip:\n"); +#endif /* Try printing the function at EIP */ if (!KdbSymPrintAddress((PVOID)KdbCurrentTrapFrame->Tf.Eip)) - KdbpPrint("<%x>\n", KdbCurrentTrapFrame->Tf.Eip); + KdbpPrint("<%p>\n", KdbCurrentTrapFrame->Tf.Eip); else KdbpPrint("\n"); } From 2c0ce1ef8f8c568242a6cce0bd67d3b9affd2c6c Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sun, 17 Jan 2010 09:38:11 +0000 Subject: [PATCH 038/121] [KE] - Fix setting of fs in KeContextToTrapFrame and comparison in KiGeneralProtectionFault svn path=/branches/ros-amd64-bringup/; revision=45120 --- reactos/ntoskrnl/ke/amd64/context.c | 4 ++-- reactos/ntoskrnl/ke/amd64/trap.S | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/reactos/ntoskrnl/ke/amd64/context.c b/reactos/ntoskrnl/ke/amd64/context.c index 84dd2dd28b4..32758073fea 100644 --- a/reactos/ntoskrnl/ke/amd64/context.c +++ b/reactos/ntoskrnl/ke/amd64/context.c @@ -102,7 +102,7 @@ KeContextToTrapFrame(IN PCONTEXT Context, /* Set valid selectors */ TrapFrame->SegDs = KGDT_64_DATA | RPL_MASK; TrapFrame->SegEs = KGDT_64_DATA | RPL_MASK; - TrapFrame->SegFs = KGDT_32_R3_TEB; + TrapFrame->SegFs = KGDT_32_R3_TEB | RPL_MASK; TrapFrame->SegGs = KGDT_64_DATA | RPL_MASK; } else @@ -218,7 +218,7 @@ KeTrapFrameToContext(IN PKTRAP_FRAME TrapFrame, /* Set valid selectors */ Context->SegDs = KGDT_64_DATA | RPL_MASK; Context->SegEs = KGDT_64_DATA | RPL_MASK; - Context->SegFs = KGDT_32_R3_TEB; + Context->SegFs = KGDT_32_R3_TEB | RPL_MASK; Context->SegGs = KGDT_64_DATA | RPL_MASK; } else diff --git a/reactos/ntoskrnl/ke/amd64/trap.S b/reactos/ntoskrnl/ke/amd64/trap.S index 471ea2330db..78a2c664095 100644 --- a/reactos/ntoskrnl/ke/amd64/trap.S +++ b/reactos/ntoskrnl/ke/amd64/trap.S @@ -577,10 +577,11 @@ KiDebugTrapOrFaultKMode: jne KiGpfPopSegDs cmp [rbp + KTRAP_FRAME_SegEs], dx jne KiGpfPopSegEs - cmp [rbp + KTRAP_FRAME_SegFs], dx - jne KiGpfPopSegFs cmp [rbp + KTRAP_FRAME_SegGs], dx jne KiGpfPopSegGs + mov dx, 0x0053 // KGDT64_R3_CMTEB | RPL_MASK + cmp [rbp + KTRAP_FRAME_SegFs], dx + jne KiGpfPopSegFs KiGpfFatal: From 682ff1ba02f98e5b1893d4e2bf9d3e9e3491902e Mon Sep 17 00:00:00 2001 From: Samuel Serapion Date: Sun, 17 Jan 2010 21:38:25 +0000 Subject: [PATCH 039/121] Fix user32 build. svn path=/branches/ros-amd64-bringup/; revision=45124 --- reactos/dll/win32/user32/windows/clipboard.c | 6 +++--- reactos/include/reactos/win32k/ntuser.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/reactos/dll/win32/user32/windows/clipboard.c b/reactos/dll/win32/user32/windows/clipboard.c index 61b11b79dd6..3634e65c87f 100644 --- a/reactos/dll/win32/user32/windows/clipboard.c +++ b/reactos/dll/win32/user32/windows/clipboard.c @@ -59,21 +59,21 @@ GetClipboardData(UINT uFormat) /* dealing with bitmap object */ if (uFormat != CF_BITMAP) { - size = NtUserGetClipboardData(uFormat, NULL); + size = (DWORD_PTR)NtUserGetClipboardData(uFormat, NULL); if (size) { hGlobal = GlobalAlloc(GMEM_DDESHARE | GMEM_MOVEABLE, size); pGlobal = GlobalLock(hGlobal); - size = NtUserGetClipboardData(uFormat, pGlobal); + size = (DWORD_PTR)NtUserGetClipboardData(uFormat, pGlobal); GlobalUnlock(hGlobal); } } else { - hGlobal = (HANDLE)NtUserGetClipboardData(CF_BITMAP, NULL); + hGlobal = NtUserGetClipboardData(CF_BITMAP, NULL); } return hGlobal; diff --git a/reactos/include/reactos/win32k/ntuser.h b/reactos/include/reactos/win32k/ntuser.h index d1ba0713ee4..b4fb469c3f7 100644 --- a/reactos/include/reactos/win32k/ntuser.h +++ b/reactos/include/reactos/win32k/ntuser.h @@ -2881,7 +2881,7 @@ BOOL NTAPI NtUserTranslateMessage( LPMSG lpMsg, - HKL dwhkl ); + UINT flags ); BOOL NTAPI From dccc119ded9c92272694215e4d99c6e5ce0013d5 Mon Sep 17 00:00:00 2001 From: Samuel Serapion Date: Sun, 17 Jan 2010 22:02:50 +0000 Subject: [PATCH 040/121] Fix win32k build svn path=/branches/ros-amd64-bringup/; revision=45126 --- reactos/subsystems/win32/win32k/include/msgqueue.h | 2 +- reactos/subsystems/win32/win32k/ntuser/message.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/reactos/subsystems/win32/win32k/include/msgqueue.h b/reactos/subsystems/win32/win32k/include/msgqueue.h index 234d0b59eeb..5094b7f1d67 100644 --- a/reactos/subsystems/win32/win32k/include/msgqueue.h +++ b/reactos/subsystems/win32/win32k/include/msgqueue.h @@ -188,7 +188,7 @@ co_IntSendMessageTimeout(HWND hWnd, LRESULT FASTCALL IntDispatchMessage(MSG* Msg); BOOL FASTCALL -IntTranslateKbdMessage(LPMSG lpMsg, HKL dwhkl); +IntTranslateKbdMessage(LPMSG lpMsg, UINT flags); VOID FASTCALL co_MsqPostKeyboardMessage(UINT uMsg, WPARAM wParam, LPARAM lParam); diff --git a/reactos/subsystems/win32/win32k/ntuser/message.c b/reactos/subsystems/win32/win32k/ntuser/message.c index 418059cda40..c64b0eb1927 100644 --- a/reactos/subsystems/win32/win32k/ntuser/message.c +++ b/reactos/subsystems/win32/win32k/ntuser/message.c @@ -2283,7 +2283,7 @@ NtUserDispatchMessage(PMSG UnsafeMsgInfo) BOOL APIENTRY NtUserTranslateMessage(LPMSG lpMsg, - HKL dwhkl) + UINT flags) { NTSTATUS Status; MSG SafeMsg; @@ -2299,7 +2299,7 @@ NtUserTranslateMessage(LPMSG lpMsg, RETURN( FALSE); } - RETURN( IntTranslateKbdMessage(&SafeMsg, dwhkl)); + RETURN( IntTranslateKbdMessage(&SafeMsg, flags)); CLEANUP: DPRINT("Leave NtUserTranslateMessage: ret=%i\n",_ret_); From 9e33320c2afa88157a50170b02408a60ee5a9987 Mon Sep 17 00:00:00 2001 From: Samuel Serapion Date: Sun, 17 Jan 2010 22:36:11 +0000 Subject: [PATCH 041/121] Try fix build again svn path=/branches/ros-amd64-bringup/; revision=45127 --- reactos/config.template.rbuild | 2 +- reactos/dll/win32/msvcrt/msvcrt-amd64.def | 14 ++++++++++++-- reactos/subsystems/win32/win32k/ntuser/keyboard.c | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/reactos/config.template.rbuild b/reactos/config.template.rbuild index 56dc853a02e..36e83d13ce9 100644 --- a/reactos/config.template.rbuild +++ b/reactos/config.template.rbuild @@ -97,7 +97,7 @@ - + + + From 351f173762664618b081290c9b3486ca62b962ed Mon Sep 17 00:00:00 2001 From: Samuel Serapion Date: Thu, 21 Jan 2010 19:54:40 +0000 Subject: [PATCH 050/121] Fix build. svn path=/branches/ros-amd64-bringup/; revision=45193 --- reactos/hal/halx86/generic/amd64/irq.S | 12 ------------ reactos/hal/halx86/hal_generic_up.rbuild | 1 - 2 files changed, 13 deletions(-) diff --git a/reactos/hal/halx86/generic/amd64/irq.S b/reactos/hal/halx86/generic/amd64/irq.S index 5ff2c8e9c18..15934cde4dd 100644 --- a/reactos/hal/halx86/generic/amd64/irq.S +++ b/reactos/hal/halx86/generic/amd64/irq.S @@ -37,18 +37,6 @@ _HalEnableInterrupt: UNIMPLEMENTED "HalEnableInterrupt" .endfunc -.global _HalDisableSystemInterrupt -.func _HalDisableSystemInterrupt -_HalDisableSystemInterrupt: - UNIMPLEMENTED "HalDisableSystemInterrupt" -.endfunc - -.global _HalEnableSystemInterrupt -.func _HalEnableSystemInterrupt -_HalEnableSystemInterrupt: - UNIMPLEMENTED "HalEnableSystemInterrupt" -.endfunc - .global _HalDisableInterrupt .func _HalDisableInterrupt _HalDisableInterrupt: diff --git a/reactos/hal/halx86/hal_generic_up.rbuild b/reactos/hal/halx86/hal_generic_up.rbuild index 1eeedf2e44a..b9c40a2b4b0 100644 --- a/reactos/hal/halx86/hal_generic_up.rbuild +++ b/reactos/hal/halx86/hal_generic_up.rbuild @@ -6,7 +6,6 @@ include - pic.c spinlock.c From 1ac4e0fac7d7960843cb22e69b94e1d5ccca7612 Mon Sep 17 00:00:00 2001 From: Samuel Serapion Date: Sat, 23 Jan 2010 04:18:57 +0000 Subject: [PATCH 051/121] - commctrl.h: revert a change from 45098 which is incorrect. - make some floating point math available on x64 - build fixes. svn path=/branches/ros-amd64-bringup/; revision=45208 --- reactos/hal/halx86/mp/halinit_mp.c | 5 -- reactos/include/crt/math.h | 92 +++++++++++++++++------------- reactos/include/psdk/commctrl.h | 2 +- reactos/ntoskrnl/mm/amd64/init.c | 4 +- reactos/tools/rbuild/rbuild.vcproj | 1 + 5 files changed, 57 insertions(+), 47 deletions(-) diff --git a/reactos/hal/halx86/mp/halinit_mp.c b/reactos/hal/halx86/mp/halinit_mp.c index e8d80e54af5..ff385393f1e 100644 --- a/reactos/hal/halx86/mp/halinit_mp.c +++ b/reactos/hal/halx86/mp/halinit_mp.c @@ -22,11 +22,6 @@ ULONG_PTR KernelBase; /***************************************************************************/ -VOID NTAPI HalpInitializePICs(IN BOOLEAN EnableInterrupts) -{ - UNIMPLEMENTED; -} - VOID HalpInitPhase0(PLOADER_PARAMETER_BLOCK LoaderBlock) diff --git a/reactos/include/crt/math.h b/reactos/include/crt/math.h index 159d048c0ae..a5761848f57 100644 --- a/reactos/include/crt/math.h +++ b/reactos/include/crt/math.h @@ -106,40 +106,40 @@ extern "C" { float __cdecl _hypotf(float _X,float _Y); #endif - float frexpf(float _X,int *_Y); - float __cdecl ldexpf(float _X,int _Y); - long double __cdecl ldexpl(long double _X,int _Y); - float __cdecl acosf(float _X); - float __cdecl asinf(float _X); - float __cdecl atanf(float _X); - float __cdecl atan2f(float _X,float _Y); - float __cdecl cosf(float _X); - float __cdecl sinf(float _X); - float __cdecl tanf(float _X); - float __cdecl coshf(float _X); - float __cdecl sinhf(float _X); - float __cdecl tanhf(float _X); - float __cdecl expf(float _X); - float expm1f(float _X); - float __cdecl logf(float _X); - float __cdecl log10f(float _X); - float __cdecl modff(float _X,float *_Y); - float __cdecl powf(float _X,float _Y); - float __cdecl sqrtf(float _X); - float __cdecl ceilf(float _X); - float __cdecl floorf(float _X); - float __cdecl fmodf(float _X,float _Y); - float __cdecl _hypotf(float _X,float _Y); - float __cdecl fabsf(float _X); + extern float frexpf(float _X,int *_Y); + extern float __cdecl ldexpf(float _X,int _Y); + extern long double __cdecl ldexpl(long double _X,int _Y); + extern float __cdecl acosf(float _X); + extern float __cdecl asinf(float _X); + extern float __cdecl atanf(float _X); + extern float __cdecl atan2f(float _X,float _Y); + extern float __cdecl cosf(float _X); + extern float __cdecl sinf(float _X); + extern float __cdecl tanf(float _X); + extern float __cdecl coshf(float _X); + extern float __cdecl sinhf(float _X); + extern float __cdecl tanhf(float _X); + extern float __cdecl expf(float _X); + extern float expm1f(float _X); + extern float __cdecl logf(float _X); + extern float __cdecl log10f(float _X); + extern float __cdecl modff(float _X,float *_Y); + extern float __cdecl powf(float _X,float _Y); + extern float __cdecl sqrtf(float _X); + extern float __cdecl ceilf(float _X); + extern float __cdecl floorf(float _X); + extern float __cdecl fmodf(float _X,float _Y); + extern float __cdecl _hypotf(float _X,float _Y); + extern float __cdecl fabsf(float _X); #if !defined(__ia64__) && !defined(_M_IA64) /* from libmingwex */ - float __cdecl _copysignf (float _Number,float _Sign); - float __cdecl _chgsignf (float _X); - float __cdecl _logbf(float _X); - float __cdecl _nextafterf(float _X,float _Y); - int __cdecl _finitef(float _X); - int __cdecl _isnanf(float _X); - int __cdecl _fpclassf(float _X); + extern float __cdecl _copysignf (float _Number,float _Sign); + extern float __cdecl _chgsignf (float _X); + extern float __cdecl _logbf(float _X); + extern float __cdecl _nextafterf(float _X,float _Y); + extern int __cdecl _finitef(float _X); + extern int __cdecl _isnanf(float _X); + extern int __cdecl _fpclassf(float _X); #endif #if defined(__GNUC__) @@ -237,14 +237,22 @@ extern "C" { #ifndef __NO_ISOCEXT #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \ - || !defined __STRICT_ANSI__ || defined __GLIBCPP__ + || !defined __STRICT_ANSI__ || defined __cplusplus -#if !defined(_MSC_VER) -#define NAN (0.0F/0.0F) -#define HUGE_VALF (1.0F/0.0F) -#define HUGE_VALL (1.0L/0.0L) -#define INFINITY (1.0F/0.0F) -#endif +#if __MINGW_GNUC_PREREQ(3, 3) +#define HUGE_VALF __builtin_huge_valf() +#define HUGE_VALL __builtin_huge_vall() +#define INFINITY __builtin_inf() +#define NAN __builtin_nan("") +#elif !defined(_MSC_VER) +extern const float __INFF; +#define HUGE_VALF __INFF +extern const long double __INFL; +#define HUGE_VALL __INFL +#define INFINITY HUGE_VALF +extern const double __QNAN; +#define NAN __QNAN +#endif /* __MINGW_GNUC_PREREQ(3, 3) */ #define FP_NAN 0x0100 @@ -320,6 +328,9 @@ __CRT_INLINE int isinf (double d) { /* 7.12.3.4 */ /* We don't need to worry about truncation here: A NaN stays a NaN. */ + extern int __cdecl __isnan (double) __MINGW_ATTRIB_PURE; + extern int __cdecl __isnanf (float) __MINGW_ATTRIB_PURE; + extern int __cdecl __isnanl (long double) __MINGW_ATTRIB_PURE; __CRT_INLINE int __cdecl __isnan (double _x) { @@ -354,6 +365,9 @@ __CRT_INLINE int isinf (double d) { #define isnormal(x) (fpclassify(x) == FP_NORMAL) /* 7.12.3.6 The signbit macro */ + extern int __cdecl __signbit (double) __MINGW_ATTRIB_PURE; + extern int __cdecl __signbitf (float) __MINGW_ATTRIB_PURE; + extern int __cdecl __signbitl (long double) __MINGW_ATTRIB_PURE; __CRT_INLINE int __cdecl __signbit (double x) { unsigned short stw; __fxam(x, stw); diff --git a/reactos/include/psdk/commctrl.h b/reactos/include/psdk/commctrl.h index 24b04fdb2e7..59b02d0ca74 100644 --- a/reactos/include/psdk/commctrl.h +++ b/reactos/include/psdk/commctrl.h @@ -2809,7 +2809,7 @@ typedef struct tagTVKEYDOWN (LPARAM)(HTREEITEM)(hitem)) #define TreeView_EnsureVisible(hwnd, hitem) \ - (BOOL)SNDMSG((hwnd), TVM_ENSUREVISIBLE, 0, (LPARAM)(UINT)(hitem)) + (BOOL)SNDMSG((hwnd), TVM_ENSUREVISIBLE, 0, (LPARAM)(hitem)) #define TreeView_SortChildrenCB(hwnd, psort, recurse) \ (BOOL)SNDMSG((hwnd), TVM_SORTCHILDRENCB, (WPARAM)recurse, \ diff --git a/reactos/ntoskrnl/mm/amd64/init.c b/reactos/ntoskrnl/mm/amd64/init.c index 59a1fcb9b20..4555478b39c 100644 --- a/reactos/ntoskrnl/mm/amd64/init.c +++ b/reactos/ntoskrnl/mm/amd64/init.c @@ -16,7 +16,7 @@ #include "../ARM3/miarm.h" -#ifndef KDBG +#ifdef _WINKD_ extern PMMPTE MmDebugPte; #endif @@ -448,7 +448,7 @@ MiInitializePageTable() MmFirstReservedMappingPte->u.Hard.PageFrameNumber = MI_HYPERSPACE_PTES; MmLastReservedMappingPte = MiAddressToPte((PVOID)MI_MAPPING_RANGE_END); -#ifndef KDBG +#ifdef _WINKD_ /* Setup debug mapping PTE */ MmDebugPte = MxGetPte(MI_DEBUG_MAPPING); #endif diff --git a/reactos/tools/rbuild/rbuild.vcproj b/reactos/tools/rbuild/rbuild.vcproj index 0d91687b4c3..b207f17118a 100644 --- a/reactos/tools/rbuild/rbuild.vcproj +++ b/reactos/tools/rbuild/rbuild.vcproj @@ -137,6 +137,7 @@ BasicRuntimeChecks="3" RuntimeLibrary="1" DefaultCharIsUnsigned="true" + OpenMP="true" UsePrecompiledHeader="0" PrecompiledHeaderFile=".\Debug/rbuild.pch" AssemblerListingLocation=".\Debug/" From 2ce78971092274730d6e856f447ce810567614e8 Mon Sep 17 00:00:00 2001 From: Samuel Serapion Date: Mon, 25 Jan 2010 11:10:06 +0000 Subject: [PATCH 052/121] [MSVCRT] - Convert to spec, based on wine. Tons of stuff missing but compiles, links and runs abiword and firefox. - Export floating point functions. [CRT] - Implement acosf, asinf, atanf, atan2f, copysign, copysignf, exp, expf, fabs, fmod, fmodf, hypotf, ceil, ceilf, cos, cosf, floor, floorf, log, log10, sin, sinf, tan, tanf, ldexp, log10f, logb, logbf, logf, modff, nextafter, nextafterf, powf, sinhf, sqrt, sqrtf, tanf, tanhf in amd64 compatible way. Made possible by mingw-w64. svn path=/branches/ros-amd64-bringup/; revision=45245 --- reactos/dll/win32/gdiplus/gdiplus.rbuild | 3 - reactos/dll/win32/msvcrt/dllmain.c | 2 +- reactos/dll/win32/msvcrt/msvcrt.rbuild | 2 +- reactos/include/crt/math.h | 25 +---- reactos/lib/sdk/crt/crt.rbuild | 104 +++++++++--------- reactos/lib/sdk/crt/except/cppexcept.c | 8 ++ reactos/lib/sdk/crt/except/i386/unwind.c | 18 +-- reactos/lib/sdk/crt/libcntpr.rbuild | 41 +++---- reactos/lib/sdk/crt/math/acosf.c | 29 +++++ reactos/lib/sdk/crt/math/amd64/atan.S | 21 ---- reactos/lib/sdk/crt/math/amd64/atan2.S | 21 ---- reactos/lib/sdk/crt/math/amd64/ceil.S | 21 ---- reactos/lib/sdk/crt/math/amd64/ceilf.S | 40 ------- reactos/lib/sdk/crt/math/amd64/cos.S | 21 ---- reactos/lib/sdk/crt/math/amd64/exp.S | 21 ---- reactos/lib/sdk/crt/math/amd64/fabs.S | 21 ---- reactos/lib/sdk/crt/math/amd64/floor.S | 21 ---- reactos/lib/sdk/crt/math/amd64/floorf.S | 40 ------- reactos/lib/sdk/crt/math/amd64/fmod.S | 21 ---- reactos/lib/sdk/crt/math/amd64/fmodf.S | 21 ---- reactos/lib/sdk/crt/math/amd64/ldexp.S | 21 ---- reactos/lib/sdk/crt/math/amd64/log.S | 21 ---- reactos/lib/sdk/crt/math/amd64/log10.S | 21 ---- reactos/lib/sdk/crt/math/amd64/sin.S | 21 ---- reactos/lib/sdk/crt/math/amd64/sqrt.S | 21 ---- reactos/lib/sdk/crt/math/amd64/sqrtf.S | 20 ---- reactos/lib/sdk/crt/math/amd64/tan.S | 21 ---- reactos/lib/sdk/crt/math/asinf.c | 27 +++++ reactos/lib/sdk/crt/math/atan.c | 18 +++ reactos/lib/sdk/crt/math/atan2.c | 16 +++ reactos/lib/sdk/crt/math/atan2f.c | 22 ++++ reactos/lib/sdk/crt/math/atanf.c | 23 ++++ reactos/lib/sdk/crt/math/copysign.c | 21 ++++ reactos/lib/sdk/crt/math/copysignf.c | 19 ++++ reactos/lib/sdk/crt/math/cosf.c | 11 ++ reactos/lib/sdk/crt/math/exp.c | 55 +++++++++ reactos/lib/sdk/crt/math/expf.c | 10 ++ reactos/lib/sdk/crt/math/fabs.c | 16 +++ reactos/lib/sdk/crt/math/fmod.c | 21 ++++ reactos/lib/sdk/crt/math/fmodf.c | 29 +++++ reactos/lib/sdk/crt/math/hypotf.c | 12 ++ reactos/lib/sdk/crt/math/i386/atan_asm.s | 50 --------- reactos/lib/sdk/crt/math/i386/ceil.S | 54 +++++++++ reactos/lib/sdk/crt/math/i386/ceil_asm.s | 57 ---------- reactos/lib/sdk/crt/math/i386/ceilf.S | 54 +++++++++ reactos/lib/sdk/crt/math/i386/cos.S | 53 +++++++++ reactos/lib/sdk/crt/math/i386/cos_asm.s | 49 --------- reactos/lib/sdk/crt/math/i386/fabs_asm.s | 49 --------- reactos/lib/sdk/crt/math/i386/floor.S | 62 +++++++++++ reactos/lib/sdk/crt/math/i386/floorf.S | 61 ++++++++++ reactos/lib/sdk/crt/math/i386/log.S | 65 +++++++++++ reactos/lib/sdk/crt/math/i386/log10.S | 92 ++++++++++++++++ reactos/lib/sdk/crt/math/i386/log10_asm.s | 27 ----- reactos/lib/sdk/crt/math/i386/log_asm.s | 51 --------- reactos/lib/sdk/crt/math/i386/sin.S | 57 ++++++++++ reactos/lib/sdk/crt/math/i386/sin_asm.s | 49 --------- reactos/lib/sdk/crt/math/i386/sqrt_asm.s | 49 --------- reactos/lib/sdk/crt/math/i386/tan.S | 61 ++++++++++ reactos/lib/sdk/crt/math/i386/tan_asm.s | 52 --------- reactos/lib/sdk/crt/math/j0_y0.c | 30 ----- reactos/lib/sdk/crt/math/j1_y1.c | 30 ----- reactos/lib/sdk/crt/math/jn_yn.c | 30 ----- .../lib/sdk/crt/math/{pow_asm.c => ldexp.c} | 23 +++- reactos/lib/sdk/crt/math/log10f.c | 11 ++ reactos/lib/sdk/crt/math/logb.c | 23 ++++ reactos/lib/sdk/crt/math/logbf.c | 23 ++++ reactos/lib/sdk/crt/math/logf.c | 11 ++ reactos/lib/sdk/crt/math/modff.c | 27 +++++ reactos/lib/sdk/crt/math/nextafter.c | 66 +++++++++++ reactos/lib/sdk/crt/math/nextafterf.c | 32 ++++++ reactos/lib/sdk/crt/math/powf.c | 10 ++ reactos/lib/sdk/crt/math/sinf.c | 11 ++ reactos/lib/sdk/crt/math/sinhf.c | 10 ++ reactos/lib/sdk/crt/math/sqrt.c | 25 +++++ reactos/lib/sdk/crt/math/sqrtf.c | 23 ++++ reactos/lib/sdk/crt/math/tanf.c | 11 ++ reactos/lib/sdk/crt/math/tanhf.c | 10 ++ reactos/lib/sdk/crt/stdio/file.c | 11 +- reactos/lib/sdk/crt/string/ctype.c | 8 +- reactos/lib/sdk/crt/time/asctime.c | 1 + reactos/lib/sdk/crt/time/ctime.c | 2 +- reactos/lib/sdk/crt/time/utime.c | 2 +- 82 files changed, 1290 insertions(+), 1079 deletions(-) create mode 100644 reactos/lib/sdk/crt/math/acosf.c delete mode 100644 reactos/lib/sdk/crt/math/amd64/atan.S delete mode 100644 reactos/lib/sdk/crt/math/amd64/atan2.S delete mode 100644 reactos/lib/sdk/crt/math/amd64/ceil.S delete mode 100644 reactos/lib/sdk/crt/math/amd64/ceilf.S delete mode 100644 reactos/lib/sdk/crt/math/amd64/cos.S delete mode 100644 reactos/lib/sdk/crt/math/amd64/exp.S delete mode 100644 reactos/lib/sdk/crt/math/amd64/fabs.S delete mode 100644 reactos/lib/sdk/crt/math/amd64/floor.S delete mode 100644 reactos/lib/sdk/crt/math/amd64/floorf.S delete mode 100644 reactos/lib/sdk/crt/math/amd64/fmod.S delete mode 100644 reactos/lib/sdk/crt/math/amd64/fmodf.S delete mode 100644 reactos/lib/sdk/crt/math/amd64/ldexp.S delete mode 100644 reactos/lib/sdk/crt/math/amd64/log.S delete mode 100644 reactos/lib/sdk/crt/math/amd64/log10.S delete mode 100644 reactos/lib/sdk/crt/math/amd64/sin.S delete mode 100644 reactos/lib/sdk/crt/math/amd64/sqrt.S delete mode 100644 reactos/lib/sdk/crt/math/amd64/sqrtf.S delete mode 100644 reactos/lib/sdk/crt/math/amd64/tan.S create mode 100644 reactos/lib/sdk/crt/math/asinf.c create mode 100644 reactos/lib/sdk/crt/math/atan.c create mode 100644 reactos/lib/sdk/crt/math/atan2.c create mode 100644 reactos/lib/sdk/crt/math/atan2f.c create mode 100644 reactos/lib/sdk/crt/math/atanf.c create mode 100644 reactos/lib/sdk/crt/math/copysign.c create mode 100644 reactos/lib/sdk/crt/math/copysignf.c create mode 100644 reactos/lib/sdk/crt/math/cosf.c create mode 100644 reactos/lib/sdk/crt/math/exp.c create mode 100644 reactos/lib/sdk/crt/math/expf.c create mode 100644 reactos/lib/sdk/crt/math/fabs.c create mode 100644 reactos/lib/sdk/crt/math/fmod.c create mode 100644 reactos/lib/sdk/crt/math/fmodf.c create mode 100644 reactos/lib/sdk/crt/math/hypotf.c delete mode 100644 reactos/lib/sdk/crt/math/i386/atan_asm.s create mode 100644 reactos/lib/sdk/crt/math/i386/ceil.S delete mode 100644 reactos/lib/sdk/crt/math/i386/ceil_asm.s create mode 100644 reactos/lib/sdk/crt/math/i386/ceilf.S create mode 100644 reactos/lib/sdk/crt/math/i386/cos.S delete mode 100644 reactos/lib/sdk/crt/math/i386/cos_asm.s delete mode 100644 reactos/lib/sdk/crt/math/i386/fabs_asm.s create mode 100644 reactos/lib/sdk/crt/math/i386/floor.S create mode 100644 reactos/lib/sdk/crt/math/i386/floorf.S create mode 100644 reactos/lib/sdk/crt/math/i386/log.S create mode 100644 reactos/lib/sdk/crt/math/i386/log10.S delete mode 100644 reactos/lib/sdk/crt/math/i386/log10_asm.s delete mode 100644 reactos/lib/sdk/crt/math/i386/log_asm.s create mode 100644 reactos/lib/sdk/crt/math/i386/sin.S delete mode 100644 reactos/lib/sdk/crt/math/i386/sin_asm.s delete mode 100644 reactos/lib/sdk/crt/math/i386/sqrt_asm.s create mode 100644 reactos/lib/sdk/crt/math/i386/tan.S delete mode 100644 reactos/lib/sdk/crt/math/i386/tan_asm.s delete mode 100644 reactos/lib/sdk/crt/math/j0_y0.c delete mode 100644 reactos/lib/sdk/crt/math/j1_y1.c delete mode 100644 reactos/lib/sdk/crt/math/jn_yn.c rename reactos/lib/sdk/crt/math/{pow_asm.c => ldexp.c} (73%) create mode 100644 reactos/lib/sdk/crt/math/log10f.c create mode 100644 reactos/lib/sdk/crt/math/logb.c create mode 100644 reactos/lib/sdk/crt/math/logbf.c create mode 100644 reactos/lib/sdk/crt/math/logf.c create mode 100644 reactos/lib/sdk/crt/math/modff.c create mode 100644 reactos/lib/sdk/crt/math/nextafter.c create mode 100644 reactos/lib/sdk/crt/math/nextafterf.c create mode 100644 reactos/lib/sdk/crt/math/powf.c create mode 100644 reactos/lib/sdk/crt/math/sinf.c create mode 100644 reactos/lib/sdk/crt/math/sinhf.c create mode 100644 reactos/lib/sdk/crt/math/sqrt.c create mode 100644 reactos/lib/sdk/crt/math/sqrtf.c create mode 100644 reactos/lib/sdk/crt/math/tanf.c create mode 100644 reactos/lib/sdk/crt/math/tanhf.c diff --git a/reactos/dll/win32/gdiplus/gdiplus.rbuild b/reactos/dll/win32/gdiplus/gdiplus.rbuild index cc07c8c5d35..d6daa4d7b7b 100644 --- a/reactos/dll/win32/gdiplus/gdiplus.rbuild +++ b/reactos/dll/win32/gdiplus/gdiplus.rbuild @@ -28,8 +28,5 @@ gdi32 windowscodecs ntdll - - crt - diff --git a/reactos/dll/win32/msvcrt/dllmain.c b/reactos/dll/win32/msvcrt/dllmain.c index 99822fc46a7..caca7c1fb86 100644 --- a/reactos/dll/win32/msvcrt/dllmain.c +++ b/reactos/dll/win32/msvcrt/dllmain.c @@ -19,7 +19,7 @@ * $Date$ * */ - +#define _CRTBLD #include #include #include diff --git a/reactos/dll/win32/msvcrt/msvcrt.rbuild b/reactos/dll/win32/msvcrt/msvcrt.rbuild index 3e4a5d93f2a..59ec3a1da0e 100644 --- a/reactos/dll/win32/msvcrt/msvcrt.rbuild +++ b/reactos/dll/win32/msvcrt/msvcrt.rbuild @@ -1,5 +1,5 @@ - + . include diff --git a/reactos/include/crt/math.h b/reactos/include/crt/math.h index a5761848f57..670b607d329 100644 --- a/reactos/include/crt/math.h +++ b/reactos/include/crt/math.h @@ -187,31 +187,8 @@ extern "C" { return (_Df); } -#if !defined(__x86_64) && !defined(_M_AMD64) - __CRT_INLINE float acosf(float _X) { return ((float)acos((double)_X)); } - __CRT_INLINE float asinf(float _X) { return ((float)asin((double)_X)); } - __CRT_INLINE float atanf(float _X) { return ((float)atan((double)_X)); } - __CRT_INLINE float atan2f(float _X,float _Y) { return ((float)atan2((double)_X,(double)_Y)); } - __CRT_INLINE float ceilf(float _X) { return ((float)ceil((double)_X)); } - __CRT_INLINE float cosf(float _X) { return ((float)cos((double)_X)); } - __CRT_INLINE float coshf(float _X) { return ((float)cosh((double)_X)); } - __CRT_INLINE float expf(float _X) { return ((float)exp((double)_X)); } + //missing in msvcrt but needed by gdiplus __CRT_INLINE float floorf(float _X) { return ((float)floor((double)_X)); } - __CRT_INLINE float fmodf(float _X,float _Y) { return ((float)fmod((double)_X,(double)_Y)); } - __CRT_INLINE float logf(float _X) { return ((float)log((double)_X)); } - __CRT_INLINE float log10f(float _X) { return ((float)log10((double)_X)); } - __CRT_INLINE float modff(float _X,float *_Y) { - double _Di,_Df = modf((double)_X,&_Di); - *_Y = (float)_Di; - return ((float)_Df); - } - __CRT_INLINE float powf(float _X,float _Y) { return ((float)pow((double)_X,(double)_Y)); } - __CRT_INLINE float sinf(float _X) { return ((float)sin((double)_X)); } - __CRT_INLINE float sinhf(float _X) { return ((float)sinh((double)_X)); } - __CRT_INLINE float sqrtf(float _X) { return ((float)sqrt((double)_X)); } - __CRT_INLINE float tanf(float _X) { return ((float)tan((double)_X)); } - __CRT_INLINE float tanhf(float _X) { return ((float)tanh((double)_X)); } -#endif #ifndef NO_OLDNAMES #define DOMAIN _DOMAIN diff --git a/reactos/lib/sdk/crt/crt.rbuild b/reactos/lib/sdk/crt/crt.rbuild index 6e7ed0d16ff..2539f2b7079 100644 --- a/reactos/lib/sdk/crt/crt.rbuild +++ b/reactos/lib/sdk/crt/crt.rbuild @@ -22,6 +22,7 @@ extern + @@ -106,87 +107,84 @@ locale.c + abs.c acos.c + acosf.c adjust.c asin.c + asinf.c + atan.c + atan2.c + atan2f.c + atanf.c cabs.c + copysign.c + copysignf.c + cosf.c cosh.c div.c + exp.c + expf.c + fabs.c fdivbug.c + fmod.c + fmodf.c frexp.c huge_val.c hypot.c + hypotf.c + ldexp.c ldiv.c + log10f.c + logb.c + logbf.c + logf.c modf.c + modff.c + nextafter.c + nextafterf.c + powf.c rand.c s_modf.c + sinf.c sinh.c + sinhf.c + sqrt.c + sqrtf.c + tanf.c tanh.c - pow_asm.c - + tanhf.c - alldiv_asm.s - alldvrm_asm.s - allmul_asm.s - allrem_asm.s - allshl_asm.s - allshr_asm.s - atan_asm.s - aulldiv_asm.s - aulldvrm_asm.s - aullrem_asm.s - aullshr_asm.s - ceil_asm.s - cos_asm.s - fabs_asm.s - floor_asm.s - ftol_asm.s - log_asm.s - log10_asm.s - pow_asm.s - sin_asm.s - sqrt_asm.s - tan_asm.s - - atan2.c - ci.c - exp.c - fmod.c - ldexp.c - - - - - - - alldiv.S - atan.S - atan2.S ceil.S ceilf.S cos.S - exp.S - fabs.S floor.S floorf.S - fmod.S - fmodf.S - ldexp.S log.S log10.S - pow.S sin.S - sqrt.S - sqrtf.S tan.S + ci.c + pow_asm.s + + + + + ceil.S + ceilf.S + cos.S + floor.S + floorf.S + log.S + log10.S + sin.S + tan.S + ci.c + + + pow.S - - stubs.c diff --git a/reactos/lib/sdk/crt/except/cppexcept.c b/reactos/lib/sdk/crt/except/cppexcept.c index 34d14a7c15d..ba75ce87daf 100644 --- a/reactos/lib/sdk/crt/except/cppexcept.c +++ b/reactos/lib/sdk/crt/except/cppexcept.c @@ -491,3 +491,11 @@ unsigned int CDECL __CxxQueryExceptionSize(void) { return sizeof(cxx_exception_type); } + +/****************************************************************** + * MSVCRT___uncaught_exception + */ +BOOL CDECL __uncaught_exception(void) +{ + return FALSE; +} diff --git a/reactos/lib/sdk/crt/except/i386/unwind.c b/reactos/lib/sdk/crt/except/i386/unwind.c index bb2c302a3b6..3807174270e 100644 --- a/reactos/lib/sdk/crt/except/i386/unwind.c +++ b/reactos/lib/sdk/crt/except/i386/unwind.c @@ -1,6 +1,7 @@ #define WIN32_NO_STATUS #include #include +#include #define NTOS_MODE_USER #include #include @@ -25,23 +26,6 @@ typedef struct _MSVCRT_EXCEPTION_FRAME PEXCEPTION_POINTERS xpointers; } MSVCRT_EXCEPTION_FRAME; - -typedef struct __JUMP_BUFFER -{ - unsigned long Ebp; - unsigned long Ebx; - unsigned long Edi; - unsigned long Esi; - unsigned long Esp; - unsigned long Eip; - unsigned long Registration; - unsigned long TryLevel; - /* Start of new struct members */ - unsigned long Cookie; - unsigned long UnwindFunc; - unsigned long UnwindData[6]; -} _JUMP_BUFFER; - void _local_unwind2(MSVCRT_EXCEPTION_FRAME *RegistrationFrame, LONG TryLevel); diff --git a/reactos/lib/sdk/crt/libcntpr.rbuild b/reactos/lib/sdk/crt/libcntpr.rbuild index 5011ae07ce9..7bb24736d16 100644 --- a/reactos/lib/sdk/crt/libcntpr.rbuild +++ b/reactos/lib/sdk/crt/libcntpr.rbuild @@ -6,6 +6,7 @@ + "extern __attribute__ ((dllexport))" @@ -40,48 +41,42 @@ allrem_asm.s allshl_asm.s allshr_asm.s - atan_asm.s aulldiv_asm.s aulldvrm_asm.s aullrem_asm.s aullshr_asm.s ci.c - ceil_asm.s - cos_asm.s - fabs_asm.s floor_asm.s ftol_asm.s - log_asm.s pow_asm.s - sin_asm.s - sqrt_asm.s - tan_asm.s - - - - - alldiv.S - atan.S - atan2.S ceil.S cos.S - exp.S - fabs.S - floor.S - fmod.S - ldexp.S log.S log10.S - pow.S sin.S - sqrt.S tan.S + + + ceil.S + cos.S + log.S + log10.S + sin.S + tan.S + + + alldiv.S + + abs.c + atan.c + fabs.c div.c labs.c rand_nt.c + sqrt.c @@ -207,4 +202,4 @@ wcsspn.c wcsstr.c - + \ No newline at end of file diff --git a/reactos/lib/sdk/crt/math/acosf.c b/reactos/lib/sdk/crt/math/acosf.c new file mode 100644 index 00000000000..316479220f6 --- /dev/null +++ b/reactos/lib/sdk/crt/math/acosf.c @@ -0,0 +1,29 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#include + +float +acosf (float x) +{ + float res = 0.0F; +#ifdef __GNUC__ + /* acosl = atanl (sqrtl(1 - x^2) / x) */ + asm ( "fld %%st\n\t" + "fmul %%st(0)\n\t" /* x^2 */ + "fld1\n\t" + "fsubp\n\t" /* 1 - x^2 */ + "fsqrt\n\t" /* sqrtl (1 - x^2) */ + "fxch %%st(1)\n\t" + "fpatan" + : "=t" (res) : "0" (x) : "st(1)"); +#endif + return res; +} diff --git a/reactos/lib/sdk/crt/math/amd64/atan.S b/reactos/lib/sdk/crt/math/amd64/atan.S deleted file mode 100644 index ef871c356fb..00000000000 --- a/reactos/lib/sdk/crt/math/amd64/atan.S +++ /dev/null @@ -1,21 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * PURPOSE: Implementation of atan - * FILE: lib/sdk/crt/math/amd64/atan.S - * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) - */ - -/* INCLUDES ******************************************************************/ - -#include -#include - -.intel_syntax noprefix - - -.proc atan - UNIMPLEMENTED atan - ret - -.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/atan2.S b/reactos/lib/sdk/crt/math/amd64/atan2.S deleted file mode 100644 index 15ac4b8422c..00000000000 --- a/reactos/lib/sdk/crt/math/amd64/atan2.S +++ /dev/null @@ -1,21 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * PURPOSE: Implementation of atan2 - * FILE: lib/sdk/crt/math/amd64/atan2.S - * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) - */ - -/* INCLUDES ******************************************************************/ - -#include -#include - -.intel_syntax noprefix - - -.proc atan2 - UNIMPLEMENTED atan2 - ret - -.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/ceil.S b/reactos/lib/sdk/crt/math/amd64/ceil.S deleted file mode 100644 index 1948364686e..00000000000 --- a/reactos/lib/sdk/crt/math/amd64/ceil.S +++ /dev/null @@ -1,21 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * PURPOSE: Implementation of ceil - * FILE: lib/sdk/crt/math/amd64/ceil.S - * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) - */ - -/* INCLUDES ******************************************************************/ - -#include -#include - -.intel_syntax noprefix - - -.proc ceil - UNIMPLEMENTED ceil - ret - -.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/ceilf.S b/reactos/lib/sdk/crt/math/amd64/ceilf.S deleted file mode 100644 index 9c887798d71..00000000000 --- a/reactos/lib/sdk/crt/math/amd64/ceilf.S +++ /dev/null @@ -1,40 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * PURPOSE: Implementation of tan - * FILE: lib/sdk/crt/math/amd64/ceilf.S - * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) - */ - -/* INCLUDES ******************************************************************/ - -#include -#include - -.intel_syntax noprefix - - -.proc ceilf - /* Put parameter on the stack */ - movss [rsp - 0x10], xmm0 - fld dword ptr [rsp] - - /* Change fpu control word to round up */ - fstcw [rsp - 0x10] - mov eax, [rsp - 0x10] - or eax, 0x00800 - and eax, 0x0fbff - mov [rsp - 0x08], eax - fldcw [rsp - 0x08] - - /* Round to integer */ - frndint - - /* Restore fpu control word */ - fldcw [rsp - 0x10] - - fstp dword ptr [rsp - 0x10] - movss xmm0, [rsp - 0x10] - ret - -.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/cos.S b/reactos/lib/sdk/crt/math/amd64/cos.S deleted file mode 100644 index 5d2e0fe787b..00000000000 --- a/reactos/lib/sdk/crt/math/amd64/cos.S +++ /dev/null @@ -1,21 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * PURPOSE: Implementation of cos - * FILE: lib/sdk/crt/math/amd64/cos.S - * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) - */ - -/* INCLUDES ******************************************************************/ - -#include -#include - -.intel_syntax noprefix - - -.proc cos - UNIMPLEMENTED cos - ret - -.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/exp.S b/reactos/lib/sdk/crt/math/amd64/exp.S deleted file mode 100644 index bd4a8d0e69b..00000000000 --- a/reactos/lib/sdk/crt/math/amd64/exp.S +++ /dev/null @@ -1,21 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * PURPOSE: Implementation of exp - * FILE: lib/sdk/crt/math/amd64/exp.S - * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) - */ - -/* INCLUDES ******************************************************************/ - -#include -#include - -.intel_syntax noprefix - - -.proc exp - UNIMPLEMENTED exp - ret - -.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/fabs.S b/reactos/lib/sdk/crt/math/amd64/fabs.S deleted file mode 100644 index 2282de1488d..00000000000 --- a/reactos/lib/sdk/crt/math/amd64/fabs.S +++ /dev/null @@ -1,21 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * PURPOSE: Implementation of fabs - * FILE: lib/sdk/crt/math/amd64/fabs.S - * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) - */ - -/* INCLUDES ******************************************************************/ - -#include -#include - -.intel_syntax noprefix - - -.proc fabs - UNIMPLEMENTED fabs - ret - -.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/floor.S b/reactos/lib/sdk/crt/math/amd64/floor.S deleted file mode 100644 index a08e4fc84ed..00000000000 --- a/reactos/lib/sdk/crt/math/amd64/floor.S +++ /dev/null @@ -1,21 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * PURPOSE: Implementation of floor - * FILE: lib/sdk/crt/math/amd64/floor.S - * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) - */ - -/* INCLUDES ******************************************************************/ - -#include -#include - -.intel_syntax noprefix - - -.proc floor - UNIMPLEMENTED floor - ret - -.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/floorf.S b/reactos/lib/sdk/crt/math/amd64/floorf.S deleted file mode 100644 index 900f8e62024..00000000000 --- a/reactos/lib/sdk/crt/math/amd64/floorf.S +++ /dev/null @@ -1,40 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * PURPOSE: Implementation of tan - * FILE: lib/sdk/crt/math/amd64/floorf.S - * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) - */ - -/* INCLUDES ******************************************************************/ - -#include -#include - -.intel_syntax noprefix - - -.proc floorf - /* Put parameter on the stack */ - movss [rsp - 0x10], xmm0 - fld dword ptr [rsp] - - /* Change fpu control word to round down */ - fstcw [rsp - 0x10] - mov eax, [rsp - 0x10] - or eax, 0x00400 - and eax, 0x0f7ff - mov [rsp - 0x08], eax - fldcw [rsp - 0x08] - - /* Round to integer */ - frndint - - /* Restore fpu control word */ - fldcw [rsp - 0x10] - - fstp dword ptr [rsp - 0x10] - movss xmm0, [rsp - 0x10] - ret - -.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/fmod.S b/reactos/lib/sdk/crt/math/amd64/fmod.S deleted file mode 100644 index 1ad26d93511..00000000000 --- a/reactos/lib/sdk/crt/math/amd64/fmod.S +++ /dev/null @@ -1,21 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * PURPOSE: Implementation of fmod - * FILE: lib/sdk/crt/math/amd64/fmod.S - * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) - */ - -/* INCLUDES ******************************************************************/ - -#include -#include - -.intel_syntax noprefix - - -.proc fmod - UNIMPLEMENTED fmod - ret - -.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/fmodf.S b/reactos/lib/sdk/crt/math/amd64/fmodf.S deleted file mode 100644 index 966ceffec40..00000000000 --- a/reactos/lib/sdk/crt/math/amd64/fmodf.S +++ /dev/null @@ -1,21 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * PURPOSE: Implementation of fmodf - * FILE: lib/sdk/crt/math/amd64/fmodf.S - * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) - */ - -/* INCLUDES ******************************************************************/ - -#include -#include - -.intel_syntax noprefix - - -.proc fmodf - UNIMPLEMENTED fmodf - ret - -.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/ldexp.S b/reactos/lib/sdk/crt/math/amd64/ldexp.S deleted file mode 100644 index 9d4649c66eb..00000000000 --- a/reactos/lib/sdk/crt/math/amd64/ldexp.S +++ /dev/null @@ -1,21 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * PURPOSE: Implementation of ldexp - * FILE: lib/sdk/crt/math/amd64/ldexp.S - * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) - */ - -/* INCLUDES ******************************************************************/ - -#include -#include - -.intel_syntax noprefix - - -.proc ldexp - UNIMPLEMENTED ldexp - ret - -.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/log.S b/reactos/lib/sdk/crt/math/amd64/log.S deleted file mode 100644 index f4190d3e286..00000000000 --- a/reactos/lib/sdk/crt/math/amd64/log.S +++ /dev/null @@ -1,21 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * PURPOSE: Implementation of log - * FILE: lib/sdk/crt/math/amd64/log.S - * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) - */ - -/* INCLUDES ******************************************************************/ - -#include -#include - -.intel_syntax noprefix - - -.proc log - UNIMPLEMENTED log - ret - -.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/log10.S b/reactos/lib/sdk/crt/math/amd64/log10.S deleted file mode 100644 index 1f9c77aaf5f..00000000000 --- a/reactos/lib/sdk/crt/math/amd64/log10.S +++ /dev/null @@ -1,21 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * PURPOSE: Implementation of log10 - * FILE: lib/sdk/crt/math/amd64/log10.S - * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) - */ - -/* INCLUDES ******************************************************************/ - -#include -#include - -.intel_syntax noprefix - - -.proc log10 - UNIMPLEMENTED log10 - ret - -.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/sin.S b/reactos/lib/sdk/crt/math/amd64/sin.S deleted file mode 100644 index 683eedcd647..00000000000 --- a/reactos/lib/sdk/crt/math/amd64/sin.S +++ /dev/null @@ -1,21 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * PURPOSE: Implementation of sin - * FILE: lib/sdk/crt/math/amd64/sin.S - * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) - */ - -/* INCLUDES ******************************************************************/ - -#include -#include - -.intel_syntax noprefix - - -.proc sin - UNIMPLEMENTED sin - ret - -.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/sqrt.S b/reactos/lib/sdk/crt/math/amd64/sqrt.S deleted file mode 100644 index 48db2fde91e..00000000000 --- a/reactos/lib/sdk/crt/math/amd64/sqrt.S +++ /dev/null @@ -1,21 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * PURPOSE: Implementation of sqrt - * FILE: lib/sdk/crt/math/amd64/sqrt.S - * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) - */ - -/* INCLUDES ******************************************************************/ - -#include -#include - -.intel_syntax noprefix - - -.proc sqrt - UNIMPLEMENTED sqrt - ret - -.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/sqrtf.S b/reactos/lib/sdk/crt/math/amd64/sqrtf.S deleted file mode 100644 index 50ea81033ac..00000000000 --- a/reactos/lib/sdk/crt/math/amd64/sqrtf.S +++ /dev/null @@ -1,20 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * PURPOSE: Implementation of tan - * FILE: lib/sdk/crt/math/amd64/sqrtf.S - * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) - */ - -/* INCLUDES ******************************************************************/ - -#include -#include - -.intel_syntax noprefix - - -.proc sqrtf - sqrtss xmm0, xmm0 - ret -.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/tan.S b/reactos/lib/sdk/crt/math/amd64/tan.S deleted file mode 100644 index 225c3acc66a..00000000000 --- a/reactos/lib/sdk/crt/math/amd64/tan.S +++ /dev/null @@ -1,21 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * PURPOSE: Implementation of tan - * FILE: lib/sdk/crt/math/amd64/tan.S - * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) - */ - -/* INCLUDES ******************************************************************/ - -#include -#include - -.intel_syntax noprefix - - -.proc tan - UNIMPLEMENTED tan - ret - -.endproc diff --git a/reactos/lib/sdk/crt/math/asinf.c b/reactos/lib/sdk/crt/math/asinf.c new file mode 100644 index 00000000000..a7a6cd79675 --- /dev/null +++ b/reactos/lib/sdk/crt/math/asinf.c @@ -0,0 +1,27 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +/* asin = atan (x / sqrt(1 - x^2)) */ + +float asinf (float x); + +float asinf (float x) +{ + float res = 0.0F; + + asm ( "fld %%st\n\t" + "fmul %%st(0)\n\t" /* x^2 */ + "fld1\n\t" + "fsubp\n\t" /* 1 - x^2 */ + "fsqrt\n\t" /* sqrt (1 - x^2) */ + "fpatan" + : "=t" (res) : "0" (x) : "st(1)"); + return res; +} diff --git a/reactos/lib/sdk/crt/math/atan.c b/reactos/lib/sdk/crt/math/atan.c new file mode 100644 index 00000000000..83ac89e7466 --- /dev/null +++ b/reactos/lib/sdk/crt/math/atan.c @@ -0,0 +1,18 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ +#include + +double +atan (double x) +{ + double res = 0.0L; +#if defined(__GNUC__) + asm ("fld1\n\t" + "fpatan" + : "=t" (res) : "0" (x)); +#endif + return res; +} diff --git a/reactos/lib/sdk/crt/math/atan2.c b/reactos/lib/sdk/crt/math/atan2.c new file mode 100644 index 00000000000..bb2f5f3518b --- /dev/null +++ b/reactos/lib/sdk/crt/math/atan2.c @@ -0,0 +1,16 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ +#include + +double +atan2 (double y, double x) +{ + long double res = 0.0L; +#ifdef __GNUC__ + asm ("fpatan" : "=t" (res) : "u" (y), "0" (x) : "st(1)"); +#endif + return res; +} diff --git a/reactos/lib/sdk/crt/math/atan2f.c b/reactos/lib/sdk/crt/math/atan2f.c new file mode 100644 index 00000000000..f7d1d943c66 --- /dev/null +++ b/reactos/lib/sdk/crt/math/atan2f.c @@ -0,0 +1,22 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ +/* + * Written by J.T. Conklin . + * Public domain. + * + */ + +#include + +float +atan2f (float y, float x) +{ + float res = 0.0F; +#ifdef __GNUC__ + asm ("fpatan" : "=t" (res) : "u" (y), "0" (x) : "st(1)"); +#endif + return res; +} diff --git a/reactos/lib/sdk/crt/math/atanf.c b/reactos/lib/sdk/crt/math/atanf.c new file mode 100644 index 00000000000..06868695a9d --- /dev/null +++ b/reactos/lib/sdk/crt/math/atanf.c @@ -0,0 +1,23 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ +/* + * Written by J.T. Conklin . + * Public domain. + * + */ + +#include + +float +atanf (float x) +{ + float res = 0.0F; +#ifdef __GNUC__ + asm ("fld1\n\t" + "fpatan" : "=t" (res) : "0" (x)); +#endif + return res; +} diff --git a/reactos/lib/sdk/crt/math/copysign.c b/reactos/lib/sdk/crt/math/copysign.c new file mode 100644 index 00000000000..d81c2de6063 --- /dev/null +++ b/reactos/lib/sdk/crt/math/copysign.c @@ -0,0 +1,21 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ +#include + +typedef union U +{ + unsigned int u[2]; + double d; +} U; + +double copysign(double x, double y) +{ + U h,j; + h.d = x; + j.d = y; + h.u[1] = (h.u[1] & 0x7fffffff) | (j.u[1] & 0x80000000); + return h.d; +} diff --git a/reactos/lib/sdk/crt/math/copysignf.c b/reactos/lib/sdk/crt/math/copysignf.c new file mode 100644 index 00000000000..ca3cc399ea3 --- /dev/null +++ b/reactos/lib/sdk/crt/math/copysignf.c @@ -0,0 +1,19 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ +#include + +typedef union ui_f { + float f; + unsigned int ui; +} ui_f; + +float copysignf(float aX, float aY) +{ + ui_f x,y; + x.f=aX; y.f=aY; + x.ui= (x.ui & 0x7fffffff) | (y.ui & 0x80000000); + return x.f; +} diff --git a/reactos/lib/sdk/crt/math/cosf.c b/reactos/lib/sdk/crt/math/cosf.c new file mode 100644 index 00000000000..d2329c7f254 --- /dev/null +++ b/reactos/lib/sdk/crt/math/cosf.c @@ -0,0 +1,11 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ +#include + +float cosf(float _X) +{ + return ((float)cos((double)_X)); +} diff --git a/reactos/lib/sdk/crt/math/exp.c b/reactos/lib/sdk/crt/math/exp.c new file mode 100644 index 00000000000..0759a28c10c --- /dev/null +++ b/reactos/lib/sdk/crt/math/exp.c @@ -0,0 +1,55 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ +#include +#define MAXLOG 7.09782712893383996843E2 +#define MINLOG -7.08396418532264106224E2 + +static double c0 = 1.44268798828125L; +static double c1 = 7.05260771340735992468e-6L; + +static double +__exp(double x) +{ + double res = 0.0L; +#ifdef __GNUC__ + asm ("fldl2e\n\t" /* 1 log2(e) */ + "fmul %%st(1),%%st\n\t" /* 1 x log2(e) */ + "frndint\n\t" /* 1 i */ + "fld %%st(1)\n\t" /* 2 x */ + "frndint\n\t" /* 2 xi */ + "fld %%st(1)\n\t" /* 3 i */ + "fldt %2\n\t" /* 4 c0 */ + "fld %%st(2)\n\t" /* 5 xi */ + "fmul %%st(1),%%st\n\t" /* 5 c0 xi */ + "fsubp %%st,%%st(2)\n\t" /* 4 f = c0 xi - i */ + "fld %%st(4)\n\t" /* 5 x */ + "fsub %%st(3),%%st\n\t" /* 5 xf = x - xi */ + "fmulp %%st,%%st(1)\n\t" /* 4 c0 xf */ + "faddp %%st,%%st(1)\n\t" /* 3 f = f + c0 xf */ + "fldt %3\n\t" /* 4 */ + "fmul %%st(4),%%st\n\t" /* 4 c1 * x */ + "faddp %%st,%%st(1)\n\t" /* 3 f = f + c1 * x */ + "f2xm1\n\t" /* 3 2^(fract(x * log2(e))) - 1 */ + "fld1\n\t" /* 4 1.0 */ + "faddp\n\t" /* 3 2^(fract(x * log2(e))) */ + "fstp %%st(1)\n\t" /* 2 */ + "fscale\n\t" /* 2 scale factor is st(1); e^x */ + "fstp %%st(1)\n\t" /* 1 */ + "fstp %%st(1)\n\t" /* 0 */ + : "=t" (res) : "0" (x), "m" (c0), "m" (c1) : "ax", "dx"); +#endif + return res; +} + +double exp (double x) +{ + if (x > MAXLOG) + return INFINITY; + else if (x < MINLOG) + return 0.0L; + else + return __exp (x); +} diff --git a/reactos/lib/sdk/crt/math/expf.c b/reactos/lib/sdk/crt/math/expf.c new file mode 100644 index 00000000000..fa09f2523f5 --- /dev/null +++ b/reactos/lib/sdk/crt/math/expf.c @@ -0,0 +1,10 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ +#include +float expf (float x) +{ + return (float) exp (x); +} diff --git a/reactos/lib/sdk/crt/math/fabs.c b/reactos/lib/sdk/crt/math/fabs.c new file mode 100644 index 00000000000..9be2ae8b743 --- /dev/null +++ b/reactos/lib/sdk/crt/math/fabs.c @@ -0,0 +1,16 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ +#include + +double +fabs (double x) +{ + double res = 0.0; +#ifdef __GNUC__ + asm ("fabs;" : "=t" (res) : "0" (x)); +#endif + return res; +} diff --git a/reactos/lib/sdk/crt/math/fmod.c b/reactos/lib/sdk/crt/math/fmod.c new file mode 100644 index 00000000000..de48b81c504 --- /dev/null +++ b/reactos/lib/sdk/crt/math/fmod.c @@ -0,0 +1,21 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ +#include + +double +fmod (double x, double y) +{ + double res = 0.0L; +#ifdef __GNUC__ + asm ("1:\tfprem\n\t" + "fstsw %%ax\n\t" + "sahf\n\t" + "jp 1b\n\t" + "fstp %%st(1)" + : "=t" (res) : "0" (x), "u" (y) : "ax", "st(1)"); +#endif + return res; +} diff --git a/reactos/lib/sdk/crt/math/fmodf.c b/reactos/lib/sdk/crt/math/fmodf.c new file mode 100644 index 00000000000..aa7bca4a0a7 --- /dev/null +++ b/reactos/lib/sdk/crt/math/fmodf.c @@ -0,0 +1,29 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ +/* + * Written by J.T. Conklin . + * Public domain. + * + * Adapted for float type by Danny Smith + * . + */ + +#include + +float +fmodf (float x, float y) +{ + float res = 0.0F; +#ifdef __GNUC__ + asm ("1:\tfprem\n\t" + "fstsw %%ax\n\t" + "sahf\n\t" + "jp 1b\n\t" + "fstp %%st(1)" + : "=t" (res) : "0" (x), "u" (y) : "ax", "st(1)"); +#endif + return res; +} diff --git a/reactos/lib/sdk/crt/math/hypotf.c b/reactos/lib/sdk/crt/math/hypotf.c new file mode 100644 index 00000000000..34367fc4df1 --- /dev/null +++ b/reactos/lib/sdk/crt/math/hypotf.c @@ -0,0 +1,12 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ +#include + +float hypotf (float x, float y) +{ + return (float) _hypot (x, y); +} + diff --git a/reactos/lib/sdk/crt/math/i386/atan_asm.s b/reactos/lib/sdk/crt/math/i386/atan_asm.s deleted file mode 100644 index 37554c940ae..00000000000 --- a/reactos/lib/sdk/crt/math/i386/atan_asm.s +++ /dev/null @@ -1,50 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * PURPOSE: Run-Time Library - * FILE: lib/rtl/i386/atan.S - * PROGRAMER: Alex Ionescu (alex@relsoft.net) - * - * Copyright (C) 2002 Michael Ringgaard. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES// LOSS OF USE, DATA, OR PROFITS// OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -.globl _atan - -.intel_syntax noprefix - -/* FUNCTIONS ***************************************************************/ - -_atan: - push ebp - mov ebp,esp - fld qword ptr [ebp+8] // Load real from stack - fld1 // Load constant 1 - fpatan // Take the arctangent - pop ebp - ret diff --git a/reactos/lib/sdk/crt/math/i386/ceil.S b/reactos/lib/sdk/crt/math/i386/ceil.S new file mode 100644 index 00000000000..198a4a28d3f --- /dev/null +++ b/reactos/lib/sdk/crt/math/i386/ceil.S @@ -0,0 +1,54 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + + .file "ceil.S" + .text +#ifdef _WIN64 + .align 8 +#else + .align 4 +#endif +.globl _ceil + .def _ceil; .scl 2; .type 32; .endef +_ceil: +#ifdef _WIN64 + fldt (%rdx) + subq $24,%rsp + + fstcw 8(%rsp) /* store fpu control word */ + + /* We use here %edx although only the low 1 bits are defined. + But none of the operations should care and they are faster + than the 16 bit operations. */ + movl $0x0800,%edx /* round towards +oo */ + orl 8(%rsp),%edx + andl $0xfbff,%edx + movl %edx,(%rsp) + fldcw (%rsp) /* load modified control word */ + + frndint /* round */ + + fldcw 8(%rsp) /* restore original control word */ + + addq $24,%rsp + movq %rcx,%rax + movq $0,8(%rcx) + fstpt (%rcx) + ret +#else + fldt 4(%esp) + subl $8,%esp + fstcw 4(%esp) + movl $0x0800,%edx + orl 4(%esp),%edx + andl $0xfbff,%edx + movl %edx,(%esp) + fldcw (%esp) + frndint + fldcw 4(%esp) + addl $8,%esp + ret +#endif diff --git a/reactos/lib/sdk/crt/math/i386/ceil_asm.s b/reactos/lib/sdk/crt/math/i386/ceil_asm.s deleted file mode 100644 index aad69114f5a..00000000000 --- a/reactos/lib/sdk/crt/math/i386/ceil_asm.s +++ /dev/null @@ -1,57 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * PURPOSE: Run-Time Library - * FILE: lib/rtl/i386/ceil.S - * PROGRAMER: Alex Ionescu (alex@relsoft.net) - * - * Copyright (C) 2002 Michael Ringgaard. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES// LOSS OF USE, DATA, OR PROFITS// OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -.globl _ceil - -.intel_syntax noprefix - -/* FUNCTIONS ***************************************************************/ - -_ceil: - push ebp - mov ebp,esp - sub esp,4 // Allocate temporary space - fld qword ptr [ebp+8] // Load real from stack - fstcw [ebp-2] // Save control word - fclex // Clear exceptions - mov word ptr [ebp-4],0xb63 // Rounding control word - fldcw [ebp-4] // Set new rounding control - frndint // Round to integer - fclex // Clear exceptions - fldcw [ebp-2] // Restore control word - mov esp,ebp // Deallocate temporary space - pop ebp - ret diff --git a/reactos/lib/sdk/crt/math/i386/ceilf.S b/reactos/lib/sdk/crt/math/i386/ceilf.S new file mode 100644 index 00000000000..6321ca0c558 --- /dev/null +++ b/reactos/lib/sdk/crt/math/i386/ceilf.S @@ -0,0 +1,54 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + + .file "ceilf.S" + .text + .align 4 +.globl _ceilf + .def _ceilf; .scl 2; .type 32; .endef +_ceilf: +#ifdef _WIN64 + subq $24,%rsp + movss %xmm0,8(%rsp) + flds 8(%rsp) + + fstcw 4(%rsp) /* store fpu control word */ + + movl $0x0800,%edx /* round towards +oo */ + orl 4(%rsp),%edx + andl $0xfbff,%edx + movl %edx,(%rsp) + fldcw (%rsp) /* load modified control word */ + + frndint /* round */ + + fldcw 4(%rsp) /* restore original control word */ + fstps 8(%rsp) + movss 8(%rsp),%xmm0 + addq $24,%rsp + ret +#else + flds 4(%esp) + subl $8,%esp + + fstcw 4(%esp) /* store fpu control word */ + + /* We use here %edx although only the low 1 bits are defined. + But none of the operations should care and they are faster + than the 16 bit operations. */ + movl $0x0800,%edx /* round towards +oo */ + orl 4(%esp),%edx + andl $0xfbff,%edx + movl %edx,(%esp) + fldcw (%esp) /* load modified control word */ + + frndint /* round */ + + fldcw 4(%esp) /* restore original control word */ + + addl $8,%esp + ret +#endif diff --git a/reactos/lib/sdk/crt/math/i386/cos.S b/reactos/lib/sdk/crt/math/i386/cos.S new file mode 100644 index 00000000000..8dc0854958f --- /dev/null +++ b/reactos/lib/sdk/crt/math/i386/cos.S @@ -0,0 +1,53 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + .file "cos.S" + .text +#ifdef _WIN64 + .align 8 +#else + .align 4 +#endif +.globl _cos + .def _cos; .scl 2; .type 32; .endef +_cos: +#ifdef _WIN64 + fldt (%rdx) + fcos + fnstsw %ax + testl $0x400,%eax + jz 1f + fldpi + fadd %st(0) + fxch %st(1) +2: fprem1 + fnstsw %ax + testl $0x400,%eax + jnz 2b + fstp %st(1) + fcos +1: movq %rcx,%rax + movq $0,8(%rcx) + fstpt (%rcx) + ret +#else + fldt 4(%esp) + fcos + fnstsw %ax + testl $0x400,%eax + jnz 1f + ret +1: fldpi + fadd %st(0) + fxch %st(1) +2: fprem1 + fnstsw %ax + testl $0x400,%eax + jnz 2b + fstp %st(1) + fcos + ret +#endif + diff --git a/reactos/lib/sdk/crt/math/i386/cos_asm.s b/reactos/lib/sdk/crt/math/i386/cos_asm.s deleted file mode 100644 index b1c6ada49b2..00000000000 --- a/reactos/lib/sdk/crt/math/i386/cos_asm.s +++ /dev/null @@ -1,49 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * PURPOSE: Run-Time Library - * FILE: lib/rtl/i386/cos.S - * PROGRAMER: Alex Ionescu (alex@relsoft.net) - * - * Copyright (C) 2002 Michael Ringgaard. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES// LOSS OF USE, DATA, OR PROFITS// OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -.globl _cos - -.intel_syntax noprefix - -/* FUNCTIONS ***************************************************************/ - -_cos: - push ebp - mov ebp,esp // Point to the stack frame - fld qword ptr [ebp+8] // Load real from stack - fcos // Take the cosine - pop ebp - ret diff --git a/reactos/lib/sdk/crt/math/i386/fabs_asm.s b/reactos/lib/sdk/crt/math/i386/fabs_asm.s deleted file mode 100644 index 5c6ce9214ef..00000000000 --- a/reactos/lib/sdk/crt/math/i386/fabs_asm.s +++ /dev/null @@ -1,49 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * PURPOSE: Run-Time Library - * FILE: lib/rtl/i386/fabs.S - * PROGRAMER: Alex Ionescu (alex@relsoft.net) - * - * Copyright (C) 2002 Michael Ringgaard. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES// LOSS OF USE, DATA, OR PROFITS// OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -.globl _fabs - -.intel_syntax noprefix - -/* FUNCTIONS ***************************************************************/ - -_fabs: - push ebp - mov ebp,esp - fld qword ptr [ebp+8] // Load real from stack - fabs // Take the absolute value - pop ebp - ret diff --git a/reactos/lib/sdk/crt/math/i386/floor.S b/reactos/lib/sdk/crt/math/i386/floor.S new file mode 100644 index 00000000000..8f6ccff190b --- /dev/null +++ b/reactos/lib/sdk/crt/math/i386/floor.S @@ -0,0 +1,62 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + + .file "floor.S" + .text +#ifdef _WIN64 + .align 8 +#else + .align 4 +#endif +.globl floor + .def floor; .scl 2; .type 32; .endef +floor: +#ifdef _WIN64 + fldt (%rdx) + subq $24,%rsp + + fstcw 8(%rsp) /* store fpu control word */ + + /* We use here %edx although only the low 1 bits are defined. + But none of the operations should care and they are faster + than the 16 bit operations. */ + movl $0x400,%edx /* round towards -oo */ + orl 8(%rsp),%edx + andl $0xf7ff,%edx + movl %edx,(%rsp) + fldcw (%rsp) /* load modified control word */ + + frndint /* round */ + + fldcw 8(%rsp) /* restore original control word */ + + addq $24,%rsp + movq %rcx,%rax + movq $0,8(%rcx) + fstpt (%rcx) + ret +#else + fldt 4(%esp) + subl $8,%esp + + fstcw 4(%esp) /* store fpu control word */ + + /* We use here %edx although only the low 1 bits are defined. + But none of the operations should care and they are faster + than the 16 bit operations. */ + movl $0x400,%edx /* round towards -oo */ + orl 4(%esp),%edx + andl $0xf7ff,%edx + movl %edx,(%esp) + fldcw (%esp) /* load modified control word */ + + frndint /* round */ + + fldcw 4(%esp) /* restore original control word */ + + addl $8,%esp + ret +#endif diff --git a/reactos/lib/sdk/crt/math/i386/floorf.S b/reactos/lib/sdk/crt/math/i386/floorf.S new file mode 100644 index 00000000000..5c83106b6e3 --- /dev/null +++ b/reactos/lib/sdk/crt/math/i386/floorf.S @@ -0,0 +1,61 @@ +/* + * Written by J.T. Conklin . + * Public domain. + * + * Changes for long double by Ulrich Drepper + * + * Removed header file dependency for use in libmingwex.a by + * Danny Smith + */ + .file "floorf.S" + .text +#ifdef _WIN64 + .align 8 +#else + .align 4 +#endif +.globl _floorf + .def _floorf; .scl 2; .type 32; .endef +_floorf: +#ifdef _WIN64 + subq $24,%rsp + movss %xmm0,8(%rsp) + flds 8(%rsp) + + fstcw 4(%rsp) /* store fpu control word */ + movl $0x400,%edx /* round towards -oo */ + orl 4(%rsp),%edx + andl $0xf7ff,%edx + movl %edx,(%rsp) + fldcw (%rsp) /* load modified control word */ + + frndint /* round */ + + fldcw 4(%rsp) /* restore original control word */ + + fstps 8(%rsp) + movss 8(%rsp),%xmm0 + addq $24,%rsp + ret +#else + flds 4(%esp) + subl $8,%esp + + fstcw 4(%esp) /* store fpu control word */ + + /* We use here %edx although only the low 1 bits are defined. + But none of the operations should care and they are faster + than the 16 bit operations. */ + movl $0x400,%edx /* round towards -oo */ + orl 4(%esp),%edx + andl $0xf7ff,%edx + movl %edx,(%esp) + fldcw (%esp) /* load modified control word */ + + frndint /* round */ + + fldcw 4(%esp) /* restore original control word */ + + addl $8,%esp + ret +#endif diff --git a/reactos/lib/sdk/crt/math/i386/log.S b/reactos/lib/sdk/crt/math/i386/log.S new file mode 100644 index 00000000000..30129c78798 --- /dev/null +++ b/reactos/lib/sdk/crt/math/i386/log.S @@ -0,0 +1,65 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + + .file "log.S" + .text +#ifdef _WIN64 + .align 8 +#else + .align 4 +#endif +one: .double 1.0 + /* It is not important that this constant is precise. It is only + a value which is known to be on the safe side for using the + fyl2xp1 instruction. */ +limit: .double 0.29 + +.globl _log + .def _log; .scl 2; .type 32; .endef +_log: +#ifdef _WIN64 + fldln2 // log(2) + fldt (%rdx) // x : log(2) + fld %st // x : x : log(2) + fsubl one // x-1 : x : log(2) + fld %st // x-1 : x-1 : x : log(2) + fabs // |x-1| : x-1 : x : log(2) + fcompl limit // x-1 : x : log(2) + fnstsw // x-1 : x : log(2) + andb $0x45, %ah + jz 2f + fstp %st(1) // x-1 : log(2) + fyl2xp1 // log(x) + movq %rcx,%rax + movq $0,8(%rcx) + fstpt (%rcx) + ret + +2: fstp %st(0) // x : log(2) + fyl2x // log(x) + movq %rcx,%rax + movq $0,8(%rcx) + fstpt (%rcx) + ret +#else + fldln2 // log(2) + fldt 4(%esp) // x : log(2) + fld %st // x : x : log(2) + fsubl one // x-1 : x : log(2) + fld %st // x-1 : x-1 : x : log(2) + fabs // |x-1| : x-1 : x : log(2) + fcompl limit // x-1 : x : log(2) + fnstsw // x-1 : x : log(2) + andb $0x45, %ah + jz 2f + fstp %st(1) // x-1 : log(2) + fyl2xp1 // log(x) + ret + +2: fstp %st(0) // x : log(2) + fyl2x // log(x) + ret +#endif diff --git a/reactos/lib/sdk/crt/math/i386/log10.S b/reactos/lib/sdk/crt/math/i386/log10.S new file mode 100644 index 00000000000..45712a68fa6 --- /dev/null +++ b/reactos/lib/sdk/crt/math/i386/log10.S @@ -0,0 +1,92 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + + .file "log10.S" + .text +#ifdef _WIN64 + .align 8 +#else + .align 4 +#endif +one: .double 1.0 + /* It is not important that this constant is precise. It is only + a value which is known to be on the safe side for using the + fyl2xp1 instruction. */ +limit: .double 0.29 + + .text +#ifdef _WIN64 + .align 8 +#else + .align 4 +#endif +.globl _log10 + .def _log10; .scl 2; .type 32; .endef +_log10: +#ifdef _WIN64 + fldlg2 // log10(2) + fldt (%rdx) // x : log10(2) + fxam + fnstsw + fld %st // x : x : log10(2) + sahf + jc 3f // in case x is NaN or Inf +4: fsubl one // x-1 : x : log10(2) + fld %st // x-1 : x-1 : x : log10(2) + fabs // |x-1| : x-1 : x : log10(2) + fcompl limit // x-1 : x : log10(2) + fnstsw // x-1 : x : log10(2) + andb $0x45, %ah + jz 2f + fstp %st(1) // x-1 : log10(2) + fyl2xp1 // log10(x) + movq %rcx,%rax + movq $0,8(%rcx) + fstpt (%rcx) + ret + +2: fstp %st(0) // x : log10(2) + fyl2x // log10(x) + movq %rcx,%rax + movq $0,8(%rcx) + fstpt (%rcx) + ret + +3: jp 4b // in case x is Inf + fstp %st(1) + fstp %st(1) + movq %rcx,%rax + movq $0,8(%rcx) + fstpt (%rcx) + ret +#else + fldlg2 // log10(2) + fldt 4(%esp) // x : log10(2) + fxam + fnstsw + fld %st // x : x : log10(2) + sahf + jc 3f // in case x is NaN or Inf +4: fsubl one // x-1 : x : log10(2) + fld %st // x-1 : x-1 : x : log10(2) + fabs // |x-1| : x-1 : x : log10(2) + fcompl limit // x-1 : x : log10(2) + fnstsw // x-1 : x : log10(2) + andb $0x45, %ah + jz 2f + fstp %st(1) // x-1 : log10(2) + fyl2xp1 // log10(x) + ret + +2: fstp %st(0) // x : log10(2) + fyl2x // log10(x) + ret + +3: jp 4b // in case x is Inf + fstp %st(1) + fstp %st(1) + ret +#endif diff --git a/reactos/lib/sdk/crt/math/i386/log10_asm.s b/reactos/lib/sdk/crt/math/i386/log10_asm.s deleted file mode 100644 index 71731816429..00000000000 --- a/reactos/lib/sdk/crt/math/i386/log10_asm.s +++ /dev/null @@ -1,27 +0,0 @@ - - /* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * PURPOSE: - * FILE: - * PROGRAMER: Magnus Olsen (magnus@greatlord.com) - * - */ - -.globl _log10 - -.intel_syntax noprefix - -/* FUNCTIONS ***************************************************************/ - -_log10: - - push ebp - mov ebp,esp - fld qword ptr [ebp+8] // Load real from stack - fldlg2 // Load log base 10 of 2 - fxch st(1) // Exchange st, st(1) - fyl2x // Compute the log base 10(x) - pop ebp - ret - diff --git a/reactos/lib/sdk/crt/math/i386/log_asm.s b/reactos/lib/sdk/crt/math/i386/log_asm.s deleted file mode 100644 index 0d98279ed41..00000000000 --- a/reactos/lib/sdk/crt/math/i386/log_asm.s +++ /dev/null @@ -1,51 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * PURPOSE: Run-Time Library - * FILE: lib/rtl/i386/log.S - * PROGRAMER: Alex Ionescu (alex@relsoft.net) - * - * Copyright (C) 2002 Michael Ringgaard. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES// LOSS OF USE, DATA, OR PROFITS// OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -.globl _log - -.intel_syntax noprefix - -/* FUNCTIONS ***************************************************************/ - -_log: - push ebp - mov ebp,esp - fld qword ptr [ebp+8] // Load real from stack - fldln2 // Load log base e of 2 - fxch st(1) // Exchange st, st(1) - fyl2x // Compute the natural log(x) - pop ebp - ret diff --git a/reactos/lib/sdk/crt/math/i386/sin.S b/reactos/lib/sdk/crt/math/i386/sin.S new file mode 100644 index 00000000000..13407dfbb61 --- /dev/null +++ b/reactos/lib/sdk/crt/math/i386/sin.S @@ -0,0 +1,57 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + + .file "sin.S" + .text +#ifdef _WIN64 + .align 8 +#else + .align 4 +#endif +.globl _sin + .def _sin; .scl 2; .type 32; .endef +_sin: +#ifdef _WIN64 + fldt (%rdx) + fsin + fnstsw %ax + testl $0x400,%eax + jnz 1f + movq %rcx,%rax + movq $0,8(%rcx) + fstpt (%rcx) + ret +1: fldpi + fadd %st(0) + fxch %st(1) +2: fprem1 + fnstsw %ax + testl $0x400,%eax + jnz 2b + fstp %st(1) + fsin + movq %rcx,%rax + movq $0,8(%rcx) + fstpt (%rcx) + ret +#else + fldt 4(%esp) + fsin + fnstsw %ax + testl $0x400,%eax + jnz 1f + ret +1: fldpi + fadd %st(0) + fxch %st(1) +2: fprem1 + fnstsw %ax + testl $0x400,%eax + jnz 2b + fstp %st(1) + fsin + ret +#endif diff --git a/reactos/lib/sdk/crt/math/i386/sin_asm.s b/reactos/lib/sdk/crt/math/i386/sin_asm.s deleted file mode 100644 index 39791a3e989..00000000000 --- a/reactos/lib/sdk/crt/math/i386/sin_asm.s +++ /dev/null @@ -1,49 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * PURPOSE: Run-Time Library - * FILE: lib/rtl/i386/sin.S - * PROGRAMER: Alex Ionescu (alex@relsoft.net) - * - * Copyright (C) 2002 Michael Ringgaard. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES// LOSS OF USE, DATA, OR PROFITS// OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -.globl _sin - -.intel_syntax noprefix - -/* FUNCTIONS ***************************************************************/ - -_sin: - push ebp // Save register bp - mov ebp,esp // Point to the stack frame - fld qword ptr [ebp+8] // Load real from stack - fsin // Take the sine - pop ebp // Restore register bp - ret diff --git a/reactos/lib/sdk/crt/math/i386/sqrt_asm.s b/reactos/lib/sdk/crt/math/i386/sqrt_asm.s deleted file mode 100644 index c953a0350e9..00000000000 --- a/reactos/lib/sdk/crt/math/i386/sqrt_asm.s +++ /dev/null @@ -1,49 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * PURPOSE: Run-Time Library - * FILE: lib/rtl/i386/sqrt.S - * PROGRAMER: Alex Ionescu (alex@relsoft.net) - * - * Copyright (C) 2002 Michael Ringgaard. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES// LOSS OF USE, DATA, OR PROFITS// OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -.globl _sqrt - -.intel_syntax noprefix - -/* FUNCTIONS ***************************************************************/ - -_sqrt: - push ebp - mov ebp,esp - fld qword ptr [ebp+8] // Load real from stack - fsqrt // Take the square root - pop ebp - ret diff --git a/reactos/lib/sdk/crt/math/i386/tan.S b/reactos/lib/sdk/crt/math/i386/tan.S new file mode 100644 index 00000000000..c8c76d52d4b --- /dev/null +++ b/reactos/lib/sdk/crt/math/i386/tan.S @@ -0,0 +1,61 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + + .file "tan.S" + .text +#ifdef _WIN64 + .align 8 +#else + .align 4 +#endif +.globl _tan + .def _tan; .scl 2; .type 32; .endef +_tan: +#ifdef _WIN64 + fldt (%rdx) + fptan + fnstsw %ax + testl $0x400,%eax + jnz 1f + fstp %st(0) + movq %rcx,%rax + movq $0,8(%rcx) + fstpt (%rcx) + ret +1: fldpi + fadd %st(0) + fxch %st(1) +2: fprem1 + fstsw %ax + testl $0x400,%eax + jnz 2b + fstp %st(1) + fptan + fstp %st(0) + movq %rcx,%rax + movq $0,8(%rcx) + fstpt (%rcx) + ret +#else + fldt 4(%esp) + fptan + fnstsw %ax + testl $0x400,%eax + jnz 1f + fstp %st(0) + ret +1: fldpi + fadd %st(0) + fxch %st(1) +2: fprem1 + fstsw %ax + testl $0x400,%eax + jnz 2b + fstp %st(1) + fptan + fstp %st(0) + ret +#endif diff --git a/reactos/lib/sdk/crt/math/i386/tan_asm.s b/reactos/lib/sdk/crt/math/i386/tan_asm.s deleted file mode 100644 index 34af2614f89..00000000000 --- a/reactos/lib/sdk/crt/math/i386/tan_asm.s +++ /dev/null @@ -1,52 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * PURPOSE: Run-Time Library - * FILE: lib/rtl/i386/tan.S - * PROGRAMER: Alex Ionescu (alex@relsoft.net) - * - * Copyright (C) 2002 Michael Ringgaard. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES// LOSS OF USE, DATA, OR PROFITS// OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -.globl _tan - -.intel_syntax noprefix - -/* FUNCTIONS ***************************************************************/ - -_tan: - push ebp - mov ebp,esp - sub esp,4 // Allocate temporary space - fld qword ptr [ebp+8] // Load real from stack - fptan // Take the tangent - fstp dword ptr [ebp-4] // Throw away the constant 1 - mov esp,ebp // Deallocate temporary space - pop ebp - ret diff --git a/reactos/lib/sdk/crt/math/j0_y0.c b/reactos/lib/sdk/crt/math/j0_y0.c deleted file mode 100644 index d6787deeb28..00000000000 --- a/reactos/lib/sdk/crt/math/j0_y0.c +++ /dev/null @@ -1,30 +0,0 @@ -#include - -typedef int fpclass_t; -fpclass_t _fpclass(double __d); -int *_errno(void); - -/* - * @unimplemented - */ -double _j0(double num) -{ - /* FIXME: errno handling */ - return j0(num); -} - -/* - * @implemented - */ -double _y0(double num) -{ - double retval; - if (!isfinite(num)) *_errno() = EDOM; - retval = y0(num); - if (_fpclass(retval) == _FPCLASS_NINF) - { - *_errno() = EDOM; - retval = sqrt(-1); - } - return retval; -} diff --git a/reactos/lib/sdk/crt/math/j1_y1.c b/reactos/lib/sdk/crt/math/j1_y1.c deleted file mode 100644 index b050889d7ae..00000000000 --- a/reactos/lib/sdk/crt/math/j1_y1.c +++ /dev/null @@ -1,30 +0,0 @@ -#include - -typedef int fpclass_t; -fpclass_t _fpclass(double __d); -int *_errno(void); - -/* - * @unimplemented - */ -double _j1(double num) -{ - /* FIXME: errno handling */ - return j1(num); -} - -/* - * @implemented - */ -double _y1(double num) -{ - double retval; - if (!isfinite(num)) *_errno() = EDOM; - retval = y1(num); - if (_fpclass(retval) == _FPCLASS_NINF) - { - *_errno() = EDOM; - retval = sqrt(-1); - } - return retval; -} diff --git a/reactos/lib/sdk/crt/math/jn_yn.c b/reactos/lib/sdk/crt/math/jn_yn.c deleted file mode 100644 index 34f2dee7a4d..00000000000 --- a/reactos/lib/sdk/crt/math/jn_yn.c +++ /dev/null @@ -1,30 +0,0 @@ -#include - -typedef int fpclass_t; -fpclass_t _fpclass(double __d); -int *_errno(void); - -/* - * @unimplemented - */ -double _jn(int n, double num) -{ - /* FIXME: errno handling */ - return jn(n, num); -} - -/* - * @implemented - */ -double _yn(int order, double num) -{ - double retval; - if (!isfinite(num)) *_errno() = EDOM; - retval = yn(order,num); - if (_fpclass(retval) == _FPCLASS_NINF) - { - *_errno() = EDOM; - retval = sqrt(-1); - } - return retval; -} diff --git a/reactos/lib/sdk/crt/math/pow_asm.c b/reactos/lib/sdk/crt/math/ldexp.c similarity index 73% rename from reactos/lib/sdk/crt/math/pow_asm.c rename to reactos/lib/sdk/crt/math/ldexp.c index 2b5877b67f6..b240275ef95 100644 --- a/reactos/lib/sdk/crt/math/pow_asm.c +++ b/reactos/lib/sdk/crt/math/ldexp.c @@ -21,11 +21,24 @@ #include -/* - * @implemented - */ +double ldexp (double __x, int __y); -long double powl (long double __x,long double __y) +double ldexp (double __x, int __y) { - return pow(__x,__y/2)*pow(__x,__y/2); + register double __val; +#ifdef __GNUC__ + __asm __volatile__ + ("fscale" + : "=t" (__val) : "0" (__x), "u" ((double) __y)); +#else + register double __dy = (double)__y; + __asm + { + fld __dy + fld __x + fscale + fstp __val + } +#endif /*__GNUC__*/ + return __val; } diff --git a/reactos/lib/sdk/crt/math/log10f.c b/reactos/lib/sdk/crt/math/log10f.c new file mode 100644 index 00000000000..2a295a4582b --- /dev/null +++ b/reactos/lib/sdk/crt/math/log10f.c @@ -0,0 +1,11 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ +#include + +float log10f(float _X) +{ + return ((float)log10((double)_X)); +} diff --git a/reactos/lib/sdk/crt/math/logb.c b/reactos/lib/sdk/crt/math/logb.c new file mode 100644 index 00000000000..640572651de --- /dev/null +++ b/reactos/lib/sdk/crt/math/logb.c @@ -0,0 +1,23 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ +/* + * Written by J.T. Conklin . + * Changes for long double by Ulrich Drepper + * Public domain. + */ + +#include + +double +logb (double x) +{ + double res = 0.0; +#ifdef __GNUC__ + asm ("fxtract\n\t" + "fstp %%st" : "=t" (res) : "0" (x)); +#endif + return res; +} diff --git a/reactos/lib/sdk/crt/math/logbf.c b/reactos/lib/sdk/crt/math/logbf.c new file mode 100644 index 00000000000..384533f946e --- /dev/null +++ b/reactos/lib/sdk/crt/math/logbf.c @@ -0,0 +1,23 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ +/* + * Written by J.T. Conklin . + * Changes for long double by Ulrich Drepper + * Public domain. + */ + +#include + +float +logbf (float x) +{ + float res = 0.0F; +#ifndef __GNUC__ + asm ("fxtract\n\t" + "fstp %%st" : "=t" (res) : "0" (x)); +#endif + return res; +} diff --git a/reactos/lib/sdk/crt/math/logf.c b/reactos/lib/sdk/crt/math/logf.c new file mode 100644 index 00000000000..0da1dae909f --- /dev/null +++ b/reactos/lib/sdk/crt/math/logf.c @@ -0,0 +1,11 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ +#include + +float logf(float _X) +{ + return ((float)log((double)_X)); +} diff --git a/reactos/lib/sdk/crt/math/modff.c b/reactos/lib/sdk/crt/math/modff.c new file mode 100644 index 00000000000..53b65ebe5b5 --- /dev/null +++ b/reactos/lib/sdk/crt/math/modff.c @@ -0,0 +1,27 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ +#include +#include +#include +#define FE_ROUNDING_MASK \ + (FE_TONEAREST | FE_DOWNWARD | FE_UPWARD | FE_TOWARDZERO) + +float +modff (float value, float* iptr) +{ + float int_part = 0.0F; + unsigned short saved_cw; + unsigned short tmp_cw; + /* truncate */ + asm ("fnstcw %0;" : "=m" (saved_cw)); /* save control word */ + tmp_cw = (saved_cw & ~FE_ROUNDING_MASK) | FE_TOWARDZERO; + asm ("fldcw %0;" : : "m" (tmp_cw)); + asm ("frndint;" : "=t" (int_part) : "0" (value)); /* round */ + asm ("fldcw %0;" : : "m" (saved_cw)); /* restore saved cw */ + if (iptr) + *iptr = int_part; + return (isinf (value) ? 0.0F : value - int_part); +} diff --git a/reactos/lib/sdk/crt/math/nextafter.c b/reactos/lib/sdk/crt/math/nextafter.c new file mode 100644 index 00000000000..7aca439b407 --- /dev/null +++ b/reactos/lib/sdk/crt/math/nextafter.c @@ -0,0 +1,66 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ +/* + nextafterl.c + Contributed by Danny Smith + No copyright claimed, absolutely no warranties. + + 2005-05-09 +*/ + +#include + +double +nextafter (double x, double y) +{ + union { + long double ld; + struct { + /* packed attribute is unnecessary on x86/x64 for these three variables */ + unsigned long long mantissa; + unsigned short expn; + unsigned short pad; + } parts; + } u; + + /* The normal bit is explicit for long doubles, unlike + float and double. */ + static const unsigned long long normal_bit = 0x8000000000000000ull; + u.ld = 0.0L; + if (isnan (y) || isnan (x)) + return x + y; + + if (x == y ) + /* nextafter (0.0, -O.0) should return -0.0. */ + return y; + + u.ld = x; + if (x == 0.0L) + { + u.parts.mantissa = 1ull; + return y > 0.0L ? u.ld : -u.ld; + } + + if (((x > 0.0L) ^ (y > x)) == 0) + { + u.parts.mantissa++; + if ((u.parts.mantissa & ~normal_bit) == 0ull) + u.parts.expn++; + } + else + { + if ((u.parts.mantissa & ~normal_bit) == 0ull) + u.parts.expn--; + u.parts.mantissa--; + } + + /* If we have updated the expn of a normal number, + or moved from denormal to normal, [re]set the normal bit. */ + if (u.parts.expn & 0x7fff) + u.parts.mantissa |= normal_bit; + + return u.ld; +} diff --git a/reactos/lib/sdk/crt/math/nextafterf.c b/reactos/lib/sdk/crt/math/nextafterf.c new file mode 100644 index 00000000000..ac12ac4ed7f --- /dev/null +++ b/reactos/lib/sdk/crt/math/nextafterf.c @@ -0,0 +1,32 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ +#include + +float +nextafterf (float x, float y) +{ + union + { + float f; + unsigned int i; + } u; + if (isnan (y) || isnan (x)) + return x + y; + if (x == y ) + /* nextafter (0.0, -O.0) should return -0.0. */ + return y; + u.f = x; + if (x == 0.0F) + { + u.i = 1; + return y > 0.0F ? u.f : -u.f; + } + if (((x > 0.0F) ^ (y > x)) == 0) + u.i++; + else + u.i--; + return u.f; +} diff --git a/reactos/lib/sdk/crt/math/powf.c b/reactos/lib/sdk/crt/math/powf.c new file mode 100644 index 00000000000..046ba12f837 --- /dev/null +++ b/reactos/lib/sdk/crt/math/powf.c @@ -0,0 +1,10 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ +#include +float powf (float x, float y) +{ + return (float) pow ((double) x, (double) y); +} diff --git a/reactos/lib/sdk/crt/math/sinf.c b/reactos/lib/sdk/crt/math/sinf.c new file mode 100644 index 00000000000..1069dcf18b7 --- /dev/null +++ b/reactos/lib/sdk/crt/math/sinf.c @@ -0,0 +1,11 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ +#include + +float sinf(float _X) +{ + return ((float) sin ((double) _X)); +} diff --git a/reactos/lib/sdk/crt/math/sinhf.c b/reactos/lib/sdk/crt/math/sinhf.c new file mode 100644 index 00000000000..f5fab441db6 --- /dev/null +++ b/reactos/lib/sdk/crt/math/sinhf.c @@ -0,0 +1,10 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ +#include +float sinhf (float x) +{ + return (float) sinh (x); +} diff --git a/reactos/lib/sdk/crt/math/sqrt.c b/reactos/lib/sdk/crt/math/sqrt.c new file mode 100644 index 00000000000..3b08e853d12 --- /dev/null +++ b/reactos/lib/sdk/crt/math/sqrt.c @@ -0,0 +1,25 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ +#include +#include + +double +sqrt (double x) +{ + if (x < 0.0L ) + { +#ifndef _LIBCNT_ + errno = EDOM; +#endif + return NAN; + } + else + { + long double res = 0.0L; + asm ("fsqrt" : "=t" (res) : "0" (x)); + return res; + } +} diff --git a/reactos/lib/sdk/crt/math/sqrtf.c b/reactos/lib/sdk/crt/math/sqrtf.c new file mode 100644 index 00000000000..567c1ecae65 --- /dev/null +++ b/reactos/lib/sdk/crt/math/sqrtf.c @@ -0,0 +1,23 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ +#include +#include + +float +sqrtf (float x) +{ + if (x < 0.0F ) + { + errno = EDOM; + return NAN; + } + else + { + float res = 0.0F; + asm ("fsqrt" : "=t" (res) : "0" (x)); + return res; + } +} diff --git a/reactos/lib/sdk/crt/math/tanf.c b/reactos/lib/sdk/crt/math/tanf.c new file mode 100644 index 00000000000..f4074032d6b --- /dev/null +++ b/reactos/lib/sdk/crt/math/tanf.c @@ -0,0 +1,11 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ +#include + +float tanf(float _X) +{ + return ((float)tan((double)_X)); +} diff --git a/reactos/lib/sdk/crt/math/tanhf.c b/reactos/lib/sdk/crt/math/tanhf.c new file mode 100644 index 00000000000..c7e25490a91 --- /dev/null +++ b/reactos/lib/sdk/crt/math/tanhf.c @@ -0,0 +1,10 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ +#include +float tanhf (float x) +{ + return (float) tanh (x); +} diff --git a/reactos/lib/sdk/crt/stdio/file.c b/reactos/lib/sdk/crt/stdio/file.c index ed28d63be8f..1980e94f2ad 100644 --- a/reactos/lib/sdk/crt/stdio/file.c +++ b/reactos/lib/sdk/crt/stdio/file.c @@ -117,11 +117,6 @@ static CRITICAL_SECTION FILE_cs; #define LOCK_FILES() do { EnterCriticalSection(&FILE_cs); } while (0) #define UNLOCK_FILES() do { LeaveCriticalSection(&FILE_cs); } while (0) -FILE *__cdecl __iob_func() -{ - return _iob; -} - static inline BOOL is_valid_fd(int fd) { return fd >= 0 && fd < fdend && (fdesc[fd].wxflag & WX_OPEN); @@ -452,11 +447,11 @@ static void int_to_base32(int num, char *str) } /********************************************************************* - * __p__iob(MSVCRT.@) + * __iob_func(MSVCRT.@) */ -FILE * CDECL __p__iob(void) +FILE * CDECL __iob_func(void) { - return _iob; + return &_iob[0]; } /********************************************************************* diff --git a/reactos/lib/sdk/crt/string/ctype.c b/reactos/lib/sdk/crt/string/ctype.c index a4873cebdd4..484ed1acf14 100644 --- a/reactos/lib/sdk/crt/string/ctype.c +++ b/reactos/lib/sdk/crt/string/ctype.c @@ -292,12 +292,12 @@ const unsigned short _ctype[] = { const unsigned short *_pctype = _ctype + 1; const unsigned short *_pwctype = _ctype + 1; -/* - * @implemented +/********************************************************************* + * __pctype_func (MSVCRT.@) */ -const unsigned short **__p__pctype(void) +const unsigned short* __cdecl __pctype_func(void) { - return &_pctype; + return _pctype; } /* diff --git a/reactos/lib/sdk/crt/time/asctime.c b/reactos/lib/sdk/crt/time/asctime.c index 84e059186d2..71e3ca66746 100644 --- a/reactos/lib/sdk/crt/time/asctime.c +++ b/reactos/lib/sdk/crt/time/asctime.c @@ -5,6 +5,7 @@ * PURPOSE: Implementation of asctime(), _asctime_s() * PROGRAMERS: Timo Kreuzer */ +#define MINGW_HAS_SECURE_API #include #include #include diff --git a/reactos/lib/sdk/crt/time/ctime.c b/reactos/lib/sdk/crt/time/ctime.c index b6d1bfb6cd1..3911b2f94b7 100644 --- a/reactos/lib/sdk/crt/time/ctime.c +++ b/reactos/lib/sdk/crt/time/ctime.c @@ -5,7 +5,7 @@ * PURPOSE: Implementation of ctime, _ctime_s * PROGRAMERS: Timo Kreuzer */ -#define MINGW_HAS_SECURE_API 1 +#define MINGW_HAS_SECURE_API #include #include diff --git a/reactos/lib/sdk/crt/time/utime.c b/reactos/lib/sdk/crt/time/utime.c index 130e5a400ba..3c0168da2fc 100644 --- a/reactos/lib/sdk/crt/time/utime.c +++ b/reactos/lib/sdk/crt/time/utime.c @@ -10,7 +10,7 @@ #include #include "bitsfixup.h" -int +int __cdecl _tutime(const _TCHAR* path, struct _utimbuf *t) { int fd = _topen(path, _O_WRONLY | _O_BINARY); From 835a07e6059de1ad8d12bc6e9e9fb4e1417dce66 Mon Sep 17 00:00:00 2001 From: Samuel Serapion Date: Mon, 25 Jan 2010 11:19:50 +0000 Subject: [PATCH 053/121] Forgot to svn add spec file. svn path=/branches/ros-amd64-bringup/; revision=45246 --- reactos/dll/win32/msvcrt/msvcrt-amd64.def | 860 ---------------------- reactos/dll/win32/msvcrt/msvcrt-i386.def | 860 ---------------------- reactos/dll/win32/msvcrt/msvcrt.spec | 839 +++++++++++++++++++++ 3 files changed, 839 insertions(+), 1720 deletions(-) delete mode 100644 reactos/dll/win32/msvcrt/msvcrt-amd64.def delete mode 100644 reactos/dll/win32/msvcrt/msvcrt-i386.def create mode 100644 reactos/dll/win32/msvcrt/msvcrt.spec diff --git a/reactos/dll/win32/msvcrt/msvcrt-amd64.def b/reactos/dll/win32/msvcrt/msvcrt-amd64.def deleted file mode 100644 index 60a902e6f50..00000000000 --- a/reactos/dll/win32/msvcrt/msvcrt-amd64.def +++ /dev/null @@ -1,860 +0,0 @@ -; -; ReactOS MSVCRT Library -; -LIBRARY msvcrt.dll - -EXPORTS - $I10_OUTPUT=MSVCRT_I10_OUTPUT @57 - ??0__non_rtti_object@@QAE@ABV0@@Z=MSVCRT___non_rtti_object_copy_ctor @1 - ??0__non_rtti_object@@QAE@PBD@Z=MSVCRT___non_rtti_object_ctor @2 -; ??0bad_cast@@AAE@PBQBD@Z @3 - ??0bad_cast@@QAE@ABQBD@Z=MSVCRT_bad_cast_ctor @4 - ??0bad_cast@@QAE@ABV0@@Z=MSVCRT_bad_cast_copy_ctor @5 -; ??0bad_cast@@QAE@PBD@Z @6 - ??0bad_typeid@@QAE@ABV0@@Z=MSVCRT_bad_typeid_copy_ctor @7 - ??0bad_typeid@@QAE@PBD@Z=MSVCRT_bad_typeid_ctor @8 - ??0exception@@QAE@ABQBD@Z=MSVCRT_exception_ctor @9 -; ??0exception@@QAE@ABQBDH@Z @10 - ??0exception@@QAE@ABV0@@Z=MSVCRT_exception_copy_ctor @11 - ??0exception@@QAE@XZ=MSVCRT_exception_default_ctor @12 - ??1__non_rtti_object@@UAE@XZ=MSVCRT___non_rtti_object_dtor @13 - ??1bad_cast@@UAE@XZ=MSVCRT_bad_cast_dtor @14 - ??1bad_typeid@@UAE@XZ=MSVCRT_bad_typeid_dtor @15 - ??1exception@@UAE@XZ=MSVCRT_exception_dtor @16 - ??1type_info@@UAE@XZ=MSVCRT_type_info_dtor @17 - ??2@YAPAXI@Z=MSVCRT_operator_new @18 - ??3@YAXPAX@Z=MSVCRT_operator_delete @19 - ??4__non_rtti_object@@QAEAAV0@ABV0@@Z=MSVCRT___non_rtti_object_opequals @20 - ??4bad_cast@@QAEAAV0@ABV0@@Z=MSVCRT_bad_cast_opequals @21 - ??4bad_typeid@@QAEAAV0@ABV0@@Z=MSVCRT_bad_typeid_opequals @22 - ??4exception@@QAEAAV0@ABV0@@Z=MSVCRT_exception_opequals @23 - ??8type_info@@QBEHABV0@@Z=MSVCRT_type_info_opequals_equals @24 - ??9type_info@@QBEHABV0@@Z=MSVCRT_type_info_opnot_equals @25 - ??_7__non_rtti_object@@6B@=MSVCRT___non_rtti_object_vtable@@6B@ @26 DATA - ??_7bad_cast@@6B@=MSVCRT_bad_cast_vtable @27 DATA - ??_7bad_typeid@@6B@=MSVCRT_bad_typeid_vtable @28 DATA - ??_7exception@@6B@=MSVCRT_exception_vtable @29 DATA - ??_E__non_rtti_object@@UAEPAXI@Z=MSVCRT___non_rtti_object_vector_dtor @30 - ??_Ebad_cast@@UAEPAXI@Z=MSVCRT_bad_cast_vector_dtor @31 - ??_Ebad_typeid@@UAEPAXI@Z=MSVCRT_bad_typeid_vector_dtor @32 - ??_Eexception@@UAEPAXI@Z=MSVCRT_exception_vector_dtor @33 -; ??_Fbad_cast@@QAEXXZ @34 -; ??_Fbad_typeid@@QAEXXZ @35 - ??_G__non_rtti_object@@UAEPAXI@Z=MSVCRT___non_rtti_object_scalar_dtor @36 - ??_Gbad_cast@@UAEPAXI@Z=MSVCRT_bad_cast_scalar_dtor @37 - ??_Gbad_typeid@@UAEPAXI@Z=MSVCRT_bad_typeid_scalar_dtor @38 - ??_Gexception@@UAEPAXI@Z=MSVCRT_exception_scalar_dtor @39 - ??_U@YAPAXI@Z=MSVCRT_operator_new @40 - ??_V@YAXPAX@Z=MSVCRT_operator_delete @41 - ?_query_new_handler@@YAP6AHI@ZXZ=MSVCRT__query_new_handler @43 - ?_query_new_mode@@YAHXZ=MSVCRT__query_new_mode @44 - ?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z=MSVCRT__set_new_handler @45 - ?_set_new_mode@@YAHH@Z=MSVCRT__set_new_mode @46 - ?_set_se_translator@@YAP6AXIPAU_EXCEPTION_POINTERS@@@ZP6AXI0@Z@Z=MSVCRT__set_se_translator @47 - ?before@type_info@@QBEHABV1@@Z=MSVCRT_type_info_before @48 - ?name@type_info@@QBEPBDXZ=MSVCRT_type_info_name @49 - ?raw_name@type_info@@QBEPBDXZ=MSVCRT_type_info_raw_name @50 - ?set_new_handler@@YAP6AXXZP6AXXZ@Z=MSVCRT__set_new_handler @51 - ?set_terminate@@YAP6AXXZP6AXXZ@Z=MSVCRT_set_terminate @52 - ?set_unexpected@@YAP6AXXZP6AXXZ@Z=MSVCRT_set_unexpected @53 - ?terminate@@YAXXZ=MSVCRT_terminate @54 - ?unexpected@@YAXXZ=MSVCRT_unexpected @55 - ?what@exception@@UBEPBDXZ=MSVCRT_what_exception @56 - _CIacos @58 - _CIasin @59 - _CIatan @60 - _CIatan2 @61 - _CIcos @62 - _CIcosh @63 - _CIexp @64 - _CIfmod @65 - _CIlog @66 - _CIlog10 @67 - _CIpow @68 - _CIsin @69 - _CIsinh @70 - _CIsqrt @71 - _CItan @72 - _CItanh @73 - _CxxThrowException @74 -; _EH_prolog @75 ??? - _Getdays @76 - _Getmonths @77 - _Gettnames @78 - _HUGE @79 DATA - _Strftime @80 - _XcptFilter @81 - __CppXcptFilter @82 -; __CxxCallUnwindDtor @83 -; __CxxCallUnwindVecDtor @84 - __CxxDetectRethrow @85 -; __CxxExceptionFilter @86 -; __CxxFrameHandler @87 ??? -; __CxxFrameHandler2 @88 -; __CxxLongjmpUnwind @89 ??? - __CxxQueryExceptionSize @90 -; __CxxRegisterExceptionObject @91 -; __CxxUnregisterExceptionObject @92 -; __DestructExceptionObject @93 - __RTCastToVoid=MSVCRT___RTCastToVoid @94 - __RTDynamicCast=MSVCRT___RTDynamicCast @95 - __RTtypeid=MSVCRT___RTtypeid @96 - __STRINGTOLD @97 -; ___lc_codepage_func @98 -; ___lc_collate_cp_func @99 -; ___lc_handle_func @100 -; ___mb_cur_max_func @101 - ___setlc_active_func @102 - ___unguarded_readlc_active_add_func @103 - __argc @104 DATA - __argv @105 DATA - __badioinfo @106 DATA - __crtCompareStringA=kernel32.CompareStringA @107 - __crtCompareStringW=kernel32.CompareStringW @108 - __crtGetLocaleInfoW=kernel32.GetLocaleInfo @109 - __crtGetStringTypeW=kernel32.GetStringTypeW @110 - __crtLCMapStringA @111 -; __crtLCMapStringW @112 - __dllonexit @113 - __doserrno @114 - __fpecode @115 - __getmainargs @116 - __initenv @117 - __iob_func=__p__iob @118 - __isascii @119 - __iscsym @120 - __iscsymf @121 - __lc_codepage @122 DATA - __lc_collate_cp @123 DATA - __lc_handle @124 DATA - __lconv_init @125 - __mb_cur_max @126 DATA - __p___argc @127 - __p___argv @128 - __p___initenv @129 - __p___mb_cur_max @130 - __p___wargv @131 - __p___winitenv @132 - __p__acmdln @133 - __p__amblksiz @134 - __p__commode @135 - __p__daylight @136 - __p__dstbias @137 - __p__environ @138 -; __p__fileinfo @139 - __p__fmode @140 - __p__iob @141 -; __p__mbcasemap @142 - __p__mbctype @143 - __p__osver @144 - __p__pctype @145 - __p__pgmptr @146 - __p__pwctype @147 - __p__timezone @148 - __p__tzname @149 - __p__wcmdln @150 - __p__wenviron @151 - __p__winmajor @152 - __p__winminor @153 - __p__winver @154 - __p__wpgmptr @155 -; __pctype_func @156 - __pioinfo @157 DATA -; __pwctype_func @158 - __pxcptinfoptrs @159 - __set_app_type @160 - __setlc_active @161 DATA - __setusermatherr @162 - __threadhandle @163 - __threadid @164 - __toascii @165 - __unDName @166 - __unDNameEx @167 -; __uncaught_exception @42 - __unguarded_readlc_active @168 DATA - __wargv @169 DATA -; __wcserror @170 - __wgetmainargs @171 - __winitenv @172 DATA - _abnormal_termination @173 -; _abs64 @174 - _access @175 - _acmdln @176 DATA - _adj_fdiv_m16i @177 - _adj_fdiv_m32 @178 - _adj_fdiv_m32i @179 - _adj_fdiv_m64 @180 - _adj_fdiv_r @181 - _adj_fdivr_m16i @182 - _adj_fdivr_m32 @183 - _adj_fdivr_m32i @184 - _adj_fdivr_m64 @185 - _adj_fpatan @186 - _adj_fprem @187 - _adj_fprem1 @188 - _adj_fptan @189 - _adjust_fdiv @190 DATA - _aexit_rtn @191 - _aligned_free @192 - _aligned_malloc @193 - _aligned_offset_malloc @194 - _aligned_offset_realloc @195 - _aligned_realloc @196 - _amsg_exit @197 - _assert @198 -; _atodbl @199 - _atoi64 @200 - _atoldbl @201 - _beep @202 - _beginthread @203 - _beginthreadex @204 - _c_exit @205 - _cabs @206 - _callnewh @207 - _cexit @208 - _cgets @209 -; _cgetws @210 - _chdir @211 - _chdrive @212 - _chgsign @213 - _chkesp @214 - _chmod @215 - _chsize @216 - _clearfp @217 - _close @218 - _commit @219 - _commode @220 DATA - _control87 @221 - _controlfp @222 - _copysign @223 - _cprintf @224 - _cputs @225 -; _cputws @226 - _creat @227 - _cscanf @228 - _ctime64 @229 - _ctype @230 DATA - _cwait @231 -; _cwprintf @232 -; _cwscanf @233 - _daylight @234 DATA - _dstbias @235 DATA - _dup @236 - _dup2 @237 - _ecvt @238 - _endthread @239 - _endthreadex @240 - _environ @241 DATA - _eof @242 - _errno @243 - _except_handler2 @244 - _except_handler3 @245 - _execl @246 - _execle @247 - _execlp @248 - _execlpe @249 - _execv @250 - _execve @251 - _execvp @252 - _execvpe @253 - _exit @254 - _expand @255 - _fcloseall @256 - _fcvt @257 - _fdopen @258 - _fgetchar @259 - _fgetwchar @260 - _filbuf @261 -; _fileinfo @262 - _filelength @263 - _filelengthi64 @264 - _fileno @265 - _findclose @266 - _findfirst @267 - _findfirst64 @268 - _findfirsti64 @269 - _findnext @270 - _findnext64 @271 - _findnexti64 @272 - _finite @273 - _flsbuf @274 - _flushall @275 - _fmode @276 DATA - _fpclass @277 - _fpieee_flt @278 - _fpreset @279 - _fputchar @280 - _fputwchar @281 - _fsopen @282 - _fstat @283 - _fstat64 @284 - _fstati64 @285 - _ftime @286 - _ftime64 @287 -; _ftol @288 ??? - _fullpath @289 - _futime @290 - _futime64 @291 - _gcvt @292 -; _get_heap_handle @293 - _get_osfhandle @294 - _get_sbh_threshold @295 - _getch @296 - _getche @297 - _getcwd @298 - _getdcwd @299 - _getdiskfree @300 - _getdllprocaddr @301 - _getdrive @302 - _getdrives=kernel32.GetLogicalDrives @303 - _getmaxstdio @304 - _getmbcp @305 - _getpid=kernel32.GetCurrentProcessId @306 - _getsystime @307 - _getw @308 -; _getwch @309 -; _getwche @310 - _getws @311 - _global_unwind2 @312 - _gmtime64=gmtime @313 - _heapadd @314 - _heapchk @315 - _heapmin @316 - _heapset @317 -; _heapused @318 - _heapwalk @319 - _hypot @320 - _i64toa @321 - _i64tow @322 - _initterm @323 -; _inp @324 -; _inpd @325 -; _inpw @326 - _iob @327 DATA - _isatty @328 - _isctype @329 - _ismbbalnum @330 - _ismbbalpha @331 - _ismbbgraph @332 - _ismbbkalnum @333 - _ismbbkana @334 -; _ismbbkprint @335 - _ismbbkpunct @336 - _ismbblead @337 - _ismbbprint @338 - _ismbbpunct @339 - _ismbbtrail @340 - _ismbcalnum @341 - _ismbcalpha @342 - _ismbcdigit @343 - _ismbcgraph @344 - _ismbchira @345 - _ismbckata @346 - _ismbcl0 @347 - _ismbcl1 @348 - _ismbcl2 @349 - _ismbclegal @350 - _ismbclower @351 - _ismbcprint @352 - _ismbcpunct @353 - _ismbcspace @354 - _ismbcsymbol @355 - _ismbcupper @356 - _ismbslead @357 - _ismbstrail @358 - _isnan @359 - _itoa @360 - _itow @361 -; FIXME: these aren't actually implemented in CRT -; _j0 @362 -; _j1 @363 -; _jn @364 - _kbhit @365 - _lfind @366 - _loaddll @367 - _local_unwind2 @368 - _localtime64 @369 - _lock @370 - _locking @371 - _logb @372 - _longjmpex=longjmp @373 - _lrotl @374 - _lrotr @375 - _lsearch @376 - _lseek @377 - _lseeki64 @378 - _ltoa @379 - _ltow @380 - _makepath @381 - _mbbtombc @382 - _mbbtype @383 -; _mbcasemap @384 - _mbccpy @385 - _mbcjistojms @386 - _mbcjmstojis @387 - _mbclen @388 - _mbctohira @389 - _mbctokata @390 - _mbctolower @391 - _mbctombb @392 - _mbctoupper @393 - _mbctype @394 DATA - _mbsbtype @395 - _mbscat @396 - _mbschr @397 - _mbscmp @398 - _mbscoll @399 - _mbscpy @400 - _mbscspn @401 - _mbsdec @402 - _mbsdup @403 - _mbsicmp @404 - _mbsicoll @405 - _mbsinc @406 - _mbslen @407 - _mbslwr @408 - _mbsnbcat @409 - _mbsnbcmp @410 - _mbsnbcnt @411 - _mbsnbcoll @412 - _mbsnbcpy @413 - _mbsnbicmp @414 - _mbsnbicoll @415 - _mbsnbset @416 - _mbsncat @417 - _mbsnccnt @418 - _mbsncmp @419 - _mbsncoll @420 - _mbsncpy @421 - _mbsnextc @422 - _mbsnicmp @423 - _mbsnicoll @424 - _mbsninc @425 - _mbsnset @426 - _mbspbrk @427 - _mbsrchr @428 - _mbsrev @429 - _mbsset @430 - _mbsspn @431 - _mbsspnp @432 - _mbsstr @433 - _mbstok @434 - _mbstrlen @435 - _mbsupr @436 - _memccpy @437 - _memicmp @438 - _mkdir @439 - _mkgmtime @440 - _mkgmtime64 @441 - _mktemp @442 - _mktime64 @443 - _msize @444 - _nextafter @445 - _onexit @446 - _open @447 - _open_osfhandle @448 -; _osplatform @449 - _osver @450 DATA -; _outp @451 -; _outpd @452 -; _outpw @453 - _pclose @454 - _pctype @455 DATA - _pgmptr @456 DATA - _pipe @457 - _popen @458 - _purecall @459 - _putch @460 - _putenv @461 - _putw @462 -; _putwch @463 - _putws @464 - _pwctype @465 - _read @466 -; _resetstkoflw @467 - _rmdir @468 - _rmtmp @469 - _rotl @470 -; _rotl64 @471 - _rotr @472 -; _rotr64 @473 - _safe_fdiv @474 - _safe_fdivr @475 - _safe_fprem @476 - _safe_fprem1 @477 - _scalb @478 -; _scprintf @479 -; _scwprintf @480 - _searchenv @481 -; _seh_longjmp_unwind @482 ??? -; _set_SSE2_enable @483 - _set_error_mode @484 - _set_sbh_threshold @485 - _seterrormode @486 - _setjmp @487 - _setjmpex @488 - _setmaxstdio @489 - _setmbcp @490 - _setmode @491 - _setsystime @492 - _sleep @493 - _snprintf @494 -; _snscanf @495 - _snwprintf @496 -; _snwscanf @497 - _sopen @498 - _spawnl @499 - _spawnle @500 - _spawnlp @501 - _spawnlpe @502 - _spawnv @503 - _spawnve @504 - _spawnvp @505 - _spawnvpe @506 - _splitpath @507 - _stat @508 - _stat64 @509 - _stati64 @510 - _statusfp @511 - _strcmpi @512 - _strdate @513 - _strdup @514 - _strerror @515 - _stricmp @516 - _stricoll @517 - _strlwr @518 - _strncoll @519 - _strnicmp @520 - _strnicoll @521 - _strnset @522 - _strrev @523 - _strset @524 - _strtime @525 -; _strtoi64 @526 - _strtoui64=strtoull @527 - _strupr @528 - _swab @529 - _sys_errlist @530 DATA - _sys_nerr @531 DATA - _tell @532 - _telli64 @533 - _tempnam @534 - _time64 @535 - _timezone @536 DATA - _tolower @537 - _toupper @538 - _tzname @539 DATA - _tzset @540 - _ui64toa @541 - _ui64tow @542 - _ultoa @543 - _ultow @544 - _umask @545 - _ungetch @546 -; _ungetwch @547 - _unlink @548 - _unloaddll @549 - _unlock @550 - _utime @551 -; _utime64 @552 -; _vscprintf @553 -; _vscwprintf @554 - _vsnprintf @555 - _vsnwprintf @556 - _waccess @557 - _wasctime @558 - _wchdir @559 - _wchmod @560 - _wcmdln @561 - _wcreat @562 - _wcsdup @563 -; _wcserror @564 - _wcsicmp @565 - _wcsicoll @566 - _wcslwr @567 - _wcsncoll @568 - _wcsnicmp @569 - _wcsnicoll @570 - _wcsnset @571 - _wcsrev @572 - _wcsset @573 -; _wcstoi64 @574 -; _wcstoui64 @575 - _wcsupr @576 - _wctime @577 -; _wctime64 @578 -; _wctype @579 - _wenviron @580 DATA - _wexecl @581 - _wexecle @582 - _wexeclp @583 - _wexeclpe @584 - _wexecv @585 - _wexecve @586 - _wexecvp @587 - _wexecvpe @588 - _wfdopen @589 - _wfindfirst @590 -; _wfindfirst64 @591 - _wfindfirsti64 @592 - _wfindnext @593 -; _wfindnext64 @594 - _wfindnexti64 @595 - _wfopen @596 - _wfreopen @597 - _wfsopen @598 - _wfullpath @599 - _wgetcwd @600 - _wgetdcwd @601 - _wgetenv @602 - _winmajor @603 DATA - _winminor @604 DATA - _winver @605 DATA - _wmakepath @606 - _wmkdir @607 - _wmktemp @608 - _wopen @609 - _wperror @610 - _wpgmptr @611 DATA - _wpopen @612 - _wputenv @613 - _wremove @614 - _wrename @615 - _write @616 - _wrmdir @617 - _wsearchenv @618 - _wsetlocale @619 - _wsopen @620 - _wspawnl @621 - _wspawnle @622 - _wspawnlp @623 - _wspawnlpe @624 - _wspawnv @625 - _wspawnve @626 - _wspawnvp @627 - _wspawnvpe @628 - _wsplitpath @629 - _wstat @630 - _wstat64 @631 - _wstati64 @632 - _wstrdate @633 - _wstrtime @634 - _wsystem @635 - _wtempnam @636 - _wtmpnam @637 -; _wtof @638 - _wtoi @639 - _wtoi64 @640 - _wtol @641 - _wunlink @642 - _wutime @643 -; _wutime64 @644 -; FIXME: these aren't actually implemented in CRT -; _y0 @645 -; _y1 @646 -; _yn @647 - abort @648 - abs @649 - acos @650 - asctime @651 - asin @652 - atan @653 - atan2 @654 - atexit @655 - atof @656 - atoi @657 - atol @658 - bsearch @659 - calloc @660 - ceil @661 - clearerr @662 - clock @663 - cos @664 - cosh @665 - ctime @666 - difftime @667 - div @668 - exit @669 - exp @670 - fabs @671 - fclose @672 - feof @673 - ferror @674 - fflush @675 - fgetc @676 - fgetpos @677 - fgets @678 - fgetwc @679 - fgetws @680 - floor @681 - fmod @682 - fopen @683 - fprintf @684 - fputc @685 - fputs @686 - fputwc @687 - fputws @688 - fread @689 - free @690 - freopen @691 - frexp @692 - fscanf @693 - fseek @694 - fsetpos @695 - ftell @696 - fwprintf @697 - fwrite @698 - fwscanf @699 - getc @700 - getchar @701 - getenv @702 - gets @703 - getwc @704 - getwchar @705 - gmtime @706 - is_wctype @707 - isalnum @708 - isalpha @709 - iscntrl @710 - isdigit @711 - isgraph @712 - isleadbyte @713 - islower @714 - isprint @715 - ispunct @716 - isspace @717 - isupper @718 - iswalnum @719 - iswalpha @720 - iswascii @721 - iswcntrl @722 - iswctype @723 - iswdigit @724 - iswgraph @725 - iswlower @726 - iswprint @727 - iswpunct @728 - iswspace @729 - iswupper @730 - iswxdigit @731 - isxdigit @732 - labs @733 - ldexp @734 - ldiv @735 - localeconv @736 -; localtime @737 ??? - log @738 - log10 @739 - longjmp @740 - malloc @741 - mblen @742 - mbstowcs @743 - mbtowc @744 - memchr @745 - memcmp @746 - memcpy=memmove @747 - memmove @748 - memset @749 - mktime @750 - modf @751 - perror @752 - pow @753 - printf @754 - putc @755 - putchar @756 - puts @757 - putwc=fputwc @758 - putwchar=_fputwchar @759 - qsort @760 - raise @761 - rand @762 - realloc @763 - remove @764 - rename @765 - rewind @766 - scanf @767 - setbuf @768 - setlocale @769 - setvbuf @770 - signal @771 - sin @772 - sinh @773 - sprintf @774 - sqrt @775 - srand @776 - sscanf @777 - strcat @778 - strchr @779 - strcmp @780 - strcoll @781 - strcpy @782 - strcspn @783 - strerror @784 - strftime @785 - strlen @786 - strncat @787 - strncmp @788 - strncpy @789 - strpbrk @790 - strrchr @791 - strspn @792 - strstr @793 - strtod @794 - strtok @795 - strtol @796 - strtoul @797 - strxfrm @798 - swprintf @799 - swscanf @800 - system @801 - tan @802 - tanh @803 - time @804 - tmpfile @805 - tmpnam @806 - tolower @807 - toupper @808 - towlower @809 - towupper @810 - ungetc @811 - ungetwc @812 - vfprintf @813 - vfwprintf @814 - vprintf @815 - vsprintf @816 - vswprintf @817 - vwprintf @818 - wcscat @819 - wcschr @820 - wcscmp @821 - wcscoll @822 - wcscpy @823 - wcscspn @824 - wcsftime @825 - wcslen @826 - wcsncat @827 - wcsncmp @828 - wcsncpy @829 - wcspbrk @830 - wcsrchr @831 - wcsspn @832 - wcsstr @833 - wcstod @834 - wcstok @835 - wcstol @836 - wcstombs @837 - wcstoul @838 - wcsxfrm @839 - wctomb @840 - wprintf @841 - wscanf @842 - - _mbsnbcpy_s - wcscpy_s - wcsncpy_s - ;_ftol2=_ftol - ;_ftol2_sse=_ftol - strcat_s - strcpy_s - _swprintf=swprintf - \ No newline at end of file diff --git a/reactos/dll/win32/msvcrt/msvcrt-i386.def b/reactos/dll/win32/msvcrt/msvcrt-i386.def deleted file mode 100644 index bcf3fe378c8..00000000000 --- a/reactos/dll/win32/msvcrt/msvcrt-i386.def +++ /dev/null @@ -1,860 +0,0 @@ -; -; ReactOS MSVCRT Library -; -LIBRARY msvcrt.dll - -EXPORTS - $I10_OUTPUT=MSVCRT_I10_OUTPUT @57 - ??0__non_rtti_object@@QAE@ABV0@@Z=__thiscall_MSVCRT___non_rtti_object_copy_ctor @1 - ??0__non_rtti_object@@QAE@PBD@Z=__thiscall_MSVCRT___non_rtti_object_ctor @2 -; ??0bad_cast@@AAE@PBQBD@Z @3 - ??0bad_cast@@QAE@ABQBD@Z=__thiscall_MSVCRT_bad_cast_ctor @4 - ??0bad_cast@@QAE@ABV0@@Z=__thiscall_MSVCRT_bad_cast_copy_ctor @5 -; ??0bad_cast@@QAE@PBD@Z @6 - ??0bad_typeid@@QAE@ABV0@@Z=__thiscall_MSVCRT_bad_typeid_copy_ctor @7 - ??0bad_typeid@@QAE@PBD@Z=__thiscall_MSVCRT_bad_typeid_ctor @8 - ??0exception@@QAE@ABQBD@Z=__thiscall_MSVCRT_exception_ctor @9 -; ??0exception@@QAE@ABQBDH@Z @10 - ??0exception@@QAE@ABV0@@Z=__thiscall_MSVCRT_exception_copy_ctor @11 - ??0exception@@QAE@XZ=__thiscall_MSVCRT_exception_default_ctor @12 - ??1__non_rtti_object@@UAE@XZ=__thiscall_MSVCRT___non_rtti_object_dtor @13 - ??1bad_cast@@UAE@XZ=__thiscall_MSVCRT_bad_cast_dtor @14 - ??1bad_typeid@@UAE@XZ=__thiscall_MSVCRT_bad_typeid_dtor @15 - ??1exception@@UAE@XZ=__thiscall_MSVCRT_exception_dtor @16 - ??1type_info@@UAE@XZ=__thiscall_MSVCRT_type_info_dtor @17 - ??2@YAPAXI@Z=MSVCRT_operator_new @18 - ??3@YAXPAX@Z=MSVCRT_operator_delete @19 - ??4__non_rtti_object@@QAEAAV0@ABV0@@Z=__thiscall_MSVCRT___non_rtti_object_opequals @20 - ??4bad_cast@@QAEAAV0@ABV0@@Z=__thiscall_MSVCRT_bad_cast_opequals @21 - ??4bad_typeid@@QAEAAV0@ABV0@@Z=__thiscall_MSVCRT_bad_typeid_opequals @22 - ??4exception@@QAEAAV0@ABV0@@Z=__thiscall_MSVCRT_exception_opequals @23 - ??8type_info@@QBEHABV0@@Z=__thiscall_MSVCRT_type_info_opequals_equals @24 - ??9type_info@@QBEHABV0@@Z=__thiscall_MSVCRT_type_info_opnot_equals @25 - ??_7__non_rtti_object@@6B@=MSVCRT___non_rtti_object_vtable@@6B@ @26 DATA - ??_7bad_cast@@6B@=MSVCRT_bad_cast_vtable @27 DATA - ??_7bad_typeid@@6B@=MSVCRT_bad_typeid_vtable @28 DATA - ??_7exception@@6B@=MSVCRT_exception_vtable @29 DATA - ??_E__non_rtti_object@@UAEPAXI@Z=__thiscall_MSVCRT___non_rtti_object_vector_dtor @30 - ??_Ebad_cast@@UAEPAXI@Z=__thiscall_MSVCRT_bad_cast_vector_dtor @31 - ??_Ebad_typeid@@UAEPAXI@Z=__thiscall_MSVCRT_bad_typeid_vector_dtor @32 - ??_Eexception@@UAEPAXI@Z=__thiscall_MSVCRT_exception_vector_dtor @33 -; ??_Fbad_cast@@QAEXXZ @34 -; ??_Fbad_typeid@@QAEXXZ @35 - ??_G__non_rtti_object@@UAEPAXI@Z=__thiscall_MSVCRT___non_rtti_object_scalar_dtor @36 - ??_Gbad_cast@@UAEPAXI@Z=__thiscall_MSVCRT_bad_cast_scalar_dtor @37 - ??_Gbad_typeid@@UAEPAXI@Z=__thiscall_MSVCRT_bad_typeid_scalar_dtor @38 - ??_Gexception@@UAEPAXI@Z=__thiscall_MSVCRT_exception_scalar_dtor @39 - ??_U@YAPAXI@Z=MSVCRT_operator_new @40 - ??_V@YAXPAX@Z=MSVCRT_operator_delete @41 - ?_query_new_handler@@YAP6AHI@ZXZ=MSVCRT__query_new_handler @43 - ?_query_new_mode@@YAHXZ=MSVCRT__query_new_mode @44 - ?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z=MSVCRT__set_new_handler @45 - ?_set_new_mode@@YAHH@Z=MSVCRT__set_new_mode @46 - ?_set_se_translator@@YAP6AXIPAU_EXCEPTION_POINTERS@@@ZP6AXI0@Z@Z=MSVCRT__set_se_translator @47 - ?before@type_info@@QBEHABV1@@Z=__thiscall_MSVCRT_type_info_before @48 - ?name@type_info@@QBEPBDXZ=__thiscall_MSVCRT_type_info_name @49 - ?raw_name@type_info@@QBEPBDXZ=__thiscall_MSVCRT_type_info_raw_name @50 - ?set_new_handler@@YAP6AXXZP6AXXZ@Z=MSVCRT__set_new_handler @51 - ?set_terminate@@YAP6AXXZP6AXXZ@Z=MSVCRT_set_terminate @52 - ?set_unexpected@@YAP6AXXZP6AXXZ@Z=MSVCRT_set_unexpected @53 - ?terminate@@YAXXZ=MSVCRT_terminate @54 - ?unexpected@@YAXXZ=MSVCRT_unexpected @55 - ?what@exception@@UBEPBDXZ=__thiscall_MSVCRT_what_exception @56 - _CIacos @58 - _CIasin @59 - _CIatan @60 - _CIatan2 @61 - _CIcos @62 - _CIcosh @63 - _CIexp @64 - _CIfmod @65 - _CIlog @66 - _CIlog10 @67 - _CIpow @68 - _CIsin @69 - _CIsinh @70 - _CIsqrt @71 - _CItan @72 - _CItanh @73 - _CxxThrowException @74 - _EH_prolog @75 - _Getdays @76 - _Getmonths @77 - _Gettnames @78 - _HUGE @79 DATA - _Strftime @80 - _XcptFilter @81 - __CppXcptFilter @82 -; __CxxCallUnwindDtor @83 -; __CxxCallUnwindVecDtor @84 - __CxxDetectRethrow @85 -; __CxxExceptionFilter @86 - __CxxFrameHandler @87 -; __CxxFrameHandler2 @88 - __CxxLongjmpUnwind @89 - __CxxQueryExceptionSize @90 -; __CxxRegisterExceptionObject @91 -; __CxxUnregisterExceptionObject @92 -; __DestructExceptionObject @93 - __RTCastToVoid=MSVCRT___RTCastToVoid @94 - __RTDynamicCast=MSVCRT___RTDynamicCast @95 - __RTtypeid=MSVCRT___RTtypeid @96 - __STRINGTOLD @97 -; ___lc_codepage_func @98 -; ___lc_collate_cp_func @99 -; ___lc_handle_func @100 -; ___mb_cur_max_func @101 - ___setlc_active_func @102 - ___unguarded_readlc_active_add_func @103 - __argc @104 DATA - __argv @105 DATA - __badioinfo @106 DATA - __crtCompareStringA=kernel32.CompareStringA @107 - __crtCompareStringW=kernel32.CompareStringW @108 - __crtGetLocaleInfoW=kernel32.GetLocaleInfo @109 - __crtGetStringTypeW=kernel32.GetStringTypeW @110 - __crtLCMapStringA @111 -; __crtLCMapStringW @112 - __dllonexit @113 - __doserrno @114 - __fpecode @115 - __getmainargs @116 - __initenv @117 - __iob_func=__p__iob @118 - __isascii @119 - __iscsym @120 - __iscsymf @121 - __lc_codepage @122 DATA - __lc_collate_cp @123 DATA - __lc_handle @124 DATA - __lconv_init @125 - __mb_cur_max @126 DATA - __p___argc @127 - __p___argv @128 - __p___initenv @129 - __p___mb_cur_max @130 - __p___wargv @131 - __p___winitenv @132 - __p__acmdln @133 - __p__amblksiz @134 - __p__commode @135 - __p__daylight @136 - __p__dstbias @137 - __p__environ @138 -; __p__fileinfo @139 - __p__fmode @140 - __p__iob @141 -; __p__mbcasemap @142 - __p__mbctype @143 - __p__osver @144 - __p__pctype @145 - __p__pgmptr @146 - __p__pwctype @147 - __p__timezone @148 - __p__tzname @149 - __p__wcmdln @150 - __p__wenviron @151 - __p__winmajor @152 - __p__winminor @153 - __p__winver @154 - __p__wpgmptr @155 -; __pctype_func @156 - __pioinfo @157 DATA -; __pwctype_func @158 - __pxcptinfoptrs @159 - __set_app_type @160 - __setlc_active @161 DATA - __setusermatherr @162 - __threadhandle @163 - __threadid @164 - __toascii @165 - __unDName @166 - __unDNameEx @167 -; __uncaught_exception @42 - __unguarded_readlc_active @168 DATA - __wargv @169 DATA -; __wcserror @170 - __wgetmainargs @171 - __winitenv @172 DATA - _abnormal_termination @173 -; _abs64 @174 - _access @175 - _acmdln @176 DATA - _adj_fdiv_m16i @177 - _adj_fdiv_m32 @178 - _adj_fdiv_m32i @179 - _adj_fdiv_m64 @180 - _adj_fdiv_r @181 - _adj_fdivr_m16i @182 - _adj_fdivr_m32 @183 - _adj_fdivr_m32i @184 - _adj_fdivr_m64 @185 - _adj_fpatan @186 - _adj_fprem @187 - _adj_fprem1 @188 - _adj_fptan @189 - _adjust_fdiv @190 DATA - _aexit_rtn @191 - _aligned_free @192 - _aligned_malloc @193 - _aligned_offset_malloc @194 - _aligned_offset_realloc @195 - _aligned_realloc @196 - _amsg_exit @197 - _assert @198 -; _atodbl @199 - _atoi64 @200 - _atoldbl @201 - _beep @202 - _beginthread @203 - _beginthreadex @204 - _c_exit @205 - _cabs @206 - _callnewh @207 - _cexit @208 - _cgets @209 -; _cgetws @210 - _chdir @211 - _chdrive @212 - _chgsign @213 - _chkesp @214 - _chmod @215 - _chsize @216 - _clearfp @217 - _close @218 - _commit @219 - _commode @220 DATA - _control87 @221 - _controlfp @222 - _copysign @223 - _cprintf @224 - _cputs @225 -; _cputws @226 - _creat @227 - _cscanf @228 -; _ctime64 @229 - _ctype @230 DATA - _cwait @231 -; _cwprintf @232 -; _cwscanf @233 - _daylight @234 DATA - _dstbias @235 DATA - _dup @236 - _dup2 @237 - _ecvt @238 - _endthread @239 - _endthreadex @240 - _environ @241 DATA - _eof @242 - _errno @243 - _except_handler2 @244 - _except_handler3 @245 - _execl @246 - _execle @247 - _execlp @248 - _execlpe @249 - _execv @250 - _execve @251 - _execvp @252 - _execvpe @253 - _exit @254 - _expand @255 - _fcloseall @256 - _fcvt @257 - _fdopen @258 - _fgetchar @259 - _fgetwchar @260 - _filbuf @261 -; _fileinfo @262 - _filelength @263 - _filelengthi64 @264 - _fileno @265 - _findclose @266 - _findfirst @267 - _findfirst64 @268 - _findfirsti64 @269 - _findnext @270 - _findnext64 @271 - _findnexti64 @272 - _finite @273 - _flsbuf @274 - _flushall @275 - _fmode @276 DATA - _fpclass @277 - _fpieee_flt @278 - _fpreset @279 - _fputchar @280 - _fputwchar @281 - _fsopen @282 - _fstat @283 - _fstat64 @284 - _fstati64 @285 - _ftime @286 -; _ftime64 @287 - _ftol @288 - _fullpath @289 - _futime @290 -; _futime64 @291 - _gcvt @292 -; _get_heap_handle @293 - _get_osfhandle @294 - _get_sbh_threshold @295 - _getch @296 - _getche @297 - _getcwd @298 - _getdcwd @299 - _getdiskfree @300 - _getdllprocaddr @301 - _getdrive @302 - _getdrives=kernel32.GetLogicalDrives @303 - _getmaxstdio @304 - _getmbcp @305 - _getpid=kernel32.GetCurrentProcessId @306 - _getsystime @307 - _getw @308 -; _getwch @309 -; _getwche @310 - _getws @311 - _global_unwind2 @312 -; _gmtime64 @313 - _heapadd @314 - _heapchk @315 - _heapmin @316 - _heapset @317 -; _heapused @318 - _heapwalk @319 - _hypot @320 - _i64toa @321 - _i64tow @322 - _initterm @323 -; _inp @324 -; _inpd @325 -; _inpw @326 - _iob @327 DATA - _isatty @328 - _isctype @329 - _ismbbalnum @330 - _ismbbalpha @331 - _ismbbgraph @332 - _ismbbkalnum @333 - _ismbbkana @334 -; _ismbbkprint @335 - _ismbbkpunct @336 - _ismbblead @337 - _ismbbprint @338 - _ismbbpunct @339 - _ismbbtrail @340 - _ismbcalnum @341 - _ismbcalpha @342 - _ismbcdigit @343 - _ismbcgraph @344 - _ismbchira @345 - _ismbckata @346 - _ismbcl0 @347 - _ismbcl1 @348 - _ismbcl2 @349 - _ismbclegal @350 - _ismbclower @351 - _ismbcprint @352 - _ismbcpunct @353 - _ismbcspace @354 - _ismbcsymbol @355 - _ismbcupper @356 - _ismbslead @357 - _ismbstrail @358 - _isnan @359 - _itoa @360 - _itow @361 -; FIXME: these aren't actually implemented in CRT -; _j0 @362 -; _j1 @363 -; _jn @364 - _kbhit @365 - _lfind @366 - _loaddll @367 - _local_unwind2 @368 -; _localtime64 @369 - _lock @370 - _locking @371 - _logb @372 - _longjmpex=longjmp @373 - _lrotl @374 - _lrotr @375 - _lsearch @376 - _lseek @377 - _lseeki64 @378 - _ltoa @379 - _ltow @380 - _makepath @381 - _mbbtombc @382 - _mbbtype @383 -; _mbcasemap @384 - _mbccpy @385 - _mbcjistojms @386 - _mbcjmstojis @387 - _mbclen @388 - _mbctohira @389 - _mbctokata @390 - _mbctolower @391 - _mbctombb @392 - _mbctoupper @393 - _mbctype @394 DATA - _mbsbtype @395 - _mbscat @396 - _mbschr @397 - _mbscmp @398 - _mbscoll @399 - _mbscpy @400 - _mbscspn @401 - _mbsdec @402 - _mbsdup @403 - _mbsicmp @404 - _mbsicoll @405 - _mbsinc @406 - _mbslen @407 - _mbslwr @408 - _mbsnbcat @409 - _mbsnbcmp @410 - _mbsnbcnt @411 - _mbsnbcoll @412 - _mbsnbcpy @413 - _mbsnbicmp @414 - _mbsnbicoll @415 - _mbsnbset @416 - _mbsncat @417 - _mbsnccnt @418 - _mbsncmp @419 - _mbsncoll @420 - _mbsncpy @421 - _mbsnextc @422 - _mbsnicmp @423 - _mbsnicoll @424 - _mbsninc @425 - _mbsnset @426 - _mbspbrk @427 - _mbsrchr @428 - _mbsrev @429 - _mbsset @430 - _mbsspn @431 - _mbsspnp @432 - _mbsstr @433 - _mbstok @434 - _mbstrlen @435 - _mbsupr @436 - _memccpy @437 - _memicmp @438 - _mkdir @439 -; _mkgmtime @440 -; _mkgmtime64 @441 - _mktemp @442 -; _mktime64 @443 - _msize @444 - _nextafter @445 - _onexit @446 - _open @447 - _open_osfhandle @448 -; _osplatform @449 - _osver @450 DATA -; _outp @451 -; _outpd @452 -; _outpw @453 - _pclose @454 - _pctype @455 DATA - _pgmptr @456 DATA - _pipe @457 - _popen @458 - _purecall @459 - _putch @460 - _putenv @461 - _putw @462 -; _putwch @463 - _putws @464 - _pwctype @465 - _read @466 -; _resetstkoflw @467 - _rmdir @468 - _rmtmp @469 - _rotl @470 -; _rotl64 @471 - _rotr @472 -; _rotr64 @473 - _safe_fdiv @474 - _safe_fdivr @475 - _safe_fprem @476 - _safe_fprem1 @477 - _scalb @478 -; _scprintf @479 -; _scwprintf @480 - _searchenv @481 - _seh_longjmp_unwind=_seh_longjmp_unwind@4 @482 -; _set_SSE2_enable @483 - _set_error_mode @484 - _set_sbh_threshold @485 - _seterrormode @486 - _setjmp @487 - _setjmp3 @488 - _setmaxstdio @489 - _setmbcp @490 - _setmode @491 - _setsystime @492 - _sleep @493 - _snprintf @494 -; _snscanf @495 - _snwprintf @496 -; _snwscanf @497 - _sopen @498 - _spawnl @499 - _spawnle @500 - _spawnlp @501 - _spawnlpe @502 - _spawnv @503 - _spawnve @504 - _spawnvp @505 - _spawnvpe @506 - _splitpath @507 - _stat @508 - _stat64 @509 - _stati64 @510 - _statusfp @511 - _strcmpi @512 - _strdate @513 - _strdup @514 - _strerror @515 - _stricmp @516 - _stricoll @517 - _strlwr @518 - _strncoll @519 - _strnicmp @520 - _strnicoll @521 - _strnset @522 - _strrev @523 - _strset @524 - _strtime @525 - _strtoi64 @526 - _strtoui64=strtoull @527 - _strupr @528 - _swab @529 - _sys_errlist @530 DATA - _sys_nerr @531 DATA - _tell @532 - _telli64 @533 - _tempnam @534 -; _time64 @535 - _timezone @536 DATA - _tolower @537 - _toupper @538 - _tzname @539 DATA - _tzset @540 - _ui64toa @541 - _ui64tow @542 - _ultoa @543 - _ultow @544 - _umask @545 - _ungetch @546 -; _ungetwch @547 - _unlink @548 - _unloaddll @549 - _unlock @550 - _utime @551 -; _utime64 @552 -; _vscprintf @553 -; _vscwprintf @554 - _vsnprintf @555 - _vsnwprintf @556 - _waccess @557 - _wasctime @558 - _wchdir @559 - _wchmod @560 - _wcmdln @561 - _wcreat @562 - _wcsdup @563 -; _wcserror @564 - _wcsicmp @565 - _wcsicoll @566 - _wcslwr @567 - _wcsncoll @568 - _wcsnicmp @569 - _wcsnicoll @570 - _wcsnset @571 - _wcsrev @572 - _wcsset @573 - _wcstoi64 @574 - _wcstoui64 @575 - _wcsupr @576 - _wctime @577 -; _wctime64 @578 -; _wctype @579 - _wenviron @580 DATA - _wexecl @581 - _wexecle @582 - _wexeclp @583 - _wexeclpe @584 - _wexecv @585 - _wexecve @586 - _wexecvp @587 - _wexecvpe @588 - _wfdopen @589 - _wfindfirst @590 - _wfindfirst64 @591 - _wfindfirsti64 @592 - _wfindnext @593 - _wfindnext64 @594 - _wfindnexti64 @595 - _wfopen @596 - _wfreopen @597 - _wfsopen @598 - _wfullpath @599 - _wgetcwd @600 - _wgetdcwd @601 - _wgetenv @602 - _winmajor @603 DATA - _winminor @604 DATA - _winver @605 DATA - _wmakepath @606 - _wmkdir @607 - _wmktemp @608 - _wopen @609 - _wperror @610 - _wpgmptr @611 DATA - _wpopen @612 - _wputenv @613 - _wremove @614 - _wrename @615 - _write @616 - _wrmdir @617 - _wsearchenv @618 - _wsetlocale @619 - _wsopen @620 - _wspawnl @621 - _wspawnle @622 - _wspawnlp @623 - _wspawnlpe @624 - _wspawnv @625 - _wspawnve @626 - _wspawnvp @627 - _wspawnvpe @628 - _wsplitpath @629 - _wstat @630 - _wstat64 @631 - _wstati64 @632 - _wstrdate @633 - _wstrtime @634 - _wsystem @635 - _wtempnam @636 - _wtmpnam @637 -; _wtof @638 - _wtoi @639 - _wtoi64 @640 - _wtol @641 - _wunlink @642 - _wutime @643 -; _wutime64 @644 -; FIXME: these aren't actually implemented in CRT -; _y0 @645 -; _y1 @646 -; _yn @647 - abort @648 - abs @649 - acos @650 - asctime @651 - asin @652 - atan @653 - atan2 @654 - atexit @655 - atof @656 - atoi @657 - atol @658 - bsearch @659 - calloc @660 - ceil @661 - clearerr @662 - clock @663 - cos @664 - cosh @665 - ctime @666 - difftime @667 - div @668 - exit @669 - exp @670 - fabs @671 - fclose @672 - feof @673 - ferror @674 - fflush @675 - fgetc @676 - fgetpos @677 - fgets @678 - fgetwc @679 - fgetws @680 - floor @681 - fmod @682 - fopen @683 - fprintf @684 - fputc @685 - fputs @686 - fputwc @687 - fputws @688 - fread @689 - free @690 - freopen @691 - frexp @692 - fscanf @693 - fseek @694 - fsetpos @695 - ftell @696 - fwprintf @697 - fwrite @698 - fwscanf @699 - getc @700 - getchar @701 - getenv @702 - gets @703 - getwc @704 - getwchar @705 - gmtime @706 - is_wctype @707 - isalnum @708 - isalpha @709 - iscntrl @710 - isdigit @711 - isgraph @712 - isleadbyte @713 - islower @714 - isprint @715 - ispunct @716 - isspace @717 - isupper @718 - iswalnum @719 - iswalpha @720 - iswascii @721 - iswcntrl @722 - iswctype @723 - iswdigit @724 - iswgraph @725 - iswlower @726 - iswprint @727 - iswpunct @728 - iswspace @729 - iswupper @730 - iswxdigit @731 - isxdigit @732 - labs @733 - ldexp @734 - ldiv @735 - localeconv @736 - localtime @737 - log @738 - log10 @739 - longjmp @740 - malloc @741 - mblen @742 - mbstowcs @743 - mbtowc @744 - memchr @745 - memcmp @746 - memcpy @747 - memmove @748 - memset @749 - mktime @750 - modf @751 - perror @752 - pow @753 - printf @754 - putc @755 - putchar @756 - puts @757 - putwc=fputwc @758 - putwchar=_fputwchar @759 - qsort @760 - raise @761 - rand @762 - realloc @763 - remove @764 - rename @765 - rewind @766 - scanf @767 - setbuf @768 - setlocale @769 - setvbuf @770 - signal @771 - sin @772 - sinh @773 - sprintf @774 - sqrt @775 - srand @776 - sscanf @777 - strcat @778 - strchr @779 - strcmp @780 - strcoll @781 - strcpy @782 - strcspn @783 - strerror @784 - strftime @785 - strlen @786 - strncat @787 - strncmp @788 - strncpy @789 - strpbrk @790 - strrchr @791 - strspn @792 - strstr @793 - strtod @794 - strtok @795 - strtol @796 - strtoul @797 - strxfrm @798 - swprintf @799 - swscanf @800 - system @801 - tan @802 - tanh @803 - time @804 - tmpfile @805 - tmpnam @806 - tolower @807 - toupper @808 - towlower @809 - towupper @810 - ungetc @811 - ungetwc @812 - vfprintf @813 - vfwprintf @814 - vprintf @815 - vsprintf @816 - vswprintf @817 - vwprintf @818 - wcscat @819 - wcschr @820 - wcscmp @821 - wcscoll @822 - wcscpy @823 - wcscspn @824 - wcsftime @825 - wcslen @826 - wcsncat @827 - wcsncmp @828 - wcsncpy @829 - wcspbrk @830 - wcsrchr @831 - wcsspn @832 - wcsstr @833 - wcstod @834 - wcstok @835 - wcstol @836 - wcstombs @837 - wcstoul @838 - wcsxfrm @839 - wctomb @840 - wprintf @841 - wscanf @842 - - _mbsnbcpy_s - wcscpy_s - wcsncpy_s - _ftol2=_ftol - _ftol2_sse=_ftol - strcat_s - strcpy_s - - _swprintf=swprintf diff --git a/reactos/dll/win32/msvcrt/msvcrt.spec b/reactos/dll/win32/msvcrt/msvcrt.spec new file mode 100644 index 00000000000..f44a90f609c --- /dev/null +++ b/reactos/dll/win32/msvcrt/msvcrt.spec @@ -0,0 +1,839 @@ +# msvcrt.dll - MS VC++ Run Time Library + +@ cdecl $I10_OUTPUT() MSVCRT_I10_OUTPUT +@ cdecl -i386 -norelay ??0__non_rtti_object@@QAE@ABV0@@Z(ptr) __thiscall_MSVCRT___non_rtti_object_copy_ctor +@ cdecl -i386 -norelay ??0__non_rtti_object@@QAE@PBD@Z(ptr) __thiscall_MSVCRT___non_rtti_object_ctor +@ cdecl -i386 -norelay ??0bad_cast@@QAE@ABQBD@Z(ptr) __thiscall_MSVCRT_bad_cast_ctor +@ cdecl -i386 -norelay ??0bad_cast@@QAE@ABV0@@Z(ptr) __thiscall_MSVCRT_bad_cast_copy_ctor +@ cdecl -i386 -norelay ??0bad_typeid@@QAE@ABV0@@Z(ptr) __thiscall_MSVCRT_bad_typeid_copy_ctor +@ cdecl -i386 -norelay ??0bad_typeid@@QAE@PBD@Z(ptr) __thiscall_MSVCRT_bad_typeid_ctor +@ cdecl -i386 -norelay ??0exception@@QAE@ABQBD@Z(ptr) __thiscall_MSVCRT_exception_ctor +@ cdecl -i386 -norelay ??0exception@@QAE@ABV0@@Z(ptr) __thiscall_MSVCRT_exception_copy_ctor +@ cdecl -i386 -norelay ??0exception@@QAE@XZ() __thiscall_MSVCRT_exception_default_ctor +@ cdecl -i386 -norelay ??1__non_rtti_object@@UAE@XZ() __thiscall_MSVCRT___non_rtti_object_dtor +@ cdecl -i386 -norelay ??1bad_cast@@UAE@XZ() __thiscall_MSVCRT_bad_cast_dtor +@ cdecl -i386 -norelay ??1bad_typeid@@UAE@XZ() __thiscall_MSVCRT_bad_typeid_dtor +@ cdecl -i386 -norelay ??1exception@@UAE@XZ() __thiscall_MSVCRT_exception_dtor +@ cdecl -i386 -norelay ??1type_info@@UAE@XZ() __thiscall_MSVCRT_type_info_dtor +@ cdecl ??2@YAPAXI@Z(long) MSVCRT_operator_new +@ cdecl ??_U@YAPAXI@Z(long) MSVCRT_operator_new +@ cdecl ??3@YAXPAX@Z(ptr) MSVCRT_operator_delete +@ cdecl ??_V@YAXPAX@Z(ptr) MSVCRT_operator_delete +@ cdecl -i386 -norelay ??4__non_rtti_object@@QAEAAV0@ABV0@@Z(ptr) __thiscall_MSVCRT___non_rtti_object_opequals +@ cdecl -i386 -norelay ??4bad_cast@@QAEAAV0@ABV0@@Z(ptr) __thiscall_MSVCRT_bad_cast_opequals +@ cdecl -i386 -norelay ??4bad_typeid@@QAEAAV0@ABV0@@Z(ptr) __thiscall_MSVCRT_bad_typeid_opequals +@ cdecl -i386 -norelay ??4exception@@QAEAAV0@ABV0@@Z(ptr) __thiscall_MSVCRT_exception_opequals +@ cdecl -i386 -norelay ??8type_info@@QBEHABV0@@Z(ptr) __thiscall_MSVCRT_type_info_opequals_equals +@ cdecl -i386 -norelay ??9type_info@@QBEHABV0@@Z(ptr) __thiscall_MSVCRT_type_info_opnot_equals +@ extern -i386 ??_7__non_rtti_object@@6B@ MSVCRT___non_rtti_object_vtable +@ extern -i386 ??_7bad_cast@@6B@ MSVCRT_bad_cast_vtable +@ extern -i386 ??_7bad_typeid@@6B@ MSVCRT_bad_typeid_vtable +@ extern -i386 ??_7exception@@6B@ MSVCRT_exception_vtable +@ cdecl -i386 -norelay ??_E__non_rtti_object@@UAEPAXI@Z(long) __thiscall_MSVCRT___non_rtti_object_vector_dtor +@ cdecl -i386 -norelay ??_Ebad_cast@@UAEPAXI@Z(long) __thiscall_MSVCRT_bad_cast_vector_dtor +@ cdecl -i386 -norelay ??_Ebad_typeid@@UAEPAXI@Z(long) __thiscall_MSVCRT_bad_typeid_vector_dtor +@ cdecl -i386 -norelay ??_Eexception@@UAEPAXI@Z(long) __thiscall_MSVCRT_exception_vector_dtor +@ cdecl -i386 -norelay ??_G__non_rtti_object@@UAEPAXI@Z(long) __thiscall_MSVCRT___non_rtti_object_scalar_dtor +@ cdecl -i386 -norelay ??_Gbad_cast@@UAEPAXI@Z(long) __thiscall_MSVCRT_bad_cast_scalar_dtor +@ cdecl -i386 -norelay ??_Gbad_typeid@@UAEPAXI@Z(long) __thiscall_MSVCRT_bad_typeid_scalar_dtor +@ cdecl -i386 -norelay ??_Gexception@@UAEPAXI@Z(long) __thiscall_MSVCRT_exception_scalar_dtor +@ cdecl ?_query_new_handler@@YAP6AHI@ZXZ() MSVCRT__query_new_handler +@ cdecl ?_query_new_mode@@YAHXZ() MSVCRT__query_new_mode +@ cdecl ?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z(ptr) MSVCRT__set_new_handler +@ cdecl ?_set_new_mode@@YAHH@Z(long) MSVCRT__set_new_mode +@ cdecl ?_set_se_translator@@YAP6AXIPAU_EXCEPTION_POINTERS@@@ZP6AXI0@Z@Z(ptr) MSVCRT__set_se_translator +@ cdecl -i386 -norelay ?before@type_info@@QBEHABV1@@Z(ptr) __thiscall_MSVCRT_type_info_before +@ cdecl -i386 -norelay ?name@type_info@@QBEPBDXZ() __thiscall_MSVCRT_type_info_name +@ cdecl -i386 -norelay ?raw_name@type_info@@QBEPBDXZ() __thiscall_MSVCRT_type_info_raw_name +@ cdecl ?set_new_handler@@YAP6AXXZP6AXXZ@Z(ptr) MSVCRT_set_new_handler +@ cdecl ?set_terminate@@YAP6AXXZP6AXXZ@Z(ptr) MSVCRT_set_terminate +@ cdecl ?set_unexpected@@YAP6AXXZP6AXXZ@Z(ptr) MSVCRT_set_unexpected +@ cdecl ?terminate@@YAXXZ() MSVCRT_terminate +@ cdecl ?unexpected@@YAXXZ() MSVCRT_unexpected +@ cdecl -i386 -norelay ?what@exception@@UBEPBDXZ() __thiscall_MSVCRT_what_exception +@ cdecl -arch=i386 _CIacos() +@ cdecl -arch=i386 _CIasin() +@ cdecl -arch=i386 _CIatan() +@ cdecl -arch=i386 _CIatan2() +@ cdecl -arch=i386 _CIcos() +@ cdecl -arch=i386 _CIcosh() +@ cdecl -arch=i386 _CIexp() +@ cdecl -arch=i386 _CIfmod() +@ cdecl -arch=i386 _CIlog() +@ cdecl -arch=i386 _CIlog10() +@ cdecl -arch=i386 _CIpow() +@ cdecl -arch=i386 _CIsin() +@ cdecl -arch=i386 _CIsinh() +@ cdecl -arch=i386 _CIsqrt() +@ cdecl -arch=i386 _CItan() +@ cdecl -arch=i386 _CItanh() +@ cdecl _CxxThrowException(long long) +@ cdecl -i386 -norelay _EH_prolog() +@ cdecl _Getdays() +@ cdecl _Getmonths() +@ cdecl _Gettnames() +@ extern _HUGE +@ cdecl _Strftime(str long str ptr ptr) +@ cdecl _XcptFilter(long ptr) +@ stdcall -arch=x86_64 __C_specific_handler(ptr long ptr ptr) ntdll.__C_specific_handler +@ cdecl __CppXcptFilter(long ptr) +@ cdecl __CxxDetectRethrow(ptr) +@ cdecl -i386 -norelay __CxxFrameHandler(ptr ptr ptr ptr) +# 88 56 0002AE4C __CxxFrameHandler2 +# 89 57 0002ADC8 __CxxFrameHandler3 +# 90 58 00029794 __DestructExceptionObject +@ stdcall -i386 __CxxLongjmpUnwind(ptr) +@ cdecl __CxxQueryExceptionSize() +@ cdecl __RTCastToVoid(ptr) MSVCRT___RTCastToVoid +@ cdecl __RTDynamicCast(ptr long ptr ptr long) MSVCRT___RTDynamicCast +@ cdecl __RTtypeid(ptr) MSVCRT___RTtypeid +@ cdecl __STRINGTOLD(ptr ptr str long) +#@ cdecl ___lc_codepage_func() +#@ cdecl ___lc_collate_cp_func() +#@ cdecl ___lc_handle_func() +#@ cdecl ___mb_cur_max_func() +@ cdecl ___setlc_active_func() +@ cdecl ___unguarded_readlc_active_add_func() +@ extern __argc +@ extern __argv +@ extern __badioinfo +@ cdecl __crtCompareStringA(long long str long str long) kernel32.CompareStringA +@ cdecl __crtCompareStringW(long long wstr long wstr long) kernel32.CompareStringW +@ cdecl __crtGetLocaleInfoW(long long ptr long)kernel32.GetLocaleInfo +@ cdecl __crtGetStringTypeW(long wstr long ptr) kernel32.GetStringTypeW +@ cdecl __crtLCMapStringA(long long str long ptr long long long) +# 109 6B 000414E0 __crtLCMapStringW +# 110 6C 00068CC4 __daylight +@ cdecl __dllonexit(ptr ptr ptr) +@ cdecl __doserrno() +@ cdecl __fpecode() +@ stub __get_app_type +@ cdecl __getmainargs(ptr ptr ptr long ptr) +@ extern __initenv +@ cdecl __iob_func() +@ cdecl __isascii(long) +@ cdecl __iscsym(long) +@ cdecl __iscsymf(long) +@ extern __lc_codepage +@ stub __lc_collate +@ extern __lc_collate_cp +@ extern __lc_handle +@ cdecl __lconv_init() +@ extern __mb_cur_max +@ cdecl -arch=i386 __p___argc() +@ cdecl -arch=i386 __p___argv() +@ cdecl -arch=i386 __p___initenv() +#@ cdecl -arch=i386 __p___mb_cur_max() ___mb_cur_max_func +@ cdecl -arch=i386 __p___wargv() +@ cdecl -arch=i386 __p___winitenv() +@ cdecl -arch=i386 __p__acmdln() +@ cdecl -arch=i386 __p__amblksiz() +@ cdecl -arch=i386 __p__commode() +@ cdecl -arch=i386 __p__daylight() +@ cdecl -arch=i386 __p__dstbias() +@ cdecl -arch=i386 __p__environ() +@ stub -arch=i386 __p__fileinfo #() +@ cdecl -arch=i386 __p__fmode() +@ cdecl -arch=i386 __p__iob() __iob_func +@ stub -arch=i386 __p__mbcasemap #() +@ cdecl -arch=i386 __p__mbctype() +@ cdecl -arch=i386 __p__osver() +@ cdecl -arch=i386 __p__pctype() __pctype_func +@ cdecl -arch=i386 __p__pgmptr() +@ stub -arch=i386 __p__pwctype #() +@ cdecl -arch=i386 __p__timezone() __p__timezone +@ cdecl -arch=i386 __p__tzname() +@ cdecl -arch=i386 __p__wcmdln() +@ cdecl -arch=i386 __p__wenviron() +@ cdecl -arch=i386 __p__winmajor() +@ cdecl -arch=i386 __p__winminor() +@ cdecl -arch=i386 __p__winver() +@ cdecl -arch=i386 __p__wpgmptr() +@ cdecl __pctype_func() __pctype_func +@ extern __pioinfo +@ stub __pxcptinfoptrs #() +@ cdecl __set_app_type(long) +@ extern __setlc_active +@ cdecl __setusermatherr(ptr) +@ cdecl __threadhandle() kernel32.GetCurrentThread +@ cdecl __threadid() kernel32.GetCurrentThreadId +@ cdecl __toascii(long) +@ cdecl __uncaught_exception() +@ cdecl __unDName(ptr str long ptr ptr long) +@ cdecl __unDNameEx(ptr str long ptr ptr ptr long) +@ extern __unguarded_readlc_active +@ extern __wargv +@ cdecl __wgetmainargs(ptr ptr ptr long ptr) +@ extern __winitenv +@ cdecl _abnormal_termination() +@ cdecl _access(str long) +@ extern _acmdln +@ stdcall -arch=i386 _adj_fdiv_m16i(long) +@ stdcall -arch=i386 _adj_fdiv_m32(long) +@ stdcall -arch=i386 _adj_fdiv_m32i(long) +@ stdcall -arch=i386 _adj_fdiv_m64(double) +@ cdecl -arch=i386 _adj_fdiv_r() +@ stdcall -arch=i386 _adj_fdivr_m16i(long) +@ stdcall -arch=i386 _adj_fdivr_m32(long) +@ stdcall -arch=i386 _adj_fdivr_m32i(long) +@ stdcall -arch=i386 _adj_fdivr_m64(double) +@ cdecl -arch=i386 _adj_fpatan() +@ cdecl -arch=i386 _adj_fprem() +@ cdecl -arch=i386 _adj_fprem1() +@ cdecl -arch=i386 _adj_fptan() +@ extern -arch=i386 _adjust_fdiv +# extern _aexit_rtn +@ cdecl _aligned_free(ptr) +@ cdecl _aligned_malloc(long long) +@ cdecl _aligned_offset_malloc(long long long) +@ cdecl _aligned_offset_realloc(ptr long long long) +@ cdecl _aligned_realloc(ptr long long) +@ cdecl _amsg_exit(long) +@ cdecl _assert(str str long) +@ stub _atodbl #(ptr str) +@ cdecl -ret64 _atoi64(str) ntdll._atoi64 +@ cdecl _atoldbl(ptr str) +@ cdecl _beep(long long) +@ cdecl _beginthread (ptr long ptr) +@ cdecl _beginthreadex (ptr long ptr ptr long ptr) +@ cdecl _c_exit() +@ cdecl _cabs(long) +@ cdecl _callnewh(long) +@ cdecl _cexit() +@ cdecl _cgets(str) +@ cdecl _chdir(str) +@ cdecl _chdrive(long) +@ cdecl _chgsign( double ) +@ cdecl -i386 -norelay _chkesp() +@ cdecl _chmod(str long) +@ cdecl _chsize (long long) +@ cdecl _clearfp() +@ cdecl _close(long) +@ cdecl _commit(long) +@ extern _commode +@ cdecl _control87(long long) +@ cdecl _controlfp(long long) +@ cdecl _copysign( double double ) +@ varargs _cprintf(str) +@ cdecl _cputs(str) +@ cdecl _creat(str long) +@ varargs _cscanf(str) +@ cdecl _ctime32(ptr) +@ cdecl _ctime64(ptr) +@ extern _ctype +@ cdecl _cwait(ptr long long) +@ extern _daylight +@ cdecl _difftime32(long long) +@ cdecl _difftime64(long long) +@ extern _dstbias +@ cdecl _dup (long) +@ cdecl _dup2 (long long) +@ cdecl _ecvt(double long ptr ptr) +@ cdecl _endthread () +@ cdecl _endthreadex(long) +@ extern _environ +@ cdecl _eof(long) +@ cdecl _errno() +@ cdecl _except_handler2(ptr ptr ptr ptr) +@ cdecl _except_handler3(ptr ptr ptr ptr) +@ varargs _execl(str str) +@ varargs _execle(str str) +@ varargs _execlp(str str) +@ varargs _execlpe(str str) +@ cdecl _execv(str ptr) +@ cdecl _execve(str ptr ptr) +@ cdecl _execvp(str ptr) +@ cdecl _execvpe(str ptr ptr) +@ cdecl _exit(long) +@ cdecl _expand(ptr long) +@ cdecl _fcloseall() +@ cdecl _fcvt(double long ptr ptr) +@ cdecl _fdopen(long str) +@ cdecl _fgetchar() +@ cdecl _fgetwchar() +@ cdecl _filbuf(ptr) +# extern _fileinfo +@ cdecl _filelength(long) +@ cdecl -ret64 _filelengthi64(long) +@ cdecl _fileno(ptr) +@ cdecl _findclose(long) +@ cdecl _findfirst(str ptr) +@ cdecl _findfirsti64(str ptr) +@ cdecl _findnext(long ptr) +@ cdecl _findnexti64(long ptr) +@ cdecl _finite( double ) +@ cdecl _flsbuf(long ptr) +@ cdecl _flushall() +@ extern _fmode +@ cdecl _fpclass(double) +@ stub _fpieee_flt #(long ptr ptr) +@ cdecl _fpreset() +@ cdecl _fputchar(long) +@ cdecl _fputwchar(long) +@ cdecl _fsopen(str str long) +@ cdecl _fstat(long ptr) +@ cdecl _fstat64(long ptr) +@ cdecl _fstati64(long ptr) +@ cdecl _ftime(ptr) +@ cdecl _ftime32(ptr) +@ cdecl _ftime64(ptr) +@ cdecl -ret64 _ftol() ntdll._ftol +@ cdecl -ret64 _ftol2_sse() ntdll._ftol #FIXME: SSE variant should be implemented +@ cdecl _fullpath(ptr str long) +@ cdecl _futime(long ptr) +@ cdecl _futime32(long ptr) +@ cdecl _futime64(long ptr) +@ cdecl _gcvt(double long str) +@ cdecl _get_osfhandle(long) +@ cdecl _get_sbh_threshold() +@ stub _get_terminate +@ stub _get_unexpected +@ cdecl _getch() +@ cdecl _getche() +@ cdecl _getcwd(str long) +@ cdecl _getdcwd(long str long) +@ cdecl _getdiskfree(long ptr) +@ cdecl _getdllprocaddr(long str long) +@ cdecl _getdrive() +@ cdecl _getdrives() kernel32.GetLogicalDrives +@ cdecl _getmaxstdio() +@ cdecl _getmbcp() +@ cdecl _getpid() kernel32.GetCurrentProcessId +@ stub _getsystime #(ptr) +@ cdecl _getw(ptr) +@ cdecl _getws(ptr) +@ cdecl _global_unwind2(ptr) +@ cdecl _gmtime32(ptr) +@ cdecl _gmtime64(ptr) +@ cdecl _heapadd (ptr long) +@ cdecl _heapchk() +@ cdecl _heapmin() +@ cdecl _heapset(long) +@ stub _heapused #(ptr ptr) +@ cdecl _heapwalk(ptr) +@ cdecl _hypot(double double) +@ cdecl _i64toa(long long ptr long) ntdll._i64toa +@ cdecl _i64tow(long long ptr long) ntdll._i64tow +@ cdecl _initterm(ptr ptr) +@ stub _inp #(long) -i386 +@ stub _inpd #(long) -i386 +@ stub _inpw #(long) -i386 +@ extern _iob +@ cdecl _isatty(long) +@ cdecl _isctype(long long) +@ stub _ismbbalnum #(long) +@ stub _ismbbalpha #(long) +@ stub _ismbbgraph #(long) +@ stub _ismbbkalnum #(long) +@ cdecl _ismbbkana(long) +@ stub _ismbbkprint #(long) +@ stub _ismbbkpunct #(long) +@ cdecl _ismbblead(long) +@ stub _ismbbprint #(long) +@ stub _ismbbpunct #(long) +@ cdecl _ismbbtrail(long) +@ cdecl _ismbcalnum(long) +@ cdecl _ismbcalpha(long) +@ cdecl _ismbcdigit(long) +@ cdecl _ismbcgraph(long) +@ cdecl _ismbchira(long) +@ cdecl _ismbckata(long) +@ stub _ismbcl0 #(long) +@ stub _ismbcl1 #(long) +@ stub _ismbcl2 #(long) +@ stub _ismbclegal #(long) +@ cdecl _ismbclower(long) +@ cdecl _ismbcprint(long) +@ cdecl _ismbcpunct(long) +@ cdecl _ismbcspace(long) +@ cdecl _ismbcsymbol(long) +@ cdecl _ismbcupper(long) +@ cdecl _ismbslead(ptr ptr) +@ cdecl _ismbstrail(ptr ptr) +@ cdecl _isnan( double ) +@ cdecl _itoa(long ptr long) ntdll._itoa +@ cdecl _itow(long ptr long) ntdll._itow +#@ cdecl _j0(double) +#@ cdecl _j1(double) +#@ cdecl _jn(long double) +@ cdecl _kbhit() +@ cdecl _lfind(ptr ptr ptr long ptr) +@ cdecl _loaddll(str) +@ cdecl -i386 _local_unwind2(ptr long) +@ cdecl _localtime32(ptr) +@ cdecl _localtime64(ptr) +@ cdecl _lock(long) +@ cdecl _locking(long long long) +@ cdecl _logb( double ) +@ cdecl -i386 _longjmpex(ptr long) longjmp +@ cdecl _lrotl(long long) +@ cdecl _lrotr(long long) +@ cdecl _lsearch(ptr ptr long long ptr) +@ cdecl _lseek(long long long) +@ cdecl -ret64 _lseeki64(long double long) +@ cdecl _ltoa(long ptr long) ntdll._ltoa +@ cdecl _ltow(long ptr long) ntdll._ltow +@ cdecl _makepath(ptr str str str str) +@ cdecl _matherr(ptr) +@ cdecl _mbbtombc(long) +@ cdecl _mbbtype(long long) +# extern _mbcasemap +@ cdecl _mbccpy (str str) +@ cdecl _mbcjistojms (long) +@ cdecl _mbcjmstojis (long) +@ cdecl _mbclen(ptr) +@ cdecl _mbctohira (long) +@ cdecl _mbctokata (long) +@ cdecl _mbctolower(long) +@ cdecl _mbctombb (long) +@ cdecl _mbctoupper(long) +@ extern _mbctype _mbctype +@ cdecl _mbsbtype(str long) +@ cdecl _mbscat(str str) +@ cdecl _mbschr(str long) +@ cdecl _mbscmp(str str) +@ cdecl _mbscoll(str str) +@ cdecl _mbscpy(ptr str) +@ cdecl _mbscspn (str str) +@ cdecl _mbsdec(ptr ptr) +@ cdecl _mbsdup(str) _strdup +@ cdecl _mbsicmp(str str) +@ cdecl _mbsicoll(str str) +@ cdecl _mbsinc(str) +@ cdecl _mbslen(str) +@ cdecl _mbslwr(str) +@ cdecl _mbsnbcat (str str long) +@ cdecl _mbsnbcmp(str str long) +@ cdecl _mbsnbcnt(ptr long) +@ cdecl _mbsnbcoll (str str long) +@ cdecl _mbsnbcpy(ptr str long) +@ cdecl _mbsnbcpy_s(ptr long str long) +@ cdecl _mbsnbicmp(str str long) +@ cdecl _mbsnbicoll (str str long) +@ cdecl _mbsnbset(str long long) +@ cdecl _mbsncat(str str long) +@ cdecl _mbsnccnt(str long) +@ cdecl _mbsncmp(str str long) +@ cdecl _mbsncoll (str str long) +@ cdecl _mbsncpy(str str long) +@ cdecl _mbsnextc(str) +@ cdecl _mbsnicmp(str str long) +@ cdecl _mbsnicoll (str str long) +@ cdecl _mbsninc(str long) +@ cdecl _mbsnset(str long long) +@ cdecl _mbspbrk(str str) +@ cdecl _mbsrchr(str long) +@ cdecl _mbsrev(str) +@ cdecl _mbsset(str long) +@ cdecl _mbsspn(str str) +@ cdecl _mbsspnp(str str) +@ cdecl _mbsstr(str str) +@ cdecl _mbstok(str str) +@ cdecl _mbstrlen(str) +@ cdecl _mbsupr(str) +@ cdecl _memccpy(ptr ptr long long) ntdll._memccpy +@ cdecl _memicmp(str str long) ntdll._memicmp +@ cdecl _mkdir(str) +@ cdecl _mktemp(str) +@ cdecl _mktime32(ptr) +@ cdecl _mktime64(ptr) +@ cdecl _msize(ptr) +@ cdecl _nextafter(double double) +@ cdecl _onexit(ptr) +@ varargs _open(str long) +@ cdecl _open_osfhandle(long long) +@ extern _osver +@ stub _outp #(long long) +@ stub _outpd #(long long) +@ stub _outpw #(long long) +@ cdecl _pclose (ptr) +@ extern _pctype +@ extern _pgmptr +@ cdecl _pipe (ptr long long) +@ cdecl _popen (str str) +@ cdecl _purecall() +@ cdecl _putch(long) +@ cdecl _putenv(str) +@ cdecl _putw(long ptr) +@ cdecl _putws(wstr) +# extern _pwctype +@ cdecl _read(long ptr long) +@ cdecl _rmdir(str) +@ cdecl _rmtmp() +@ cdecl _rotl(long long) +@ cdecl _rotr(long long) +@ cdecl -arch=i386 _safe_fdiv() +@ cdecl -arch=i386 _safe_fdivr() +@ cdecl -arch=i386 _safe_fprem() +@ cdecl -arch=i386 _safe_fprem1() +@ cdecl _scalb( double long) +@ cdecl _searchenv(str str ptr) +@ stdcall -i386 _seh_longjmp_unwind(ptr) +@ cdecl _set_error_mode(long) +@ cdecl _set_sbh_threshold(long) +@ cdecl _seterrormode(long) +@ cdecl -norelay _setjmp(ptr) +@ cdecl -i386 -norelay _setjmp3(ptr long) +@ cdecl _setmaxstdio(long) +@ cdecl _setmbcp(long) +@ cdecl _setmode(long long) +@ stub _setsystime #(ptr long) +@ cdecl _sleep(long) +@ varargs _snprintf(ptr long str) +@ varargs _snwprintf(ptr long wstr) +@ varargs _sopen(str long long) +@ varargs _spawnl(long str str) +@ varargs _spawnle(long str str) +@ varargs _spawnlp(long str str) +@ varargs _spawnlpe(long str str) +@ cdecl _spawnv(long str ptr) +@ cdecl _spawnve(long str ptr ptr) +@ cdecl _spawnvp(long str ptr) +@ cdecl _spawnvpe(long str ptr ptr) +@ cdecl _splitpath(str ptr ptr ptr ptr) ntdll._splitpath +@ cdecl _stat(str ptr) +@ cdecl _stat64(str ptr) +@ cdecl _stati64(str ptr) +@ cdecl _statusfp() +@ cdecl _strcmpi(str str) ntdll._strcmpi +@ cdecl _strdate(ptr) +@ cdecl _strdup(str) +@ cdecl _strerror(long) +@ cdecl _stricmp(str str) ntdll._stricmp +@ cdecl _stricoll(str str) +@ cdecl _strlwr(str) ntdll._strlwr +@ cdecl _strncoll (str str long) +@ cdecl _strnicmp(str str long) ntdll._strnicmp +@ cdecl _strnicoll (str str long) +@ cdecl _strnset(str long long) +@ cdecl _strrev(str) +@ cdecl _strset(str long) +@ cdecl _strtime(ptr) +@ cdecl _strtoui64(ptr ptr long) strtoull +@ cdecl _strupr(str) ntdll._strupr +@ cdecl _swab(str str long) +@ extern _sys_errlist +@ extern _sys_nerr +@ cdecl _tell(long) +@ cdecl -ret64 _telli64(long) +@ cdecl _tempnam(str str) +@ cdecl _time32(ptr) +@ cdecl _time64(ptr) +@ extern _timezone +@ cdecl _tolower(long) +@ cdecl _toupper(long) +@ extern _tzname +@ cdecl _tzset() +@ cdecl _ui64toa(long long ptr long) ntdll._ui64toa +@ cdecl _ui64tow(long long ptr long) ntdll._ui64tow +@ cdecl _ultoa(long ptr long) ntdll._ultoa +@ cdecl _ultow(long ptr long) ntdll._ultow +@ cdecl _umask(long) +@ cdecl _ungetch(long) +@ cdecl _unlink(str) +@ cdecl _unloaddll(long) +@ cdecl _unlock(long) +@ cdecl _utime32(str ptr) +@ cdecl _utime64(str ptr) +@ cdecl _utime(str ptr) +#@ cdecl _vscprintf(str ptr) +#@ cdecl _vscwprintf(wstr ptr) +@ cdecl _vsnprintf(ptr long str ptr) +@ cdecl _vsnwprintf(ptr long wstr ptr) +@ cdecl _waccess(wstr long) +@ cdecl _wasctime(ptr) +@ cdecl _wchdir(wstr) +@ cdecl _wchmod(wstr long) +@ extern _wcmdln +@ cdecl _wcreat(wstr long) +@ cdecl _wcsdup(wstr) +@ cdecl _wcsicmp(wstr wstr) ntdll._wcsicmp +@ cdecl _wcsicoll(wstr wstr) +@ cdecl _wcslwr(wstr) ntdll._wcslwr +@ cdecl _wcsncoll (wstr wstr long) +@ cdecl _wcsnicmp(wstr wstr long) ntdll._wcsnicmp +@ cdecl _wcsnicoll (wstr wstr long) +@ cdecl _wcsnset(wstr long long) +@ cdecl _wcsrev(wstr) +@ cdecl _wcsset(wstr long) +@ cdecl _wcsupr(wstr) ntdll._wcsupr +@ cdecl _wcsupr_s(wstr long) +@ cdecl _wctime(ptr) +@ cdecl _wctime32(ptr) +@ cdecl _wctime64(ptr) +@ extern _wenviron +@ varargs _wexecl(wstr wstr) +@ varargs _wexecle(wstr wstr) +@ varargs _wexeclp(wstr wstr) +@ varargs _wexeclpe(wstr wstr) +@ cdecl _wexecv(wstr ptr) +@ cdecl _wexecve(wstr ptr ptr) +@ cdecl _wexecvp(wstr ptr) +@ cdecl _wexecvpe(wstr ptr ptr) +@ cdecl _wfdopen(long wstr) +@ cdecl _wfindfirst(wstr ptr) +@ cdecl _wfindfirsti64(wstr ptr) +@ cdecl _wfindnext(long ptr) +@ cdecl _wfindnexti64(long ptr) +@ cdecl _wfopen(wstr wstr) +@ cdecl _wfreopen(wstr wstr ptr) +@ cdecl _wfsopen(wstr wstr long) +@ cdecl _wfullpath(ptr wstr long) +@ cdecl _wgetcwd(wstr long) +@ cdecl _wgetdcwd(long wstr long) +@ cdecl _wgetenv(wstr) +@ extern _winmajor +@ extern _winminor +@ extern _winver +@ cdecl _wmakepath(wstr wstr wstr wstr wstr) +@ cdecl _wmkdir(wstr) +@ cdecl _wmktemp(wstr) +@ varargs _wopen(wstr long) +@ stub _wperror #(wstr) +@ extern _wpgmptr +@ cdecl _wpopen (wstr wstr) +@ cdecl _wputenv(wstr) +@ cdecl _wremove(wstr) +@ cdecl _wrename(wstr wstr) +@ cdecl _write(long ptr long) +@ cdecl _wrmdir(wstr) +@ cdecl _wsearchenv(wstr wstr ptr) +@ cdecl _wsetlocale(long wstr) +@ varargs _wsopen (wstr long long) +@ varargs _wspawnl(long wstr wstr) +@ varargs _wspawnle(long wstr wstr) +@ varargs _wspawnlp(long wstr wstr) +@ varargs _wspawnlpe(long wstr wstr) +@ cdecl _wspawnv(long wstr ptr) +@ cdecl _wspawnve(long wstr ptr ptr) +@ cdecl _wspawnvp(long wstr ptr) +@ cdecl _wspawnvpe(long wstr ptr ptr) +@ cdecl _wsplitpath(wstr ptr ptr ptr ptr) +#@ cdecl _wsplitpath_s(wstr ptr long ptr long ptr long ptr long) +@ cdecl _wstat(wstr ptr) +@ cdecl _wstati64(wstr ptr) +@ cdecl _wstat64(wstr ptr) +@ cdecl _wstrdate(ptr) +@ cdecl _wstrtime(ptr) +@ cdecl _wsystem(wstr) +@ cdecl _wtempnam(wstr wstr) +@ stub _wtmpnam #(ptr) +@ cdecl _wtoi(wstr) ntdll._wtoi +@ cdecl _wtoi64(wstr) ntdll._wtoi64 +@ cdecl _wtol(wstr) ntdll._wtol +@ cdecl _wunlink(wstr) +@ cdecl _wutime(wstr ptr) +@ cdecl _wutime32(wstr ptr) +@ cdecl _wutime64(wstr ptr) +#@ cdecl _y0(double) +#@ cdecl _y1(double) +#@ cdecl _yn(long double ) +@ cdecl abort() +@ cdecl abs(long) ntdll.abs +@ cdecl acos(double) +@ cdecl asctime(ptr) +@ cdecl asin(double) +@ cdecl atan(double) +@ cdecl atan2(double double) +@ cdecl atexit(ptr) +@ cdecl atof(str) +@ cdecl atoi(str) ntdll.atoi +@ cdecl atol(str) ntdll.atol +@ cdecl bsearch(ptr ptr long long ptr) ntdll.bsearch +@ cdecl calloc(long long) +@ cdecl ceil(double) +@ cdecl ceilf(double) +@ cdecl clearerr(ptr) +@ cdecl clock() +@ cdecl cos(double) +@ cdecl cosh(double) +@ cdecl cosf(double) +@ cdecl ctime(ptr) +@ cdecl difftime(long long) +@ cdecl div(long long) +@ cdecl exit(long) +@ cdecl exp(double) +@ cdecl fabs(double) +@ cdecl fclose(ptr) +@ cdecl feof(ptr) +@ cdecl ferror(ptr) +@ cdecl fflush(ptr) +@ cdecl fgetc(ptr) +@ cdecl fgetpos(ptr ptr) +@ cdecl fgets(ptr long ptr) +@ cdecl fgetwc(ptr) +@ cdecl fgetws(ptr long ptr) +@ cdecl floor(double) +@ cdecl fmod(double double) +@ cdecl fmodf(double double) +@ cdecl fopen(str str) +@ varargs fprintf(ptr str) +@ cdecl fputc(long ptr) +@ cdecl fputs(str ptr) +@ cdecl fputwc(long ptr) +@ cdecl fputws(wstr ptr) +@ cdecl fread(ptr long long ptr) +@ cdecl free(ptr) +@ cdecl freopen(str str ptr) +@ cdecl frexp(double ptr) +@ varargs fscanf(ptr str) +@ cdecl fseek(ptr long long) +@ cdecl fsetpos(ptr ptr) +@ cdecl ftell(ptr) +@ varargs fwprintf(ptr wstr) +@ cdecl fwrite(ptr long long ptr) +@ varargs fwscanf(ptr wstr) +@ cdecl getc(ptr) +@ cdecl getchar() +@ cdecl getenv(str) +@ cdecl gets(str) +@ cdecl getwc(ptr) +@ cdecl getwchar() +@ cdecl gmtime(ptr) +@ cdecl is_wctype(long long) ntdll.iswctype +@ cdecl isalnum(long) +@ cdecl isalpha(long) +@ cdecl iscntrl(long) +@ cdecl isdigit(long) +@ cdecl isgraph(long) +@ cdecl isleadbyte(long) +@ cdecl islower(long) +@ cdecl isprint(long) +@ cdecl ispunct(long) +@ cdecl isspace(long) +@ cdecl isupper(long) +@ cdecl iswalnum(long) +@ cdecl iswalpha(long) ntdll.iswalpha +@ cdecl iswascii(long) +@ cdecl iswcntrl(long) +@ cdecl iswctype(long long) ntdll.iswctype +@ cdecl iswdigit(long) +@ cdecl iswgraph(long) +@ cdecl iswlower(long) +@ cdecl iswprint(long) +@ cdecl iswpunct(long) +@ cdecl iswspace(long) +@ cdecl iswupper(long) +@ cdecl iswxdigit(long) +@ cdecl isxdigit(long) +@ cdecl labs(long) ntdll.labs +@ cdecl ldexp( double long) +@ cdecl ldiv(long long) +@ cdecl localeconv() +@ cdecl localtime(ptr) +@ cdecl log(double) +@ cdecl logf(double) +@ cdecl log10(double) +@ cdecl longjmp(ptr long) +@ cdecl malloc(long) +@ cdecl mblen(ptr long) +@ cdecl mbstowcs(ptr str long) ntdll.mbstowcs +@ cdecl mbtowc(wstr str long) +@ cdecl memchr(ptr long long) ntdll.memchr +@ cdecl memcmp(ptr ptr long) ntdll.memcmp +@ cdecl memcpy(ptr ptr long) ntdll.memcpy +@ cdecl memmove(ptr ptr long) ntdll.memmove +@ cdecl memset(ptr long long) ntdll.memset +@ cdecl mktime(ptr) +@ cdecl modf(double ptr) +@ cdecl perror(str) +@ cdecl pow(double double) +@ varargs printf(str) +@ cdecl putc(long ptr) +@ cdecl putchar(long) +@ cdecl puts(str) +@ cdecl putwc(long ptr) fputwc #redirection is hack +@ cdecl putwchar(long) _fputwchar #redirection is hack +@ cdecl qsort(ptr long long ptr) ntdll.qsort +@ cdecl raise(long) +@ cdecl rand() +#@ cdecl rand_s(ptr) +@ cdecl realloc(ptr long) +@ cdecl remove(str) +@ cdecl rename(str str) +@ cdecl rewind(ptr) +@ varargs scanf(str) +@ cdecl setbuf(ptr ptr) +@ cdecl setlocale(long str) +@ cdecl setvbuf(ptr str long long) +@ cdecl signal(long long) +@ cdecl sin(double) +@ cdecl sinh(double) +@ varargs sprintf(ptr str) +#@ varargs sprintf_s(ptr long str) +@ cdecl sqrt(double) +@ cdecl sqrtf(double) +@ cdecl srand(long) +@ varargs sscanf(str str) +@ cdecl strcat(str str) ntdll.strcat +@ cdecl strcat_s(str long str) +@ cdecl strchr(str long) ntdll.strchr +@ cdecl strcmp(str str) ntdll.strcmp +@ cdecl strcoll(str str) +@ cdecl strcpy(ptr str) ntdll.strcpy +@ cdecl strcpy_s(ptr long str) +@ cdecl strcspn(str str) ntdll.strcspn +@ cdecl strerror(long) +@ cdecl strftime(str long str ptr) +@ cdecl strlen(str) ntdll.strlen +@ cdecl strncat(str str long) ntdll.strncat +@ cdecl strncmp(str str long) ntdll.strncmp +@ cdecl strncpy(ptr str long) ntdll.strncpy +@ cdecl strpbrk(str str) ntdll.strpbrk +@ cdecl strrchr(str long) ntdll.strrchr +@ cdecl strspn(str str) ntdll.strspn +@ cdecl strstr(str str) ntdll.strstr +@ cdecl strtod(str ptr) +@ cdecl strtok(str str) +@ cdecl strtol(str ptr long) +@ cdecl strtoul(str ptr long) +@ cdecl strxfrm(ptr str long) +@ varargs swprintf(ptr wstr) +@ varargs swscanf(wstr wstr) +@ cdecl system(str) +@ cdecl tan(double) +@ cdecl tanh(double) +@ cdecl time(ptr) +@ cdecl tmpfile() +@ cdecl tmpnam(ptr) +@ cdecl tolower(long) ntdll.tolower +@ cdecl toupper(long) ntdll.toupper +@ cdecl towlower(long) ntdll.towlower +@ cdecl towupper(long) ntdll.towupper +@ cdecl ungetc(long ptr) +@ cdecl ungetwc(long ptr) +@ cdecl vfprintf(ptr str ptr) +@ cdecl vfwprintf(ptr wstr ptr) +@ cdecl vprintf(str ptr) +@ cdecl vsprintf(ptr str ptr) +#@ cdecl vsprintf_s(ptr long str ptr) +@ cdecl vswprintf(ptr wstr ptr) +#@ cdecl vswprintf_s(ptr long wstr ptr) +@ cdecl vwprintf(wstr ptr) +@ cdecl wcscat(wstr wstr) ntdll.wcscat +#@ cdecl wcscat_s(wstr long wstr) +@ cdecl wcschr(wstr long) ntdll.wcschr +@ cdecl wcscmp(wstr wstr) ntdll.wcscmp +@ cdecl wcscoll(wstr wstr) +@ cdecl wcscpy(ptr wstr) ntdll.wcscpy +@ cdecl wcscpy_s(ptr long wstr) +@ cdecl wcscspn(wstr wstr) ntdll.wcscspn +@ cdecl wcsftime(ptr long wstr ptr) +@ cdecl wcslen(wstr) ntdll.wcslen +@ cdecl wcsncat(wstr wstr long) ntdll.wcsncat +@ cdecl wcsncmp(wstr wstr long) ntdll.wcsncmp +@ cdecl wcsncpy(ptr wstr long) ntdll.wcsncpy +@ cdecl wcsncpy_s(ptr long wstr long) +@ cdecl wcspbrk(wstr wstr) +@ cdecl wcsrchr(wstr long) ntdll.wcsrchr +@ cdecl wcsspn(wstr wstr) ntdll.wcsspn +@ cdecl wcsstr(wstr wstr) ntdll.wcsstr +@ cdecl wcstod(wstr ptr) +@ cdecl wcstok(wstr wstr) +@ cdecl wcstol(wstr ptr long) ntdll.wcstol +@ cdecl wcstombs(ptr ptr long) ntdll.wcstombs +@ cdecl wcstoul(wstr ptr long) ntdll.wcstoul +@ stub wcsxfrm #(ptr wstr long) +@ cdecl wctomb(ptr long) +@ varargs wprintf(wstr) +@ varargs wscanf(wstr) From 3ec17c4a18645c3d306a9b2aee77a080965b6092 Mon Sep 17 00:00:00 2001 From: Samuel Serapion Date: Mon, 25 Jan 2010 11:54:37 +0000 Subject: [PATCH 054/121] Fix amd64 libcntpr. svn path=/branches/ros-amd64-bringup/; revision=45247 --- reactos/lib/sdk/crt/libcntpr.rbuild | 2 ++ reactos/lib/sdk/crt/math/i386/floor.S | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/reactos/lib/sdk/crt/libcntpr.rbuild b/reactos/lib/sdk/crt/libcntpr.rbuild index 7bb24736d16..b3714aade69 100644 --- a/reactos/lib/sdk/crt/libcntpr.rbuild +++ b/reactos/lib/sdk/crt/libcntpr.rbuild @@ -61,6 +61,7 @@ ceil.S cos.S + floor.S log.S log10.S sin.S @@ -68,6 +69,7 @@ alldiv.S + pow.S abs.c diff --git a/reactos/lib/sdk/crt/math/i386/floor.S b/reactos/lib/sdk/crt/math/i386/floor.S index 8f6ccff190b..f70b70d0db1 100644 --- a/reactos/lib/sdk/crt/math/i386/floor.S +++ b/reactos/lib/sdk/crt/math/i386/floor.S @@ -11,9 +11,9 @@ #else .align 4 #endif -.globl floor - .def floor; .scl 2; .type 32; .endef -floor: +.globl _floor + .def _floor; .scl 2; .type 32; .endef +_floor: #ifdef _WIN64 fldt (%rdx) subq $24,%rsp From 9c9f4a9fd767dd4d430d54bc59a2c7efab84545a Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Mon, 25 Jan 2010 22:01:02 +0000 Subject: [PATCH 055/121] Revert r45245 - r45247 Although the idea of using mingw-w64's routines is good, we can't because it's using x87. We need SSE2. svn path=/branches/ros-amd64-bringup/; revision=45255 --- reactos/dll/win32/gdiplus/gdiplus.rbuild | 3 + reactos/dll/win32/msvcrt/dllmain.c | 2 +- reactos/dll/win32/msvcrt/msvcrt-amd64.def | 850 +++++++++++++++++ reactos/dll/win32/msvcrt/msvcrt-i386.def | 860 ++++++++++++++++++ reactos/dll/win32/msvcrt/msvcrt.rbuild | 2 +- reactos/dll/win32/msvcrt/msvcrt.spec | 839 ----------------- reactos/include/crt/math.h | 25 +- reactos/lib/sdk/crt/crt.rbuild | 98 +- reactos/lib/sdk/crt/except/cppexcept.c | 8 - reactos/lib/sdk/crt/except/i386/unwind.c | 18 +- reactos/lib/sdk/crt/libcntpr.rbuild | 43 +- reactos/lib/sdk/crt/math/acosf.c | 29 - reactos/lib/sdk/crt/math/amd64/atan.S | 21 + reactos/lib/sdk/crt/math/amd64/atan2.S | 21 + reactos/lib/sdk/crt/math/amd64/ceil.S | 21 + reactos/lib/sdk/crt/math/amd64/ceilf.S | 40 + reactos/lib/sdk/crt/math/amd64/cos.S | 21 + reactos/lib/sdk/crt/math/amd64/exp.S | 21 + reactos/lib/sdk/crt/math/amd64/fabs.S | 21 + reactos/lib/sdk/crt/math/amd64/floor.S | 21 + reactos/lib/sdk/crt/math/amd64/floorf.S | 40 + reactos/lib/sdk/crt/math/amd64/fmod.S | 21 + reactos/lib/sdk/crt/math/amd64/fmodf.S | 21 + reactos/lib/sdk/crt/math/amd64/ldexp.S | 21 + reactos/lib/sdk/crt/math/amd64/log.S | 21 + reactos/lib/sdk/crt/math/amd64/log10.S | 21 + reactos/lib/sdk/crt/math/amd64/sin.S | 21 + reactos/lib/sdk/crt/math/amd64/sqrt.S | 21 + reactos/lib/sdk/crt/math/amd64/sqrtf.S | 20 + reactos/lib/sdk/crt/math/amd64/tan.S | 21 + reactos/lib/sdk/crt/math/asinf.c | 27 - reactos/lib/sdk/crt/math/atan.c | 18 - reactos/lib/sdk/crt/math/atan2.c | 16 - reactos/lib/sdk/crt/math/atan2f.c | 22 - reactos/lib/sdk/crt/math/atanf.c | 23 - reactos/lib/sdk/crt/math/copysign.c | 21 - reactos/lib/sdk/crt/math/copysignf.c | 19 - reactos/lib/sdk/crt/math/cosf.c | 11 - reactos/lib/sdk/crt/math/exp.c | 55 -- reactos/lib/sdk/crt/math/expf.c | 10 - reactos/lib/sdk/crt/math/fabs.c | 16 - reactos/lib/sdk/crt/math/fmod.c | 21 - reactos/lib/sdk/crt/math/fmodf.c | 29 - reactos/lib/sdk/crt/math/hypotf.c | 12 - reactos/lib/sdk/crt/math/i386/atan_asm.s | 50 + reactos/lib/sdk/crt/math/i386/ceil.S | 54 -- reactos/lib/sdk/crt/math/i386/ceil_asm.s | 57 ++ reactos/lib/sdk/crt/math/i386/ceilf.S | 54 -- reactos/lib/sdk/crt/math/i386/cos.S | 53 -- reactos/lib/sdk/crt/math/i386/cos_asm.s | 49 + reactos/lib/sdk/crt/math/i386/fabs_asm.s | 49 + reactos/lib/sdk/crt/math/i386/floor.S | 62 -- reactos/lib/sdk/crt/math/i386/floorf.S | 61 -- reactos/lib/sdk/crt/math/i386/log.S | 65 -- reactos/lib/sdk/crt/math/i386/log10.S | 92 -- reactos/lib/sdk/crt/math/i386/log10_asm.s | 27 + reactos/lib/sdk/crt/math/i386/log_asm.s | 51 ++ reactos/lib/sdk/crt/math/i386/sin.S | 57 -- reactos/lib/sdk/crt/math/i386/sin_asm.s | 49 + reactos/lib/sdk/crt/math/i386/sqrt_asm.s | 49 + reactos/lib/sdk/crt/math/i386/tan.S | 61 -- reactos/lib/sdk/crt/math/i386/tan_asm.s | 52 ++ reactos/lib/sdk/crt/math/j0_y0.c | 30 + reactos/lib/sdk/crt/math/j1_y1.c | 30 + reactos/lib/sdk/crt/math/jn_yn.c | 30 + reactos/lib/sdk/crt/math/log10f.c | 11 - reactos/lib/sdk/crt/math/logb.c | 23 - reactos/lib/sdk/crt/math/logbf.c | 23 - reactos/lib/sdk/crt/math/logf.c | 11 - reactos/lib/sdk/crt/math/modff.c | 27 - reactos/lib/sdk/crt/math/nextafter.c | 66 -- reactos/lib/sdk/crt/math/nextafterf.c | 32 - .../lib/sdk/crt/math/{ldexp.c => pow_asm.c} | 23 +- reactos/lib/sdk/crt/math/powf.c | 10 - reactos/lib/sdk/crt/math/sinf.c | 11 - reactos/lib/sdk/crt/math/sinhf.c | 10 - reactos/lib/sdk/crt/math/sqrt.c | 25 - reactos/lib/sdk/crt/math/sqrtf.c | 23 - reactos/lib/sdk/crt/math/tanf.c | 11 - reactos/lib/sdk/crt/math/tanhf.c | 10 - reactos/lib/sdk/crt/stdio/file.c | 11 +- reactos/lib/sdk/crt/string/ctype.c | 8 +- reactos/lib/sdk/crt/time/asctime.c | 1 - reactos/lib/sdk/crt/time/ctime.c | 2 +- reactos/lib/sdk/crt/time/utime.c | 2 +- 85 files changed, 2786 insertions(+), 2128 deletions(-) create mode 100644 reactos/dll/win32/msvcrt/msvcrt-amd64.def create mode 100644 reactos/dll/win32/msvcrt/msvcrt-i386.def delete mode 100644 reactos/dll/win32/msvcrt/msvcrt.spec delete mode 100644 reactos/lib/sdk/crt/math/acosf.c create mode 100644 reactos/lib/sdk/crt/math/amd64/atan.S create mode 100644 reactos/lib/sdk/crt/math/amd64/atan2.S create mode 100644 reactos/lib/sdk/crt/math/amd64/ceil.S create mode 100644 reactos/lib/sdk/crt/math/amd64/ceilf.S create mode 100644 reactos/lib/sdk/crt/math/amd64/cos.S create mode 100644 reactos/lib/sdk/crt/math/amd64/exp.S create mode 100644 reactos/lib/sdk/crt/math/amd64/fabs.S create mode 100644 reactos/lib/sdk/crt/math/amd64/floor.S create mode 100644 reactos/lib/sdk/crt/math/amd64/floorf.S create mode 100644 reactos/lib/sdk/crt/math/amd64/fmod.S create mode 100644 reactos/lib/sdk/crt/math/amd64/fmodf.S create mode 100644 reactos/lib/sdk/crt/math/amd64/ldexp.S create mode 100644 reactos/lib/sdk/crt/math/amd64/log.S create mode 100644 reactos/lib/sdk/crt/math/amd64/log10.S create mode 100644 reactos/lib/sdk/crt/math/amd64/sin.S create mode 100644 reactos/lib/sdk/crt/math/amd64/sqrt.S create mode 100644 reactos/lib/sdk/crt/math/amd64/sqrtf.S create mode 100644 reactos/lib/sdk/crt/math/amd64/tan.S delete mode 100644 reactos/lib/sdk/crt/math/asinf.c delete mode 100644 reactos/lib/sdk/crt/math/atan.c delete mode 100644 reactos/lib/sdk/crt/math/atan2.c delete mode 100644 reactos/lib/sdk/crt/math/atan2f.c delete mode 100644 reactos/lib/sdk/crt/math/atanf.c delete mode 100644 reactos/lib/sdk/crt/math/copysign.c delete mode 100644 reactos/lib/sdk/crt/math/copysignf.c delete mode 100644 reactos/lib/sdk/crt/math/cosf.c delete mode 100644 reactos/lib/sdk/crt/math/exp.c delete mode 100644 reactos/lib/sdk/crt/math/expf.c delete mode 100644 reactos/lib/sdk/crt/math/fabs.c delete mode 100644 reactos/lib/sdk/crt/math/fmod.c delete mode 100644 reactos/lib/sdk/crt/math/fmodf.c delete mode 100644 reactos/lib/sdk/crt/math/hypotf.c create mode 100644 reactos/lib/sdk/crt/math/i386/atan_asm.s delete mode 100644 reactos/lib/sdk/crt/math/i386/ceil.S create mode 100644 reactos/lib/sdk/crt/math/i386/ceil_asm.s delete mode 100644 reactos/lib/sdk/crt/math/i386/ceilf.S delete mode 100644 reactos/lib/sdk/crt/math/i386/cos.S create mode 100644 reactos/lib/sdk/crt/math/i386/cos_asm.s create mode 100644 reactos/lib/sdk/crt/math/i386/fabs_asm.s delete mode 100644 reactos/lib/sdk/crt/math/i386/floor.S delete mode 100644 reactos/lib/sdk/crt/math/i386/floorf.S delete mode 100644 reactos/lib/sdk/crt/math/i386/log.S delete mode 100644 reactos/lib/sdk/crt/math/i386/log10.S create mode 100644 reactos/lib/sdk/crt/math/i386/log10_asm.s create mode 100644 reactos/lib/sdk/crt/math/i386/log_asm.s delete mode 100644 reactos/lib/sdk/crt/math/i386/sin.S create mode 100644 reactos/lib/sdk/crt/math/i386/sin_asm.s create mode 100644 reactos/lib/sdk/crt/math/i386/sqrt_asm.s delete mode 100644 reactos/lib/sdk/crt/math/i386/tan.S create mode 100644 reactos/lib/sdk/crt/math/i386/tan_asm.s create mode 100644 reactos/lib/sdk/crt/math/j0_y0.c create mode 100644 reactos/lib/sdk/crt/math/j1_y1.c create mode 100644 reactos/lib/sdk/crt/math/jn_yn.c delete mode 100644 reactos/lib/sdk/crt/math/log10f.c delete mode 100644 reactos/lib/sdk/crt/math/logb.c delete mode 100644 reactos/lib/sdk/crt/math/logbf.c delete mode 100644 reactos/lib/sdk/crt/math/logf.c delete mode 100644 reactos/lib/sdk/crt/math/modff.c delete mode 100644 reactos/lib/sdk/crt/math/nextafter.c delete mode 100644 reactos/lib/sdk/crt/math/nextafterf.c rename reactos/lib/sdk/crt/math/{ldexp.c => pow_asm.c} (73%) delete mode 100644 reactos/lib/sdk/crt/math/powf.c delete mode 100644 reactos/lib/sdk/crt/math/sinf.c delete mode 100644 reactos/lib/sdk/crt/math/sinhf.c delete mode 100644 reactos/lib/sdk/crt/math/sqrt.c delete mode 100644 reactos/lib/sdk/crt/math/sqrtf.c delete mode 100644 reactos/lib/sdk/crt/math/tanf.c delete mode 100644 reactos/lib/sdk/crt/math/tanhf.c diff --git a/reactos/dll/win32/gdiplus/gdiplus.rbuild b/reactos/dll/win32/gdiplus/gdiplus.rbuild index d6daa4d7b7b..cc07c8c5d35 100644 --- a/reactos/dll/win32/gdiplus/gdiplus.rbuild +++ b/reactos/dll/win32/gdiplus/gdiplus.rbuild @@ -28,5 +28,8 @@ gdi32 windowscodecs ntdll + + crt + diff --git a/reactos/dll/win32/msvcrt/dllmain.c b/reactos/dll/win32/msvcrt/dllmain.c index caca7c1fb86..99822fc46a7 100644 --- a/reactos/dll/win32/msvcrt/dllmain.c +++ b/reactos/dll/win32/msvcrt/dllmain.c @@ -19,7 +19,7 @@ * $Date$ * */ -#define _CRTBLD + #include #include #include diff --git a/reactos/dll/win32/msvcrt/msvcrt-amd64.def b/reactos/dll/win32/msvcrt/msvcrt-amd64.def new file mode 100644 index 00000000000..61b42844390 --- /dev/null +++ b/reactos/dll/win32/msvcrt/msvcrt-amd64.def @@ -0,0 +1,850 @@ +; +; ReactOS MSVCRT Library +; +LIBRARY msvcrt.dll + +EXPORTS + $I10_OUTPUT=MSVCRT_I10_OUTPUT @57 + ??0__non_rtti_object@@QAE@ABV0@@Z=MSVCRT___non_rtti_object_copy_ctor @1 + ??0__non_rtti_object@@QAE@PBD@Z=MSVCRT___non_rtti_object_ctor @2 +; ??0bad_cast@@AAE@PBQBD@Z @3 + ??0bad_cast@@QAE@ABQBD@Z=MSVCRT_bad_cast_ctor @4 + ??0bad_cast@@QAE@ABV0@@Z=MSVCRT_bad_cast_copy_ctor @5 +; ??0bad_cast@@QAE@PBD@Z @6 + ??0bad_typeid@@QAE@ABV0@@Z=MSVCRT_bad_typeid_copy_ctor @7 + ??0bad_typeid@@QAE@PBD@Z=MSVCRT_bad_typeid_ctor @8 + ??0exception@@QAE@ABQBD@Z=MSVCRT_exception_ctor @9 +; ??0exception@@QAE@ABQBDH@Z @10 + ??0exception@@QAE@ABV0@@Z=MSVCRT_exception_copy_ctor @11 + ??0exception@@QAE@XZ=MSVCRT_exception_default_ctor @12 + ??1__non_rtti_object@@UAE@XZ=MSVCRT___non_rtti_object_dtor @13 + ??1bad_cast@@UAE@XZ=MSVCRT_bad_cast_dtor @14 + ??1bad_typeid@@UAE@XZ=MSVCRT_bad_typeid_dtor @15 + ??1exception@@UAE@XZ=MSVCRT_exception_dtor @16 + ??1type_info@@UAE@XZ=MSVCRT_type_info_dtor @17 + ??2@YAPAXI@Z=MSVCRT_operator_new @18 + ??3@YAXPAX@Z=MSVCRT_operator_delete @19 + ??4__non_rtti_object@@QAEAAV0@ABV0@@Z=MSVCRT___non_rtti_object_opequals @20 + ??4bad_cast@@QAEAAV0@ABV0@@Z=MSVCRT_bad_cast_opequals @21 + ??4bad_typeid@@QAEAAV0@ABV0@@Z=MSVCRT_bad_typeid_opequals @22 + ??4exception@@QAEAAV0@ABV0@@Z=MSVCRT_exception_opequals @23 + ??8type_info@@QBEHABV0@@Z=MSVCRT_type_info_opequals_equals @24 + ??9type_info@@QBEHABV0@@Z=MSVCRT_type_info_opnot_equals @25 + ??_7__non_rtti_object@@6B@=MSVCRT___non_rtti_object_vtable@@6B@ @26 DATA + ??_7bad_cast@@6B@=MSVCRT_bad_cast_vtable @27 DATA + ??_7bad_typeid@@6B@=MSVCRT_bad_typeid_vtable @28 DATA + ??_7exception@@6B@=MSVCRT_exception_vtable @29 DATA + ??_E__non_rtti_object@@UAEPAXI@Z=MSVCRT___non_rtti_object_vector_dtor @30 + ??_Ebad_cast@@UAEPAXI@Z=MSVCRT_bad_cast_vector_dtor @31 + ??_Ebad_typeid@@UAEPAXI@Z=MSVCRT_bad_typeid_vector_dtor @32 + ??_Eexception@@UAEPAXI@Z=MSVCRT_exception_vector_dtor @33 +; ??_Fbad_cast@@QAEXXZ @34 +; ??_Fbad_typeid@@QAEXXZ @35 + ??_G__non_rtti_object@@UAEPAXI@Z=MSVCRT___non_rtti_object_scalar_dtor @36 + ??_Gbad_cast@@UAEPAXI@Z=MSVCRT_bad_cast_scalar_dtor @37 + ??_Gbad_typeid@@UAEPAXI@Z=MSVCRT_bad_typeid_scalar_dtor @38 + ??_Gexception@@UAEPAXI@Z=MSVCRT_exception_scalar_dtor @39 + ??_U@YAPAXI@Z=MSVCRT_operator_new @40 + ??_V@YAXPAX@Z=MSVCRT_operator_delete @41 + ?_query_new_handler@@YAP6AHI@ZXZ=MSVCRT__query_new_handler @43 + ?_query_new_mode@@YAHXZ=MSVCRT__query_new_mode @44 + ?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z=MSVCRT__set_new_handler @45 + ?_set_new_mode@@YAHH@Z=MSVCRT__set_new_mode @46 + ?_set_se_translator@@YAP6AXIPAU_EXCEPTION_POINTERS@@@ZP6AXI0@Z@Z=MSVCRT__set_se_translator @47 + ?before@type_info@@QBEHABV1@@Z=MSVCRT_type_info_before @48 + ?name@type_info@@QBEPBDXZ=MSVCRT_type_info_name @49 + ?raw_name@type_info@@QBEPBDXZ=MSVCRT_type_info_raw_name @50 + ?set_new_handler@@YAP6AXXZP6AXXZ@Z=MSVCRT__set_new_handler @51 + ?set_terminate@@YAP6AXXZP6AXXZ@Z=MSVCRT_set_terminate @52 + ?set_unexpected@@YAP6AXXZP6AXXZ@Z=MSVCRT_set_unexpected @53 + ?terminate@@YAXXZ=MSVCRT_terminate @54 + ?unexpected@@YAXXZ=MSVCRT_unexpected @55 + ?what@exception@@UBEPBDXZ=MSVCRT_what_exception @56 + _CIacos @58 + _CIasin @59 + _CIatan @60 + _CIatan2 @61 + _CIcos @62 + _CIcosh @63 + _CIexp @64 + _CIfmod @65 + _CIlog @66 + _CIlog10 @67 + _CIpow @68 + _CIsin @69 + _CIsinh @70 + _CIsqrt @71 + _CItan @72 + _CItanh @73 + _CxxThrowException @74 +; _EH_prolog @75 ??? + _Getdays @76 + _Getmonths @77 + _Gettnames @78 + _HUGE @79 DATA + _Strftime @80 + _XcptFilter @81 + __CppXcptFilter @82 +; __CxxCallUnwindDtor @83 +; __CxxCallUnwindVecDtor @84 + __CxxDetectRethrow @85 +; __CxxExceptionFilter @86 +; __CxxFrameHandler @87 ??? +; __CxxFrameHandler2 @88 +; __CxxLongjmpUnwind @89 ??? + __CxxQueryExceptionSize @90 +; __CxxRegisterExceptionObject @91 +; __CxxUnregisterExceptionObject @92 +; __DestructExceptionObject @93 + __RTCastToVoid=MSVCRT___RTCastToVoid @94 + __RTDynamicCast=MSVCRT___RTDynamicCast @95 + __RTtypeid=MSVCRT___RTtypeid @96 + __STRINGTOLD @97 +; ___lc_codepage_func @98 +; ___lc_collate_cp_func @99 +; ___lc_handle_func @100 +; ___mb_cur_max_func @101 + ___setlc_active_func @102 + ___unguarded_readlc_active_add_func @103 + __argc @104 DATA + __argv @105 DATA + __badioinfo @106 DATA + __crtCompareStringA=kernel32.CompareStringA @107 + __crtCompareStringW=kernel32.CompareStringW @108 + __crtGetLocaleInfoW=kernel32.GetLocaleInfo @109 + __crtGetStringTypeW=kernel32.GetStringTypeW @110 + __crtLCMapStringA @111 +; __crtLCMapStringW @112 + __dllonexit @113 + __doserrno @114 + __fpecode @115 + __getmainargs @116 + __initenv @117 + __iob_func=__p__iob @118 + __isascii @119 + __iscsym @120 + __iscsymf @121 + __lc_codepage @122 DATA + __lc_collate_cp @123 DATA + __lc_handle @124 DATA + __lconv_init @125 + __mb_cur_max @126 DATA + __p___argc @127 + __p___argv @128 + __p___initenv @129 + __p___mb_cur_max @130 + __p___wargv @131 + __p___winitenv @132 + __p__acmdln @133 + __p__amblksiz @134 + __p__commode @135 + __p__daylight @136 + __p__dstbias @137 + __p__environ @138 +; __p__fileinfo @139 + __p__fmode @140 + __p__iob @141 +; __p__mbcasemap @142 + __p__mbctype @143 + __p__osver @144 + __p__pctype @145 + __p__pgmptr @146 + __p__pwctype @147 + __p__timezone @148 + __p__tzname @149 + __p__wcmdln @150 + __p__wenviron @151 + __p__winmajor @152 + __p__winminor @153 + __p__winver @154 + __p__wpgmptr @155 +; __pctype_func @156 + __pioinfo @157 DATA +; __pwctype_func @158 + __pxcptinfoptrs @159 + __set_app_type @160 + __setlc_active @161 DATA + __setusermatherr @162 + __threadhandle @163 + __threadid @164 + __toascii @165 + __unDName @166 + __unDNameEx @167 +; __uncaught_exception @42 + __unguarded_readlc_active @168 DATA + __wargv @169 DATA +; __wcserror @170 + __wgetmainargs @171 + __winitenv @172 DATA + _abnormal_termination @173 +; _abs64 @174 + _access @175 + _acmdln @176 DATA + _adj_fdiv_m16i @177 + _adj_fdiv_m32 @178 + _adj_fdiv_m32i @179 + _adj_fdiv_m64 @180 + _adj_fdiv_r @181 + _adj_fdivr_m16i @182 + _adj_fdivr_m32 @183 + _adj_fdivr_m32i @184 + _adj_fdivr_m64 @185 + _adj_fpatan @186 + _adj_fprem @187 + _adj_fprem1 @188 + _adj_fptan @189 + _adjust_fdiv @190 DATA + _aexit_rtn @191 + _aligned_free @192 + _aligned_malloc @193 + _aligned_offset_malloc @194 + _aligned_offset_realloc @195 + _aligned_realloc @196 + _amsg_exit @197 + _assert @198 +; _atodbl @199 + _atoi64 @200 + _atoldbl @201 + _beep @202 + _beginthread @203 + _beginthreadex @204 + _c_exit @205 + _cabs @206 + _callnewh @207 + _cexit @208 + _cgets @209 +; _cgetws @210 + _chdir @211 + _chdrive @212 + _chgsign @213 + _chkesp @214 + _chmod @215 + _chsize @216 + _clearfp @217 + _close @218 + _commit @219 + _commode @220 DATA + _control87 @221 + _controlfp @222 + _copysign @223 + _cprintf @224 + _cputs @225 +; _cputws @226 + _creat @227 + _cscanf @228 + _ctime64 @229 + _ctype @230 DATA + _cwait @231 +; _cwprintf @232 +; _cwscanf @233 + _daylight @234 DATA + _dstbias @235 DATA + _dup @236 + _dup2 @237 + _ecvt @238 + _endthread @239 + _endthreadex @240 + _environ @241 DATA + _eof @242 + _errno @243 + _except_handler2 @244 + _except_handler3 @245 + _execl @246 + _execle @247 + _execlp @248 + _execlpe @249 + _execv @250 + _execve @251 + _execvp @252 + _execvpe @253 + _exit @254 + _expand @255 + _fcloseall @256 + _fcvt @257 + _fdopen @258 + _fgetchar @259 + _fgetwchar @260 + _filbuf @261 +; _fileinfo @262 + _filelength @263 + _filelengthi64 @264 + _fileno @265 + _findclose @266 + _findfirst @267 + _findfirst64 @268 + _findfirsti64 @269 + _findnext @270 + _findnext64 @271 + _findnexti64 @272 + _finite @273 + _flsbuf @274 + _flushall @275 + _fmode @276 DATA + _fpclass @277 + _fpieee_flt @278 + _fpreset @279 + _fputchar @280 + _fputwchar @281 + _fsopen @282 + _fstat @283 + _fstat64 @284 + _fstati64 @285 + _ftime @286 +; _ftime64 @287 ??? +; _ftol @288 ??? + _fullpath @289 + _futime @290 +; _futime64 @291 + _gcvt @292 +; _get_heap_handle @293 + _get_osfhandle @294 + _get_sbh_threshold @295 + _getch @296 + _getche @297 + _getcwd @298 + _getdcwd @299 + _getdiskfree @300 + _getdllprocaddr @301 + _getdrive @302 + _getdrives=kernel32.GetLogicalDrives @303 + _getmaxstdio @304 + _getmbcp @305 + _getpid=kernel32.GetCurrentProcessId @306 + _getsystime @307 + _getw @308 +; _getwch @309 +; _getwche @310 + _getws @311 + _global_unwind2 @312 + _gmtime64=gmtime @313 + _heapadd @314 + _heapchk @315 + _heapmin @316 + _heapset @317 +; _heapused @318 + _heapwalk @319 + _hypot @320 + _i64toa @321 + _i64tow @322 + _initterm @323 +; _inp @324 +; _inpd @325 +; _inpw @326 + _iob @327 DATA + _isatty @328 + _isctype @329 + _ismbbalnum @330 + _ismbbalpha @331 + _ismbbgraph @332 + _ismbbkalnum @333 + _ismbbkana @334 +; _ismbbkprint @335 + _ismbbkpunct @336 + _ismbblead @337 + _ismbbprint @338 + _ismbbpunct @339 + _ismbbtrail @340 + _ismbcalnum @341 + _ismbcalpha @342 + _ismbcdigit @343 + _ismbcgraph @344 + _ismbchira @345 + _ismbckata @346 + _ismbcl0 @347 + _ismbcl1 @348 + _ismbcl2 @349 + _ismbclegal @350 + _ismbclower @351 + _ismbcprint @352 + _ismbcpunct @353 + _ismbcspace @354 + _ismbcsymbol @355 + _ismbcupper @356 + _ismbslead @357 + _ismbstrail @358 + _isnan @359 + _itoa @360 + _itow @361 +; FIXME: these aren't actually implemented in CRT +; _j0 @362 +; _j1 @363 +; _jn @364 + _kbhit @365 + _lfind @366 + _loaddll @367 + _local_unwind2 @368 + _localtime64 @369 + _lock @370 + _locking @371 + _logb @372 + _longjmpex=longjmp @373 + _lrotl @374 + _lrotr @375 + _lsearch @376 + _lseek @377 + _lseeki64 @378 + _ltoa @379 + _ltow @380 + _makepath @381 + _mbbtombc @382 + _mbbtype @383 +; _mbcasemap @384 + _mbccpy @385 + _mbcjistojms @386 + _mbcjmstojis @387 + _mbclen @388 + _mbctohira @389 + _mbctokata @390 + _mbctolower @391 + _mbctombb @392 + _mbctoupper @393 + _mbctype @394 DATA + _mbsbtype @395 + _mbscat @396 + _mbschr @397 + _mbscmp @398 + _mbscoll @399 + _mbscpy @400 + _mbscspn @401 + _mbsdec @402 + _mbsdup @403 + _mbsicmp @404 + _mbsicoll @405 + _mbsinc @406 + _mbslen @407 + _mbslwr @408 + _mbsnbcat @409 + _mbsnbcmp @410 + _mbsnbcnt @411 + _mbsnbcoll @412 + _mbsnbcpy @413 + _mbsnbicmp @414 + _mbsnbicoll @415 + _mbsnbset @416 + _mbsncat @417 + _mbsnccnt @418 + _mbsncmp @419 + _mbsncoll @420 + _mbsncpy @421 + _mbsnextc @422 + _mbsnicmp @423 + _mbsnicoll @424 + _mbsninc @425 + _mbsnset @426 + _mbspbrk @427 + _mbsrchr @428 + _mbsrev @429 + _mbsset @430 + _mbsspn @431 + _mbsspnp @432 + _mbsstr @433 + _mbstok @434 + _mbstrlen @435 + _mbsupr @436 + _memccpy @437 + _memicmp @438 + _mkdir @439 + _mkgmtime @440 + _mkgmtime64 @441 + _mktemp @442 + _mktime64 @443 + _msize @444 + _nextafter @445 + _onexit @446 + _open @447 + _open_osfhandle @448 +; _osplatform @449 + _osver @450 DATA +; _outp @451 +; _outpd @452 +; _outpw @453 + _pclose @454 + _pctype @455 DATA + _pgmptr @456 DATA + _pipe @457 + _popen @458 + _purecall @459 + _putch @460 + _putenv @461 + _putw @462 +; _putwch @463 + _putws @464 + _pwctype @465 + _read @466 +; _resetstkoflw @467 + _rmdir @468 + _rmtmp @469 + _rotl @470 +; _rotl64 @471 + _rotr @472 +; _rotr64 @473 + _safe_fdiv @474 + _safe_fdivr @475 + _safe_fprem @476 + _safe_fprem1 @477 + _scalb @478 +; _scprintf @479 +; _scwprintf @480 + _searchenv @481 +; _seh_longjmp_unwind @482 ??? +; _set_SSE2_enable @483 + _set_error_mode @484 + _set_sbh_threshold @485 + _seterrormode @486 + _setjmp @487 + _setjmpex @488 + _setmaxstdio @489 + _setmbcp @490 + _setmode @491 + _setsystime @492 + _sleep @493 + _snprintf @494 +; _snscanf @495 + _snwprintf @496 +; _snwscanf @497 + _sopen @498 + _spawnl @499 + _spawnle @500 + _spawnlp @501 + _spawnlpe @502 + _spawnv @503 + _spawnve @504 + _spawnvp @505 + _spawnvpe @506 + _splitpath @507 + _stat @508 + _stat64 @509 + _stati64 @510 + _statusfp @511 + _strcmpi @512 + _strdate @513 + _strdup @514 + _strerror @515 + _stricmp @516 + _stricoll @517 + _strlwr @518 + _strncoll @519 + _strnicmp @520 + _strnicoll @521 + _strnset @522 + _strrev @523 + _strset @524 + _strtime @525 +; _strtoi64 @526 + _strtoui64=strtoull @527 + _strupr @528 + _swab @529 + _sys_errlist @530 DATA + _sys_nerr @531 DATA + _tell @532 + _telli64 @533 + _tempnam @534 + _time64 @535 + _timezone @536 DATA + _tolower @537 + _toupper @538 + _tzname @539 DATA + _tzset @540 + _ui64toa @541 + _ui64tow @542 + _ultoa @543 + _ultow @544 + _umask @545 + _ungetch @546 +; _ungetwch @547 + _unlink @548 + _unloaddll @549 + _unlock @550 + _utime @551 +; _utime64 @552 +; _vscprintf @553 +; _vscwprintf @554 + _vsnprintf @555 + _vsnwprintf @556 + _waccess @557 + _wasctime @558 + _wchdir @559 + _wchmod @560 + _wcmdln @561 + _wcreat @562 + _wcsdup @563 +; _wcserror @564 + _wcsicmp @565 + _wcsicoll @566 + _wcslwr @567 + _wcsncoll @568 + _wcsnicmp @569 + _wcsnicoll @570 + _wcsnset @571 + _wcsrev @572 + _wcsset @573 +; _wcstoi64 @574 +; _wcstoui64 @575 + _wcsupr @576 + _wctime @577 +; _wctime64 @578 +; _wctype @579 + _wenviron @580 DATA + _wexecl @581 + _wexecle @582 + _wexeclp @583 + _wexeclpe @584 + _wexecv @585 + _wexecve @586 + _wexecvp @587 + _wexecvpe @588 + _wfdopen @589 + _wfindfirst @590 +; _wfindfirst64 @591 + _wfindfirsti64 @592 + _wfindnext @593 +; _wfindnext64 @594 + _wfindnexti64 @595 + _wfopen @596 + _wfreopen @597 + _wfsopen @598 + _wfullpath @599 + _wgetcwd @600 + _wgetdcwd @601 + _wgetenv @602 + _winmajor @603 DATA + _winminor @604 DATA + _winver @605 DATA + _wmakepath @606 + _wmkdir @607 + _wmktemp @608 + _wopen @609 + _wperror @610 + _wpgmptr @611 DATA + _wpopen @612 + _wputenv @613 + _wremove @614 + _wrename @615 + _write @616 + _wrmdir @617 + _wsearchenv @618 + _wsetlocale @619 + _wsopen @620 + _wspawnl @621 + _wspawnle @622 + _wspawnlp @623 + _wspawnlpe @624 + _wspawnv @625 + _wspawnve @626 + _wspawnvp @627 + _wspawnvpe @628 + _wsplitpath @629 + _wstat @630 + _wstat64 @631 + _wstati64 @632 + _wstrdate @633 + _wstrtime @634 + _wsystem @635 + _wtempnam @636 + _wtmpnam @637 +; _wtof @638 + _wtoi @639 + _wtoi64 @640 + _wtol @641 + _wunlink @642 + _wutime @643 +; _wutime64 @644 +; FIXME: these aren't actually implemented in CRT +; _y0 @645 +; _y1 @646 +; _yn @647 + abort @648 + abs @649 + acos @650 + asctime @651 + asin @652 + atan @653 + atan2 @654 + atexit @655 + atof @656 + atoi @657 + atol @658 + bsearch @659 + calloc @660 + ceil @661 + clearerr @662 + clock @663 + cos @664 + cosh @665 + ctime @666 + difftime @667 + div @668 + exit @669 + exp @670 + fabs @671 + fclose @672 + feof @673 + ferror @674 + fflush @675 + fgetc @676 + fgetpos @677 + fgets @678 + fgetwc @679 + fgetws @680 + floor @681 + fmod @682 + fopen @683 + fprintf @684 + fputc @685 + fputs @686 + fputwc @687 + fputws @688 + fread @689 + free @690 + freopen @691 + frexp @692 + fscanf @693 + fseek @694 + fsetpos @695 + ftell @696 + fwprintf @697 + fwrite @698 + fwscanf @699 + getc @700 + getchar @701 + getenv @702 + gets @703 + getwc @704 + getwchar @705 + gmtime @706 + is_wctype @707 + isalnum @708 + isalpha @709 + iscntrl @710 + isdigit @711 + isgraph @712 + isleadbyte @713 + islower @714 + isprint @715 + ispunct @716 + isspace @717 + isupper @718 + iswalnum @719 + iswalpha @720 + iswascii @721 + iswcntrl @722 + iswctype @723 + iswdigit @724 + iswgraph @725 + iswlower @726 + iswprint @727 + iswpunct @728 + iswspace @729 + iswupper @730 + iswxdigit @731 + isxdigit @732 + labs @733 + ldexp @734 + ldiv @735 + localeconv @736 +; localtime @737 ??? + log @738 + log10 @739 + longjmp @740 + malloc @741 + mblen @742 + mbstowcs @743 + mbtowc @744 + memchr @745 + memcmp @746 + memcpy=memmove @747 + memmove @748 + memset @749 + mktime @750 + modf @751 + perror @752 + pow @753 + printf @754 + putc @755 + putchar @756 + puts @757 + putwc=fputwc @758 + putwchar=_fputwchar @759 + qsort @760 + raise @761 + rand @762 + realloc @763 + remove @764 + rename @765 + rewind @766 + scanf @767 + setbuf @768 + setlocale @769 + setvbuf @770 + signal @771 + sin @772 + sinh @773 + sprintf @774 + sqrt @775 + srand @776 + sscanf @777 + strcat @778 + strchr @779 + strcmp @780 + strcoll @781 + strcpy @782 + strcspn @783 + strerror @784 + strftime @785 + strlen @786 + strncat @787 + strncmp @788 + strncpy @789 + strpbrk @790 + strrchr @791 + strspn @792 + strstr @793 + strtod @794 + strtok @795 + strtol @796 + strtoul @797 + strxfrm @798 + swprintf @799 + swscanf @800 + system @801 + tan @802 + tanh @803 + time @804 + tmpfile @805 + tmpnam @806 + tolower @807 + toupper @808 + towlower @809 + towupper @810 + ungetc @811 + ungetwc @812 + vfprintf @813 + vfwprintf @814 + vprintf @815 + vsprintf @816 + vswprintf @817 + vwprintf @818 + wcscat @819 + wcschr @820 + wcscmp @821 + wcscoll @822 + wcscpy @823 + wcscspn @824 + wcsftime @825 + wcslen @826 + wcsncat @827 + wcsncmp @828 + wcsncpy @829 + wcspbrk @830 + wcsrchr @831 + wcsspn @832 + wcsstr @833 + wcstod @834 + wcstok @835 + wcstol @836 + wcstombs @837 + wcstoul @838 + wcsxfrm @839 + wctomb @840 + wprintf @841 + wscanf @842 diff --git a/reactos/dll/win32/msvcrt/msvcrt-i386.def b/reactos/dll/win32/msvcrt/msvcrt-i386.def new file mode 100644 index 00000000000..bcf3fe378c8 --- /dev/null +++ b/reactos/dll/win32/msvcrt/msvcrt-i386.def @@ -0,0 +1,860 @@ +; +; ReactOS MSVCRT Library +; +LIBRARY msvcrt.dll + +EXPORTS + $I10_OUTPUT=MSVCRT_I10_OUTPUT @57 + ??0__non_rtti_object@@QAE@ABV0@@Z=__thiscall_MSVCRT___non_rtti_object_copy_ctor @1 + ??0__non_rtti_object@@QAE@PBD@Z=__thiscall_MSVCRT___non_rtti_object_ctor @2 +; ??0bad_cast@@AAE@PBQBD@Z @3 + ??0bad_cast@@QAE@ABQBD@Z=__thiscall_MSVCRT_bad_cast_ctor @4 + ??0bad_cast@@QAE@ABV0@@Z=__thiscall_MSVCRT_bad_cast_copy_ctor @5 +; ??0bad_cast@@QAE@PBD@Z @6 + ??0bad_typeid@@QAE@ABV0@@Z=__thiscall_MSVCRT_bad_typeid_copy_ctor @7 + ??0bad_typeid@@QAE@PBD@Z=__thiscall_MSVCRT_bad_typeid_ctor @8 + ??0exception@@QAE@ABQBD@Z=__thiscall_MSVCRT_exception_ctor @9 +; ??0exception@@QAE@ABQBDH@Z @10 + ??0exception@@QAE@ABV0@@Z=__thiscall_MSVCRT_exception_copy_ctor @11 + ??0exception@@QAE@XZ=__thiscall_MSVCRT_exception_default_ctor @12 + ??1__non_rtti_object@@UAE@XZ=__thiscall_MSVCRT___non_rtti_object_dtor @13 + ??1bad_cast@@UAE@XZ=__thiscall_MSVCRT_bad_cast_dtor @14 + ??1bad_typeid@@UAE@XZ=__thiscall_MSVCRT_bad_typeid_dtor @15 + ??1exception@@UAE@XZ=__thiscall_MSVCRT_exception_dtor @16 + ??1type_info@@UAE@XZ=__thiscall_MSVCRT_type_info_dtor @17 + ??2@YAPAXI@Z=MSVCRT_operator_new @18 + ??3@YAXPAX@Z=MSVCRT_operator_delete @19 + ??4__non_rtti_object@@QAEAAV0@ABV0@@Z=__thiscall_MSVCRT___non_rtti_object_opequals @20 + ??4bad_cast@@QAEAAV0@ABV0@@Z=__thiscall_MSVCRT_bad_cast_opequals @21 + ??4bad_typeid@@QAEAAV0@ABV0@@Z=__thiscall_MSVCRT_bad_typeid_opequals @22 + ??4exception@@QAEAAV0@ABV0@@Z=__thiscall_MSVCRT_exception_opequals @23 + ??8type_info@@QBEHABV0@@Z=__thiscall_MSVCRT_type_info_opequals_equals @24 + ??9type_info@@QBEHABV0@@Z=__thiscall_MSVCRT_type_info_opnot_equals @25 + ??_7__non_rtti_object@@6B@=MSVCRT___non_rtti_object_vtable@@6B@ @26 DATA + ??_7bad_cast@@6B@=MSVCRT_bad_cast_vtable @27 DATA + ??_7bad_typeid@@6B@=MSVCRT_bad_typeid_vtable @28 DATA + ??_7exception@@6B@=MSVCRT_exception_vtable @29 DATA + ??_E__non_rtti_object@@UAEPAXI@Z=__thiscall_MSVCRT___non_rtti_object_vector_dtor @30 + ??_Ebad_cast@@UAEPAXI@Z=__thiscall_MSVCRT_bad_cast_vector_dtor @31 + ??_Ebad_typeid@@UAEPAXI@Z=__thiscall_MSVCRT_bad_typeid_vector_dtor @32 + ??_Eexception@@UAEPAXI@Z=__thiscall_MSVCRT_exception_vector_dtor @33 +; ??_Fbad_cast@@QAEXXZ @34 +; ??_Fbad_typeid@@QAEXXZ @35 + ??_G__non_rtti_object@@UAEPAXI@Z=__thiscall_MSVCRT___non_rtti_object_scalar_dtor @36 + ??_Gbad_cast@@UAEPAXI@Z=__thiscall_MSVCRT_bad_cast_scalar_dtor @37 + ??_Gbad_typeid@@UAEPAXI@Z=__thiscall_MSVCRT_bad_typeid_scalar_dtor @38 + ??_Gexception@@UAEPAXI@Z=__thiscall_MSVCRT_exception_scalar_dtor @39 + ??_U@YAPAXI@Z=MSVCRT_operator_new @40 + ??_V@YAXPAX@Z=MSVCRT_operator_delete @41 + ?_query_new_handler@@YAP6AHI@ZXZ=MSVCRT__query_new_handler @43 + ?_query_new_mode@@YAHXZ=MSVCRT__query_new_mode @44 + ?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z=MSVCRT__set_new_handler @45 + ?_set_new_mode@@YAHH@Z=MSVCRT__set_new_mode @46 + ?_set_se_translator@@YAP6AXIPAU_EXCEPTION_POINTERS@@@ZP6AXI0@Z@Z=MSVCRT__set_se_translator @47 + ?before@type_info@@QBEHABV1@@Z=__thiscall_MSVCRT_type_info_before @48 + ?name@type_info@@QBEPBDXZ=__thiscall_MSVCRT_type_info_name @49 + ?raw_name@type_info@@QBEPBDXZ=__thiscall_MSVCRT_type_info_raw_name @50 + ?set_new_handler@@YAP6AXXZP6AXXZ@Z=MSVCRT__set_new_handler @51 + ?set_terminate@@YAP6AXXZP6AXXZ@Z=MSVCRT_set_terminate @52 + ?set_unexpected@@YAP6AXXZP6AXXZ@Z=MSVCRT_set_unexpected @53 + ?terminate@@YAXXZ=MSVCRT_terminate @54 + ?unexpected@@YAXXZ=MSVCRT_unexpected @55 + ?what@exception@@UBEPBDXZ=__thiscall_MSVCRT_what_exception @56 + _CIacos @58 + _CIasin @59 + _CIatan @60 + _CIatan2 @61 + _CIcos @62 + _CIcosh @63 + _CIexp @64 + _CIfmod @65 + _CIlog @66 + _CIlog10 @67 + _CIpow @68 + _CIsin @69 + _CIsinh @70 + _CIsqrt @71 + _CItan @72 + _CItanh @73 + _CxxThrowException @74 + _EH_prolog @75 + _Getdays @76 + _Getmonths @77 + _Gettnames @78 + _HUGE @79 DATA + _Strftime @80 + _XcptFilter @81 + __CppXcptFilter @82 +; __CxxCallUnwindDtor @83 +; __CxxCallUnwindVecDtor @84 + __CxxDetectRethrow @85 +; __CxxExceptionFilter @86 + __CxxFrameHandler @87 +; __CxxFrameHandler2 @88 + __CxxLongjmpUnwind @89 + __CxxQueryExceptionSize @90 +; __CxxRegisterExceptionObject @91 +; __CxxUnregisterExceptionObject @92 +; __DestructExceptionObject @93 + __RTCastToVoid=MSVCRT___RTCastToVoid @94 + __RTDynamicCast=MSVCRT___RTDynamicCast @95 + __RTtypeid=MSVCRT___RTtypeid @96 + __STRINGTOLD @97 +; ___lc_codepage_func @98 +; ___lc_collate_cp_func @99 +; ___lc_handle_func @100 +; ___mb_cur_max_func @101 + ___setlc_active_func @102 + ___unguarded_readlc_active_add_func @103 + __argc @104 DATA + __argv @105 DATA + __badioinfo @106 DATA + __crtCompareStringA=kernel32.CompareStringA @107 + __crtCompareStringW=kernel32.CompareStringW @108 + __crtGetLocaleInfoW=kernel32.GetLocaleInfo @109 + __crtGetStringTypeW=kernel32.GetStringTypeW @110 + __crtLCMapStringA @111 +; __crtLCMapStringW @112 + __dllonexit @113 + __doserrno @114 + __fpecode @115 + __getmainargs @116 + __initenv @117 + __iob_func=__p__iob @118 + __isascii @119 + __iscsym @120 + __iscsymf @121 + __lc_codepage @122 DATA + __lc_collate_cp @123 DATA + __lc_handle @124 DATA + __lconv_init @125 + __mb_cur_max @126 DATA + __p___argc @127 + __p___argv @128 + __p___initenv @129 + __p___mb_cur_max @130 + __p___wargv @131 + __p___winitenv @132 + __p__acmdln @133 + __p__amblksiz @134 + __p__commode @135 + __p__daylight @136 + __p__dstbias @137 + __p__environ @138 +; __p__fileinfo @139 + __p__fmode @140 + __p__iob @141 +; __p__mbcasemap @142 + __p__mbctype @143 + __p__osver @144 + __p__pctype @145 + __p__pgmptr @146 + __p__pwctype @147 + __p__timezone @148 + __p__tzname @149 + __p__wcmdln @150 + __p__wenviron @151 + __p__winmajor @152 + __p__winminor @153 + __p__winver @154 + __p__wpgmptr @155 +; __pctype_func @156 + __pioinfo @157 DATA +; __pwctype_func @158 + __pxcptinfoptrs @159 + __set_app_type @160 + __setlc_active @161 DATA + __setusermatherr @162 + __threadhandle @163 + __threadid @164 + __toascii @165 + __unDName @166 + __unDNameEx @167 +; __uncaught_exception @42 + __unguarded_readlc_active @168 DATA + __wargv @169 DATA +; __wcserror @170 + __wgetmainargs @171 + __winitenv @172 DATA + _abnormal_termination @173 +; _abs64 @174 + _access @175 + _acmdln @176 DATA + _adj_fdiv_m16i @177 + _adj_fdiv_m32 @178 + _adj_fdiv_m32i @179 + _adj_fdiv_m64 @180 + _adj_fdiv_r @181 + _adj_fdivr_m16i @182 + _adj_fdivr_m32 @183 + _adj_fdivr_m32i @184 + _adj_fdivr_m64 @185 + _adj_fpatan @186 + _adj_fprem @187 + _adj_fprem1 @188 + _adj_fptan @189 + _adjust_fdiv @190 DATA + _aexit_rtn @191 + _aligned_free @192 + _aligned_malloc @193 + _aligned_offset_malloc @194 + _aligned_offset_realloc @195 + _aligned_realloc @196 + _amsg_exit @197 + _assert @198 +; _atodbl @199 + _atoi64 @200 + _atoldbl @201 + _beep @202 + _beginthread @203 + _beginthreadex @204 + _c_exit @205 + _cabs @206 + _callnewh @207 + _cexit @208 + _cgets @209 +; _cgetws @210 + _chdir @211 + _chdrive @212 + _chgsign @213 + _chkesp @214 + _chmod @215 + _chsize @216 + _clearfp @217 + _close @218 + _commit @219 + _commode @220 DATA + _control87 @221 + _controlfp @222 + _copysign @223 + _cprintf @224 + _cputs @225 +; _cputws @226 + _creat @227 + _cscanf @228 +; _ctime64 @229 + _ctype @230 DATA + _cwait @231 +; _cwprintf @232 +; _cwscanf @233 + _daylight @234 DATA + _dstbias @235 DATA + _dup @236 + _dup2 @237 + _ecvt @238 + _endthread @239 + _endthreadex @240 + _environ @241 DATA + _eof @242 + _errno @243 + _except_handler2 @244 + _except_handler3 @245 + _execl @246 + _execle @247 + _execlp @248 + _execlpe @249 + _execv @250 + _execve @251 + _execvp @252 + _execvpe @253 + _exit @254 + _expand @255 + _fcloseall @256 + _fcvt @257 + _fdopen @258 + _fgetchar @259 + _fgetwchar @260 + _filbuf @261 +; _fileinfo @262 + _filelength @263 + _filelengthi64 @264 + _fileno @265 + _findclose @266 + _findfirst @267 + _findfirst64 @268 + _findfirsti64 @269 + _findnext @270 + _findnext64 @271 + _findnexti64 @272 + _finite @273 + _flsbuf @274 + _flushall @275 + _fmode @276 DATA + _fpclass @277 + _fpieee_flt @278 + _fpreset @279 + _fputchar @280 + _fputwchar @281 + _fsopen @282 + _fstat @283 + _fstat64 @284 + _fstati64 @285 + _ftime @286 +; _ftime64 @287 + _ftol @288 + _fullpath @289 + _futime @290 +; _futime64 @291 + _gcvt @292 +; _get_heap_handle @293 + _get_osfhandle @294 + _get_sbh_threshold @295 + _getch @296 + _getche @297 + _getcwd @298 + _getdcwd @299 + _getdiskfree @300 + _getdllprocaddr @301 + _getdrive @302 + _getdrives=kernel32.GetLogicalDrives @303 + _getmaxstdio @304 + _getmbcp @305 + _getpid=kernel32.GetCurrentProcessId @306 + _getsystime @307 + _getw @308 +; _getwch @309 +; _getwche @310 + _getws @311 + _global_unwind2 @312 +; _gmtime64 @313 + _heapadd @314 + _heapchk @315 + _heapmin @316 + _heapset @317 +; _heapused @318 + _heapwalk @319 + _hypot @320 + _i64toa @321 + _i64tow @322 + _initterm @323 +; _inp @324 +; _inpd @325 +; _inpw @326 + _iob @327 DATA + _isatty @328 + _isctype @329 + _ismbbalnum @330 + _ismbbalpha @331 + _ismbbgraph @332 + _ismbbkalnum @333 + _ismbbkana @334 +; _ismbbkprint @335 + _ismbbkpunct @336 + _ismbblead @337 + _ismbbprint @338 + _ismbbpunct @339 + _ismbbtrail @340 + _ismbcalnum @341 + _ismbcalpha @342 + _ismbcdigit @343 + _ismbcgraph @344 + _ismbchira @345 + _ismbckata @346 + _ismbcl0 @347 + _ismbcl1 @348 + _ismbcl2 @349 + _ismbclegal @350 + _ismbclower @351 + _ismbcprint @352 + _ismbcpunct @353 + _ismbcspace @354 + _ismbcsymbol @355 + _ismbcupper @356 + _ismbslead @357 + _ismbstrail @358 + _isnan @359 + _itoa @360 + _itow @361 +; FIXME: these aren't actually implemented in CRT +; _j0 @362 +; _j1 @363 +; _jn @364 + _kbhit @365 + _lfind @366 + _loaddll @367 + _local_unwind2 @368 +; _localtime64 @369 + _lock @370 + _locking @371 + _logb @372 + _longjmpex=longjmp @373 + _lrotl @374 + _lrotr @375 + _lsearch @376 + _lseek @377 + _lseeki64 @378 + _ltoa @379 + _ltow @380 + _makepath @381 + _mbbtombc @382 + _mbbtype @383 +; _mbcasemap @384 + _mbccpy @385 + _mbcjistojms @386 + _mbcjmstojis @387 + _mbclen @388 + _mbctohira @389 + _mbctokata @390 + _mbctolower @391 + _mbctombb @392 + _mbctoupper @393 + _mbctype @394 DATA + _mbsbtype @395 + _mbscat @396 + _mbschr @397 + _mbscmp @398 + _mbscoll @399 + _mbscpy @400 + _mbscspn @401 + _mbsdec @402 + _mbsdup @403 + _mbsicmp @404 + _mbsicoll @405 + _mbsinc @406 + _mbslen @407 + _mbslwr @408 + _mbsnbcat @409 + _mbsnbcmp @410 + _mbsnbcnt @411 + _mbsnbcoll @412 + _mbsnbcpy @413 + _mbsnbicmp @414 + _mbsnbicoll @415 + _mbsnbset @416 + _mbsncat @417 + _mbsnccnt @418 + _mbsncmp @419 + _mbsncoll @420 + _mbsncpy @421 + _mbsnextc @422 + _mbsnicmp @423 + _mbsnicoll @424 + _mbsninc @425 + _mbsnset @426 + _mbspbrk @427 + _mbsrchr @428 + _mbsrev @429 + _mbsset @430 + _mbsspn @431 + _mbsspnp @432 + _mbsstr @433 + _mbstok @434 + _mbstrlen @435 + _mbsupr @436 + _memccpy @437 + _memicmp @438 + _mkdir @439 +; _mkgmtime @440 +; _mkgmtime64 @441 + _mktemp @442 +; _mktime64 @443 + _msize @444 + _nextafter @445 + _onexit @446 + _open @447 + _open_osfhandle @448 +; _osplatform @449 + _osver @450 DATA +; _outp @451 +; _outpd @452 +; _outpw @453 + _pclose @454 + _pctype @455 DATA + _pgmptr @456 DATA + _pipe @457 + _popen @458 + _purecall @459 + _putch @460 + _putenv @461 + _putw @462 +; _putwch @463 + _putws @464 + _pwctype @465 + _read @466 +; _resetstkoflw @467 + _rmdir @468 + _rmtmp @469 + _rotl @470 +; _rotl64 @471 + _rotr @472 +; _rotr64 @473 + _safe_fdiv @474 + _safe_fdivr @475 + _safe_fprem @476 + _safe_fprem1 @477 + _scalb @478 +; _scprintf @479 +; _scwprintf @480 + _searchenv @481 + _seh_longjmp_unwind=_seh_longjmp_unwind@4 @482 +; _set_SSE2_enable @483 + _set_error_mode @484 + _set_sbh_threshold @485 + _seterrormode @486 + _setjmp @487 + _setjmp3 @488 + _setmaxstdio @489 + _setmbcp @490 + _setmode @491 + _setsystime @492 + _sleep @493 + _snprintf @494 +; _snscanf @495 + _snwprintf @496 +; _snwscanf @497 + _sopen @498 + _spawnl @499 + _spawnle @500 + _spawnlp @501 + _spawnlpe @502 + _spawnv @503 + _spawnve @504 + _spawnvp @505 + _spawnvpe @506 + _splitpath @507 + _stat @508 + _stat64 @509 + _stati64 @510 + _statusfp @511 + _strcmpi @512 + _strdate @513 + _strdup @514 + _strerror @515 + _stricmp @516 + _stricoll @517 + _strlwr @518 + _strncoll @519 + _strnicmp @520 + _strnicoll @521 + _strnset @522 + _strrev @523 + _strset @524 + _strtime @525 + _strtoi64 @526 + _strtoui64=strtoull @527 + _strupr @528 + _swab @529 + _sys_errlist @530 DATA + _sys_nerr @531 DATA + _tell @532 + _telli64 @533 + _tempnam @534 +; _time64 @535 + _timezone @536 DATA + _tolower @537 + _toupper @538 + _tzname @539 DATA + _tzset @540 + _ui64toa @541 + _ui64tow @542 + _ultoa @543 + _ultow @544 + _umask @545 + _ungetch @546 +; _ungetwch @547 + _unlink @548 + _unloaddll @549 + _unlock @550 + _utime @551 +; _utime64 @552 +; _vscprintf @553 +; _vscwprintf @554 + _vsnprintf @555 + _vsnwprintf @556 + _waccess @557 + _wasctime @558 + _wchdir @559 + _wchmod @560 + _wcmdln @561 + _wcreat @562 + _wcsdup @563 +; _wcserror @564 + _wcsicmp @565 + _wcsicoll @566 + _wcslwr @567 + _wcsncoll @568 + _wcsnicmp @569 + _wcsnicoll @570 + _wcsnset @571 + _wcsrev @572 + _wcsset @573 + _wcstoi64 @574 + _wcstoui64 @575 + _wcsupr @576 + _wctime @577 +; _wctime64 @578 +; _wctype @579 + _wenviron @580 DATA + _wexecl @581 + _wexecle @582 + _wexeclp @583 + _wexeclpe @584 + _wexecv @585 + _wexecve @586 + _wexecvp @587 + _wexecvpe @588 + _wfdopen @589 + _wfindfirst @590 + _wfindfirst64 @591 + _wfindfirsti64 @592 + _wfindnext @593 + _wfindnext64 @594 + _wfindnexti64 @595 + _wfopen @596 + _wfreopen @597 + _wfsopen @598 + _wfullpath @599 + _wgetcwd @600 + _wgetdcwd @601 + _wgetenv @602 + _winmajor @603 DATA + _winminor @604 DATA + _winver @605 DATA + _wmakepath @606 + _wmkdir @607 + _wmktemp @608 + _wopen @609 + _wperror @610 + _wpgmptr @611 DATA + _wpopen @612 + _wputenv @613 + _wremove @614 + _wrename @615 + _write @616 + _wrmdir @617 + _wsearchenv @618 + _wsetlocale @619 + _wsopen @620 + _wspawnl @621 + _wspawnle @622 + _wspawnlp @623 + _wspawnlpe @624 + _wspawnv @625 + _wspawnve @626 + _wspawnvp @627 + _wspawnvpe @628 + _wsplitpath @629 + _wstat @630 + _wstat64 @631 + _wstati64 @632 + _wstrdate @633 + _wstrtime @634 + _wsystem @635 + _wtempnam @636 + _wtmpnam @637 +; _wtof @638 + _wtoi @639 + _wtoi64 @640 + _wtol @641 + _wunlink @642 + _wutime @643 +; _wutime64 @644 +; FIXME: these aren't actually implemented in CRT +; _y0 @645 +; _y1 @646 +; _yn @647 + abort @648 + abs @649 + acos @650 + asctime @651 + asin @652 + atan @653 + atan2 @654 + atexit @655 + atof @656 + atoi @657 + atol @658 + bsearch @659 + calloc @660 + ceil @661 + clearerr @662 + clock @663 + cos @664 + cosh @665 + ctime @666 + difftime @667 + div @668 + exit @669 + exp @670 + fabs @671 + fclose @672 + feof @673 + ferror @674 + fflush @675 + fgetc @676 + fgetpos @677 + fgets @678 + fgetwc @679 + fgetws @680 + floor @681 + fmod @682 + fopen @683 + fprintf @684 + fputc @685 + fputs @686 + fputwc @687 + fputws @688 + fread @689 + free @690 + freopen @691 + frexp @692 + fscanf @693 + fseek @694 + fsetpos @695 + ftell @696 + fwprintf @697 + fwrite @698 + fwscanf @699 + getc @700 + getchar @701 + getenv @702 + gets @703 + getwc @704 + getwchar @705 + gmtime @706 + is_wctype @707 + isalnum @708 + isalpha @709 + iscntrl @710 + isdigit @711 + isgraph @712 + isleadbyte @713 + islower @714 + isprint @715 + ispunct @716 + isspace @717 + isupper @718 + iswalnum @719 + iswalpha @720 + iswascii @721 + iswcntrl @722 + iswctype @723 + iswdigit @724 + iswgraph @725 + iswlower @726 + iswprint @727 + iswpunct @728 + iswspace @729 + iswupper @730 + iswxdigit @731 + isxdigit @732 + labs @733 + ldexp @734 + ldiv @735 + localeconv @736 + localtime @737 + log @738 + log10 @739 + longjmp @740 + malloc @741 + mblen @742 + mbstowcs @743 + mbtowc @744 + memchr @745 + memcmp @746 + memcpy @747 + memmove @748 + memset @749 + mktime @750 + modf @751 + perror @752 + pow @753 + printf @754 + putc @755 + putchar @756 + puts @757 + putwc=fputwc @758 + putwchar=_fputwchar @759 + qsort @760 + raise @761 + rand @762 + realloc @763 + remove @764 + rename @765 + rewind @766 + scanf @767 + setbuf @768 + setlocale @769 + setvbuf @770 + signal @771 + sin @772 + sinh @773 + sprintf @774 + sqrt @775 + srand @776 + sscanf @777 + strcat @778 + strchr @779 + strcmp @780 + strcoll @781 + strcpy @782 + strcspn @783 + strerror @784 + strftime @785 + strlen @786 + strncat @787 + strncmp @788 + strncpy @789 + strpbrk @790 + strrchr @791 + strspn @792 + strstr @793 + strtod @794 + strtok @795 + strtol @796 + strtoul @797 + strxfrm @798 + swprintf @799 + swscanf @800 + system @801 + tan @802 + tanh @803 + time @804 + tmpfile @805 + tmpnam @806 + tolower @807 + toupper @808 + towlower @809 + towupper @810 + ungetc @811 + ungetwc @812 + vfprintf @813 + vfwprintf @814 + vprintf @815 + vsprintf @816 + vswprintf @817 + vwprintf @818 + wcscat @819 + wcschr @820 + wcscmp @821 + wcscoll @822 + wcscpy @823 + wcscspn @824 + wcsftime @825 + wcslen @826 + wcsncat @827 + wcsncmp @828 + wcsncpy @829 + wcspbrk @830 + wcsrchr @831 + wcsspn @832 + wcsstr @833 + wcstod @834 + wcstok @835 + wcstol @836 + wcstombs @837 + wcstoul @838 + wcsxfrm @839 + wctomb @840 + wprintf @841 + wscanf @842 + + _mbsnbcpy_s + wcscpy_s + wcsncpy_s + _ftol2=_ftol + _ftol2_sse=_ftol + strcat_s + strcpy_s + + _swprintf=swprintf diff --git a/reactos/dll/win32/msvcrt/msvcrt.rbuild b/reactos/dll/win32/msvcrt/msvcrt.rbuild index 59ec3a1da0e..3e4a5d93f2a 100644 --- a/reactos/dll/win32/msvcrt/msvcrt.rbuild +++ b/reactos/dll/win32/msvcrt/msvcrt.rbuild @@ -1,5 +1,5 @@ - + . include diff --git a/reactos/dll/win32/msvcrt/msvcrt.spec b/reactos/dll/win32/msvcrt/msvcrt.spec deleted file mode 100644 index f44a90f609c..00000000000 --- a/reactos/dll/win32/msvcrt/msvcrt.spec +++ /dev/null @@ -1,839 +0,0 @@ -# msvcrt.dll - MS VC++ Run Time Library - -@ cdecl $I10_OUTPUT() MSVCRT_I10_OUTPUT -@ cdecl -i386 -norelay ??0__non_rtti_object@@QAE@ABV0@@Z(ptr) __thiscall_MSVCRT___non_rtti_object_copy_ctor -@ cdecl -i386 -norelay ??0__non_rtti_object@@QAE@PBD@Z(ptr) __thiscall_MSVCRT___non_rtti_object_ctor -@ cdecl -i386 -norelay ??0bad_cast@@QAE@ABQBD@Z(ptr) __thiscall_MSVCRT_bad_cast_ctor -@ cdecl -i386 -norelay ??0bad_cast@@QAE@ABV0@@Z(ptr) __thiscall_MSVCRT_bad_cast_copy_ctor -@ cdecl -i386 -norelay ??0bad_typeid@@QAE@ABV0@@Z(ptr) __thiscall_MSVCRT_bad_typeid_copy_ctor -@ cdecl -i386 -norelay ??0bad_typeid@@QAE@PBD@Z(ptr) __thiscall_MSVCRT_bad_typeid_ctor -@ cdecl -i386 -norelay ??0exception@@QAE@ABQBD@Z(ptr) __thiscall_MSVCRT_exception_ctor -@ cdecl -i386 -norelay ??0exception@@QAE@ABV0@@Z(ptr) __thiscall_MSVCRT_exception_copy_ctor -@ cdecl -i386 -norelay ??0exception@@QAE@XZ() __thiscall_MSVCRT_exception_default_ctor -@ cdecl -i386 -norelay ??1__non_rtti_object@@UAE@XZ() __thiscall_MSVCRT___non_rtti_object_dtor -@ cdecl -i386 -norelay ??1bad_cast@@UAE@XZ() __thiscall_MSVCRT_bad_cast_dtor -@ cdecl -i386 -norelay ??1bad_typeid@@UAE@XZ() __thiscall_MSVCRT_bad_typeid_dtor -@ cdecl -i386 -norelay ??1exception@@UAE@XZ() __thiscall_MSVCRT_exception_dtor -@ cdecl -i386 -norelay ??1type_info@@UAE@XZ() __thiscall_MSVCRT_type_info_dtor -@ cdecl ??2@YAPAXI@Z(long) MSVCRT_operator_new -@ cdecl ??_U@YAPAXI@Z(long) MSVCRT_operator_new -@ cdecl ??3@YAXPAX@Z(ptr) MSVCRT_operator_delete -@ cdecl ??_V@YAXPAX@Z(ptr) MSVCRT_operator_delete -@ cdecl -i386 -norelay ??4__non_rtti_object@@QAEAAV0@ABV0@@Z(ptr) __thiscall_MSVCRT___non_rtti_object_opequals -@ cdecl -i386 -norelay ??4bad_cast@@QAEAAV0@ABV0@@Z(ptr) __thiscall_MSVCRT_bad_cast_opequals -@ cdecl -i386 -norelay ??4bad_typeid@@QAEAAV0@ABV0@@Z(ptr) __thiscall_MSVCRT_bad_typeid_opequals -@ cdecl -i386 -norelay ??4exception@@QAEAAV0@ABV0@@Z(ptr) __thiscall_MSVCRT_exception_opequals -@ cdecl -i386 -norelay ??8type_info@@QBEHABV0@@Z(ptr) __thiscall_MSVCRT_type_info_opequals_equals -@ cdecl -i386 -norelay ??9type_info@@QBEHABV0@@Z(ptr) __thiscall_MSVCRT_type_info_opnot_equals -@ extern -i386 ??_7__non_rtti_object@@6B@ MSVCRT___non_rtti_object_vtable -@ extern -i386 ??_7bad_cast@@6B@ MSVCRT_bad_cast_vtable -@ extern -i386 ??_7bad_typeid@@6B@ MSVCRT_bad_typeid_vtable -@ extern -i386 ??_7exception@@6B@ MSVCRT_exception_vtable -@ cdecl -i386 -norelay ??_E__non_rtti_object@@UAEPAXI@Z(long) __thiscall_MSVCRT___non_rtti_object_vector_dtor -@ cdecl -i386 -norelay ??_Ebad_cast@@UAEPAXI@Z(long) __thiscall_MSVCRT_bad_cast_vector_dtor -@ cdecl -i386 -norelay ??_Ebad_typeid@@UAEPAXI@Z(long) __thiscall_MSVCRT_bad_typeid_vector_dtor -@ cdecl -i386 -norelay ??_Eexception@@UAEPAXI@Z(long) __thiscall_MSVCRT_exception_vector_dtor -@ cdecl -i386 -norelay ??_G__non_rtti_object@@UAEPAXI@Z(long) __thiscall_MSVCRT___non_rtti_object_scalar_dtor -@ cdecl -i386 -norelay ??_Gbad_cast@@UAEPAXI@Z(long) __thiscall_MSVCRT_bad_cast_scalar_dtor -@ cdecl -i386 -norelay ??_Gbad_typeid@@UAEPAXI@Z(long) __thiscall_MSVCRT_bad_typeid_scalar_dtor -@ cdecl -i386 -norelay ??_Gexception@@UAEPAXI@Z(long) __thiscall_MSVCRT_exception_scalar_dtor -@ cdecl ?_query_new_handler@@YAP6AHI@ZXZ() MSVCRT__query_new_handler -@ cdecl ?_query_new_mode@@YAHXZ() MSVCRT__query_new_mode -@ cdecl ?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z(ptr) MSVCRT__set_new_handler -@ cdecl ?_set_new_mode@@YAHH@Z(long) MSVCRT__set_new_mode -@ cdecl ?_set_se_translator@@YAP6AXIPAU_EXCEPTION_POINTERS@@@ZP6AXI0@Z@Z(ptr) MSVCRT__set_se_translator -@ cdecl -i386 -norelay ?before@type_info@@QBEHABV1@@Z(ptr) __thiscall_MSVCRT_type_info_before -@ cdecl -i386 -norelay ?name@type_info@@QBEPBDXZ() __thiscall_MSVCRT_type_info_name -@ cdecl -i386 -norelay ?raw_name@type_info@@QBEPBDXZ() __thiscall_MSVCRT_type_info_raw_name -@ cdecl ?set_new_handler@@YAP6AXXZP6AXXZ@Z(ptr) MSVCRT_set_new_handler -@ cdecl ?set_terminate@@YAP6AXXZP6AXXZ@Z(ptr) MSVCRT_set_terminate -@ cdecl ?set_unexpected@@YAP6AXXZP6AXXZ@Z(ptr) MSVCRT_set_unexpected -@ cdecl ?terminate@@YAXXZ() MSVCRT_terminate -@ cdecl ?unexpected@@YAXXZ() MSVCRT_unexpected -@ cdecl -i386 -norelay ?what@exception@@UBEPBDXZ() __thiscall_MSVCRT_what_exception -@ cdecl -arch=i386 _CIacos() -@ cdecl -arch=i386 _CIasin() -@ cdecl -arch=i386 _CIatan() -@ cdecl -arch=i386 _CIatan2() -@ cdecl -arch=i386 _CIcos() -@ cdecl -arch=i386 _CIcosh() -@ cdecl -arch=i386 _CIexp() -@ cdecl -arch=i386 _CIfmod() -@ cdecl -arch=i386 _CIlog() -@ cdecl -arch=i386 _CIlog10() -@ cdecl -arch=i386 _CIpow() -@ cdecl -arch=i386 _CIsin() -@ cdecl -arch=i386 _CIsinh() -@ cdecl -arch=i386 _CIsqrt() -@ cdecl -arch=i386 _CItan() -@ cdecl -arch=i386 _CItanh() -@ cdecl _CxxThrowException(long long) -@ cdecl -i386 -norelay _EH_prolog() -@ cdecl _Getdays() -@ cdecl _Getmonths() -@ cdecl _Gettnames() -@ extern _HUGE -@ cdecl _Strftime(str long str ptr ptr) -@ cdecl _XcptFilter(long ptr) -@ stdcall -arch=x86_64 __C_specific_handler(ptr long ptr ptr) ntdll.__C_specific_handler -@ cdecl __CppXcptFilter(long ptr) -@ cdecl __CxxDetectRethrow(ptr) -@ cdecl -i386 -norelay __CxxFrameHandler(ptr ptr ptr ptr) -# 88 56 0002AE4C __CxxFrameHandler2 -# 89 57 0002ADC8 __CxxFrameHandler3 -# 90 58 00029794 __DestructExceptionObject -@ stdcall -i386 __CxxLongjmpUnwind(ptr) -@ cdecl __CxxQueryExceptionSize() -@ cdecl __RTCastToVoid(ptr) MSVCRT___RTCastToVoid -@ cdecl __RTDynamicCast(ptr long ptr ptr long) MSVCRT___RTDynamicCast -@ cdecl __RTtypeid(ptr) MSVCRT___RTtypeid -@ cdecl __STRINGTOLD(ptr ptr str long) -#@ cdecl ___lc_codepage_func() -#@ cdecl ___lc_collate_cp_func() -#@ cdecl ___lc_handle_func() -#@ cdecl ___mb_cur_max_func() -@ cdecl ___setlc_active_func() -@ cdecl ___unguarded_readlc_active_add_func() -@ extern __argc -@ extern __argv -@ extern __badioinfo -@ cdecl __crtCompareStringA(long long str long str long) kernel32.CompareStringA -@ cdecl __crtCompareStringW(long long wstr long wstr long) kernel32.CompareStringW -@ cdecl __crtGetLocaleInfoW(long long ptr long)kernel32.GetLocaleInfo -@ cdecl __crtGetStringTypeW(long wstr long ptr) kernel32.GetStringTypeW -@ cdecl __crtLCMapStringA(long long str long ptr long long long) -# 109 6B 000414E0 __crtLCMapStringW -# 110 6C 00068CC4 __daylight -@ cdecl __dllonexit(ptr ptr ptr) -@ cdecl __doserrno() -@ cdecl __fpecode() -@ stub __get_app_type -@ cdecl __getmainargs(ptr ptr ptr long ptr) -@ extern __initenv -@ cdecl __iob_func() -@ cdecl __isascii(long) -@ cdecl __iscsym(long) -@ cdecl __iscsymf(long) -@ extern __lc_codepage -@ stub __lc_collate -@ extern __lc_collate_cp -@ extern __lc_handle -@ cdecl __lconv_init() -@ extern __mb_cur_max -@ cdecl -arch=i386 __p___argc() -@ cdecl -arch=i386 __p___argv() -@ cdecl -arch=i386 __p___initenv() -#@ cdecl -arch=i386 __p___mb_cur_max() ___mb_cur_max_func -@ cdecl -arch=i386 __p___wargv() -@ cdecl -arch=i386 __p___winitenv() -@ cdecl -arch=i386 __p__acmdln() -@ cdecl -arch=i386 __p__amblksiz() -@ cdecl -arch=i386 __p__commode() -@ cdecl -arch=i386 __p__daylight() -@ cdecl -arch=i386 __p__dstbias() -@ cdecl -arch=i386 __p__environ() -@ stub -arch=i386 __p__fileinfo #() -@ cdecl -arch=i386 __p__fmode() -@ cdecl -arch=i386 __p__iob() __iob_func -@ stub -arch=i386 __p__mbcasemap #() -@ cdecl -arch=i386 __p__mbctype() -@ cdecl -arch=i386 __p__osver() -@ cdecl -arch=i386 __p__pctype() __pctype_func -@ cdecl -arch=i386 __p__pgmptr() -@ stub -arch=i386 __p__pwctype #() -@ cdecl -arch=i386 __p__timezone() __p__timezone -@ cdecl -arch=i386 __p__tzname() -@ cdecl -arch=i386 __p__wcmdln() -@ cdecl -arch=i386 __p__wenviron() -@ cdecl -arch=i386 __p__winmajor() -@ cdecl -arch=i386 __p__winminor() -@ cdecl -arch=i386 __p__winver() -@ cdecl -arch=i386 __p__wpgmptr() -@ cdecl __pctype_func() __pctype_func -@ extern __pioinfo -@ stub __pxcptinfoptrs #() -@ cdecl __set_app_type(long) -@ extern __setlc_active -@ cdecl __setusermatherr(ptr) -@ cdecl __threadhandle() kernel32.GetCurrentThread -@ cdecl __threadid() kernel32.GetCurrentThreadId -@ cdecl __toascii(long) -@ cdecl __uncaught_exception() -@ cdecl __unDName(ptr str long ptr ptr long) -@ cdecl __unDNameEx(ptr str long ptr ptr ptr long) -@ extern __unguarded_readlc_active -@ extern __wargv -@ cdecl __wgetmainargs(ptr ptr ptr long ptr) -@ extern __winitenv -@ cdecl _abnormal_termination() -@ cdecl _access(str long) -@ extern _acmdln -@ stdcall -arch=i386 _adj_fdiv_m16i(long) -@ stdcall -arch=i386 _adj_fdiv_m32(long) -@ stdcall -arch=i386 _adj_fdiv_m32i(long) -@ stdcall -arch=i386 _adj_fdiv_m64(double) -@ cdecl -arch=i386 _adj_fdiv_r() -@ stdcall -arch=i386 _adj_fdivr_m16i(long) -@ stdcall -arch=i386 _adj_fdivr_m32(long) -@ stdcall -arch=i386 _adj_fdivr_m32i(long) -@ stdcall -arch=i386 _adj_fdivr_m64(double) -@ cdecl -arch=i386 _adj_fpatan() -@ cdecl -arch=i386 _adj_fprem() -@ cdecl -arch=i386 _adj_fprem1() -@ cdecl -arch=i386 _adj_fptan() -@ extern -arch=i386 _adjust_fdiv -# extern _aexit_rtn -@ cdecl _aligned_free(ptr) -@ cdecl _aligned_malloc(long long) -@ cdecl _aligned_offset_malloc(long long long) -@ cdecl _aligned_offset_realloc(ptr long long long) -@ cdecl _aligned_realloc(ptr long long) -@ cdecl _amsg_exit(long) -@ cdecl _assert(str str long) -@ stub _atodbl #(ptr str) -@ cdecl -ret64 _atoi64(str) ntdll._atoi64 -@ cdecl _atoldbl(ptr str) -@ cdecl _beep(long long) -@ cdecl _beginthread (ptr long ptr) -@ cdecl _beginthreadex (ptr long ptr ptr long ptr) -@ cdecl _c_exit() -@ cdecl _cabs(long) -@ cdecl _callnewh(long) -@ cdecl _cexit() -@ cdecl _cgets(str) -@ cdecl _chdir(str) -@ cdecl _chdrive(long) -@ cdecl _chgsign( double ) -@ cdecl -i386 -norelay _chkesp() -@ cdecl _chmod(str long) -@ cdecl _chsize (long long) -@ cdecl _clearfp() -@ cdecl _close(long) -@ cdecl _commit(long) -@ extern _commode -@ cdecl _control87(long long) -@ cdecl _controlfp(long long) -@ cdecl _copysign( double double ) -@ varargs _cprintf(str) -@ cdecl _cputs(str) -@ cdecl _creat(str long) -@ varargs _cscanf(str) -@ cdecl _ctime32(ptr) -@ cdecl _ctime64(ptr) -@ extern _ctype -@ cdecl _cwait(ptr long long) -@ extern _daylight -@ cdecl _difftime32(long long) -@ cdecl _difftime64(long long) -@ extern _dstbias -@ cdecl _dup (long) -@ cdecl _dup2 (long long) -@ cdecl _ecvt(double long ptr ptr) -@ cdecl _endthread () -@ cdecl _endthreadex(long) -@ extern _environ -@ cdecl _eof(long) -@ cdecl _errno() -@ cdecl _except_handler2(ptr ptr ptr ptr) -@ cdecl _except_handler3(ptr ptr ptr ptr) -@ varargs _execl(str str) -@ varargs _execle(str str) -@ varargs _execlp(str str) -@ varargs _execlpe(str str) -@ cdecl _execv(str ptr) -@ cdecl _execve(str ptr ptr) -@ cdecl _execvp(str ptr) -@ cdecl _execvpe(str ptr ptr) -@ cdecl _exit(long) -@ cdecl _expand(ptr long) -@ cdecl _fcloseall() -@ cdecl _fcvt(double long ptr ptr) -@ cdecl _fdopen(long str) -@ cdecl _fgetchar() -@ cdecl _fgetwchar() -@ cdecl _filbuf(ptr) -# extern _fileinfo -@ cdecl _filelength(long) -@ cdecl -ret64 _filelengthi64(long) -@ cdecl _fileno(ptr) -@ cdecl _findclose(long) -@ cdecl _findfirst(str ptr) -@ cdecl _findfirsti64(str ptr) -@ cdecl _findnext(long ptr) -@ cdecl _findnexti64(long ptr) -@ cdecl _finite( double ) -@ cdecl _flsbuf(long ptr) -@ cdecl _flushall() -@ extern _fmode -@ cdecl _fpclass(double) -@ stub _fpieee_flt #(long ptr ptr) -@ cdecl _fpreset() -@ cdecl _fputchar(long) -@ cdecl _fputwchar(long) -@ cdecl _fsopen(str str long) -@ cdecl _fstat(long ptr) -@ cdecl _fstat64(long ptr) -@ cdecl _fstati64(long ptr) -@ cdecl _ftime(ptr) -@ cdecl _ftime32(ptr) -@ cdecl _ftime64(ptr) -@ cdecl -ret64 _ftol() ntdll._ftol -@ cdecl -ret64 _ftol2_sse() ntdll._ftol #FIXME: SSE variant should be implemented -@ cdecl _fullpath(ptr str long) -@ cdecl _futime(long ptr) -@ cdecl _futime32(long ptr) -@ cdecl _futime64(long ptr) -@ cdecl _gcvt(double long str) -@ cdecl _get_osfhandle(long) -@ cdecl _get_sbh_threshold() -@ stub _get_terminate -@ stub _get_unexpected -@ cdecl _getch() -@ cdecl _getche() -@ cdecl _getcwd(str long) -@ cdecl _getdcwd(long str long) -@ cdecl _getdiskfree(long ptr) -@ cdecl _getdllprocaddr(long str long) -@ cdecl _getdrive() -@ cdecl _getdrives() kernel32.GetLogicalDrives -@ cdecl _getmaxstdio() -@ cdecl _getmbcp() -@ cdecl _getpid() kernel32.GetCurrentProcessId -@ stub _getsystime #(ptr) -@ cdecl _getw(ptr) -@ cdecl _getws(ptr) -@ cdecl _global_unwind2(ptr) -@ cdecl _gmtime32(ptr) -@ cdecl _gmtime64(ptr) -@ cdecl _heapadd (ptr long) -@ cdecl _heapchk() -@ cdecl _heapmin() -@ cdecl _heapset(long) -@ stub _heapused #(ptr ptr) -@ cdecl _heapwalk(ptr) -@ cdecl _hypot(double double) -@ cdecl _i64toa(long long ptr long) ntdll._i64toa -@ cdecl _i64tow(long long ptr long) ntdll._i64tow -@ cdecl _initterm(ptr ptr) -@ stub _inp #(long) -i386 -@ stub _inpd #(long) -i386 -@ stub _inpw #(long) -i386 -@ extern _iob -@ cdecl _isatty(long) -@ cdecl _isctype(long long) -@ stub _ismbbalnum #(long) -@ stub _ismbbalpha #(long) -@ stub _ismbbgraph #(long) -@ stub _ismbbkalnum #(long) -@ cdecl _ismbbkana(long) -@ stub _ismbbkprint #(long) -@ stub _ismbbkpunct #(long) -@ cdecl _ismbblead(long) -@ stub _ismbbprint #(long) -@ stub _ismbbpunct #(long) -@ cdecl _ismbbtrail(long) -@ cdecl _ismbcalnum(long) -@ cdecl _ismbcalpha(long) -@ cdecl _ismbcdigit(long) -@ cdecl _ismbcgraph(long) -@ cdecl _ismbchira(long) -@ cdecl _ismbckata(long) -@ stub _ismbcl0 #(long) -@ stub _ismbcl1 #(long) -@ stub _ismbcl2 #(long) -@ stub _ismbclegal #(long) -@ cdecl _ismbclower(long) -@ cdecl _ismbcprint(long) -@ cdecl _ismbcpunct(long) -@ cdecl _ismbcspace(long) -@ cdecl _ismbcsymbol(long) -@ cdecl _ismbcupper(long) -@ cdecl _ismbslead(ptr ptr) -@ cdecl _ismbstrail(ptr ptr) -@ cdecl _isnan( double ) -@ cdecl _itoa(long ptr long) ntdll._itoa -@ cdecl _itow(long ptr long) ntdll._itow -#@ cdecl _j0(double) -#@ cdecl _j1(double) -#@ cdecl _jn(long double) -@ cdecl _kbhit() -@ cdecl _lfind(ptr ptr ptr long ptr) -@ cdecl _loaddll(str) -@ cdecl -i386 _local_unwind2(ptr long) -@ cdecl _localtime32(ptr) -@ cdecl _localtime64(ptr) -@ cdecl _lock(long) -@ cdecl _locking(long long long) -@ cdecl _logb( double ) -@ cdecl -i386 _longjmpex(ptr long) longjmp -@ cdecl _lrotl(long long) -@ cdecl _lrotr(long long) -@ cdecl _lsearch(ptr ptr long long ptr) -@ cdecl _lseek(long long long) -@ cdecl -ret64 _lseeki64(long double long) -@ cdecl _ltoa(long ptr long) ntdll._ltoa -@ cdecl _ltow(long ptr long) ntdll._ltow -@ cdecl _makepath(ptr str str str str) -@ cdecl _matherr(ptr) -@ cdecl _mbbtombc(long) -@ cdecl _mbbtype(long long) -# extern _mbcasemap -@ cdecl _mbccpy (str str) -@ cdecl _mbcjistojms (long) -@ cdecl _mbcjmstojis (long) -@ cdecl _mbclen(ptr) -@ cdecl _mbctohira (long) -@ cdecl _mbctokata (long) -@ cdecl _mbctolower(long) -@ cdecl _mbctombb (long) -@ cdecl _mbctoupper(long) -@ extern _mbctype _mbctype -@ cdecl _mbsbtype(str long) -@ cdecl _mbscat(str str) -@ cdecl _mbschr(str long) -@ cdecl _mbscmp(str str) -@ cdecl _mbscoll(str str) -@ cdecl _mbscpy(ptr str) -@ cdecl _mbscspn (str str) -@ cdecl _mbsdec(ptr ptr) -@ cdecl _mbsdup(str) _strdup -@ cdecl _mbsicmp(str str) -@ cdecl _mbsicoll(str str) -@ cdecl _mbsinc(str) -@ cdecl _mbslen(str) -@ cdecl _mbslwr(str) -@ cdecl _mbsnbcat (str str long) -@ cdecl _mbsnbcmp(str str long) -@ cdecl _mbsnbcnt(ptr long) -@ cdecl _mbsnbcoll (str str long) -@ cdecl _mbsnbcpy(ptr str long) -@ cdecl _mbsnbcpy_s(ptr long str long) -@ cdecl _mbsnbicmp(str str long) -@ cdecl _mbsnbicoll (str str long) -@ cdecl _mbsnbset(str long long) -@ cdecl _mbsncat(str str long) -@ cdecl _mbsnccnt(str long) -@ cdecl _mbsncmp(str str long) -@ cdecl _mbsncoll (str str long) -@ cdecl _mbsncpy(str str long) -@ cdecl _mbsnextc(str) -@ cdecl _mbsnicmp(str str long) -@ cdecl _mbsnicoll (str str long) -@ cdecl _mbsninc(str long) -@ cdecl _mbsnset(str long long) -@ cdecl _mbspbrk(str str) -@ cdecl _mbsrchr(str long) -@ cdecl _mbsrev(str) -@ cdecl _mbsset(str long) -@ cdecl _mbsspn(str str) -@ cdecl _mbsspnp(str str) -@ cdecl _mbsstr(str str) -@ cdecl _mbstok(str str) -@ cdecl _mbstrlen(str) -@ cdecl _mbsupr(str) -@ cdecl _memccpy(ptr ptr long long) ntdll._memccpy -@ cdecl _memicmp(str str long) ntdll._memicmp -@ cdecl _mkdir(str) -@ cdecl _mktemp(str) -@ cdecl _mktime32(ptr) -@ cdecl _mktime64(ptr) -@ cdecl _msize(ptr) -@ cdecl _nextafter(double double) -@ cdecl _onexit(ptr) -@ varargs _open(str long) -@ cdecl _open_osfhandle(long long) -@ extern _osver -@ stub _outp #(long long) -@ stub _outpd #(long long) -@ stub _outpw #(long long) -@ cdecl _pclose (ptr) -@ extern _pctype -@ extern _pgmptr -@ cdecl _pipe (ptr long long) -@ cdecl _popen (str str) -@ cdecl _purecall() -@ cdecl _putch(long) -@ cdecl _putenv(str) -@ cdecl _putw(long ptr) -@ cdecl _putws(wstr) -# extern _pwctype -@ cdecl _read(long ptr long) -@ cdecl _rmdir(str) -@ cdecl _rmtmp() -@ cdecl _rotl(long long) -@ cdecl _rotr(long long) -@ cdecl -arch=i386 _safe_fdiv() -@ cdecl -arch=i386 _safe_fdivr() -@ cdecl -arch=i386 _safe_fprem() -@ cdecl -arch=i386 _safe_fprem1() -@ cdecl _scalb( double long) -@ cdecl _searchenv(str str ptr) -@ stdcall -i386 _seh_longjmp_unwind(ptr) -@ cdecl _set_error_mode(long) -@ cdecl _set_sbh_threshold(long) -@ cdecl _seterrormode(long) -@ cdecl -norelay _setjmp(ptr) -@ cdecl -i386 -norelay _setjmp3(ptr long) -@ cdecl _setmaxstdio(long) -@ cdecl _setmbcp(long) -@ cdecl _setmode(long long) -@ stub _setsystime #(ptr long) -@ cdecl _sleep(long) -@ varargs _snprintf(ptr long str) -@ varargs _snwprintf(ptr long wstr) -@ varargs _sopen(str long long) -@ varargs _spawnl(long str str) -@ varargs _spawnle(long str str) -@ varargs _spawnlp(long str str) -@ varargs _spawnlpe(long str str) -@ cdecl _spawnv(long str ptr) -@ cdecl _spawnve(long str ptr ptr) -@ cdecl _spawnvp(long str ptr) -@ cdecl _spawnvpe(long str ptr ptr) -@ cdecl _splitpath(str ptr ptr ptr ptr) ntdll._splitpath -@ cdecl _stat(str ptr) -@ cdecl _stat64(str ptr) -@ cdecl _stati64(str ptr) -@ cdecl _statusfp() -@ cdecl _strcmpi(str str) ntdll._strcmpi -@ cdecl _strdate(ptr) -@ cdecl _strdup(str) -@ cdecl _strerror(long) -@ cdecl _stricmp(str str) ntdll._stricmp -@ cdecl _stricoll(str str) -@ cdecl _strlwr(str) ntdll._strlwr -@ cdecl _strncoll (str str long) -@ cdecl _strnicmp(str str long) ntdll._strnicmp -@ cdecl _strnicoll (str str long) -@ cdecl _strnset(str long long) -@ cdecl _strrev(str) -@ cdecl _strset(str long) -@ cdecl _strtime(ptr) -@ cdecl _strtoui64(ptr ptr long) strtoull -@ cdecl _strupr(str) ntdll._strupr -@ cdecl _swab(str str long) -@ extern _sys_errlist -@ extern _sys_nerr -@ cdecl _tell(long) -@ cdecl -ret64 _telli64(long) -@ cdecl _tempnam(str str) -@ cdecl _time32(ptr) -@ cdecl _time64(ptr) -@ extern _timezone -@ cdecl _tolower(long) -@ cdecl _toupper(long) -@ extern _tzname -@ cdecl _tzset() -@ cdecl _ui64toa(long long ptr long) ntdll._ui64toa -@ cdecl _ui64tow(long long ptr long) ntdll._ui64tow -@ cdecl _ultoa(long ptr long) ntdll._ultoa -@ cdecl _ultow(long ptr long) ntdll._ultow -@ cdecl _umask(long) -@ cdecl _ungetch(long) -@ cdecl _unlink(str) -@ cdecl _unloaddll(long) -@ cdecl _unlock(long) -@ cdecl _utime32(str ptr) -@ cdecl _utime64(str ptr) -@ cdecl _utime(str ptr) -#@ cdecl _vscprintf(str ptr) -#@ cdecl _vscwprintf(wstr ptr) -@ cdecl _vsnprintf(ptr long str ptr) -@ cdecl _vsnwprintf(ptr long wstr ptr) -@ cdecl _waccess(wstr long) -@ cdecl _wasctime(ptr) -@ cdecl _wchdir(wstr) -@ cdecl _wchmod(wstr long) -@ extern _wcmdln -@ cdecl _wcreat(wstr long) -@ cdecl _wcsdup(wstr) -@ cdecl _wcsicmp(wstr wstr) ntdll._wcsicmp -@ cdecl _wcsicoll(wstr wstr) -@ cdecl _wcslwr(wstr) ntdll._wcslwr -@ cdecl _wcsncoll (wstr wstr long) -@ cdecl _wcsnicmp(wstr wstr long) ntdll._wcsnicmp -@ cdecl _wcsnicoll (wstr wstr long) -@ cdecl _wcsnset(wstr long long) -@ cdecl _wcsrev(wstr) -@ cdecl _wcsset(wstr long) -@ cdecl _wcsupr(wstr) ntdll._wcsupr -@ cdecl _wcsupr_s(wstr long) -@ cdecl _wctime(ptr) -@ cdecl _wctime32(ptr) -@ cdecl _wctime64(ptr) -@ extern _wenviron -@ varargs _wexecl(wstr wstr) -@ varargs _wexecle(wstr wstr) -@ varargs _wexeclp(wstr wstr) -@ varargs _wexeclpe(wstr wstr) -@ cdecl _wexecv(wstr ptr) -@ cdecl _wexecve(wstr ptr ptr) -@ cdecl _wexecvp(wstr ptr) -@ cdecl _wexecvpe(wstr ptr ptr) -@ cdecl _wfdopen(long wstr) -@ cdecl _wfindfirst(wstr ptr) -@ cdecl _wfindfirsti64(wstr ptr) -@ cdecl _wfindnext(long ptr) -@ cdecl _wfindnexti64(long ptr) -@ cdecl _wfopen(wstr wstr) -@ cdecl _wfreopen(wstr wstr ptr) -@ cdecl _wfsopen(wstr wstr long) -@ cdecl _wfullpath(ptr wstr long) -@ cdecl _wgetcwd(wstr long) -@ cdecl _wgetdcwd(long wstr long) -@ cdecl _wgetenv(wstr) -@ extern _winmajor -@ extern _winminor -@ extern _winver -@ cdecl _wmakepath(wstr wstr wstr wstr wstr) -@ cdecl _wmkdir(wstr) -@ cdecl _wmktemp(wstr) -@ varargs _wopen(wstr long) -@ stub _wperror #(wstr) -@ extern _wpgmptr -@ cdecl _wpopen (wstr wstr) -@ cdecl _wputenv(wstr) -@ cdecl _wremove(wstr) -@ cdecl _wrename(wstr wstr) -@ cdecl _write(long ptr long) -@ cdecl _wrmdir(wstr) -@ cdecl _wsearchenv(wstr wstr ptr) -@ cdecl _wsetlocale(long wstr) -@ varargs _wsopen (wstr long long) -@ varargs _wspawnl(long wstr wstr) -@ varargs _wspawnle(long wstr wstr) -@ varargs _wspawnlp(long wstr wstr) -@ varargs _wspawnlpe(long wstr wstr) -@ cdecl _wspawnv(long wstr ptr) -@ cdecl _wspawnve(long wstr ptr ptr) -@ cdecl _wspawnvp(long wstr ptr) -@ cdecl _wspawnvpe(long wstr ptr ptr) -@ cdecl _wsplitpath(wstr ptr ptr ptr ptr) -#@ cdecl _wsplitpath_s(wstr ptr long ptr long ptr long ptr long) -@ cdecl _wstat(wstr ptr) -@ cdecl _wstati64(wstr ptr) -@ cdecl _wstat64(wstr ptr) -@ cdecl _wstrdate(ptr) -@ cdecl _wstrtime(ptr) -@ cdecl _wsystem(wstr) -@ cdecl _wtempnam(wstr wstr) -@ stub _wtmpnam #(ptr) -@ cdecl _wtoi(wstr) ntdll._wtoi -@ cdecl _wtoi64(wstr) ntdll._wtoi64 -@ cdecl _wtol(wstr) ntdll._wtol -@ cdecl _wunlink(wstr) -@ cdecl _wutime(wstr ptr) -@ cdecl _wutime32(wstr ptr) -@ cdecl _wutime64(wstr ptr) -#@ cdecl _y0(double) -#@ cdecl _y1(double) -#@ cdecl _yn(long double ) -@ cdecl abort() -@ cdecl abs(long) ntdll.abs -@ cdecl acos(double) -@ cdecl asctime(ptr) -@ cdecl asin(double) -@ cdecl atan(double) -@ cdecl atan2(double double) -@ cdecl atexit(ptr) -@ cdecl atof(str) -@ cdecl atoi(str) ntdll.atoi -@ cdecl atol(str) ntdll.atol -@ cdecl bsearch(ptr ptr long long ptr) ntdll.bsearch -@ cdecl calloc(long long) -@ cdecl ceil(double) -@ cdecl ceilf(double) -@ cdecl clearerr(ptr) -@ cdecl clock() -@ cdecl cos(double) -@ cdecl cosh(double) -@ cdecl cosf(double) -@ cdecl ctime(ptr) -@ cdecl difftime(long long) -@ cdecl div(long long) -@ cdecl exit(long) -@ cdecl exp(double) -@ cdecl fabs(double) -@ cdecl fclose(ptr) -@ cdecl feof(ptr) -@ cdecl ferror(ptr) -@ cdecl fflush(ptr) -@ cdecl fgetc(ptr) -@ cdecl fgetpos(ptr ptr) -@ cdecl fgets(ptr long ptr) -@ cdecl fgetwc(ptr) -@ cdecl fgetws(ptr long ptr) -@ cdecl floor(double) -@ cdecl fmod(double double) -@ cdecl fmodf(double double) -@ cdecl fopen(str str) -@ varargs fprintf(ptr str) -@ cdecl fputc(long ptr) -@ cdecl fputs(str ptr) -@ cdecl fputwc(long ptr) -@ cdecl fputws(wstr ptr) -@ cdecl fread(ptr long long ptr) -@ cdecl free(ptr) -@ cdecl freopen(str str ptr) -@ cdecl frexp(double ptr) -@ varargs fscanf(ptr str) -@ cdecl fseek(ptr long long) -@ cdecl fsetpos(ptr ptr) -@ cdecl ftell(ptr) -@ varargs fwprintf(ptr wstr) -@ cdecl fwrite(ptr long long ptr) -@ varargs fwscanf(ptr wstr) -@ cdecl getc(ptr) -@ cdecl getchar() -@ cdecl getenv(str) -@ cdecl gets(str) -@ cdecl getwc(ptr) -@ cdecl getwchar() -@ cdecl gmtime(ptr) -@ cdecl is_wctype(long long) ntdll.iswctype -@ cdecl isalnum(long) -@ cdecl isalpha(long) -@ cdecl iscntrl(long) -@ cdecl isdigit(long) -@ cdecl isgraph(long) -@ cdecl isleadbyte(long) -@ cdecl islower(long) -@ cdecl isprint(long) -@ cdecl ispunct(long) -@ cdecl isspace(long) -@ cdecl isupper(long) -@ cdecl iswalnum(long) -@ cdecl iswalpha(long) ntdll.iswalpha -@ cdecl iswascii(long) -@ cdecl iswcntrl(long) -@ cdecl iswctype(long long) ntdll.iswctype -@ cdecl iswdigit(long) -@ cdecl iswgraph(long) -@ cdecl iswlower(long) -@ cdecl iswprint(long) -@ cdecl iswpunct(long) -@ cdecl iswspace(long) -@ cdecl iswupper(long) -@ cdecl iswxdigit(long) -@ cdecl isxdigit(long) -@ cdecl labs(long) ntdll.labs -@ cdecl ldexp( double long) -@ cdecl ldiv(long long) -@ cdecl localeconv() -@ cdecl localtime(ptr) -@ cdecl log(double) -@ cdecl logf(double) -@ cdecl log10(double) -@ cdecl longjmp(ptr long) -@ cdecl malloc(long) -@ cdecl mblen(ptr long) -@ cdecl mbstowcs(ptr str long) ntdll.mbstowcs -@ cdecl mbtowc(wstr str long) -@ cdecl memchr(ptr long long) ntdll.memchr -@ cdecl memcmp(ptr ptr long) ntdll.memcmp -@ cdecl memcpy(ptr ptr long) ntdll.memcpy -@ cdecl memmove(ptr ptr long) ntdll.memmove -@ cdecl memset(ptr long long) ntdll.memset -@ cdecl mktime(ptr) -@ cdecl modf(double ptr) -@ cdecl perror(str) -@ cdecl pow(double double) -@ varargs printf(str) -@ cdecl putc(long ptr) -@ cdecl putchar(long) -@ cdecl puts(str) -@ cdecl putwc(long ptr) fputwc #redirection is hack -@ cdecl putwchar(long) _fputwchar #redirection is hack -@ cdecl qsort(ptr long long ptr) ntdll.qsort -@ cdecl raise(long) -@ cdecl rand() -#@ cdecl rand_s(ptr) -@ cdecl realloc(ptr long) -@ cdecl remove(str) -@ cdecl rename(str str) -@ cdecl rewind(ptr) -@ varargs scanf(str) -@ cdecl setbuf(ptr ptr) -@ cdecl setlocale(long str) -@ cdecl setvbuf(ptr str long long) -@ cdecl signal(long long) -@ cdecl sin(double) -@ cdecl sinh(double) -@ varargs sprintf(ptr str) -#@ varargs sprintf_s(ptr long str) -@ cdecl sqrt(double) -@ cdecl sqrtf(double) -@ cdecl srand(long) -@ varargs sscanf(str str) -@ cdecl strcat(str str) ntdll.strcat -@ cdecl strcat_s(str long str) -@ cdecl strchr(str long) ntdll.strchr -@ cdecl strcmp(str str) ntdll.strcmp -@ cdecl strcoll(str str) -@ cdecl strcpy(ptr str) ntdll.strcpy -@ cdecl strcpy_s(ptr long str) -@ cdecl strcspn(str str) ntdll.strcspn -@ cdecl strerror(long) -@ cdecl strftime(str long str ptr) -@ cdecl strlen(str) ntdll.strlen -@ cdecl strncat(str str long) ntdll.strncat -@ cdecl strncmp(str str long) ntdll.strncmp -@ cdecl strncpy(ptr str long) ntdll.strncpy -@ cdecl strpbrk(str str) ntdll.strpbrk -@ cdecl strrchr(str long) ntdll.strrchr -@ cdecl strspn(str str) ntdll.strspn -@ cdecl strstr(str str) ntdll.strstr -@ cdecl strtod(str ptr) -@ cdecl strtok(str str) -@ cdecl strtol(str ptr long) -@ cdecl strtoul(str ptr long) -@ cdecl strxfrm(ptr str long) -@ varargs swprintf(ptr wstr) -@ varargs swscanf(wstr wstr) -@ cdecl system(str) -@ cdecl tan(double) -@ cdecl tanh(double) -@ cdecl time(ptr) -@ cdecl tmpfile() -@ cdecl tmpnam(ptr) -@ cdecl tolower(long) ntdll.tolower -@ cdecl toupper(long) ntdll.toupper -@ cdecl towlower(long) ntdll.towlower -@ cdecl towupper(long) ntdll.towupper -@ cdecl ungetc(long ptr) -@ cdecl ungetwc(long ptr) -@ cdecl vfprintf(ptr str ptr) -@ cdecl vfwprintf(ptr wstr ptr) -@ cdecl vprintf(str ptr) -@ cdecl vsprintf(ptr str ptr) -#@ cdecl vsprintf_s(ptr long str ptr) -@ cdecl vswprintf(ptr wstr ptr) -#@ cdecl vswprintf_s(ptr long wstr ptr) -@ cdecl vwprintf(wstr ptr) -@ cdecl wcscat(wstr wstr) ntdll.wcscat -#@ cdecl wcscat_s(wstr long wstr) -@ cdecl wcschr(wstr long) ntdll.wcschr -@ cdecl wcscmp(wstr wstr) ntdll.wcscmp -@ cdecl wcscoll(wstr wstr) -@ cdecl wcscpy(ptr wstr) ntdll.wcscpy -@ cdecl wcscpy_s(ptr long wstr) -@ cdecl wcscspn(wstr wstr) ntdll.wcscspn -@ cdecl wcsftime(ptr long wstr ptr) -@ cdecl wcslen(wstr) ntdll.wcslen -@ cdecl wcsncat(wstr wstr long) ntdll.wcsncat -@ cdecl wcsncmp(wstr wstr long) ntdll.wcsncmp -@ cdecl wcsncpy(ptr wstr long) ntdll.wcsncpy -@ cdecl wcsncpy_s(ptr long wstr long) -@ cdecl wcspbrk(wstr wstr) -@ cdecl wcsrchr(wstr long) ntdll.wcsrchr -@ cdecl wcsspn(wstr wstr) ntdll.wcsspn -@ cdecl wcsstr(wstr wstr) ntdll.wcsstr -@ cdecl wcstod(wstr ptr) -@ cdecl wcstok(wstr wstr) -@ cdecl wcstol(wstr ptr long) ntdll.wcstol -@ cdecl wcstombs(ptr ptr long) ntdll.wcstombs -@ cdecl wcstoul(wstr ptr long) ntdll.wcstoul -@ stub wcsxfrm #(ptr wstr long) -@ cdecl wctomb(ptr long) -@ varargs wprintf(wstr) -@ varargs wscanf(wstr) diff --git a/reactos/include/crt/math.h b/reactos/include/crt/math.h index 670b607d329..a5761848f57 100644 --- a/reactos/include/crt/math.h +++ b/reactos/include/crt/math.h @@ -187,8 +187,31 @@ extern "C" { return (_Df); } - //missing in msvcrt but needed by gdiplus +#if !defined(__x86_64) && !defined(_M_AMD64) + __CRT_INLINE float acosf(float _X) { return ((float)acos((double)_X)); } + __CRT_INLINE float asinf(float _X) { return ((float)asin((double)_X)); } + __CRT_INLINE float atanf(float _X) { return ((float)atan((double)_X)); } + __CRT_INLINE float atan2f(float _X,float _Y) { return ((float)atan2((double)_X,(double)_Y)); } + __CRT_INLINE float ceilf(float _X) { return ((float)ceil((double)_X)); } + __CRT_INLINE float cosf(float _X) { return ((float)cos((double)_X)); } + __CRT_INLINE float coshf(float _X) { return ((float)cosh((double)_X)); } + __CRT_INLINE float expf(float _X) { return ((float)exp((double)_X)); } __CRT_INLINE float floorf(float _X) { return ((float)floor((double)_X)); } + __CRT_INLINE float fmodf(float _X,float _Y) { return ((float)fmod((double)_X,(double)_Y)); } + __CRT_INLINE float logf(float _X) { return ((float)log((double)_X)); } + __CRT_INLINE float log10f(float _X) { return ((float)log10((double)_X)); } + __CRT_INLINE float modff(float _X,float *_Y) { + double _Di,_Df = modf((double)_X,&_Di); + *_Y = (float)_Di; + return ((float)_Df); + } + __CRT_INLINE float powf(float _X,float _Y) { return ((float)pow((double)_X,(double)_Y)); } + __CRT_INLINE float sinf(float _X) { return ((float)sin((double)_X)); } + __CRT_INLINE float sinhf(float _X) { return ((float)sinh((double)_X)); } + __CRT_INLINE float sqrtf(float _X) { return ((float)sqrt((double)_X)); } + __CRT_INLINE float tanf(float _X) { return ((float)tan((double)_X)); } + __CRT_INLINE float tanhf(float _X) { return ((float)tanh((double)_X)); } +#endif #ifndef NO_OLDNAMES #define DOMAIN _DOMAIN diff --git a/reactos/lib/sdk/crt/crt.rbuild b/reactos/lib/sdk/crt/crt.rbuild index 2539f2b7079..6e7ed0d16ff 100644 --- a/reactos/lib/sdk/crt/crt.rbuild +++ b/reactos/lib/sdk/crt/crt.rbuild @@ -22,7 +22,6 @@ extern - @@ -107,84 +106,87 @@ locale.c - abs.c acos.c - acosf.c adjust.c asin.c - asinf.c - atan.c - atan2.c - atan2f.c - atanf.c cabs.c - copysign.c - copysignf.c - cosf.c cosh.c div.c - exp.c - expf.c - fabs.c fdivbug.c - fmod.c - fmodf.c frexp.c huge_val.c hypot.c - hypotf.c - ldexp.c ldiv.c - log10f.c - logb.c - logbf.c - logf.c modf.c - modff.c - nextafter.c - nextafterf.c - powf.c rand.c s_modf.c - sinf.c sinh.c - sinhf.c - sqrt.c - sqrtf.c - tanf.c tanh.c - tanhf.c + pow_asm.c + - ceil.S - ceilf.S - cos.S - floor.S - floorf.S - log.S - log10.S - sin.S - tan.S - ci.c + alldiv_asm.s + alldvrm_asm.s + allmul_asm.s + allrem_asm.s + allshl_asm.s + allshr_asm.s + atan_asm.s + aulldiv_asm.s + aulldvrm_asm.s + aullrem_asm.s + aullshr_asm.s + ceil_asm.s + cos_asm.s + fabs_asm.s + floor_asm.s + ftol_asm.s + log_asm.s + log10_asm.s pow_asm.s + sin_asm.s + sqrt_asm.s + tan_asm.s + + atan2.c + ci.c + exp.c + fmod.c + ldexp.c + + - + + alldiv.S + atan.S + atan2.S ceil.S ceilf.S cos.S + exp.S + fabs.S floor.S floorf.S + fmod.S + fmodf.S + ldexp.S log.S log10.S - sin.S - tan.S - ci.c - - pow.S + sin.S + sqrt.S + sqrtf.S + tan.S + + stubs.c diff --git a/reactos/lib/sdk/crt/except/cppexcept.c b/reactos/lib/sdk/crt/except/cppexcept.c index ba75ce87daf..34d14a7c15d 100644 --- a/reactos/lib/sdk/crt/except/cppexcept.c +++ b/reactos/lib/sdk/crt/except/cppexcept.c @@ -491,11 +491,3 @@ unsigned int CDECL __CxxQueryExceptionSize(void) { return sizeof(cxx_exception_type); } - -/****************************************************************** - * MSVCRT___uncaught_exception - */ -BOOL CDECL __uncaught_exception(void) -{ - return FALSE; -} diff --git a/reactos/lib/sdk/crt/except/i386/unwind.c b/reactos/lib/sdk/crt/except/i386/unwind.c index 3807174270e..bb2c302a3b6 100644 --- a/reactos/lib/sdk/crt/except/i386/unwind.c +++ b/reactos/lib/sdk/crt/except/i386/unwind.c @@ -1,7 +1,6 @@ #define WIN32_NO_STATUS #include #include -#include #define NTOS_MODE_USER #include #include @@ -26,6 +25,23 @@ typedef struct _MSVCRT_EXCEPTION_FRAME PEXCEPTION_POINTERS xpointers; } MSVCRT_EXCEPTION_FRAME; + +typedef struct __JUMP_BUFFER +{ + unsigned long Ebp; + unsigned long Ebx; + unsigned long Edi; + unsigned long Esi; + unsigned long Esp; + unsigned long Eip; + unsigned long Registration; + unsigned long TryLevel; + /* Start of new struct members */ + unsigned long Cookie; + unsigned long UnwindFunc; + unsigned long UnwindData[6]; +} _JUMP_BUFFER; + void _local_unwind2(MSVCRT_EXCEPTION_FRAME *RegistrationFrame, LONG TryLevel); diff --git a/reactos/lib/sdk/crt/libcntpr.rbuild b/reactos/lib/sdk/crt/libcntpr.rbuild index b3714aade69..5011ae07ce9 100644 --- a/reactos/lib/sdk/crt/libcntpr.rbuild +++ b/reactos/lib/sdk/crt/libcntpr.rbuild @@ -6,7 +6,6 @@ - "extern __attribute__ ((dllexport))" @@ -41,44 +40,48 @@ allrem_asm.s allshl_asm.s allshr_asm.s + atan_asm.s aulldiv_asm.s aulldvrm_asm.s aullrem_asm.s aullshr_asm.s ci.c + ceil_asm.s + cos_asm.s + fabs_asm.s floor_asm.s ftol_asm.s + log_asm.s pow_asm.s - ceil.S - cos.S - log.S - log10.S - sin.S - tan.S + sin_asm.s + sqrt_asm.s + tan_asm.s - - ceil.S - cos.S - floor.S - log.S - log10.S - sin.S - tan.S - alldiv.S + atan.S + atan2.S + ceil.S + cos.S + exp.S + fabs.S + floor.S + fmod.S + ldexp.S + log.S + log10.S pow.S + sin.S + sqrt.S + tan.S abs.c - atan.c - fabs.c div.c labs.c rand_nt.c - sqrt.c @@ -204,4 +207,4 @@ wcsspn.c wcsstr.c - \ No newline at end of file + diff --git a/reactos/lib/sdk/crt/math/acosf.c b/reactos/lib/sdk/crt/math/acosf.c deleted file mode 100644 index 316479220f6..00000000000 --- a/reactos/lib/sdk/crt/math/acosf.c +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -float -acosf (float x) -{ - float res = 0.0F; -#ifdef __GNUC__ - /* acosl = atanl (sqrtl(1 - x^2) / x) */ - asm ( "fld %%st\n\t" - "fmul %%st(0)\n\t" /* x^2 */ - "fld1\n\t" - "fsubp\n\t" /* 1 - x^2 */ - "fsqrt\n\t" /* sqrtl (1 - x^2) */ - "fxch %%st(1)\n\t" - "fpatan" - : "=t" (res) : "0" (x) : "st(1)"); -#endif - return res; -} diff --git a/reactos/lib/sdk/crt/math/amd64/atan.S b/reactos/lib/sdk/crt/math/amd64/atan.S new file mode 100644 index 00000000000..ef871c356fb --- /dev/null +++ b/reactos/lib/sdk/crt/math/amd64/atan.S @@ -0,0 +1,21 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Implementation of atan + * FILE: lib/sdk/crt/math/amd64/atan.S + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include +#include + +.intel_syntax noprefix + + +.proc atan + UNIMPLEMENTED atan + ret + +.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/atan2.S b/reactos/lib/sdk/crt/math/amd64/atan2.S new file mode 100644 index 00000000000..15ac4b8422c --- /dev/null +++ b/reactos/lib/sdk/crt/math/amd64/atan2.S @@ -0,0 +1,21 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Implementation of atan2 + * FILE: lib/sdk/crt/math/amd64/atan2.S + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include +#include + +.intel_syntax noprefix + + +.proc atan2 + UNIMPLEMENTED atan2 + ret + +.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/ceil.S b/reactos/lib/sdk/crt/math/amd64/ceil.S new file mode 100644 index 00000000000..1948364686e --- /dev/null +++ b/reactos/lib/sdk/crt/math/amd64/ceil.S @@ -0,0 +1,21 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Implementation of ceil + * FILE: lib/sdk/crt/math/amd64/ceil.S + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include +#include + +.intel_syntax noprefix + + +.proc ceil + UNIMPLEMENTED ceil + ret + +.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/ceilf.S b/reactos/lib/sdk/crt/math/amd64/ceilf.S new file mode 100644 index 00000000000..9c887798d71 --- /dev/null +++ b/reactos/lib/sdk/crt/math/amd64/ceilf.S @@ -0,0 +1,40 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Implementation of tan + * FILE: lib/sdk/crt/math/amd64/ceilf.S + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include +#include + +.intel_syntax noprefix + + +.proc ceilf + /* Put parameter on the stack */ + movss [rsp - 0x10], xmm0 + fld dword ptr [rsp] + + /* Change fpu control word to round up */ + fstcw [rsp - 0x10] + mov eax, [rsp - 0x10] + or eax, 0x00800 + and eax, 0x0fbff + mov [rsp - 0x08], eax + fldcw [rsp - 0x08] + + /* Round to integer */ + frndint + + /* Restore fpu control word */ + fldcw [rsp - 0x10] + + fstp dword ptr [rsp - 0x10] + movss xmm0, [rsp - 0x10] + ret + +.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/cos.S b/reactos/lib/sdk/crt/math/amd64/cos.S new file mode 100644 index 00000000000..5d2e0fe787b --- /dev/null +++ b/reactos/lib/sdk/crt/math/amd64/cos.S @@ -0,0 +1,21 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Implementation of cos + * FILE: lib/sdk/crt/math/amd64/cos.S + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include +#include + +.intel_syntax noprefix + + +.proc cos + UNIMPLEMENTED cos + ret + +.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/exp.S b/reactos/lib/sdk/crt/math/amd64/exp.S new file mode 100644 index 00000000000..bd4a8d0e69b --- /dev/null +++ b/reactos/lib/sdk/crt/math/amd64/exp.S @@ -0,0 +1,21 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Implementation of exp + * FILE: lib/sdk/crt/math/amd64/exp.S + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include +#include + +.intel_syntax noprefix + + +.proc exp + UNIMPLEMENTED exp + ret + +.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/fabs.S b/reactos/lib/sdk/crt/math/amd64/fabs.S new file mode 100644 index 00000000000..2282de1488d --- /dev/null +++ b/reactos/lib/sdk/crt/math/amd64/fabs.S @@ -0,0 +1,21 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Implementation of fabs + * FILE: lib/sdk/crt/math/amd64/fabs.S + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include +#include + +.intel_syntax noprefix + + +.proc fabs + UNIMPLEMENTED fabs + ret + +.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/floor.S b/reactos/lib/sdk/crt/math/amd64/floor.S new file mode 100644 index 00000000000..a08e4fc84ed --- /dev/null +++ b/reactos/lib/sdk/crt/math/amd64/floor.S @@ -0,0 +1,21 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Implementation of floor + * FILE: lib/sdk/crt/math/amd64/floor.S + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include +#include + +.intel_syntax noprefix + + +.proc floor + UNIMPLEMENTED floor + ret + +.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/floorf.S b/reactos/lib/sdk/crt/math/amd64/floorf.S new file mode 100644 index 00000000000..900f8e62024 --- /dev/null +++ b/reactos/lib/sdk/crt/math/amd64/floorf.S @@ -0,0 +1,40 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Implementation of tan + * FILE: lib/sdk/crt/math/amd64/floorf.S + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include +#include + +.intel_syntax noprefix + + +.proc floorf + /* Put parameter on the stack */ + movss [rsp - 0x10], xmm0 + fld dword ptr [rsp] + + /* Change fpu control word to round down */ + fstcw [rsp - 0x10] + mov eax, [rsp - 0x10] + or eax, 0x00400 + and eax, 0x0f7ff + mov [rsp - 0x08], eax + fldcw [rsp - 0x08] + + /* Round to integer */ + frndint + + /* Restore fpu control word */ + fldcw [rsp - 0x10] + + fstp dword ptr [rsp - 0x10] + movss xmm0, [rsp - 0x10] + ret + +.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/fmod.S b/reactos/lib/sdk/crt/math/amd64/fmod.S new file mode 100644 index 00000000000..1ad26d93511 --- /dev/null +++ b/reactos/lib/sdk/crt/math/amd64/fmod.S @@ -0,0 +1,21 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Implementation of fmod + * FILE: lib/sdk/crt/math/amd64/fmod.S + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include +#include + +.intel_syntax noprefix + + +.proc fmod + UNIMPLEMENTED fmod + ret + +.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/fmodf.S b/reactos/lib/sdk/crt/math/amd64/fmodf.S new file mode 100644 index 00000000000..966ceffec40 --- /dev/null +++ b/reactos/lib/sdk/crt/math/amd64/fmodf.S @@ -0,0 +1,21 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Implementation of fmodf + * FILE: lib/sdk/crt/math/amd64/fmodf.S + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include +#include + +.intel_syntax noprefix + + +.proc fmodf + UNIMPLEMENTED fmodf + ret + +.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/ldexp.S b/reactos/lib/sdk/crt/math/amd64/ldexp.S new file mode 100644 index 00000000000..9d4649c66eb --- /dev/null +++ b/reactos/lib/sdk/crt/math/amd64/ldexp.S @@ -0,0 +1,21 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Implementation of ldexp + * FILE: lib/sdk/crt/math/amd64/ldexp.S + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include +#include + +.intel_syntax noprefix + + +.proc ldexp + UNIMPLEMENTED ldexp + ret + +.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/log.S b/reactos/lib/sdk/crt/math/amd64/log.S new file mode 100644 index 00000000000..f4190d3e286 --- /dev/null +++ b/reactos/lib/sdk/crt/math/amd64/log.S @@ -0,0 +1,21 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Implementation of log + * FILE: lib/sdk/crt/math/amd64/log.S + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include +#include + +.intel_syntax noprefix + + +.proc log + UNIMPLEMENTED log + ret + +.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/log10.S b/reactos/lib/sdk/crt/math/amd64/log10.S new file mode 100644 index 00000000000..1f9c77aaf5f --- /dev/null +++ b/reactos/lib/sdk/crt/math/amd64/log10.S @@ -0,0 +1,21 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Implementation of log10 + * FILE: lib/sdk/crt/math/amd64/log10.S + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include +#include + +.intel_syntax noprefix + + +.proc log10 + UNIMPLEMENTED log10 + ret + +.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/sin.S b/reactos/lib/sdk/crt/math/amd64/sin.S new file mode 100644 index 00000000000..683eedcd647 --- /dev/null +++ b/reactos/lib/sdk/crt/math/amd64/sin.S @@ -0,0 +1,21 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Implementation of sin + * FILE: lib/sdk/crt/math/amd64/sin.S + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include +#include + +.intel_syntax noprefix + + +.proc sin + UNIMPLEMENTED sin + ret + +.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/sqrt.S b/reactos/lib/sdk/crt/math/amd64/sqrt.S new file mode 100644 index 00000000000..48db2fde91e --- /dev/null +++ b/reactos/lib/sdk/crt/math/amd64/sqrt.S @@ -0,0 +1,21 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Implementation of sqrt + * FILE: lib/sdk/crt/math/amd64/sqrt.S + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include +#include + +.intel_syntax noprefix + + +.proc sqrt + UNIMPLEMENTED sqrt + ret + +.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/sqrtf.S b/reactos/lib/sdk/crt/math/amd64/sqrtf.S new file mode 100644 index 00000000000..50ea81033ac --- /dev/null +++ b/reactos/lib/sdk/crt/math/amd64/sqrtf.S @@ -0,0 +1,20 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Implementation of tan + * FILE: lib/sdk/crt/math/amd64/sqrtf.S + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include +#include + +.intel_syntax noprefix + + +.proc sqrtf + sqrtss xmm0, xmm0 + ret +.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/tan.S b/reactos/lib/sdk/crt/math/amd64/tan.S new file mode 100644 index 00000000000..225c3acc66a --- /dev/null +++ b/reactos/lib/sdk/crt/math/amd64/tan.S @@ -0,0 +1,21 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Implementation of tan + * FILE: lib/sdk/crt/math/amd64/tan.S + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include +#include + +.intel_syntax noprefix + + +.proc tan + UNIMPLEMENTED tan + ret + +.endproc diff --git a/reactos/lib/sdk/crt/math/asinf.c b/reactos/lib/sdk/crt/math/asinf.c deleted file mode 100644 index a7a6cd79675..00000000000 --- a/reactos/lib/sdk/crt/math/asinf.c +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -/* asin = atan (x / sqrt(1 - x^2)) */ - -float asinf (float x); - -float asinf (float x) -{ - float res = 0.0F; - - asm ( "fld %%st\n\t" - "fmul %%st(0)\n\t" /* x^2 */ - "fld1\n\t" - "fsubp\n\t" /* 1 - x^2 */ - "fsqrt\n\t" /* sqrt (1 - x^2) */ - "fpatan" - : "=t" (res) : "0" (x) : "st(1)"); - return res; -} diff --git a/reactos/lib/sdk/crt/math/atan.c b/reactos/lib/sdk/crt/math/atan.c deleted file mode 100644 index 83ac89e7466..00000000000 --- a/reactos/lib/sdk/crt/math/atan.c +++ /dev/null @@ -1,18 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include - -double -atan (double x) -{ - double res = 0.0L; -#if defined(__GNUC__) - asm ("fld1\n\t" - "fpatan" - : "=t" (res) : "0" (x)); -#endif - return res; -} diff --git a/reactos/lib/sdk/crt/math/atan2.c b/reactos/lib/sdk/crt/math/atan2.c deleted file mode 100644 index bb2f5f3518b..00000000000 --- a/reactos/lib/sdk/crt/math/atan2.c +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include - -double -atan2 (double y, double x) -{ - long double res = 0.0L; -#ifdef __GNUC__ - asm ("fpatan" : "=t" (res) : "u" (y), "0" (x) : "st(1)"); -#endif - return res; -} diff --git a/reactos/lib/sdk/crt/math/atan2f.c b/reactos/lib/sdk/crt/math/atan2f.c deleted file mode 100644 index f7d1d943c66..00000000000 --- a/reactos/lib/sdk/crt/math/atan2f.c +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -/* - * Written by J.T. Conklin . - * Public domain. - * - */ - -#include - -float -atan2f (float y, float x) -{ - float res = 0.0F; -#ifdef __GNUC__ - asm ("fpatan" : "=t" (res) : "u" (y), "0" (x) : "st(1)"); -#endif - return res; -} diff --git a/reactos/lib/sdk/crt/math/atanf.c b/reactos/lib/sdk/crt/math/atanf.c deleted file mode 100644 index 06868695a9d..00000000000 --- a/reactos/lib/sdk/crt/math/atanf.c +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -/* - * Written by J.T. Conklin . - * Public domain. - * - */ - -#include - -float -atanf (float x) -{ - float res = 0.0F; -#ifdef __GNUC__ - asm ("fld1\n\t" - "fpatan" : "=t" (res) : "0" (x)); -#endif - return res; -} diff --git a/reactos/lib/sdk/crt/math/copysign.c b/reactos/lib/sdk/crt/math/copysign.c deleted file mode 100644 index d81c2de6063..00000000000 --- a/reactos/lib/sdk/crt/math/copysign.c +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include - -typedef union U -{ - unsigned int u[2]; - double d; -} U; - -double copysign(double x, double y) -{ - U h,j; - h.d = x; - j.d = y; - h.u[1] = (h.u[1] & 0x7fffffff) | (j.u[1] & 0x80000000); - return h.d; -} diff --git a/reactos/lib/sdk/crt/math/copysignf.c b/reactos/lib/sdk/crt/math/copysignf.c deleted file mode 100644 index ca3cc399ea3..00000000000 --- a/reactos/lib/sdk/crt/math/copysignf.c +++ /dev/null @@ -1,19 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include - -typedef union ui_f { - float f; - unsigned int ui; -} ui_f; - -float copysignf(float aX, float aY) -{ - ui_f x,y; - x.f=aX; y.f=aY; - x.ui= (x.ui & 0x7fffffff) | (y.ui & 0x80000000); - return x.f; -} diff --git a/reactos/lib/sdk/crt/math/cosf.c b/reactos/lib/sdk/crt/math/cosf.c deleted file mode 100644 index d2329c7f254..00000000000 --- a/reactos/lib/sdk/crt/math/cosf.c +++ /dev/null @@ -1,11 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include - -float cosf(float _X) -{ - return ((float)cos((double)_X)); -} diff --git a/reactos/lib/sdk/crt/math/exp.c b/reactos/lib/sdk/crt/math/exp.c deleted file mode 100644 index 0759a28c10c..00000000000 --- a/reactos/lib/sdk/crt/math/exp.c +++ /dev/null @@ -1,55 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include -#define MAXLOG 7.09782712893383996843E2 -#define MINLOG -7.08396418532264106224E2 - -static double c0 = 1.44268798828125L; -static double c1 = 7.05260771340735992468e-6L; - -static double -__exp(double x) -{ - double res = 0.0L; -#ifdef __GNUC__ - asm ("fldl2e\n\t" /* 1 log2(e) */ - "fmul %%st(1),%%st\n\t" /* 1 x log2(e) */ - "frndint\n\t" /* 1 i */ - "fld %%st(1)\n\t" /* 2 x */ - "frndint\n\t" /* 2 xi */ - "fld %%st(1)\n\t" /* 3 i */ - "fldt %2\n\t" /* 4 c0 */ - "fld %%st(2)\n\t" /* 5 xi */ - "fmul %%st(1),%%st\n\t" /* 5 c0 xi */ - "fsubp %%st,%%st(2)\n\t" /* 4 f = c0 xi - i */ - "fld %%st(4)\n\t" /* 5 x */ - "fsub %%st(3),%%st\n\t" /* 5 xf = x - xi */ - "fmulp %%st,%%st(1)\n\t" /* 4 c0 xf */ - "faddp %%st,%%st(1)\n\t" /* 3 f = f + c0 xf */ - "fldt %3\n\t" /* 4 */ - "fmul %%st(4),%%st\n\t" /* 4 c1 * x */ - "faddp %%st,%%st(1)\n\t" /* 3 f = f + c1 * x */ - "f2xm1\n\t" /* 3 2^(fract(x * log2(e))) - 1 */ - "fld1\n\t" /* 4 1.0 */ - "faddp\n\t" /* 3 2^(fract(x * log2(e))) */ - "fstp %%st(1)\n\t" /* 2 */ - "fscale\n\t" /* 2 scale factor is st(1); e^x */ - "fstp %%st(1)\n\t" /* 1 */ - "fstp %%st(1)\n\t" /* 0 */ - : "=t" (res) : "0" (x), "m" (c0), "m" (c1) : "ax", "dx"); -#endif - return res; -} - -double exp (double x) -{ - if (x > MAXLOG) - return INFINITY; - else if (x < MINLOG) - return 0.0L; - else - return __exp (x); -} diff --git a/reactos/lib/sdk/crt/math/expf.c b/reactos/lib/sdk/crt/math/expf.c deleted file mode 100644 index fa09f2523f5..00000000000 --- a/reactos/lib/sdk/crt/math/expf.c +++ /dev/null @@ -1,10 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include -float expf (float x) -{ - return (float) exp (x); -} diff --git a/reactos/lib/sdk/crt/math/fabs.c b/reactos/lib/sdk/crt/math/fabs.c deleted file mode 100644 index 9be2ae8b743..00000000000 --- a/reactos/lib/sdk/crt/math/fabs.c +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include - -double -fabs (double x) -{ - double res = 0.0; -#ifdef __GNUC__ - asm ("fabs;" : "=t" (res) : "0" (x)); -#endif - return res; -} diff --git a/reactos/lib/sdk/crt/math/fmod.c b/reactos/lib/sdk/crt/math/fmod.c deleted file mode 100644 index de48b81c504..00000000000 --- a/reactos/lib/sdk/crt/math/fmod.c +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include - -double -fmod (double x, double y) -{ - double res = 0.0L; -#ifdef __GNUC__ - asm ("1:\tfprem\n\t" - "fstsw %%ax\n\t" - "sahf\n\t" - "jp 1b\n\t" - "fstp %%st(1)" - : "=t" (res) : "0" (x), "u" (y) : "ax", "st(1)"); -#endif - return res; -} diff --git a/reactos/lib/sdk/crt/math/fmodf.c b/reactos/lib/sdk/crt/math/fmodf.c deleted file mode 100644 index aa7bca4a0a7..00000000000 --- a/reactos/lib/sdk/crt/math/fmodf.c +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -/* - * Written by J.T. Conklin . - * Public domain. - * - * Adapted for float type by Danny Smith - * . - */ - -#include - -float -fmodf (float x, float y) -{ - float res = 0.0F; -#ifdef __GNUC__ - asm ("1:\tfprem\n\t" - "fstsw %%ax\n\t" - "sahf\n\t" - "jp 1b\n\t" - "fstp %%st(1)" - : "=t" (res) : "0" (x), "u" (y) : "ax", "st(1)"); -#endif - return res; -} diff --git a/reactos/lib/sdk/crt/math/hypotf.c b/reactos/lib/sdk/crt/math/hypotf.c deleted file mode 100644 index 34367fc4df1..00000000000 --- a/reactos/lib/sdk/crt/math/hypotf.c +++ /dev/null @@ -1,12 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include - -float hypotf (float x, float y) -{ - return (float) _hypot (x, y); -} - diff --git a/reactos/lib/sdk/crt/math/i386/atan_asm.s b/reactos/lib/sdk/crt/math/i386/atan_asm.s new file mode 100644 index 00000000000..37554c940ae --- /dev/null +++ b/reactos/lib/sdk/crt/math/i386/atan_asm.s @@ -0,0 +1,50 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * PURPOSE: Run-Time Library + * FILE: lib/rtl/i386/atan.S + * PROGRAMER: Alex Ionescu (alex@relsoft.net) + * + * Copyright (C) 2002 Michael Ringgaard. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES// LOSS OF USE, DATA, OR PROFITS// OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +.globl _atan + +.intel_syntax noprefix + +/* FUNCTIONS ***************************************************************/ + +_atan: + push ebp + mov ebp,esp + fld qword ptr [ebp+8] // Load real from stack + fld1 // Load constant 1 + fpatan // Take the arctangent + pop ebp + ret diff --git a/reactos/lib/sdk/crt/math/i386/ceil.S b/reactos/lib/sdk/crt/math/i386/ceil.S deleted file mode 100644 index 198a4a28d3f..00000000000 --- a/reactos/lib/sdk/crt/math/i386/ceil.S +++ /dev/null @@ -1,54 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - - .file "ceil.S" - .text -#ifdef _WIN64 - .align 8 -#else - .align 4 -#endif -.globl _ceil - .def _ceil; .scl 2; .type 32; .endef -_ceil: -#ifdef _WIN64 - fldt (%rdx) - subq $24,%rsp - - fstcw 8(%rsp) /* store fpu control word */ - - /* We use here %edx although only the low 1 bits are defined. - But none of the operations should care and they are faster - than the 16 bit operations. */ - movl $0x0800,%edx /* round towards +oo */ - orl 8(%rsp),%edx - andl $0xfbff,%edx - movl %edx,(%rsp) - fldcw (%rsp) /* load modified control word */ - - frndint /* round */ - - fldcw 8(%rsp) /* restore original control word */ - - addq $24,%rsp - movq %rcx,%rax - movq $0,8(%rcx) - fstpt (%rcx) - ret -#else - fldt 4(%esp) - subl $8,%esp - fstcw 4(%esp) - movl $0x0800,%edx - orl 4(%esp),%edx - andl $0xfbff,%edx - movl %edx,(%esp) - fldcw (%esp) - frndint - fldcw 4(%esp) - addl $8,%esp - ret -#endif diff --git a/reactos/lib/sdk/crt/math/i386/ceil_asm.s b/reactos/lib/sdk/crt/math/i386/ceil_asm.s new file mode 100644 index 00000000000..aad69114f5a --- /dev/null +++ b/reactos/lib/sdk/crt/math/i386/ceil_asm.s @@ -0,0 +1,57 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * PURPOSE: Run-Time Library + * FILE: lib/rtl/i386/ceil.S + * PROGRAMER: Alex Ionescu (alex@relsoft.net) + * + * Copyright (C) 2002 Michael Ringgaard. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES// LOSS OF USE, DATA, OR PROFITS// OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +.globl _ceil + +.intel_syntax noprefix + +/* FUNCTIONS ***************************************************************/ + +_ceil: + push ebp + mov ebp,esp + sub esp,4 // Allocate temporary space + fld qword ptr [ebp+8] // Load real from stack + fstcw [ebp-2] // Save control word + fclex // Clear exceptions + mov word ptr [ebp-4],0xb63 // Rounding control word + fldcw [ebp-4] // Set new rounding control + frndint // Round to integer + fclex // Clear exceptions + fldcw [ebp-2] // Restore control word + mov esp,ebp // Deallocate temporary space + pop ebp + ret diff --git a/reactos/lib/sdk/crt/math/i386/ceilf.S b/reactos/lib/sdk/crt/math/i386/ceilf.S deleted file mode 100644 index 6321ca0c558..00000000000 --- a/reactos/lib/sdk/crt/math/i386/ceilf.S +++ /dev/null @@ -1,54 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - - .file "ceilf.S" - .text - .align 4 -.globl _ceilf - .def _ceilf; .scl 2; .type 32; .endef -_ceilf: -#ifdef _WIN64 - subq $24,%rsp - movss %xmm0,8(%rsp) - flds 8(%rsp) - - fstcw 4(%rsp) /* store fpu control word */ - - movl $0x0800,%edx /* round towards +oo */ - orl 4(%rsp),%edx - andl $0xfbff,%edx - movl %edx,(%rsp) - fldcw (%rsp) /* load modified control word */ - - frndint /* round */ - - fldcw 4(%rsp) /* restore original control word */ - fstps 8(%rsp) - movss 8(%rsp),%xmm0 - addq $24,%rsp - ret -#else - flds 4(%esp) - subl $8,%esp - - fstcw 4(%esp) /* store fpu control word */ - - /* We use here %edx although only the low 1 bits are defined. - But none of the operations should care and they are faster - than the 16 bit operations. */ - movl $0x0800,%edx /* round towards +oo */ - orl 4(%esp),%edx - andl $0xfbff,%edx - movl %edx,(%esp) - fldcw (%esp) /* load modified control word */ - - frndint /* round */ - - fldcw 4(%esp) /* restore original control word */ - - addl $8,%esp - ret -#endif diff --git a/reactos/lib/sdk/crt/math/i386/cos.S b/reactos/lib/sdk/crt/math/i386/cos.S deleted file mode 100644 index 8dc0854958f..00000000000 --- a/reactos/lib/sdk/crt/math/i386/cos.S +++ /dev/null @@ -1,53 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - .file "cos.S" - .text -#ifdef _WIN64 - .align 8 -#else - .align 4 -#endif -.globl _cos - .def _cos; .scl 2; .type 32; .endef -_cos: -#ifdef _WIN64 - fldt (%rdx) - fcos - fnstsw %ax - testl $0x400,%eax - jz 1f - fldpi - fadd %st(0) - fxch %st(1) -2: fprem1 - fnstsw %ax - testl $0x400,%eax - jnz 2b - fstp %st(1) - fcos -1: movq %rcx,%rax - movq $0,8(%rcx) - fstpt (%rcx) - ret -#else - fldt 4(%esp) - fcos - fnstsw %ax - testl $0x400,%eax - jnz 1f - ret -1: fldpi - fadd %st(0) - fxch %st(1) -2: fprem1 - fnstsw %ax - testl $0x400,%eax - jnz 2b - fstp %st(1) - fcos - ret -#endif - diff --git a/reactos/lib/sdk/crt/math/i386/cos_asm.s b/reactos/lib/sdk/crt/math/i386/cos_asm.s new file mode 100644 index 00000000000..b1c6ada49b2 --- /dev/null +++ b/reactos/lib/sdk/crt/math/i386/cos_asm.s @@ -0,0 +1,49 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * PURPOSE: Run-Time Library + * FILE: lib/rtl/i386/cos.S + * PROGRAMER: Alex Ionescu (alex@relsoft.net) + * + * Copyright (C) 2002 Michael Ringgaard. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES// LOSS OF USE, DATA, OR PROFITS// OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +.globl _cos + +.intel_syntax noprefix + +/* FUNCTIONS ***************************************************************/ + +_cos: + push ebp + mov ebp,esp // Point to the stack frame + fld qword ptr [ebp+8] // Load real from stack + fcos // Take the cosine + pop ebp + ret diff --git a/reactos/lib/sdk/crt/math/i386/fabs_asm.s b/reactos/lib/sdk/crt/math/i386/fabs_asm.s new file mode 100644 index 00000000000..5c6ce9214ef --- /dev/null +++ b/reactos/lib/sdk/crt/math/i386/fabs_asm.s @@ -0,0 +1,49 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * PURPOSE: Run-Time Library + * FILE: lib/rtl/i386/fabs.S + * PROGRAMER: Alex Ionescu (alex@relsoft.net) + * + * Copyright (C) 2002 Michael Ringgaard. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES// LOSS OF USE, DATA, OR PROFITS// OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +.globl _fabs + +.intel_syntax noprefix + +/* FUNCTIONS ***************************************************************/ + +_fabs: + push ebp + mov ebp,esp + fld qword ptr [ebp+8] // Load real from stack + fabs // Take the absolute value + pop ebp + ret diff --git a/reactos/lib/sdk/crt/math/i386/floor.S b/reactos/lib/sdk/crt/math/i386/floor.S deleted file mode 100644 index f70b70d0db1..00000000000 --- a/reactos/lib/sdk/crt/math/i386/floor.S +++ /dev/null @@ -1,62 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - - .file "floor.S" - .text -#ifdef _WIN64 - .align 8 -#else - .align 4 -#endif -.globl _floor - .def _floor; .scl 2; .type 32; .endef -_floor: -#ifdef _WIN64 - fldt (%rdx) - subq $24,%rsp - - fstcw 8(%rsp) /* store fpu control word */ - - /* We use here %edx although only the low 1 bits are defined. - But none of the operations should care and they are faster - than the 16 bit operations. */ - movl $0x400,%edx /* round towards -oo */ - orl 8(%rsp),%edx - andl $0xf7ff,%edx - movl %edx,(%rsp) - fldcw (%rsp) /* load modified control word */ - - frndint /* round */ - - fldcw 8(%rsp) /* restore original control word */ - - addq $24,%rsp - movq %rcx,%rax - movq $0,8(%rcx) - fstpt (%rcx) - ret -#else - fldt 4(%esp) - subl $8,%esp - - fstcw 4(%esp) /* store fpu control word */ - - /* We use here %edx although only the low 1 bits are defined. - But none of the operations should care and they are faster - than the 16 bit operations. */ - movl $0x400,%edx /* round towards -oo */ - orl 4(%esp),%edx - andl $0xf7ff,%edx - movl %edx,(%esp) - fldcw (%esp) /* load modified control word */ - - frndint /* round */ - - fldcw 4(%esp) /* restore original control word */ - - addl $8,%esp - ret -#endif diff --git a/reactos/lib/sdk/crt/math/i386/floorf.S b/reactos/lib/sdk/crt/math/i386/floorf.S deleted file mode 100644 index 5c83106b6e3..00000000000 --- a/reactos/lib/sdk/crt/math/i386/floorf.S +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - * - * Changes for long double by Ulrich Drepper - * - * Removed header file dependency for use in libmingwex.a by - * Danny Smith - */ - .file "floorf.S" - .text -#ifdef _WIN64 - .align 8 -#else - .align 4 -#endif -.globl _floorf - .def _floorf; .scl 2; .type 32; .endef -_floorf: -#ifdef _WIN64 - subq $24,%rsp - movss %xmm0,8(%rsp) - flds 8(%rsp) - - fstcw 4(%rsp) /* store fpu control word */ - movl $0x400,%edx /* round towards -oo */ - orl 4(%rsp),%edx - andl $0xf7ff,%edx - movl %edx,(%rsp) - fldcw (%rsp) /* load modified control word */ - - frndint /* round */ - - fldcw 4(%rsp) /* restore original control word */ - - fstps 8(%rsp) - movss 8(%rsp),%xmm0 - addq $24,%rsp - ret -#else - flds 4(%esp) - subl $8,%esp - - fstcw 4(%esp) /* store fpu control word */ - - /* We use here %edx although only the low 1 bits are defined. - But none of the operations should care and they are faster - than the 16 bit operations. */ - movl $0x400,%edx /* round towards -oo */ - orl 4(%esp),%edx - andl $0xf7ff,%edx - movl %edx,(%esp) - fldcw (%esp) /* load modified control word */ - - frndint /* round */ - - fldcw 4(%esp) /* restore original control word */ - - addl $8,%esp - ret -#endif diff --git a/reactos/lib/sdk/crt/math/i386/log.S b/reactos/lib/sdk/crt/math/i386/log.S deleted file mode 100644 index 30129c78798..00000000000 --- a/reactos/lib/sdk/crt/math/i386/log.S +++ /dev/null @@ -1,65 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - - .file "log.S" - .text -#ifdef _WIN64 - .align 8 -#else - .align 4 -#endif -one: .double 1.0 - /* It is not important that this constant is precise. It is only - a value which is known to be on the safe side for using the - fyl2xp1 instruction. */ -limit: .double 0.29 - -.globl _log - .def _log; .scl 2; .type 32; .endef -_log: -#ifdef _WIN64 - fldln2 // log(2) - fldt (%rdx) // x : log(2) - fld %st // x : x : log(2) - fsubl one // x-1 : x : log(2) - fld %st // x-1 : x-1 : x : log(2) - fabs // |x-1| : x-1 : x : log(2) - fcompl limit // x-1 : x : log(2) - fnstsw // x-1 : x : log(2) - andb $0x45, %ah - jz 2f - fstp %st(1) // x-1 : log(2) - fyl2xp1 // log(x) - movq %rcx,%rax - movq $0,8(%rcx) - fstpt (%rcx) - ret - -2: fstp %st(0) // x : log(2) - fyl2x // log(x) - movq %rcx,%rax - movq $0,8(%rcx) - fstpt (%rcx) - ret -#else - fldln2 // log(2) - fldt 4(%esp) // x : log(2) - fld %st // x : x : log(2) - fsubl one // x-1 : x : log(2) - fld %st // x-1 : x-1 : x : log(2) - fabs // |x-1| : x-1 : x : log(2) - fcompl limit // x-1 : x : log(2) - fnstsw // x-1 : x : log(2) - andb $0x45, %ah - jz 2f - fstp %st(1) // x-1 : log(2) - fyl2xp1 // log(x) - ret - -2: fstp %st(0) // x : log(2) - fyl2x // log(x) - ret -#endif diff --git a/reactos/lib/sdk/crt/math/i386/log10.S b/reactos/lib/sdk/crt/math/i386/log10.S deleted file mode 100644 index 45712a68fa6..00000000000 --- a/reactos/lib/sdk/crt/math/i386/log10.S +++ /dev/null @@ -1,92 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - - .file "log10.S" - .text -#ifdef _WIN64 - .align 8 -#else - .align 4 -#endif -one: .double 1.0 - /* It is not important that this constant is precise. It is only - a value which is known to be on the safe side for using the - fyl2xp1 instruction. */ -limit: .double 0.29 - - .text -#ifdef _WIN64 - .align 8 -#else - .align 4 -#endif -.globl _log10 - .def _log10; .scl 2; .type 32; .endef -_log10: -#ifdef _WIN64 - fldlg2 // log10(2) - fldt (%rdx) // x : log10(2) - fxam - fnstsw - fld %st // x : x : log10(2) - sahf - jc 3f // in case x is NaN or Inf -4: fsubl one // x-1 : x : log10(2) - fld %st // x-1 : x-1 : x : log10(2) - fabs // |x-1| : x-1 : x : log10(2) - fcompl limit // x-1 : x : log10(2) - fnstsw // x-1 : x : log10(2) - andb $0x45, %ah - jz 2f - fstp %st(1) // x-1 : log10(2) - fyl2xp1 // log10(x) - movq %rcx,%rax - movq $0,8(%rcx) - fstpt (%rcx) - ret - -2: fstp %st(0) // x : log10(2) - fyl2x // log10(x) - movq %rcx,%rax - movq $0,8(%rcx) - fstpt (%rcx) - ret - -3: jp 4b // in case x is Inf - fstp %st(1) - fstp %st(1) - movq %rcx,%rax - movq $0,8(%rcx) - fstpt (%rcx) - ret -#else - fldlg2 // log10(2) - fldt 4(%esp) // x : log10(2) - fxam - fnstsw - fld %st // x : x : log10(2) - sahf - jc 3f // in case x is NaN or Inf -4: fsubl one // x-1 : x : log10(2) - fld %st // x-1 : x-1 : x : log10(2) - fabs // |x-1| : x-1 : x : log10(2) - fcompl limit // x-1 : x : log10(2) - fnstsw // x-1 : x : log10(2) - andb $0x45, %ah - jz 2f - fstp %st(1) // x-1 : log10(2) - fyl2xp1 // log10(x) - ret - -2: fstp %st(0) // x : log10(2) - fyl2x // log10(x) - ret - -3: jp 4b // in case x is Inf - fstp %st(1) - fstp %st(1) - ret -#endif diff --git a/reactos/lib/sdk/crt/math/i386/log10_asm.s b/reactos/lib/sdk/crt/math/i386/log10_asm.s new file mode 100644 index 00000000000..71731816429 --- /dev/null +++ b/reactos/lib/sdk/crt/math/i386/log10_asm.s @@ -0,0 +1,27 @@ + + /* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * PURPOSE: + * FILE: + * PROGRAMER: Magnus Olsen (magnus@greatlord.com) + * + */ + +.globl _log10 + +.intel_syntax noprefix + +/* FUNCTIONS ***************************************************************/ + +_log10: + + push ebp + mov ebp,esp + fld qword ptr [ebp+8] // Load real from stack + fldlg2 // Load log base 10 of 2 + fxch st(1) // Exchange st, st(1) + fyl2x // Compute the log base 10(x) + pop ebp + ret + diff --git a/reactos/lib/sdk/crt/math/i386/log_asm.s b/reactos/lib/sdk/crt/math/i386/log_asm.s new file mode 100644 index 00000000000..0d98279ed41 --- /dev/null +++ b/reactos/lib/sdk/crt/math/i386/log_asm.s @@ -0,0 +1,51 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * PURPOSE: Run-Time Library + * FILE: lib/rtl/i386/log.S + * PROGRAMER: Alex Ionescu (alex@relsoft.net) + * + * Copyright (C) 2002 Michael Ringgaard. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES// LOSS OF USE, DATA, OR PROFITS// OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +.globl _log + +.intel_syntax noprefix + +/* FUNCTIONS ***************************************************************/ + +_log: + push ebp + mov ebp,esp + fld qword ptr [ebp+8] // Load real from stack + fldln2 // Load log base e of 2 + fxch st(1) // Exchange st, st(1) + fyl2x // Compute the natural log(x) + pop ebp + ret diff --git a/reactos/lib/sdk/crt/math/i386/sin.S b/reactos/lib/sdk/crt/math/i386/sin.S deleted file mode 100644 index 13407dfbb61..00000000000 --- a/reactos/lib/sdk/crt/math/i386/sin.S +++ /dev/null @@ -1,57 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - - .file "sin.S" - .text -#ifdef _WIN64 - .align 8 -#else - .align 4 -#endif -.globl _sin - .def _sin; .scl 2; .type 32; .endef -_sin: -#ifdef _WIN64 - fldt (%rdx) - fsin - fnstsw %ax - testl $0x400,%eax - jnz 1f - movq %rcx,%rax - movq $0,8(%rcx) - fstpt (%rcx) - ret -1: fldpi - fadd %st(0) - fxch %st(1) -2: fprem1 - fnstsw %ax - testl $0x400,%eax - jnz 2b - fstp %st(1) - fsin - movq %rcx,%rax - movq $0,8(%rcx) - fstpt (%rcx) - ret -#else - fldt 4(%esp) - fsin - fnstsw %ax - testl $0x400,%eax - jnz 1f - ret -1: fldpi - fadd %st(0) - fxch %st(1) -2: fprem1 - fnstsw %ax - testl $0x400,%eax - jnz 2b - fstp %st(1) - fsin - ret -#endif diff --git a/reactos/lib/sdk/crt/math/i386/sin_asm.s b/reactos/lib/sdk/crt/math/i386/sin_asm.s new file mode 100644 index 00000000000..39791a3e989 --- /dev/null +++ b/reactos/lib/sdk/crt/math/i386/sin_asm.s @@ -0,0 +1,49 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * PURPOSE: Run-Time Library + * FILE: lib/rtl/i386/sin.S + * PROGRAMER: Alex Ionescu (alex@relsoft.net) + * + * Copyright (C) 2002 Michael Ringgaard. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES// LOSS OF USE, DATA, OR PROFITS// OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +.globl _sin + +.intel_syntax noprefix + +/* FUNCTIONS ***************************************************************/ + +_sin: + push ebp // Save register bp + mov ebp,esp // Point to the stack frame + fld qword ptr [ebp+8] // Load real from stack + fsin // Take the sine + pop ebp // Restore register bp + ret diff --git a/reactos/lib/sdk/crt/math/i386/sqrt_asm.s b/reactos/lib/sdk/crt/math/i386/sqrt_asm.s new file mode 100644 index 00000000000..c953a0350e9 --- /dev/null +++ b/reactos/lib/sdk/crt/math/i386/sqrt_asm.s @@ -0,0 +1,49 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * PURPOSE: Run-Time Library + * FILE: lib/rtl/i386/sqrt.S + * PROGRAMER: Alex Ionescu (alex@relsoft.net) + * + * Copyright (C) 2002 Michael Ringgaard. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES// LOSS OF USE, DATA, OR PROFITS// OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +.globl _sqrt + +.intel_syntax noprefix + +/* FUNCTIONS ***************************************************************/ + +_sqrt: + push ebp + mov ebp,esp + fld qword ptr [ebp+8] // Load real from stack + fsqrt // Take the square root + pop ebp + ret diff --git a/reactos/lib/sdk/crt/math/i386/tan.S b/reactos/lib/sdk/crt/math/i386/tan.S deleted file mode 100644 index c8c76d52d4b..00000000000 --- a/reactos/lib/sdk/crt/math/i386/tan.S +++ /dev/null @@ -1,61 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - - .file "tan.S" - .text -#ifdef _WIN64 - .align 8 -#else - .align 4 -#endif -.globl _tan - .def _tan; .scl 2; .type 32; .endef -_tan: -#ifdef _WIN64 - fldt (%rdx) - fptan - fnstsw %ax - testl $0x400,%eax - jnz 1f - fstp %st(0) - movq %rcx,%rax - movq $0,8(%rcx) - fstpt (%rcx) - ret -1: fldpi - fadd %st(0) - fxch %st(1) -2: fprem1 - fstsw %ax - testl $0x400,%eax - jnz 2b - fstp %st(1) - fptan - fstp %st(0) - movq %rcx,%rax - movq $0,8(%rcx) - fstpt (%rcx) - ret -#else - fldt 4(%esp) - fptan - fnstsw %ax - testl $0x400,%eax - jnz 1f - fstp %st(0) - ret -1: fldpi - fadd %st(0) - fxch %st(1) -2: fprem1 - fstsw %ax - testl $0x400,%eax - jnz 2b - fstp %st(1) - fptan - fstp %st(0) - ret -#endif diff --git a/reactos/lib/sdk/crt/math/i386/tan_asm.s b/reactos/lib/sdk/crt/math/i386/tan_asm.s new file mode 100644 index 00000000000..34af2614f89 --- /dev/null +++ b/reactos/lib/sdk/crt/math/i386/tan_asm.s @@ -0,0 +1,52 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * PURPOSE: Run-Time Library + * FILE: lib/rtl/i386/tan.S + * PROGRAMER: Alex Ionescu (alex@relsoft.net) + * + * Copyright (C) 2002 Michael Ringgaard. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES// LOSS OF USE, DATA, OR PROFITS// OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +.globl _tan + +.intel_syntax noprefix + +/* FUNCTIONS ***************************************************************/ + +_tan: + push ebp + mov ebp,esp + sub esp,4 // Allocate temporary space + fld qword ptr [ebp+8] // Load real from stack + fptan // Take the tangent + fstp dword ptr [ebp-4] // Throw away the constant 1 + mov esp,ebp // Deallocate temporary space + pop ebp + ret diff --git a/reactos/lib/sdk/crt/math/j0_y0.c b/reactos/lib/sdk/crt/math/j0_y0.c new file mode 100644 index 00000000000..d6787deeb28 --- /dev/null +++ b/reactos/lib/sdk/crt/math/j0_y0.c @@ -0,0 +1,30 @@ +#include + +typedef int fpclass_t; +fpclass_t _fpclass(double __d); +int *_errno(void); + +/* + * @unimplemented + */ +double _j0(double num) +{ + /* FIXME: errno handling */ + return j0(num); +} + +/* + * @implemented + */ +double _y0(double num) +{ + double retval; + if (!isfinite(num)) *_errno() = EDOM; + retval = y0(num); + if (_fpclass(retval) == _FPCLASS_NINF) + { + *_errno() = EDOM; + retval = sqrt(-1); + } + return retval; +} diff --git a/reactos/lib/sdk/crt/math/j1_y1.c b/reactos/lib/sdk/crt/math/j1_y1.c new file mode 100644 index 00000000000..b050889d7ae --- /dev/null +++ b/reactos/lib/sdk/crt/math/j1_y1.c @@ -0,0 +1,30 @@ +#include + +typedef int fpclass_t; +fpclass_t _fpclass(double __d); +int *_errno(void); + +/* + * @unimplemented + */ +double _j1(double num) +{ + /* FIXME: errno handling */ + return j1(num); +} + +/* + * @implemented + */ +double _y1(double num) +{ + double retval; + if (!isfinite(num)) *_errno() = EDOM; + retval = y1(num); + if (_fpclass(retval) == _FPCLASS_NINF) + { + *_errno() = EDOM; + retval = sqrt(-1); + } + return retval; +} diff --git a/reactos/lib/sdk/crt/math/jn_yn.c b/reactos/lib/sdk/crt/math/jn_yn.c new file mode 100644 index 00000000000..34f2dee7a4d --- /dev/null +++ b/reactos/lib/sdk/crt/math/jn_yn.c @@ -0,0 +1,30 @@ +#include + +typedef int fpclass_t; +fpclass_t _fpclass(double __d); +int *_errno(void); + +/* + * @unimplemented + */ +double _jn(int n, double num) +{ + /* FIXME: errno handling */ + return jn(n, num); +} + +/* + * @implemented + */ +double _yn(int order, double num) +{ + double retval; + if (!isfinite(num)) *_errno() = EDOM; + retval = yn(order,num); + if (_fpclass(retval) == _FPCLASS_NINF) + { + *_errno() = EDOM; + retval = sqrt(-1); + } + return retval; +} diff --git a/reactos/lib/sdk/crt/math/log10f.c b/reactos/lib/sdk/crt/math/log10f.c deleted file mode 100644 index 2a295a4582b..00000000000 --- a/reactos/lib/sdk/crt/math/log10f.c +++ /dev/null @@ -1,11 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include - -float log10f(float _X) -{ - return ((float)log10((double)_X)); -} diff --git a/reactos/lib/sdk/crt/math/logb.c b/reactos/lib/sdk/crt/math/logb.c deleted file mode 100644 index 640572651de..00000000000 --- a/reactos/lib/sdk/crt/math/logb.c +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -/* - * Written by J.T. Conklin . - * Changes for long double by Ulrich Drepper - * Public domain. - */ - -#include - -double -logb (double x) -{ - double res = 0.0; -#ifdef __GNUC__ - asm ("fxtract\n\t" - "fstp %%st" : "=t" (res) : "0" (x)); -#endif - return res; -} diff --git a/reactos/lib/sdk/crt/math/logbf.c b/reactos/lib/sdk/crt/math/logbf.c deleted file mode 100644 index 384533f946e..00000000000 --- a/reactos/lib/sdk/crt/math/logbf.c +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -/* - * Written by J.T. Conklin . - * Changes for long double by Ulrich Drepper - * Public domain. - */ - -#include - -float -logbf (float x) -{ - float res = 0.0F; -#ifndef __GNUC__ - asm ("fxtract\n\t" - "fstp %%st" : "=t" (res) : "0" (x)); -#endif - return res; -} diff --git a/reactos/lib/sdk/crt/math/logf.c b/reactos/lib/sdk/crt/math/logf.c deleted file mode 100644 index 0da1dae909f..00000000000 --- a/reactos/lib/sdk/crt/math/logf.c +++ /dev/null @@ -1,11 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include - -float logf(float _X) -{ - return ((float)log((double)_X)); -} diff --git a/reactos/lib/sdk/crt/math/modff.c b/reactos/lib/sdk/crt/math/modff.c deleted file mode 100644 index 53b65ebe5b5..00000000000 --- a/reactos/lib/sdk/crt/math/modff.c +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include -#include -#include -#define FE_ROUNDING_MASK \ - (FE_TONEAREST | FE_DOWNWARD | FE_UPWARD | FE_TOWARDZERO) - -float -modff (float value, float* iptr) -{ - float int_part = 0.0F; - unsigned short saved_cw; - unsigned short tmp_cw; - /* truncate */ - asm ("fnstcw %0;" : "=m" (saved_cw)); /* save control word */ - tmp_cw = (saved_cw & ~FE_ROUNDING_MASK) | FE_TOWARDZERO; - asm ("fldcw %0;" : : "m" (tmp_cw)); - asm ("frndint;" : "=t" (int_part) : "0" (value)); /* round */ - asm ("fldcw %0;" : : "m" (saved_cw)); /* restore saved cw */ - if (iptr) - *iptr = int_part; - return (isinf (value) ? 0.0F : value - int_part); -} diff --git a/reactos/lib/sdk/crt/math/nextafter.c b/reactos/lib/sdk/crt/math/nextafter.c deleted file mode 100644 index 7aca439b407..00000000000 --- a/reactos/lib/sdk/crt/math/nextafter.c +++ /dev/null @@ -1,66 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -/* - nextafterl.c - Contributed by Danny Smith - No copyright claimed, absolutely no warranties. - - 2005-05-09 -*/ - -#include - -double -nextafter (double x, double y) -{ - union { - long double ld; - struct { - /* packed attribute is unnecessary on x86/x64 for these three variables */ - unsigned long long mantissa; - unsigned short expn; - unsigned short pad; - } parts; - } u; - - /* The normal bit is explicit for long doubles, unlike - float and double. */ - static const unsigned long long normal_bit = 0x8000000000000000ull; - u.ld = 0.0L; - if (isnan (y) || isnan (x)) - return x + y; - - if (x == y ) - /* nextafter (0.0, -O.0) should return -0.0. */ - return y; - - u.ld = x; - if (x == 0.0L) - { - u.parts.mantissa = 1ull; - return y > 0.0L ? u.ld : -u.ld; - } - - if (((x > 0.0L) ^ (y > x)) == 0) - { - u.parts.mantissa++; - if ((u.parts.mantissa & ~normal_bit) == 0ull) - u.parts.expn++; - } - else - { - if ((u.parts.mantissa & ~normal_bit) == 0ull) - u.parts.expn--; - u.parts.mantissa--; - } - - /* If we have updated the expn of a normal number, - or moved from denormal to normal, [re]set the normal bit. */ - if (u.parts.expn & 0x7fff) - u.parts.mantissa |= normal_bit; - - return u.ld; -} diff --git a/reactos/lib/sdk/crt/math/nextafterf.c b/reactos/lib/sdk/crt/math/nextafterf.c deleted file mode 100644 index ac12ac4ed7f..00000000000 --- a/reactos/lib/sdk/crt/math/nextafterf.c +++ /dev/null @@ -1,32 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include - -float -nextafterf (float x, float y) -{ - union - { - float f; - unsigned int i; - } u; - if (isnan (y) || isnan (x)) - return x + y; - if (x == y ) - /* nextafter (0.0, -O.0) should return -0.0. */ - return y; - u.f = x; - if (x == 0.0F) - { - u.i = 1; - return y > 0.0F ? u.f : -u.f; - } - if (((x > 0.0F) ^ (y > x)) == 0) - u.i++; - else - u.i--; - return u.f; -} diff --git a/reactos/lib/sdk/crt/math/ldexp.c b/reactos/lib/sdk/crt/math/pow_asm.c similarity index 73% rename from reactos/lib/sdk/crt/math/ldexp.c rename to reactos/lib/sdk/crt/math/pow_asm.c index b240275ef95..2b5877b67f6 100644 --- a/reactos/lib/sdk/crt/math/ldexp.c +++ b/reactos/lib/sdk/crt/math/pow_asm.c @@ -21,24 +21,11 @@ #include -double ldexp (double __x, int __y); +/* + * @implemented + */ -double ldexp (double __x, int __y) +long double powl (long double __x,long double __y) { - register double __val; -#ifdef __GNUC__ - __asm __volatile__ - ("fscale" - : "=t" (__val) : "0" (__x), "u" ((double) __y)); -#else - register double __dy = (double)__y; - __asm - { - fld __dy - fld __x - fscale - fstp __val - } -#endif /*__GNUC__*/ - return __val; + return pow(__x,__y/2)*pow(__x,__y/2); } diff --git a/reactos/lib/sdk/crt/math/powf.c b/reactos/lib/sdk/crt/math/powf.c deleted file mode 100644 index 046ba12f837..00000000000 --- a/reactos/lib/sdk/crt/math/powf.c +++ /dev/null @@ -1,10 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include -float powf (float x, float y) -{ - return (float) pow ((double) x, (double) y); -} diff --git a/reactos/lib/sdk/crt/math/sinf.c b/reactos/lib/sdk/crt/math/sinf.c deleted file mode 100644 index 1069dcf18b7..00000000000 --- a/reactos/lib/sdk/crt/math/sinf.c +++ /dev/null @@ -1,11 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include - -float sinf(float _X) -{ - return ((float) sin ((double) _X)); -} diff --git a/reactos/lib/sdk/crt/math/sinhf.c b/reactos/lib/sdk/crt/math/sinhf.c deleted file mode 100644 index f5fab441db6..00000000000 --- a/reactos/lib/sdk/crt/math/sinhf.c +++ /dev/null @@ -1,10 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include -float sinhf (float x) -{ - return (float) sinh (x); -} diff --git a/reactos/lib/sdk/crt/math/sqrt.c b/reactos/lib/sdk/crt/math/sqrt.c deleted file mode 100644 index 3b08e853d12..00000000000 --- a/reactos/lib/sdk/crt/math/sqrt.c +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include -#include - -double -sqrt (double x) -{ - if (x < 0.0L ) - { -#ifndef _LIBCNT_ - errno = EDOM; -#endif - return NAN; - } - else - { - long double res = 0.0L; - asm ("fsqrt" : "=t" (res) : "0" (x)); - return res; - } -} diff --git a/reactos/lib/sdk/crt/math/sqrtf.c b/reactos/lib/sdk/crt/math/sqrtf.c deleted file mode 100644 index 567c1ecae65..00000000000 --- a/reactos/lib/sdk/crt/math/sqrtf.c +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include -#include - -float -sqrtf (float x) -{ - if (x < 0.0F ) - { - errno = EDOM; - return NAN; - } - else - { - float res = 0.0F; - asm ("fsqrt" : "=t" (res) : "0" (x)); - return res; - } -} diff --git a/reactos/lib/sdk/crt/math/tanf.c b/reactos/lib/sdk/crt/math/tanf.c deleted file mode 100644 index f4074032d6b..00000000000 --- a/reactos/lib/sdk/crt/math/tanf.c +++ /dev/null @@ -1,11 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include - -float tanf(float _X) -{ - return ((float)tan((double)_X)); -} diff --git a/reactos/lib/sdk/crt/math/tanhf.c b/reactos/lib/sdk/crt/math/tanhf.c deleted file mode 100644 index c7e25490a91..00000000000 --- a/reactos/lib/sdk/crt/math/tanhf.c +++ /dev/null @@ -1,10 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ -#include -float tanhf (float x) -{ - return (float) tanh (x); -} diff --git a/reactos/lib/sdk/crt/stdio/file.c b/reactos/lib/sdk/crt/stdio/file.c index 1980e94f2ad..ed28d63be8f 100644 --- a/reactos/lib/sdk/crt/stdio/file.c +++ b/reactos/lib/sdk/crt/stdio/file.c @@ -117,6 +117,11 @@ static CRITICAL_SECTION FILE_cs; #define LOCK_FILES() do { EnterCriticalSection(&FILE_cs); } while (0) #define UNLOCK_FILES() do { LeaveCriticalSection(&FILE_cs); } while (0) +FILE *__cdecl __iob_func() +{ + return _iob; +} + static inline BOOL is_valid_fd(int fd) { return fd >= 0 && fd < fdend && (fdesc[fd].wxflag & WX_OPEN); @@ -447,11 +452,11 @@ static void int_to_base32(int num, char *str) } /********************************************************************* - * __iob_func(MSVCRT.@) + * __p__iob(MSVCRT.@) */ -FILE * CDECL __iob_func(void) +FILE * CDECL __p__iob(void) { - return &_iob[0]; + return _iob; } /********************************************************************* diff --git a/reactos/lib/sdk/crt/string/ctype.c b/reactos/lib/sdk/crt/string/ctype.c index 484ed1acf14..a4873cebdd4 100644 --- a/reactos/lib/sdk/crt/string/ctype.c +++ b/reactos/lib/sdk/crt/string/ctype.c @@ -292,12 +292,12 @@ const unsigned short _ctype[] = { const unsigned short *_pctype = _ctype + 1; const unsigned short *_pwctype = _ctype + 1; -/********************************************************************* - * __pctype_func (MSVCRT.@) +/* + * @implemented */ -const unsigned short* __cdecl __pctype_func(void) +const unsigned short **__p__pctype(void) { - return _pctype; + return &_pctype; } /* diff --git a/reactos/lib/sdk/crt/time/asctime.c b/reactos/lib/sdk/crt/time/asctime.c index 71e3ca66746..84e059186d2 100644 --- a/reactos/lib/sdk/crt/time/asctime.c +++ b/reactos/lib/sdk/crt/time/asctime.c @@ -5,7 +5,6 @@ * PURPOSE: Implementation of asctime(), _asctime_s() * PROGRAMERS: Timo Kreuzer */ -#define MINGW_HAS_SECURE_API #include #include #include diff --git a/reactos/lib/sdk/crt/time/ctime.c b/reactos/lib/sdk/crt/time/ctime.c index 3911b2f94b7..b6d1bfb6cd1 100644 --- a/reactos/lib/sdk/crt/time/ctime.c +++ b/reactos/lib/sdk/crt/time/ctime.c @@ -5,7 +5,7 @@ * PURPOSE: Implementation of ctime, _ctime_s * PROGRAMERS: Timo Kreuzer */ -#define MINGW_HAS_SECURE_API +#define MINGW_HAS_SECURE_API 1 #include #include diff --git a/reactos/lib/sdk/crt/time/utime.c b/reactos/lib/sdk/crt/time/utime.c index 3c0168da2fc..130e5a400ba 100644 --- a/reactos/lib/sdk/crt/time/utime.c +++ b/reactos/lib/sdk/crt/time/utime.c @@ -10,7 +10,7 @@ #include #include "bitsfixup.h" -int __cdecl +int _tutime(const _TCHAR* path, struct _utimbuf *t) { int fd = _topen(path, _O_WRONLY | _O_BINARY); From c21ada51d6ed1ac0e5e029ce39688aaf55538956 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Wed, 27 Jan 2010 23:42:34 +0000 Subject: [PATCH 056/121] [CRT] - implement generic C version of cos(). On amd64 machines it will compile into very optimized SSE2 code. No need to use assembly. svn path=/branches/ros-amd64-bringup/; revision=45290 --- reactos/lib/sdk/crt/crt.rbuild | 2 +- reactos/lib/sdk/crt/libcntpr.rbuild | 1 - reactos/lib/sdk/crt/math/amd64/cos.S | 21 ------- reactos/lib/sdk/crt/math/cos.c | 89 ++++++++++++++++++++++++++++ 4 files changed, 90 insertions(+), 23 deletions(-) delete mode 100644 reactos/lib/sdk/crt/math/amd64/cos.S create mode 100644 reactos/lib/sdk/crt/math/cos.c diff --git a/reactos/lib/sdk/crt/crt.rbuild b/reactos/lib/sdk/crt/crt.rbuild index 6e7ed0d16ff..b763d97727e 100644 --- a/reactos/lib/sdk/crt/crt.rbuild +++ b/reactos/lib/sdk/crt/crt.rbuild @@ -161,13 +161,13 @@ jn_yn.c--> + cos.c alldiv.S atan.S atan2.S ceil.S ceilf.S - cos.S exp.S fabs.S floor.S diff --git a/reactos/lib/sdk/crt/libcntpr.rbuild b/reactos/lib/sdk/crt/libcntpr.rbuild index 5011ae07ce9..deb0db03718 100644 --- a/reactos/lib/sdk/crt/libcntpr.rbuild +++ b/reactos/lib/sdk/crt/libcntpr.rbuild @@ -64,7 +64,6 @@ atan.S atan2.S ceil.S - cos.S exp.S fabs.S floor.S diff --git a/reactos/lib/sdk/crt/math/amd64/cos.S b/reactos/lib/sdk/crt/math/amd64/cos.S deleted file mode 100644 index 5d2e0fe787b..00000000000 --- a/reactos/lib/sdk/crt/math/amd64/cos.S +++ /dev/null @@ -1,21 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * PURPOSE: Implementation of cos - * FILE: lib/sdk/crt/math/amd64/cos.S - * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) - */ - -/* INCLUDES ******************************************************************/ - -#include -#include - -.intel_syntax noprefix - - -.proc cos - UNIMPLEMENTED cos - ret - -.endproc diff --git a/reactos/lib/sdk/crt/math/cos.c b/reactos/lib/sdk/crt/math/cos.c new file mode 100644 index 00000000000..dd3d12bdb31 --- /dev/null +++ b/reactos/lib/sdk/crt/math/cos.c @@ -0,0 +1,89 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS CRT + * FILE: lib/crt/math/cos.c + * PURPOSE: Generic C Implementation of cos + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +#define PRECISION 9 +#define M_PI 3.141592653589793238462643 + +static double cos_off_tbl[] = {0.0, -M_PI/2., 0, -M_PI/2.}; +static double cos_sign_tbl[] = {1,-1,-1,1}; + +double +cos(double x) +{ + int quadrant; + double x2, result; + + /* Calculate the quadrant */ + quadrant = x * (2./M_PI); + + /* Get offset inside quadrant */ + x = x - quadrant * (M_PI/2.); + + /* Normalize quadrant to [0..3] */ + quadrant = quadrant & 0x3; + + /* Fixup value for the generic function */ + x += cos_off_tbl[quadrant]; + + /* Calculate the negative of the square of x */ + x2 = - (x * x); + + /* This is an unrolled taylor series using iterations + * Example with 4 iterations: + * result = 1 - x^2/2! + x^4/4! - x^6/6! + x^8/8! + * To save multiplications and to keep the precision high, it's performed + * like this: + * result = 1 - x^2 * (1/2! - x^2 * (1/4! - x^2 * (1/6! - x^2 * (1/8!)))) + */ + + /* Start with 0, compiler will optimize this away */ + result = 0; + +#if (PRECISION >= 10) + result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12*13*14*15*16*17*18*20); + result *= x2; +#endif +#if (PRECISION >= 9) + result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12*13*14*15*16*17*18); + result *= x2; +#endif +#if (PRECISION >= 8) + result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12*13*14*15*16); + result *= x2; +#endif +#if (PRECISION >= 7) + result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12*13*14); + result *= x2; +#endif +#if (PRECISION >= 6) + result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12); + result *= x2; +#endif +#if (PRECISION >= 5) + result += 1./(1.*2*3*4*5*6*7*8*9*10); + result *= x2; +#endif + result += 1./(1.*2*3*4*5*6*7*8); + result *= x2; + + result += 1./(1.*2*3*4*5*6); + result *= x2; + + result += 1./(1.*2*3*4); + result *= x2; + + result += 1./(1.*2); + result *= x2; + + result += 1; + + /* Apply correct sign */ + result *= cos_sign_tbl[quadrant]; + + return result; +} From 80be38766391a5cba107ef9f8f4b8e4c560f28b6 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Thu, 28 Jan 2010 00:59:40 +0000 Subject: [PATCH 057/121] fix a typo svn path=/branches/ros-amd64-bringup/; revision=45292 --- reactos/lib/sdk/crt/math/cos.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/lib/sdk/crt/math/cos.c b/reactos/lib/sdk/crt/math/cos.c index dd3d12bdb31..1e7d8c4206c 100644 --- a/reactos/lib/sdk/crt/math/cos.c +++ b/reactos/lib/sdk/crt/math/cos.c @@ -45,7 +45,7 @@ cos(double x) result = 0; #if (PRECISION >= 10) - result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12*13*14*15*16*17*18*20); + result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12*13*14*15*16*17*18*19*20); result *= x2; #endif #if (PRECISION >= 9) From 01afdbbe91acbad7ecd41641c64d43ab2ad04b3f Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Thu, 28 Jan 2010 01:18:12 +0000 Subject: [PATCH 058/121] [CRT] Implement sin() in C. Code is actually 99% identical to cos. Note: We are using even exponents for sin, too, as this results in higher precision than using uneven exponents. svn path=/branches/ros-amd64-bringup/; revision=45294 --- reactos/lib/sdk/crt/crt.rbuild | 2 +- reactos/lib/sdk/crt/libcntpr.rbuild | 1 - reactos/lib/sdk/crt/math/amd64/sin.S | 21 ------- reactos/lib/sdk/crt/math/sin.c | 89 ++++++++++++++++++++++++++++ 4 files changed, 90 insertions(+), 23 deletions(-) delete mode 100644 reactos/lib/sdk/crt/math/amd64/sin.S create mode 100644 reactos/lib/sdk/crt/math/sin.c diff --git a/reactos/lib/sdk/crt/crt.rbuild b/reactos/lib/sdk/crt/crt.rbuild index b763d97727e..c33cb823b31 100644 --- a/reactos/lib/sdk/crt/crt.rbuild +++ b/reactos/lib/sdk/crt/crt.rbuild @@ -162,6 +162,7 @@ cos.c + sin.c alldiv.S atan.S @@ -178,7 +179,6 @@ log.S log10.S pow.S - sin.S sqrt.S sqrtf.S tan.S diff --git a/reactos/lib/sdk/crt/libcntpr.rbuild b/reactos/lib/sdk/crt/libcntpr.rbuild index deb0db03718..2ef42f05913 100644 --- a/reactos/lib/sdk/crt/libcntpr.rbuild +++ b/reactos/lib/sdk/crt/libcntpr.rbuild @@ -72,7 +72,6 @@ log.S log10.S pow.S - sin.S sqrt.S tan.S diff --git a/reactos/lib/sdk/crt/math/amd64/sin.S b/reactos/lib/sdk/crt/math/amd64/sin.S deleted file mode 100644 index 683eedcd647..00000000000 --- a/reactos/lib/sdk/crt/math/amd64/sin.S +++ /dev/null @@ -1,21 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * PURPOSE: Implementation of sin - * FILE: lib/sdk/crt/math/amd64/sin.S - * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) - */ - -/* INCLUDES ******************************************************************/ - -#include -#include - -.intel_syntax noprefix - - -.proc sin - UNIMPLEMENTED sin - ret - -.endproc diff --git a/reactos/lib/sdk/crt/math/sin.c b/reactos/lib/sdk/crt/math/sin.c new file mode 100644 index 00000000000..de99d50ee74 --- /dev/null +++ b/reactos/lib/sdk/crt/math/sin.c @@ -0,0 +1,89 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS CRT + * FILE: lib/crt/math/sin.c + * PURPOSE: Generic C Implementation of sin + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +#define PRECISION 9 +#define M_PI 3.141592653589793238462643 + +static double sin_off_tbl[] = {0.0, -M_PI/2., 0, -M_PI/2.}; +static double sin_sign_tbl[] = {1,-1,-1,1}; + +double +sin(double x) +{ + int quadrant; + double x2, result; + + /* Calculate the quadrant */ + quadrant = x * (2./M_PI); + + /* Get offset inside quadrant */ + x = x - quadrant * (M_PI/2.); + + /* Normalize quadrant to [0..3] */ + quadrant = (quadrant - 1) & 0x3; + + /* Fixup value for the generic function */ + x += sin_off_tbl[quadrant]; + + /* Calculate the negative of the square of x */ + x2 = - (x * x); + + /* This is an unrolled taylor series using iterations + * Example with 4 iterations: + * result = 1 - x^2/2! + x^4/4! - x^6/6! + x^8/8! + * To save multiplications and to keep the precision high, it's performed + * like this: + * result = 1 - x^2 * (1/2! - x^2 * (1/4! - x^2 * (1/6! - x^2 * (1/8!)))) + */ + + /* Start with 0, compiler will optimize this away */ + result = 0; + +#if (PRECISION >= 10) + result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12*13*14*15*16*17*18*20); + result *= x2; +#endif +#if (PRECISION >= 9) + result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12*13*14*15*16*17*18); + result *= x2; +#endif +#if (PRECISION >= 8) + result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12*13*14*15*16); + result *= x2; +#endif +#if (PRECISION >= 7) + result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12*13*14); + result *= x2; +#endif +#if (PRECISION >= 6) + result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12); + result *= x2; +#endif +#if (PRECISION >= 5) + result += 1./(1.*2*3*4*5*6*7*8*9*10); + result *= x2; +#endif + result += 1./(1.*2*3*4*5*6*7*8); + result *= x2; + + result += 1./(1.*2*3*4*5*6); + result *= x2; + + result += 1./(1.*2*3*4); + result *= x2; + + result += 1./(1.*2); + result *= x2; + + result += 1; + + /* Apply correct sign */ + result *= sin_sign_tbl[quadrant]; + + return result; +} From 9943d23d5d7fb34a5da6e240e2d5848b55a4c17c Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Thu, 28 Jan 2010 02:37:28 +0000 Subject: [PATCH 059/121] fix the same typo once more svn path=/branches/ros-amd64-bringup/; revision=45295 --- reactos/lib/sdk/crt/math/sin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/lib/sdk/crt/math/sin.c b/reactos/lib/sdk/crt/math/sin.c index de99d50ee74..da69573edb8 100644 --- a/reactos/lib/sdk/crt/math/sin.c +++ b/reactos/lib/sdk/crt/math/sin.c @@ -45,7 +45,7 @@ sin(double x) result = 0; #if (PRECISION >= 10) - result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12*13*14*15*16*17*18*20); + result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12*13*14*15*16*17*18*19*20); result *= x2; #endif #if (PRECISION >= 9) From b4c3b1e6f67e3a365085d6c59fc087cc8afb6259 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Fri, 29 Jan 2010 05:23:59 +0000 Subject: [PATCH 060/121] unimplement a bunch or intrinsics for msc, as we cannot use inline asm. svn path=/branches/ros-amd64-bringup/; revision=45313 --- .../include/internal/amd64/intrin_i.h | 96 ++++++++----------- 1 file changed, 38 insertions(+), 58 deletions(-) diff --git a/reactos/ntoskrnl/include/internal/amd64/intrin_i.h b/reactos/ntoskrnl/include/internal/amd64/intrin_i.h index 5b33aa811c7..61fa6d2443a 100644 --- a/reactos/ntoskrnl/include/internal/amd64/intrin_i.h +++ b/reactos/ntoskrnl/include/internal/amd64/intrin_i.h @@ -177,9 +177,7 @@ Ke386Wrmsr(IN ULONG Register, IN ULONG Var1, IN ULONG Var2) { - __asm mov eax, Var1; - __asm mov edx, Var2; - __asm wrmsr; + __writemsr(Register, (ULONG64)Var1 <<32 | Var2); } ULONGLONG @@ -188,11 +186,11 @@ Ke386Rdmsr(IN ULONG Register, IN ULONG Var1, IN ULONG Var2) { - __asm mov eax, Var1; - __asm mov edx, Var2; - __asm rdmsr; + return __readmsr(Register); } +#define UNIMPLEMENTED DbgPrint("unimplemented!!!\n"); + VOID FORCEINLINE Ki386Cpuid(IN ULONG Operation, @@ -201,98 +199,91 @@ Ki386Cpuid(IN ULONG Operation, OUT PULONG Var3, OUT PULONG Var4) { - __asm mov eax, Operation; - __asm cpuid; - __asm mov [Var1], eax; - __asm mov [Var2], ebx; - __asm mov [Var3], ecx; - __asm mov [Var4], edx; + UNIMPLEMENTED; } VOID FORCEINLINE Ke386FnInit(VOID) { - __asm fninit; + UNIMPLEMENTED; } VOID FORCEINLINE Ke386HaltProcessor(VOID) { - __asm hlt; + UNIMPLEMENTED; } VOID FORCEINLINE Ke386GetInterruptDescriptorTable(OUT KDESCRIPTOR Descriptor) { - __asm sidt Descriptor; + UNIMPLEMENTED; } VOID FORCEINLINE Ke386SetInterruptDescriptorTable(IN KDESCRIPTOR Descriptor) { - __asm lidt Descriptor; + UNIMPLEMENTED; } VOID FORCEINLINE Ke386GetGlobalDescriptorTable(OUT KDESCRIPTOR Descriptor) { - __asm sgdt Descriptor; + UNIMPLEMENTED; } VOID FORCEINLINE Ke386SetGlobalDescriptorTable(IN KDESCRIPTOR Descriptor) { - __asm lgdt Descriptor; + UNIMPLEMENTED; } VOID FORCEINLINE Ke386GetLocalDescriptorTable(OUT USHORT Descriptor) { - __asm sldt Descriptor; + UNIMPLEMENTED; } VOID FORCEINLINE Ke386SetLocalDescriptorTable(IN USHORT Descriptor) { - __asm lldt Descriptor; + UNIMPLEMENTED; } VOID FORCEINLINE Ke386SaveFlags(IN ULONG Flags) { - __asm pushf; - __asm pop Flags; + UNIMPLEMENTED; } VOID FORCEINLINE Ke386RestoreFlags(IN ULONG Flags) { - __asm push Flags; - __asm popf; + UNIMPLEMENTED; } VOID FORCEINLINE Ke386SetTr(IN USHORT Tr) { - __asm ltr Tr; + UNIMPLEMENTED; } USHORT FORCEINLINE Ke386GetTr(IN USHORT Tr) { - __asm str Tr; + UNIMPLEMENTED; } // @@ -302,8 +293,7 @@ VOID FORCEINLINE Ke386SetCr2(IN ULONG Value) { - __asm mov eax, Value; - __asm mov cr2, eax; + UNIMPLEMENTED; } // @@ -313,90 +303,84 @@ ULONG FORCEINLINE Ke386GetDr0(VOID) { - __asm mov eax, dr0; + UNIMPLEMENTED; } ULONG FORCEINLINE Ke386GetDr1(VOID) { - __asm mov eax, dr1; + UNIMPLEMENTED; } ULONG FORCEINLINE Ke386GetDr2(VOID) { - __asm mov eax, dr2; + UNIMPLEMENTED; } ULONG FORCEINLINE Ke386GetDr3(VOID) { - __asm mov eax, dr3; + UNIMPLEMENTED; } ULONG FORCEINLINE Ke386GetDr6(VOID) { - __asm mov eax, dr6; + UNIMPLEMENTED; } ULONG FORCEINLINE Ke386GetDr7(VOID) { - __asm mov eax, dr7; + UNIMPLEMENTED; } VOID FORCEINLINE Ke386SetDr0(IN ULONG Value) { - __asm mov eax, Value; - __asm mov dr0, eax; + UNIMPLEMENTED; } VOID FORCEINLINE Ke386SetDr1(IN ULONG Value) { - __asm mov eax, Value; - __asm mov dr1, eax; + UNIMPLEMENTED; } VOID FORCEINLINE Ke386SetDr2(IN ULONG Value) { - __asm mov eax, Value; - __asm mov dr2, eax; + UNIMPLEMENTED; } VOID FORCEINLINE Ke386SetDr3(IN ULONG Value) { - __asm mov eax, Value; - __asm mov dr3, eax; + UNIMPLEMENTED; } VOID FORCEINLINE Ke386SetDr6(IN ULONG Value) { - __asm mov eax, Value; - __asm mov dr6, eax; + UNIMPLEMENTED; } VOID FORCEINLINE Ke386SetDr7(IN ULONG Value) { - __asm mov eax, Value; - __asm mov dr7, eax; + UNIMPLEMENTED; } // @@ -406,60 +390,56 @@ USHORT FORCEINLINE Ke386GetSs(VOID) { - __asm mov ax, ss; + UNIMPLEMENTED; } USHORT FORCEINLINE Ke386GetFs(VOID) { - __asm mov ax, fs; + UNIMPLEMENTED; } USHORT FORCEINLINE Ke386GetDs(VOID) { - __asm mov ax, ds; + UNIMPLEMENTED; } USHORT FORCEINLINE Ke386GetEs(VOID) { - __asm mov ax, es; + UNIMPLEMENTED; } VOID FORCEINLINE Ke386SetSs(IN USHORT Value) { - __asm mov ax, Value; - __asm mov ss, ax; + UNIMPLEMENTED; } VOID FORCEINLINE Ke386SetFs(IN USHORT Value) { - __asm mov ax, Value; - __asm mov fs, ax; + UNIMPLEMENTED; } VOID FORCEINLINE Ke386SetDs(IN USHORT Value) { - __asm mov ax, Value; - __asm mov ds, ax; + UNIMPLEMENTED; } VOID FORCEINLINE Ke386SetEs(IN USHORT Value) { - __asm mov ax, Value; - __asm mov es, ax; + UNIMPLEMENTED; } #else From a0055ff789999a448d2a2c6badda0f3cfa361209 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Fri, 29 Jan 2010 05:25:26 +0000 Subject: [PATCH 061/121] Use __inline instead of inline svn path=/branches/ros-amd64-bringup/; revision=45314 --- reactos/include/psdk/basetsd.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/reactos/include/psdk/basetsd.h b/reactos/include/psdk/basetsd.h index e2e5b93f453..929475d5336 100644 --- a/reactos/include/psdk/basetsd.h +++ b/reactos/include/psdk/basetsd.h @@ -79,33 +79,33 @@ typedef unsigned int UHALF_PTR, *PUHALF_PTR; typedef int HALF_PTR, *PHALF_PTR; #if !defined(__midl) && !defined(__WIDL__) -static inline unsigned long HandleToUlong(const void* h ) +static __inline unsigned long HandleToUlong(const void* h ) { return((unsigned long)(ULONG_PTR) h ); } -static inline long HandleToLong( const void* h ) +static __inline long HandleToLong( const void* h ) { return((long)(LONG_PTR) h ); } -static inline void* ULongToHandle( const long h ) +static __inline void* ULongToHandle( const long h ) { return((void*) (UINT_PTR) h ); } -static inline void* LongToHandle( const long h ) +static __inline void* LongToHandle( const long h ) { return((void*) (INT_PTR) h ); } -static inline unsigned long PtrToUlong( const void* p) +static __inline unsigned long PtrToUlong( const void* p) { return((unsigned long)(ULONG_PTR) p ); } -static inline unsigned int PtrToUint( const void* p ) +static __inline unsigned int PtrToUint( const void* p ) { return((unsigned int)(UINT_PTR) p ); } -static inline unsigned short PtrToUshort( const void* p ) +static __inline unsigned short PtrToUshort( const void* p ) { return((unsigned short)(ULONG_PTR) p ); } -static inline long PtrToLong( const void* p ) +static __inline long PtrToLong( const void* p ) { return((long)(LONG_PTR) p ); } -static inline int PtrToInt( const void* p ) +static __inline int PtrToInt( const void* p ) { return((int)(INT_PTR) p ); } -static inline short PtrToShort( const void* p ) +static __inline short PtrToShort( const void* p ) { return((short)(INT_PTR) p ); } -static inline void* IntToPtr( const int i ) +static __inline void* IntToPtr( const int i ) { return( (void*)(INT_PTR)i ); } -static inline void* UIntToPtr(const unsigned int ui) +static __inline void* UIntToPtr(const unsigned int ui) { return( (void*)(UINT_PTR)ui ); } -static inline void* LongToPtr( const long l ) +static __inline void* LongToPtr( const long l ) { return( (void*)(LONG_PTR)l ); } -static inline void* ULongToPtr( const unsigned long ul ) +static __inline void* ULongToPtr( const unsigned long ul ) { return( (void*)(ULONG_PTR)ul ); } #endif /* !__midl */ #else /* !_WIN64 */ From ef3224edab2ffddab84b803a30e53d9e827b07db Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Fri, 29 Jan 2010 13:23:00 +0000 Subject: [PATCH 062/121] Fix parameters of KeUpdateSystemTime, make it regparm only for X86 ans remove the now deprecated stub. Add a few stubs for MSVC svn path=/branches/ros-amd64-bringup/; revision=45318 --- reactos/ntoskrnl/ke/amd64/stubs.c | 43 ++++++++++++++++++++++++------- reactos/ntoskrnl/ke/time.c | 8 +++--- 2 files changed, 37 insertions(+), 14 deletions(-) diff --git a/reactos/ntoskrnl/ke/amd64/stubs.c b/reactos/ntoskrnl/ke/amd64/stubs.c index 894cc09f70b..1aea2cb674c 100644 --- a/reactos/ntoskrnl/ke/amd64/stubs.c +++ b/reactos/ntoskrnl/ke/amd64/stubs.c @@ -39,16 +39,6 @@ KeSynchronizeExecution( return FALSE; } -VOID -NTAPI -KeUpdateSystemTime(IN PKTRAP_FRAME TrapFrame, - IN KIRQL Irql, - IN ULONG Increment) -{ - UNIMPLEMENTED; -} - - NTSTATUS NTAPI KeUserModeCallback(IN ULONG RoutineIndex, @@ -161,3 +151,36 @@ ExQueryDepthSList(IN PSLIST_HEADER ListHead) { return (USHORT)(ListHead->Alignment & 0xffff); } + +#ifdef _MSC_VER +void +__GSHandlerCheck() +{ +} + +int __security_cookie; + +void +__security_check_cookie() +{ +} + + +NTKERNELAPI +PSLIST_ENTRY +ExpInterlockedPopEntrySList( + PSLIST_HEADER ListHead) +{ + return 0; +} + +NTKERNELAPI +PSLIST_ENTRY +ExpInterlockedPushEntrySList( + PSLIST_HEADER ListHead, + PSLIST_ENTRY ListEntry) +{ + return 0; +} + +#endif diff --git a/reactos/ntoskrnl/ke/time.c b/reactos/ntoskrnl/ke/time.c index 9fcef31a96f..2eb131873fd 100644 --- a/reactos/ntoskrnl/ke/time.c +++ b/reactos/ntoskrnl/ke/time.c @@ -19,7 +19,7 @@ ULONG KeTimeAdjustment; /* FUNCTIONS ******************************************************************/ -#ifndef _M_ARM +#ifdef _M_IX86 VOID __attribute__((regparm(3))) KeUpdateSystemTimeHandler(IN ULONG Increment, @@ -29,8 +29,8 @@ KeUpdateSystemTimeHandler(IN ULONG Increment, VOID NTAPI KeUpdateSystemTime(IN PKTRAP_FRAME TrapFrame, - IN ULONG Increment, - IN KIRQL Irql) + IN KIRQL Irql, + IN ULONG Increment) #endif { PKPRCB Prcb = KeGetCurrentPrcb(); @@ -133,7 +133,7 @@ KeUpdateRunTime(IN PKTRAP_FRAME TrapFrame, Prcb->InterruptCount++; /* Check if we came from user mode */ -#if !defined(_M_ARM) && !defined(_M_AMD64) +#if defined(_M_IX86) if ((TrapFrame->SegCs & MODE_MASK) || (TrapFrame->EFlags & EFLAGS_V86_MASK)) #else if (TrapFrame->PreviousMode == UserMode) From 6b38c83e7a238eef23a0dc72d7b1f16f33c42d7c Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Fri, 29 Jan 2010 23:25:05 +0000 Subject: [PATCH 063/121] [NTOS] MSVC compatibility fix: use DECLSPEC_ALIGN and remove inline asm (it was testcode anyway) svn path=/branches/ros-amd64-bringup/; revision=45325 --- reactos/ntoskrnl/ke/amd64/kiinit.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/reactos/ntoskrnl/ke/amd64/kiinit.c b/reactos/ntoskrnl/ke/amd64/kiinit.c index 0abb16fb291..b80872aeed9 100644 --- a/reactos/ntoskrnl/ke/amd64/kiinit.c +++ b/reactos/ntoskrnl/ke/amd64/kiinit.c @@ -31,8 +31,8 @@ extern ADDRESS_RANGE KeMemoryMap[64]; KIPCR KiInitialPcr; /* Boot and double-fault/NMI/DPC stack */ -UCHAR P0BootStackData[KERNEL_STACK_SIZE] __attribute__((aligned (16))) = {0}; -UCHAR KiDoubleFaultStackData[KERNEL_STACK_SIZE] __attribute__((aligned (16))) = {0}; +UCHAR P0BootStackData[KERNEL_STACK_SIZE] DECLSPEC_ALIGN(16) = {0}; +UCHAR KiDoubleFaultStackData[KERNEL_STACK_SIZE] DECLSPEC_ALIGN(16) = {0}; ULONG_PTR P0BootStack = (ULONG_PTR)&P0BootStackData[KERNEL_STACK_SIZE]; ULONG_PTR KiDoubleFaultStack = (ULONG_PTR)&KiDoubleFaultStackData[KERNEL_STACK_SIZE]; @@ -189,7 +189,6 @@ KiInitializeCpuFeatures(ULONG Cpu) /* Disable x87 fpu exceptions */ __writecr0(__readcr0() & ~CR0_NE); - asm volatile ("fninit\n"); } VOID From 5a811f8ce284044ce58827db92dc39cf7460b990 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Fri, 29 Jan 2010 23:29:58 +0000 Subject: [PATCH 064/121] Add include/reactos/asm.h This file replaces asmmacro.S and shall provide GAS/ML64 compatibility definitions svn path=/branches/ros-amd64-bringup/; revision=45326 --- reactos/include/reactos/asm.h | 86 +++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 reactos/include/reactos/asm.h diff --git a/reactos/include/reactos/asm.h b/reactos/include/reactos/asm.h new file mode 100644 index 00000000000..8d8f48d1a74 --- /dev/null +++ b/reactos/include/reactos/asm.h @@ -0,0 +1,86 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Kernel + * FILE: ntoskrnl/include/amd64/asmmacro.S + * PURPOSE: ASM macros for for GAS and ML64 + * PROGRAMMERS: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +#ifdef _MSC_VER + +#else + +.intel_syntax noprefix +.code64 + +/* Macros for x64 stack unwind OPs */ + +.macro .proc name + .func name + .global _\name + _\name: + .cfi_startproc + .equ cfa_current_offset, -8 +.endm + +.macro .endproc + .cfi_endproc + .endfunc +.endm + +.macro .allocstack size + .cfi_adjust_cfa_offset \size + .set cfa_current_offset, cfa_current_offset - \size +.endm + +.macro .pushframe code + .if (\code == 0) + .cfi_adjust_cfa_offset 0x28 + .set cfa_current_offset, cfa_current_offset - 0x28 + .else + .cfi_adjust_cfa_offset 0x30 + .set cfa_current_offset, cfa_current_offset - 0x30 + .endif +.endm + +.macro .pushreg reg + .cfi_adjust_cfa_offset 8 + .equ cfa_current_offset, cfa_current_offset - 8 + .cfi_offset \reg, cfa_current_offset +.endm + +.macro .savereg reg, offset + // checkme!!! + .cfi_offset \reg, \offset +.endm + +.macro .savexmm128 reg, offset + // checkme!!! + .cfi_offset \reg, \offset +.endm + +.macro .setframe reg, offset + .cfi_def_cfa reg, \offset + .equ cfa_current_offset, \offset +.endm + +.macro .endprolog +.endm + +.macro UNIMPLEMENTED2 file, line, func + jmp 3f + .equ expr, 12 +1: .asciz "\func" +2: .asciz "\file" +3: + sub rsp, 0x20 + lea rcx, _MsgUnimplemented[rip] + lea rdx, 1b[rip] + lea r8, 2b[rip] + mov r9, \line + call _DbgPrint + add rsp, 0x20 +.endm +#define UNIMPLEMENTED UNIMPLEMENTED2 __FILE__, __LINE__, + +#endif From fde64b37c3d058eb400322484a08f5825879f574 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Fri, 29 Jan 2010 23:41:52 +0000 Subject: [PATCH 065/121] make use of the new file svn path=/branches/ros-amd64-bringup/; revision=45327 --- reactos/ntoskrnl/kdbg/amd64/kdb_help.S | 2 +- reactos/ntoskrnl/kdbg/amd64/setjmp.S | 2 +- reactos/ntoskrnl/ke/amd64/ctxswitch.S | 19 ++----------------- reactos/ntoskrnl/ke/amd64/trap.S | 2 +- 4 files changed, 5 insertions(+), 20 deletions(-) diff --git a/reactos/ntoskrnl/kdbg/amd64/kdb_help.S b/reactos/ntoskrnl/kdbg/amd64/kdb_help.S index 781b5c886b8..54d31c93535 100644 --- a/reactos/ntoskrnl/kdbg/amd64/kdb_help.S +++ b/reactos/ntoskrnl/kdbg/amd64/kdb_help.S @@ -1,5 +1,5 @@ +#include #include -#include .globl _KdbEnter _KdbEnter: diff --git a/reactos/ntoskrnl/kdbg/amd64/setjmp.S b/reactos/ntoskrnl/kdbg/amd64/setjmp.S index 8a973342b5e..8921e18697d 100644 --- a/reactos/ntoskrnl/kdbg/amd64/setjmp.S +++ b/reactos/ntoskrnl/kdbg/amd64/setjmp.S @@ -8,8 +8,8 @@ /* INCLUDES ******************************************************************/ +#include #include -#include .intel_syntax noprefix diff --git a/reactos/ntoskrnl/ke/amd64/ctxswitch.S b/reactos/ntoskrnl/ke/amd64/ctxswitch.S index 9a51fee6c5d..72b0b7d3a8b 100644 --- a/reactos/ntoskrnl/ke/amd64/ctxswitch.S +++ b/reactos/ntoskrnl/ke/amd64/ctxswitch.S @@ -9,23 +9,8 @@ /* INCLUDES ******************************************************************/ -#include - -.intel_syntax noprefix - -.altmacro -.macro UNIMPLEMENTED func - jmp 2f -1: - .ascii "Sorry, asm function " - .ascii func - .ascii " is unimplemented!\n\0" -2: - movabs rcx, offset 1b - call _DbgPrint - ret -.endm - +#include +#include /* FUNCTIONS ****************************************************************/ diff --git a/reactos/ntoskrnl/ke/amd64/trap.S b/reactos/ntoskrnl/ke/amd64/trap.S index 1da1fe5c1ed..44e5c483748 100644 --- a/reactos/ntoskrnl/ke/amd64/trap.S +++ b/reactos/ntoskrnl/ke/amd64/trap.S @@ -7,8 +7,8 @@ /* INCLUDES ******************************************************************/ +#include #include -#include /* GLOBALS *******************************************************************/ From 459f389307f682ed28e2981d935819f83db87f6e Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 30 Jan 2010 00:22:03 +0000 Subject: [PATCH 066/121] Update some asm macros, partly adding MASM/ML support svn path=/branches/ros-amd64-bringup/; revision=45328 --- reactos/include/reactos/asm.h | 47 +++++++++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 7 deletions(-) diff --git a/reactos/include/reactos/asm.h b/reactos/include/reactos/asm.h index 8d8f48d1a74..3aef7f1b595 100644 --- a/reactos/include/reactos/asm.h +++ b/reactos/include/reactos/asm.h @@ -8,26 +8,54 @@ #ifdef _MSC_VER -#else +/* MASM/ML doesn't want explicit [rip] addressing */ +#define RIP(address) address +/* Due to MASM's reverse syntax, we are forced to use a precompiler macro */ +#define MACRO(name, ...) name MACRO __VA_ARGS__ + +/* To avoid reverse syntax we provide a new macro .PROC, replacing PROC... */ +.PROC MACRO namex + namex PROC FRAME +ENDM + +/* ... and .ENDP, replacing ENDP */ +.ENDP MACRO name + name ENDP +ENDM + + +#else /***********************************************************************/ + +/* Force intel syntax */ .intel_syntax noprefix .code64 -/* Macros for x64 stack unwind OPs */ +/* GAS needs explicit [rip] addressing */ +#define RIP(address) address##[rip] -.macro .proc name - .func name - .global _\name - _\name: +/* Due to MASM's reverse syntax, we are forced to use a precompiler macro */ +#define MACRO(name, ...) .MACRO name, __VA_ARGS__ + +/* To avoid reverse syntax we provide a new macro .PROC, replacing PROC... */ +.macro .PROC name + .func \name + \name: .cfi_startproc .equ cfa_current_offset, -8 .endm -.macro .endproc +/* ... and .ENDP, replacing ENDP */ +.macro .ENDP .cfi_endproc .endfunc .endm +/* MASM compatible PUBLIC */ +#define PUBLIC .global + +/* Macros for x64 stack unwind OPs */ + .macro .allocstack size .cfi_adjust_cfa_offset \size .set cfa_current_offset, cfa_current_offset - \size @@ -83,4 +111,9 @@ .endm #define UNIMPLEMENTED UNIMPLEMENTED2 __FILE__, __LINE__, +/* MASM/ML uses ".if" for runtime conditionals, and "if" for compile time + conditionals. We therefore use "if", too. .if shouldn't be used at all */ +#define if .if +#define endif .endif + #endif From fbe7bbfcdba2e82e6277e2c1fdc9c0af8ddd299b Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 30 Jan 2010 00:30:08 +0000 Subject: [PATCH 067/121] Update trap.S to conform svn path=/branches/ros-amd64-bringup/; revision=45329 --- reactos/ntoskrnl/ke/amd64/trap.S | 178 +++++++++++++++++-------------- 1 file changed, 98 insertions(+), 80 deletions(-) diff --git a/reactos/ntoskrnl/ke/amd64/trap.S b/reactos/ntoskrnl/ke/amd64/trap.S index 44e5c483748..03bb63ca664 100644 --- a/reactos/ntoskrnl/ke/amd64/trap.S +++ b/reactos/ntoskrnl/ke/amd64/trap.S @@ -97,14 +97,14 @@ _MsgTrapInfo: /* Point rbp to the KTRAP_FRAME */ lea rbp, [rsp] -.if (TRAPFLAGS & TRAPFLAG_NONVOLATILES) +if (TRAPFLAGS & TRAPFLAG_NONVOLATILES) /* Save non-volatile registers */ mov [rbp + KTRAP_FRAME_Rbx], rbx mov [rbp + KTRAP_FRAME_Rdi], rdi mov [rbp + KTRAP_FRAME_Rsi], rsi -.endif +endif -.if (TRAPFLAGS & TRAPFLAG_VOLATILES) +if (TRAPFLAGS & TRAPFLAG_VOLATILES) /* Save volatile registers */ mov [rbp + KTRAP_FRAME_Rax], rax mov [rbp + KTRAP_FRAME_Rcx], rcx @@ -113,9 +113,9 @@ _MsgTrapInfo: mov [rbp + KTRAP_FRAME_R9], r9 mov [rbp + KTRAP_FRAME_R10], r10 mov [rbp + KTRAP_FRAME_R11], r11 -.endif +endif -.if (TRAPFLAGS & TRAPFLAG_XMM) +if (TRAPFLAGS & TRAPFLAG_XMM) /* Save xmm registers */ movdqa [rbp + KTRAP_FRAME_Xmm0], xmm0 movdqa [rbp + KTRAP_FRAME_Xmm1], xmm1 @@ -123,9 +123,9 @@ _MsgTrapInfo: movdqa [rbp + KTRAP_FRAME_Xmm3], xmm3 movdqa [rbp + KTRAP_FRAME_Xmm4], xmm4 movdqa [rbp + KTRAP_FRAME_Xmm5], xmm5 -.endif +endif -.if (TRAPFLAGS & TRAPFLAG_SEGMENTS) +if (TRAPFLAGS & TRAPFLAG_SEGMENTS) /* Save segment selectors */ mov ax, ds mov [rbp + KTRAP_FRAME_SegDs], ax @@ -135,7 +135,7 @@ _MsgTrapInfo: mov [rbp + KTRAP_FRAME_SegFs], ax mov ax, gs mov [rbp + KTRAP_FRAME_SegGs], ax -.endif +endif /* Save previous mode and swap gs when it was UserMode */ mov ax, [rbp + KTRAP_FRAME_SegCs] @@ -153,7 +153,7 @@ _MsgTrapInfo: // KTRAP_FRAME_ExceptionActive // KTRAP_FRAME_MxCsr -.if (TRAPFLAGS & TRAPFLAG_DEBUG) +if (TRAPFLAGS & TRAPFLAG_DEBUG) /* Save debug registers */ mov rax, dr0 mov [rbp + KTRAP_FRAME_Dr0], rax @@ -167,7 +167,7 @@ _MsgTrapInfo: mov [rbp + KTRAP_FRAME_Dr6], rax mov rax, dr7 mov [rbp + KTRAP_FRAME_Dr7], rax -.endif +endif // KTRAP_FRAME_DebugControl // KTRAP_FRAME_LastBranchToRip @@ -186,7 +186,7 @@ _MsgTrapInfo: */ .macro LEAVE_TRAP_FRAME -.if (TRAPFLAGS & TRAPFLAG_SEGMENTS) +if (TRAPFLAGS & TRAPFLAG_SEGMENTS) /* Restore segment selectors */ mov ax, [rbp + KTRAP_FRAME_SegDs] mov ds, ax @@ -194,21 +194,21 @@ _MsgTrapInfo: mov es, ax mov ax, [rbp + KTRAP_FRAME_SegFs] mov fs, ax -.endif +endif test byte ptr [rbp + KTRAP_FRAME_PreviousMode], 1 jz 1f swapgs 1: -.if (TRAPFLAGS & TRAPFLAG_NONVOLATILES) +if (TRAPFLAGS & TRAPFLAG_NONVOLATILES) /* Restore non-volatile registers */ mov rbx, [rbp + KTRAP_FRAME_Rbx] mov rdi, [rbp + KTRAP_FRAME_Rdi] mov rsi, [rbp + KTRAP_FRAME_Rsi] -.endif +endif -.if (TRAPFLAGS & TRAPFLAG_VOLATILES) +if (TRAPFLAGS & TRAPFLAG_VOLATILES) /* Restore volatile registers */ mov rax, [rbp + KTRAP_FRAME_Rax] mov rcx, [rbp + KTRAP_FRAME_Rcx] @@ -217,9 +217,9 @@ _MsgTrapInfo: mov r9, [rbp + KTRAP_FRAME_R9] mov r10, [rbp + KTRAP_FRAME_R10] mov r11, [rbp + KTRAP_FRAME_R11] -.endif +endif -.if (TRAPFLAGS & TRAPFLAG_XMM) +if (TRAPFLAGS & TRAPFLAG_XMM) /* Restore xmm registers */ movdqa xmm0, [rbp + KTRAP_FRAME_Xmm0] movdqa xmm1, [rbp + KTRAP_FRAME_Xmm1] @@ -227,7 +227,7 @@ _MsgTrapInfo: movdqa xmm3, [rbp + KTRAP_FRAME_Xmm3] movdqa xmm4, [rbp + KTRAP_FRAME_Xmm4] movdqa xmm5, [rbp + KTRAP_FRAME_Xmm5] -.endif +endif /* Restore rbp */ mov rbp, [rbp + KTRAP_FRAME_Rbp] @@ -323,7 +323,8 @@ _InternalDispatchException: /* SOFTWARE INTERRUPT SERVICES ***********************************************/ -.proc KiDivideErrorFault +PUBLIC _KiDivideErrorFault +.PROC _KiDivideErrorFault .pushframe 0 /* Push pseudo error code */ push 0 @@ -332,9 +333,10 @@ _InternalDispatchException: UNIMPLEMENTED KiDivideErrorFault jmp $ -.endproc +.ENDP -.proc KiDebugTrapOrFault +PUBLIC _KiDebugTrapOrFault +.PROC _KiDebugTrapOrFault .pushframe 0 /* Push pseudo error code */ push 0 @@ -344,7 +346,7 @@ _InternalDispatchException: TRAPINFO KiDebugTrapOrFault - /* Check if the frame was from kernelmode */ + /* Checkif the frame was from kernelmode */ test word ptr [rbp + KTRAP_FRAME_SegCs], 3 jz KiDebugTrapOrFaultKMode @@ -364,9 +366,10 @@ KiDebugTrapOrFaultKMode: /* Return */ LEAVE_TRAP_FRAME iretq -.endproc +.ENDP -.proc KiNmiInterrupt +PUBLIC _KiNmiInterrupt +.PROC _KiNmiInterrupt .pushframe 0 /* Push pseudo error code */ push 0 @@ -375,9 +378,10 @@ KiDebugTrapOrFaultKMode: UNIMPLEMENTED KiNmiInterrupt jmp $ -.endproc +.ENDP -.proc KiBreakpointTrap +PUBLIC _KiBreakpointTrap +.PROC _KiBreakpointTrap .pushframe 0 /* Push pseudo error code */ push 0 @@ -402,9 +406,10 @@ KiDebugTrapOrFaultKMode: /* Return */ LEAVE_TRAP_FRAME iretq -.endproc +.ENDP -.proc KiOverflowTrap +PUBLIC _KiOverflowTrap +.PROC _KiOverflowTrap .pushframe 0 /* Push pseudo error code */ push 0 @@ -412,9 +417,10 @@ KiDebugTrapOrFaultKMode: UNIMPLEMENTED KiOverflowTrap jmp $ -.endproc +.ENDP -.proc KiBoundFault +PUBLIC _KiBoundFault +.PROC _KiBoundFault .pushframe 0 /* Push pseudo error code */ push 0 @@ -429,9 +435,10 @@ KiDebugTrapOrFaultKMode: UNIMPLEMENTED KiBoundFault jmp $ -.endproc +.ENDP -.proc KiInvalidOpcodeFault +PUBLIC _KiInvalidOpcodeFault +.PROC _KiInvalidOpcodeFault .pushframe 0 /* Push pseudo error code */ push 0 @@ -451,9 +458,10 @@ KiDebugTrapOrFaultKMode: /* Return */ LEAVE_TRAP_FRAME iretq -.endproc +.ENDP -.proc KiNpxNotAvailableFault +PUBLIC _KiNpxNotAvailableFault +.PROC _KiNpxNotAvailableFault .pushframe 0 /* Push pseudo error code */ push 0 @@ -462,9 +470,10 @@ KiDebugTrapOrFaultKMode: UNIMPLEMENTED KiNpxNotAvailableFault jmp $ -.endproc +.ENDP -.proc KiDoubleFaultAbort +PUBLIC _KiDoubleFaultAbort +.PROC _KiDoubleFaultAbort .pushframe 0 /* Push pseudo error code */ push 0 @@ -489,9 +498,10 @@ KiDebugTrapOrFaultKMode: call _KeBugCheckWithTf jmp $ -.endproc +.ENDP -.proc KiNpxSegmentOverrunAbort +PUBLIC _KiNpxSegmentOverrunAbort +.PROC _KiNpxSegmentOverrunAbort .pushframe 0 /* Push pseudo error code */ push 0 @@ -500,38 +510,40 @@ KiDebugTrapOrFaultKMode: UNIMPLEMENTED KiNpxSegmentOverrunAbort jmp $ -.endproc +.ENDP -.proc KiInvalidTssFault +PUBLIC _KiInvalidTssFault +.PROC _KiInvalidTssFault .pushframe 1 /* We have an error code */ UNIMPLEMENTED KiInvalidTssFault jmp $ -.endproc +.ENDP - -.proc KiSegmentNotPresentFault +PUBLIC _KiSegmentNotPresentFault +.PROC _KiSegmentNotPresentFault .pushframe 1 /* We have an error code */ UNIMPLEMENTED KiSegmentNotPresentFault jmp $ -.endproc +.ENDP -.proc KiStackFault +PUBLIC _KiStackFault +.PROC _KiStackFault .pushframe 1 /* We have an error code */ UNIMPLEMENTED KiStackFault jmp $ -.endproc +.ENDP - -.proc KiGeneralProtectionFault +PUBLIC _KiGeneralProtectionFault +.PROC _KiGeneralProtectionFault .pushframe 1 /* We have an error code */ @@ -544,7 +556,7 @@ KiDebugTrapOrFaultKMode: lea rcx, _MsgGeneralProtFault[rip] call _FrLdrDbgPrint[rip] - /* Check if this was from user-mode */ + /* Checkif this was from user-mode */ cmp byte ptr [rbp + KTRAP_FRAME_PreviousMode], KernelMode jnz KiGpfUserMode @@ -640,10 +652,10 @@ KiGpfExit: LEAVE_TRAP_FRAME iretq -.endproc +.ENDP - -.proc KiPageFault +PUBLIC _KiPageFault +.PROC _KiPageFault .pushframe 1 /* We have an error code */ @@ -709,10 +721,10 @@ SpecialCode: PageFaultReturn: LEAVE_TRAP_FRAME; iretq -.endproc +.ENDP - -.proc KiFloatingErrorFault +PUBLIC _KiFloatingErrorFault +.PROC _KiFloatingErrorFault .pushframe 0 /* Push pseudo error code */ push 0 @@ -721,18 +733,20 @@ PageFaultReturn: UNIMPLEMENTED KiFloatingErrorFault jmp $ -.endproc +.ENDP -.proc KiAlignmentFault +PUBLIC _KiAlignmentFault +.PROC _KiAlignmentFault .pushframe 1 /* We have an error code */ UNIMPLEMENTED KiAlignmentFault jmp $ -.endproc +.ENDP -.proc KiMcheckAbort +PUBLIC _KiMcheckAbort +.PROC _KiMcheckAbort .pushframe 0 /* Push pseudo error code */ push 0 @@ -741,9 +755,10 @@ PageFaultReturn: UNIMPLEMENTED KiMcheckAbort jmp $ -.endproc +.ENDP -.proc KiXmmException +PUBLIC _KiXmmException +.PROC _KiXmmException .pushframe 0 /* Push pseudo error code */ push 0 @@ -752,25 +767,28 @@ PageFaultReturn: UNIMPLEMENTED KiXmmException jmp $ -.endproc +.ENDP -.proc KiApcInterrupt +PUBLIC _KiApcInterrupt +.PROC _KiApcInterrupt .pushframe 1 UNIMPLEMENTED KiApcInterrupt jmp $ -.endproc +.ENDP -.proc KiRaiseAssertion +PUBLIC _KiRaiseAssertion +.PROC _KiRaiseAssertion .pushframe 1 UNIMPLEMENTED KiRaiseAssertion jmp $ -.endproc +.ENDP -.proc KiDebugServiceTrap +PUBLIC _KiDebugServiceTrap +.PROC _KiDebugServiceTrap .pushframe 0 /* Push pseudo error code */ push 0 @@ -793,28 +811,28 @@ PageFaultReturn: LEAVE_TRAP_FRAME; iretq -.endproc +.ENDP - -.proc KiDpcInterrupt +PUBLIC _KiDpcInterrupt +.PROC _KiDpcInterrupt .pushframe 1 UNIMPLEMENTED KiDpcInterrupt jmp $ -.endproc +.ENDP - -.proc KiIpiInterrupt +PUBLIC _KiIpiInterrupt +.PROC _KiIpiInterrupt .pushframe 1 UNIMPLEMENTED KiIpiInterrupt jmp $ -.endproc +.ENDP - -.proc KiUnexpectedInterrupt +PUBLIC _KiUnexpectedInterrupt +.PROC _KiUnexpectedInterrupt .pushframe 0 /* The error code is the vector */ @@ -832,10 +850,10 @@ PageFaultReturn: mov [rbp + KTRAP_FRAME_P5 + 8], rbp // trap frame call _KeBugCheckWithTf -.endproc +.ENDP +PUBLIC _KiSystemFatalException +.PROC _KiSystemFatalException -.proc KiSystemFatalException - -.endproc +.ENDP From 5698669639479baed865e4bbf3fde26fff8d4312 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 30 Jan 2010 00:52:23 +0000 Subject: [PATCH 068/121] Update macros a bit more svn path=/branches/ros-amd64-bringup/; revision=45330 --- reactos/include/reactos/asm.h | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/reactos/include/reactos/asm.h b/reactos/include/reactos/asm.h index 3aef7f1b595..fab908d29b7 100644 --- a/reactos/include/reactos/asm.h +++ b/reactos/include/reactos/asm.h @@ -2,12 +2,18 @@ * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS Kernel * FILE: ntoskrnl/include/amd64/asmmacro.S - * PURPOSE: ASM macros for for GAS and ML64 + * PURPOSE: ASM macros for for GAS and MASM/ML64 * PROGRAMMERS: Timo Kreuzer (timo.kreuzer@reactos.org) */ #ifdef _MSC_VER +/* Allow ".name" identifiers */ +OPTION DOTNAME + +/* Hex numbers need to be in 01ABh format */ +#define HEX(x) 0##x##h + /* MASM/ML doesn't want explicit [rip] addressing */ #define RIP(address) address @@ -24,6 +30,13 @@ ENDM name ENDP ENDM +/* MASM doesn't have an ASCIIZ macro */ +.ASCIIZ MACRO text + DB text, 0 +ENDM + +/* We need this to distinguish repeat from macros */ +#define ENDR ENDM #else /***********************************************************************/ @@ -31,6 +44,9 @@ ENDM .intel_syntax noprefix .code64 +/* Hex numbers need to be in 0x1AB format */ +#define HEX(x) 0x##x + /* GAS needs explicit [rip] addressing */ #define RIP(address) address##[rip] @@ -46,7 +62,7 @@ ENDM .endm /* ... and .ENDP, replacing ENDP */ -.macro .ENDP +.macro .ENDP name .cfi_endproc .endfunc .endm @@ -54,6 +70,14 @@ ENDM /* MASM compatible PUBLIC */ #define PUBLIC .global +/* MASM compatible ALIGN */ +#define ALIGN .align + +/* MASM compatible REPEAT, additional ENDR */ +#define REPEAT .rept +#define ENDR .endr + + /* Macros for x64 stack unwind OPs */ .macro .allocstack size From cf3c48103514c580a08da5652ff51e646e66ab39 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 30 Jan 2010 00:53:01 +0000 Subject: [PATCH 069/121] And once again fix trap.S svn path=/branches/ros-amd64-bringup/; revision=45331 --- reactos/ntoskrnl/ke/amd64/trap.S | 95 ++++++++++++++++---------------- 1 file changed, 47 insertions(+), 48 deletions(-) diff --git a/reactos/ntoskrnl/ke/amd64/trap.S b/reactos/ntoskrnl/ke/amd64/trap.S index 03bb63ca664..ab5e04633cd 100644 --- a/reactos/ntoskrnl/ke/amd64/trap.S +++ b/reactos/ntoskrnl/ke/amd64/trap.S @@ -16,7 +16,7 @@ .global _MsgUnimplemented _MsgUnimplemented: -.asciz "WARNING: %s at %s:%d is UNIMPLEMENTED!\n" +.ascii "WARNING: %s at %s:%d is UNIMPLEMENTED!\n\0" _MsgPageFault: .ascii "Page fault! Code = 0x%x, RIP = %p, FaultingAddress = %p\n\0" @@ -81,10 +81,9 @@ _MsgTrapInfo: * ENTER_TRAP_FRAME - Allocate SIZE_KTRAP_FRAME and save registers to it */ .macro ENTER_TRAP_FRAME Flags -.set SIZE_INITIAL_FRAME, 7 * 8 -//.set SIZE_LOCAL_DATA, SIZE_EXCEPTION_RECORD + 0x28 -.set SIZE_TRAP_FRAME_ALLOC, SIZE_KTRAP_FRAME - SIZE_INITIAL_FRAME -.set TRAPFLAGS, \Flags + SIZE_INITIAL_FRAME = 7 * 8 + SIZE_TRAP_FRAME_ALLOC = SIZE_KTRAP_FRAME - SIZE_INITIAL_FRAME + TRAPFLAGS = \Flags /* Save rbp */ push rbp @@ -97,14 +96,14 @@ _MsgTrapInfo: /* Point rbp to the KTRAP_FRAME */ lea rbp, [rsp] -if (TRAPFLAGS & TRAPFLAG_NONVOLATILES) +if (TRAPFLAGS AND TRAPFLAG_NONVOLATILES) /* Save non-volatile registers */ mov [rbp + KTRAP_FRAME_Rbx], rbx mov [rbp + KTRAP_FRAME_Rdi], rdi mov [rbp + KTRAP_FRAME_Rsi], rsi endif -if (TRAPFLAGS & TRAPFLAG_VOLATILES) +if (TRAPFLAGS AND TRAPFLAG_VOLATILES) /* Save volatile registers */ mov [rbp + KTRAP_FRAME_Rax], rax mov [rbp + KTRAP_FRAME_Rcx], rcx @@ -115,7 +114,7 @@ if (TRAPFLAGS & TRAPFLAG_VOLATILES) mov [rbp + KTRAP_FRAME_R11], r11 endif -if (TRAPFLAGS & TRAPFLAG_XMM) +if (TRAPFLAGS AND TRAPFLAG_XMM) /* Save xmm registers */ movdqa [rbp + KTRAP_FRAME_Xmm0], xmm0 movdqa [rbp + KTRAP_FRAME_Xmm1], xmm1 @@ -125,7 +124,7 @@ if (TRAPFLAGS & TRAPFLAG_XMM) movdqa [rbp + KTRAP_FRAME_Xmm5], xmm5 endif -if (TRAPFLAGS & TRAPFLAG_SEGMENTS) +if (TRAPFLAGS AND TRAPFLAG_SEGMENTS) /* Save segment selectors */ mov ax, ds mov [rbp + KTRAP_FRAME_SegDs], ax @@ -153,7 +152,7 @@ endif // KTRAP_FRAME_ExceptionActive // KTRAP_FRAME_MxCsr -if (TRAPFLAGS & TRAPFLAG_DEBUG) +if (TRAPFLAGS AND TRAPFLAG_DEBUG) /* Save debug registers */ mov rax, dr0 mov [rbp + KTRAP_FRAME_Dr0], rax @@ -186,7 +185,7 @@ endif */ .macro LEAVE_TRAP_FRAME -if (TRAPFLAGS & TRAPFLAG_SEGMENTS) +if (TRAPFLAGS AND TRAPFLAG_SEGMENTS) /* Restore segment selectors */ mov ax, [rbp + KTRAP_FRAME_SegDs] mov ds, ax @@ -201,14 +200,14 @@ endif swapgs 1: -if (TRAPFLAGS & TRAPFLAG_NONVOLATILES) +if (TRAPFLAGS AND TRAPFLAG_NONVOLATILES) /* Restore non-volatile registers */ mov rbx, [rbp + KTRAP_FRAME_Rbx] mov rdi, [rbp + KTRAP_FRAME_Rdi] mov rsi, [rbp + KTRAP_FRAME_Rsi] endif -if (TRAPFLAGS & TRAPFLAG_VOLATILES) +if (TRAPFLAGS AND TRAPFLAG_VOLATILES) /* Restore volatile registers */ mov rax, [rbp + KTRAP_FRAME_Rax] mov rcx, [rbp + KTRAP_FRAME_Rcx] @@ -219,7 +218,7 @@ if (TRAPFLAGS & TRAPFLAG_VOLATILES) mov r11, [rbp + KTRAP_FRAME_R11] endif -if (TRAPFLAGS & TRAPFLAG_XMM) +if (TRAPFLAGS AND TRAPFLAG_XMM) /* Restore xmm registers */ movdqa xmm0, [rbp + KTRAP_FRAME_Xmm0] movdqa xmm1, [rbp + KTRAP_FRAME_Xmm1] @@ -242,16 +241,16 @@ endif .text .code64 -.align 8 -.global _InterruptDispatchTable +ALIGN 8 +PUBLIC _InterruptDispatchTable _InterruptDispatchTable: -.set Vector, 0 -.rept 256 +Vector = 0 +REPEAT 256 push Vector jmp _KiUnexpectedInterrupt - .align 8 - .set Vector, Vector+1 -.endr + ALIGN 8 + Vector = Vector + 1 +ENDR // rbp = TrapFrame, eax = ExceptionCode, edx = NumParams, r9,r10,r11 = params _InternalDispatchException: @@ -333,7 +332,7 @@ PUBLIC _KiDivideErrorFault UNIMPLEMENTED KiDivideErrorFault jmp $ -.ENDP +.ENDP _KiDivideErrorFault PUBLIC _KiDebugTrapOrFault .PROC _KiDebugTrapOrFault @@ -366,7 +365,7 @@ KiDebugTrapOrFaultKMode: /* Return */ LEAVE_TRAP_FRAME iretq -.ENDP +.ENDP _KiDebugTrapOrFault PUBLIC _KiNmiInterrupt .PROC _KiNmiInterrupt @@ -378,7 +377,7 @@ PUBLIC _KiNmiInterrupt UNIMPLEMENTED KiNmiInterrupt jmp $ -.ENDP +.ENDP _KiNmiInterrupt PUBLIC _KiBreakpointTrap .PROC _KiBreakpointTrap @@ -406,7 +405,7 @@ PUBLIC _KiBreakpointTrap /* Return */ LEAVE_TRAP_FRAME iretq -.ENDP +.ENDP _KiBreakpointTrap PUBLIC _KiOverflowTrap .PROC _KiOverflowTrap @@ -417,7 +416,7 @@ PUBLIC _KiOverflowTrap UNIMPLEMENTED KiOverflowTrap jmp $ -.ENDP +.ENDP _KiOverflowTrap PUBLIC _KiBoundFault .PROC _KiBoundFault @@ -435,7 +434,7 @@ PUBLIC _KiBoundFault UNIMPLEMENTED KiBoundFault jmp $ -.ENDP +.ENDP _KiBoundFault PUBLIC _KiInvalidOpcodeFault .PROC _KiInvalidOpcodeFault @@ -458,7 +457,7 @@ PUBLIC _KiInvalidOpcodeFault /* Return */ LEAVE_TRAP_FRAME iretq -.ENDP +.ENDP _KiInvalidOpcodeFault PUBLIC _KiNpxNotAvailableFault .PROC _KiNpxNotAvailableFault @@ -470,7 +469,7 @@ PUBLIC _KiNpxNotAvailableFault UNIMPLEMENTED KiNpxNotAvailableFault jmp $ -.ENDP +.ENDP _KiNpxNotAvailableFault PUBLIC _KiDoubleFaultAbort .PROC _KiDoubleFaultAbort @@ -498,7 +497,7 @@ PUBLIC _KiDoubleFaultAbort call _KeBugCheckWithTf jmp $ -.ENDP +.ENDP _KiDoubleFaultAbort PUBLIC _KiNpxSegmentOverrunAbort .PROC _KiNpxSegmentOverrunAbort @@ -510,7 +509,7 @@ PUBLIC _KiNpxSegmentOverrunAbort UNIMPLEMENTED KiNpxSegmentOverrunAbort jmp $ -.ENDP +.ENDP _KiNpxSegmentOverrunAbort PUBLIC _KiInvalidTssFault .PROC _KiInvalidTssFault @@ -520,7 +519,7 @@ PUBLIC _KiInvalidTssFault UNIMPLEMENTED KiInvalidTssFault jmp $ -.ENDP +.ENDP _KiInvalidTssFault PUBLIC _KiSegmentNotPresentFault .PROC _KiSegmentNotPresentFault @@ -530,7 +529,7 @@ PUBLIC _KiSegmentNotPresentFault UNIMPLEMENTED KiSegmentNotPresentFault jmp $ -.ENDP +.ENDP _KiSegmentNotPresentFault PUBLIC _KiStackFault .PROC _KiStackFault @@ -540,7 +539,7 @@ PUBLIC _KiStackFault UNIMPLEMENTED KiStackFault jmp $ -.ENDP +.ENDP _KiStackFault PUBLIC _KiGeneralProtectionFault .PROC _KiGeneralProtectionFault @@ -652,7 +651,7 @@ KiGpfExit: LEAVE_TRAP_FRAME iretq -.ENDP +.ENDP _KiGeneralProtectionFault PUBLIC _KiPageFault .PROC _KiPageFault @@ -721,7 +720,7 @@ SpecialCode: PageFaultReturn: LEAVE_TRAP_FRAME; iretq -.ENDP +.ENDP _KiPageFault PUBLIC _KiFloatingErrorFault .PROC _KiFloatingErrorFault @@ -733,7 +732,7 @@ PUBLIC _KiFloatingErrorFault UNIMPLEMENTED KiFloatingErrorFault jmp $ -.ENDP +.ENDP _KiFloatingErrorFault PUBLIC _KiAlignmentFault .PROC _KiAlignmentFault @@ -743,7 +742,7 @@ PUBLIC _KiAlignmentFault UNIMPLEMENTED KiAlignmentFault jmp $ -.ENDP +.ENDP _KiAlignmentFault PUBLIC _KiMcheckAbort .PROC _KiMcheckAbort @@ -755,7 +754,7 @@ PUBLIC _KiMcheckAbort UNIMPLEMENTED KiMcheckAbort jmp $ -.ENDP +.ENDP _KiMcheckAbort PUBLIC _KiXmmException .PROC _KiXmmException @@ -767,7 +766,7 @@ PUBLIC _KiXmmException UNIMPLEMENTED KiXmmException jmp $ -.ENDP +.ENDP _KiXmmException PUBLIC _KiApcInterrupt .PROC _KiApcInterrupt @@ -776,16 +775,16 @@ PUBLIC _KiApcInterrupt UNIMPLEMENTED KiApcInterrupt jmp $ -.ENDP +.ENDP _KiApcInterrupt PUBLIC _KiRaiseAssertion .PROC _KiRaiseAssertion .pushframe 1 UNIMPLEMENTED KiRaiseAssertion - + jmp $ -.ENDP +.ENDP _KiRaiseAssertion PUBLIC _KiDebugServiceTrap .PROC _KiDebugServiceTrap @@ -811,7 +810,7 @@ PUBLIC _KiDebugServiceTrap LEAVE_TRAP_FRAME; iretq -.ENDP +.ENDP _KiDebugServiceTrap PUBLIC _KiDpcInterrupt .PROC _KiDpcInterrupt @@ -820,7 +819,7 @@ PUBLIC _KiDpcInterrupt UNIMPLEMENTED KiDpcInterrupt jmp $ -.ENDP +.ENDP _KiDpcInterrupt PUBLIC _KiIpiInterrupt .PROC _KiIpiInterrupt @@ -829,7 +828,7 @@ PUBLIC _KiIpiInterrupt UNIMPLEMENTED KiIpiInterrupt jmp $ -.ENDP +.ENDP _KiIpiInterrupt PUBLIC _KiUnexpectedInterrupt .PROC _KiUnexpectedInterrupt @@ -850,10 +849,10 @@ PUBLIC _KiUnexpectedInterrupt mov [rbp + KTRAP_FRAME_P5 + 8], rbp // trap frame call _KeBugCheckWithTf -.ENDP +.ENDP _KiUnexpectedInterrupt PUBLIC _KiSystemFatalException .PROC _KiSystemFatalException -.ENDP +.ENDP _KiSystemFatalException From e2151932e4ee6ee0fdd08977172616562410b843 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 30 Jan 2010 01:16:42 +0000 Subject: [PATCH 070/121] More macros and fixes svn path=/branches/ros-amd64-bringup/; revision=45332 --- reactos/include/reactos/asm.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/reactos/include/reactos/asm.h b/reactos/include/reactos/asm.h index fab908d29b7..2e08472ab42 100644 --- a/reactos/include/reactos/asm.h +++ b/reactos/include/reactos/asm.h @@ -14,6 +14,9 @@ OPTION DOTNAME /* Hex numbers need to be in 01ABh format */ #define HEX(x) 0##x##h +/* Macro values need to be marked */ +#define VAL(x) x + /* MASM/ML doesn't want explicit [rip] addressing */ #define RIP(address) address @@ -47,11 +50,15 @@ ENDM /* Hex numbers need to be in 0x1AB format */ #define HEX(x) 0x##x +/* Macro values need to be marked */ +#define VAL(x) \x + /* GAS needs explicit [rip] addressing */ #define RIP(address) address##[rip] /* Due to MASM's reverse syntax, we are forced to use a precompiler macro */ -#define MACRO(name, ...) .MACRO name, __VA_ARGS__ +#define MACRO(...) .macro __VA_ARGS__ +#define ENDM .endm /* To avoid reverse syntax we provide a new macro .PROC, replacing PROC... */ .macro .PROC name @@ -77,6 +84,12 @@ ENDM #define REPEAT .rept #define ENDR .endr +/* MASM compatible EXTERN */ +.macro EXTERN name +.endm + +/* MASM needs an END tag */ +#define END /* Macros for x64 stack unwind OPs */ From f0c278391bd72f5072dc69b2b2ebeddf9ba495e9 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 30 Jan 2010 01:17:06 +0000 Subject: [PATCH 071/121] fixup trap.S. Almost there... svn path=/branches/ros-amd64-bringup/; revision=45333 --- reactos/ntoskrnl/ke/amd64/trap.S | 159 +++++++++++++++++++------------ 1 file changed, 97 insertions(+), 62 deletions(-) diff --git a/reactos/ntoskrnl/ke/amd64/trap.S b/reactos/ntoskrnl/ke/amd64/trap.S index ab5e04633cd..c2f82a9fea6 100644 --- a/reactos/ntoskrnl/ke/amd64/trap.S +++ b/reactos/ntoskrnl/ke/amd64/trap.S @@ -10,13 +10,18 @@ #include #include +EXTERN _KiDispatchException:PROC +EXTERN _FrLdrDbgPrint:PROC +EXTERN _KeBugCheckWithTf:PROC +EXTERN _MmAccessFault:PROC + /* GLOBALS *******************************************************************/ .data -.global _MsgUnimplemented +PUBLIC _MsgUnimplemented _MsgUnimplemented: -.ascii "WARNING: %s at %s:%d is UNIMPLEMENTED!\n\0" +.ascii "WARNING: %s at %s:%d is UNIMPLEMENTED!\n" _MsgPageFault: .ascii "Page fault! Code = 0x%x, RIP = %p, FaultingAddress = %p\n\0" @@ -39,31 +44,31 @@ _MsgDoubleFault: _MsgTrapInfo: .ascii "Trap: %s at %p\n\0" -.macro TRAPINFO func +MACRO(TRAPINFO, func) #if 0 jmp 2f .equ expr, 12 1: .asciz "\func" 2: - sub rsp, 0x20 - lea rcx, _MsgTrapInfo[rip] + sub rsp, 32 + lea rcx, RIP(_MsgTrapInfo) lea rdx, 1b[rip] mov r8, [rbp + KTRAP_FRAME_Rip] call _FrLdrDbgPrint[rip] - add rsp, 0x20 + add rsp, 32 #endif -.endm +ENDM /* Helper Macros *************************************************************/ -#define TRAPFLAG_VOLATILES 0x01 -#define TRAPFLAG_NONVOLATILES 0x02 -#define TRAPFLAG_XMM 0x04 -#define TRAPFLAG_SEGMENTS 0x08 -#define TRAPFLAG_DEBUG 0x10 +#define TRAPFLAG_VOLATILES HEX(01) +#define TRAPFLAG_NONVOLATILES HEX(02) +#define TRAPFLAG_XMM HEX(04) +#define TRAPFLAG_SEGMENTS HEX(08) +#define TRAPFLAG_DEBUG HEX(10) #define TRAPFLAG_SYSTEMSERVICE (TRAPFLAG_VOLATILES|TRAPFLAG_DEBUG) -#define TRAPFLAG_ALL 0xff +#define TRAPFLAG_ALL HEX(ff) /* * Stack Layout: @@ -80,10 +85,10 @@ _MsgTrapInfo: /* * ENTER_TRAP_FRAME - Allocate SIZE_KTRAP_FRAME and save registers to it */ -.macro ENTER_TRAP_FRAME Flags +MACRO(ENTER_TRAP_FRAME, Flags) SIZE_INITIAL_FRAME = 7 * 8 SIZE_TRAP_FRAME_ALLOC = SIZE_KTRAP_FRAME - SIZE_INITIAL_FRAME - TRAPFLAGS = \Flags + TRAPFLAGS = VAL(Flags) /* Save rbp */ push rbp @@ -177,13 +182,13 @@ endif /* Make sure the direction flag is cleared */ cld -.endm +ENDM /* * LEAVE_TRAP_FRAME - Restore registers and free stack space */ -.macro LEAVE_TRAP_FRAME +MACRO(LEAVE_TRAP_FRAME) if (TRAPFLAGS AND TRAPFLAG_SEGMENTS) /* Restore segment selectors */ @@ -232,8 +237,8 @@ endif mov rbp, [rbp + KTRAP_FRAME_Rbp] /* Adjust stack pointer (plus one qword for rbp, one for error code) */ - add rsp, SIZE_TRAP_FRAME_ALLOC + 0x10 -.endm + add rsp, SIZE_TRAP_FRAME_ALLOC + HEX(10) +ENDM /* FUNCTIONS *****************************************************************/ @@ -242,6 +247,7 @@ endif .code64 ALIGN 8 + PUBLIC _InterruptDispatchTable _InterruptDispatchTable: Vector = 0 @@ -249,7 +255,7 @@ REPEAT 256 push Vector jmp _KiUnexpectedInterrupt ALIGN 8 - Vector = Vector + 1 + Vector = Vector+1 ENDR // rbp = TrapFrame, eax = ExceptionCode, edx = NumParams, r9,r10,r11 = params @@ -267,9 +273,9 @@ _InternalDispatchException: mov rax, [rbp + KTRAP_FRAME_Rip] mov [rcx + EXCEPTION_RECORD_ExceptionAddress], rax mov [rcx + EXCEPTION_RECORD_NumberParameters], edx - mov [rcx + EXCEPTION_RECORD_ExceptionInformation + 0x00], r9 - mov [rcx + EXCEPTION_RECORD_ExceptionInformation + 0x08], r10 - mov [rcx + EXCEPTION_RECORD_ExceptionInformation + 0x10], r11 + mov [rcx + EXCEPTION_RECORD_ExceptionInformation + HEX(00)], r9 + mov [rcx + EXCEPTION_RECORD_ExceptionInformation + HEX(08)], r10 + mov [rcx + EXCEPTION_RECORD_ExceptionInformation + HEX(10)], r11 /* Set up KEXCEPTION_FRAME */ mov rax, [rbp + KTRAP_FRAME_Rbp] @@ -327,7 +333,8 @@ PUBLIC _KiDivideErrorFault .pushframe 0 /* Push pseudo error code */ push 0 - .allocstack 0x8 + .allocstack 8 + .endprolog UNIMPLEMENTED KiDivideErrorFault @@ -339,13 +346,14 @@ PUBLIC _KiDebugTrapOrFault .pushframe 0 /* Push pseudo error code */ push 0 - .allocstack 0x8 + .allocstack 8 + .endprolog ENTER_TRAP_FRAME TRAPFLAG_ALL TRAPINFO KiDebugTrapOrFault - /* Checkif the frame was from kernelmode */ + /* Check if the frame was from kernelmode */ test word ptr [rbp + KTRAP_FRAME_SegCs], 3 jz KiDebugTrapOrFaultKMode @@ -372,7 +380,8 @@ PUBLIC _KiNmiInterrupt .pushframe 0 /* Push pseudo error code */ push 0 - .allocstack 0x8 + .allocstack 8 + .endprolog UNIMPLEMENTED KiNmiInterrupt @@ -384,15 +393,16 @@ PUBLIC _KiBreakpointTrap .pushframe 0 /* Push pseudo error code */ push 0 - .allocstack 0x8 + .allocstack 8 + .endprolog ENTER_TRAP_FRAME TRAPFLAG_ALL TRAPINFO KiBreakpointTrap -// lea rcx, _MsgBreakpointTrap[rip] +// lea rcx, RIP(_MsgBreakpointTrap) // mov rdx, rsp -// call _FrLdrDbgPrint[rip] +// call RIP(_FrLdrDbgPrint) /* Dispatch the exception */ mov eax, STATUS_BREAKPOINT @@ -412,7 +422,8 @@ PUBLIC _KiOverflowTrap .pushframe 0 /* Push pseudo error code */ push 0 - .allocstack 0x8 + .allocstack 8 + .endprolog UNIMPLEMENTED KiOverflowTrap jmp $ @@ -425,11 +436,12 @@ PUBLIC _KiBoundFault push 0 .allocstack 8 - sub rsp, 0x20 - .allocstack 0x20 + sub rsp, 32 + .allocstack 32 mov [rsp + 8], rbx .savereg rbx, 8 + .endprolog UNIMPLEMENTED KiBoundFault @@ -441,7 +453,8 @@ PUBLIC _KiInvalidOpcodeFault .pushframe 0 /* Push pseudo error code */ push 0 - .allocstack 0x8 + .allocstack 8 + .endprolog ENTER_TRAP_FRAME TRAPFLAG_ALL @@ -450,8 +463,8 @@ PUBLIC _KiInvalidOpcodeFault // DISPATCH_EXCEPTION STATUS_BREAKPOINT, 3, 0, 0, 0 mov rdx, [rbp + KTRAP_FRAME_Rip] - lea rcx, _MsgInvalidOpcodeFault[rip] - call _FrLdrDbgPrint[rip] + lea rcx, RIP(_MsgInvalidOpcodeFault) + call RIP(_FrLdrDbgPrint) jmp $ /* Return */ @@ -464,7 +477,8 @@ PUBLIC _KiNpxNotAvailableFault .pushframe 0 /* Push pseudo error code */ push 0 - .allocstack 0x8 + .allocstack 8 + .endprolog UNIMPLEMENTED KiNpxNotAvailableFault @@ -476,20 +490,21 @@ PUBLIC _KiDoubleFaultAbort .pushframe 0 /* Push pseudo error code */ push 0 - .allocstack 0x8 + .allocstack 8 + .endprolog ENTER_TRAP_FRAME TRAPFLAG_ALL - lea rcx, _MsgDoubleFault[rip] + lea rcx, RIP(_MsgDoubleFault) mov rdx, [rbp + KTRAP_FRAME_FaultAddress] mov r8, rbp - call _FrLdrDbgPrint[rip] + call RIP(_FrLdrDbgPrint) /* Bugcheck code UNEXPECTED_KERNEL_MODE_TRAP */ - mov rcx, 0x0000007F + mov rcx, HEX(0000007F) /* Set double fault parameters */ - mov rdx, 0x00000008 // EXCEPTION_DOUBLE_FAULT + mov rdx, 8 // EXCEPTION_DOUBLE_FAULT mov r8, 0 mov r9, 0 mov [rbp + KTRAP_FRAME_P5], rbp // trap frame (HACKY) @@ -504,7 +519,8 @@ PUBLIC _KiNpxSegmentOverrunAbort .pushframe 0 /* Push pseudo error code */ push 0 - .allocstack 0x8 + .allocstack 8 + .endprolog UNIMPLEMENTED KiNpxSegmentOverrunAbort @@ -515,6 +531,7 @@ PUBLIC _KiInvalidTssFault .PROC _KiInvalidTssFault .pushframe 1 /* We have an error code */ + .endprolog UNIMPLEMENTED KiInvalidTssFault @@ -525,6 +542,7 @@ PUBLIC _KiSegmentNotPresentFault .PROC _KiSegmentNotPresentFault .pushframe 1 /* We have an error code */ + .endprolog UNIMPLEMENTED KiSegmentNotPresentFault @@ -535,6 +553,7 @@ PUBLIC _KiStackFault .PROC _KiStackFault .pushframe 1 /* We have an error code */ + .endprolog UNIMPLEMENTED KiStackFault @@ -545,6 +564,7 @@ PUBLIC _KiGeneralProtectionFault .PROC _KiGeneralProtectionFault .pushframe 1 /* We have an error code */ + .endprolog cli ENTER_TRAP_FRAME TRAPFLAG_ALL @@ -552,10 +572,10 @@ PUBLIC _KiGeneralProtectionFault TRAPINFO KiGeneralProtectionFault mov rdx, [rbp + KTRAP_FRAME_Rip] - lea rcx, _MsgGeneralProtFault[rip] - call _FrLdrDbgPrint[rip] + lea rcx, RIP(_MsgGeneralProtFault) + call RIP(_FrLdrDbgPrint) - /* Checkif this was from user-mode */ + /* Check if this was from user-mode */ cmp byte ptr [rbp + KTRAP_FRAME_PreviousMode], KernelMode jnz KiGpfUserMode @@ -564,33 +584,33 @@ PUBLIC _KiGeneralProtectionFault mov rax, [rax] /* Check for MSR failure */ - cmp al, 0xF + cmp al, HEX(0F) jz KiGpfMsr /* Check for IRET */ - cmp ax, 0xCF48 + cmp ax, HEX(0CF48) je KiGpfIret /* Check for pop ds/es/fs/gs */ xor edx, edx - cmp al, 0x1F + cmp al, HEX(1F) jz KiGpfPopSegDs - cmp al, 0x07 + cmp al, HEX(07) jz KiGpfPopSegEs - cmp ax, 0xA10F + cmp ax, HEX(0A10F) jz KiGpfPopSegFs - cmp ax, 0xA90F + cmp ax, HEX(0A90F) jz KiGpfPopSegGs - mov dx, 0x002B // KGDT64_R3_DATA | RPL_MASK + mov dx, HEX(002B) // KGDT64_R3_DATA | RPL_MASK cmp [rbp + KTRAP_FRAME_SegDs], dx jne KiGpfPopSegDs cmp [rbp + KTRAP_FRAME_SegEs], dx jne KiGpfPopSegEs cmp [rbp + KTRAP_FRAME_SegGs], dx jne KiGpfPopSegGs - mov dx, 0x0053 // KGDT64_R3_CMTEB | RPL_MASK + mov dx, HEX(0053) // KGDT64_R3_CMTEB | RPL_MASK cmp [rbp + KTRAP_FRAME_SegFs], dx jne KiGpfPopSegFs @@ -598,7 +618,7 @@ KiGpfFatal: /* Bugcheck */ mov ecx, UNEXPECTED_KERNEL_MODE_TRAP - mov rdx, 0x0000D // EXCEPTION_GP_FAULT + mov rdx, HEX(000D) // EXCEPTION_GP_FAULT xor r8, r8 mov r9, [rbp + KTRAP_FRAME_ErrorCode] // error code sub rsp, 8 @@ -657,17 +677,18 @@ PUBLIC _KiPageFault .PROC _KiPageFault .pushframe 1 /* We have an error code */ + .endprolog ENTER_TRAP_FRAME TRAPFLAG_ALL TRAPINFO KiPageFault #if 0 - lea rcx, _MsgPageFault[rip] + lea rcx, RIP(_MsgPageFault) mov rdx, [rbp + KTRAP_FRAME_ErrorCode] mov r8, [rbp + KTRAP_FRAME_Rip] mov r9, [rbp + KTRAP_FRAME_FaultAddress] - call _FrLdrDbgPrint[rip] + call RIP(_FrLdrDbgPrint) #endif /* Save page fault address */ @@ -727,7 +748,8 @@ PUBLIC _KiFloatingErrorFault .pushframe 0 /* Push pseudo error code */ push 0 - .allocstack 0x8 + .allocstack 8 + .endprolog UNIMPLEMENTED KiFloatingErrorFault @@ -738,6 +760,7 @@ PUBLIC _KiAlignmentFault .PROC _KiAlignmentFault .pushframe 1 /* We have an error code */ + .endprolog UNIMPLEMENTED KiAlignmentFault @@ -749,7 +772,8 @@ PUBLIC _KiMcheckAbort .pushframe 0 /* Push pseudo error code */ push 0 - .allocstack 0x08 + .allocstack 8 + .endprolog UNIMPLEMENTED KiMcheckAbort @@ -761,7 +785,8 @@ PUBLIC _KiXmmException .pushframe 0 /* Push pseudo error code */ push 0 - .allocstack 0x08 + .allocstack 8 + .endprolog UNIMPLEMENTED KiXmmException @@ -771,6 +796,7 @@ PUBLIC _KiXmmException PUBLIC _KiApcInterrupt .PROC _KiApcInterrupt .pushframe 1 + .endprolog UNIMPLEMENTED KiApcInterrupt @@ -780,9 +806,10 @@ PUBLIC _KiApcInterrupt PUBLIC _KiRaiseAssertion .PROC _KiRaiseAssertion .pushframe 1 + .endprolog UNIMPLEMENTED KiRaiseAssertion - + jmp $ .ENDP _KiRaiseAssertion @@ -791,7 +818,8 @@ PUBLIC _KiDebugServiceTrap .pushframe 0 /* Push pseudo error code */ push 0 - .allocstack 0x08 + .allocstack 8 + .endprolog ENTER_TRAP_FRAME TRAPFLAG_ALL @@ -815,6 +843,7 @@ PUBLIC _KiDebugServiceTrap PUBLIC _KiDpcInterrupt .PROC _KiDpcInterrupt .pushframe 1 + .endprolog UNIMPLEMENTED KiDpcInterrupt @@ -824,6 +853,7 @@ PUBLIC _KiDpcInterrupt PUBLIC _KiIpiInterrupt .PROC _KiIpiInterrupt .pushframe 1 + .endprolog UNIMPLEMENTED KiIpiInterrupt @@ -833,6 +863,7 @@ PUBLIC _KiIpiInterrupt PUBLIC _KiUnexpectedInterrupt .PROC _KiUnexpectedInterrupt .pushframe 0 + .endprolog /* The error code is the vector */ @@ -853,6 +884,10 @@ PUBLIC _KiUnexpectedInterrupt PUBLIC _KiSystemFatalException .PROC _KiSystemFatalException + .endprolog .ENDP _KiSystemFatalException + + +END From fcd9ab3f5026c71c0f89906f434b091552bf8ca3 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 30 Jan 2010 01:46:16 +0000 Subject: [PATCH 072/121] fix macros... svn path=/branches/ros-amd64-bringup/; revision=45334 --- reactos/include/reactos/asm.h | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/reactos/include/reactos/asm.h b/reactos/include/reactos/asm.h index 2e08472ab42..46e1e5c94cb 100644 --- a/reactos/include/reactos/asm.h +++ b/reactos/include/reactos/asm.h @@ -18,7 +18,7 @@ OPTION DOTNAME #define VAL(x) x /* MASM/ML doesn't want explicit [rip] addressing */ -#define RIP(address) address +#define RIP(address) [address] /* Due to MASM's reverse syntax, we are forced to use a precompiler macro */ #define MACRO(name, ...) name MACRO __VA_ARGS__ @@ -33,8 +33,13 @@ ENDM name ENDP ENDM -/* MASM doesn't have an ASCIIZ macro */ -.ASCIIZ MACRO text +/* MASM doesn't have an ASCII macro */ +.ASCII MACRO text + DB text +ENDM + +/* MASM doesn't have an ASCIZ macro */ +.ASCIZ MACRO text DB text, 0 ENDM @@ -98,13 +103,14 @@ ENDM .set cfa_current_offset, cfa_current_offset - \size .endm -.macro .pushframe code - .if (\code == 0) - .cfi_adjust_cfa_offset 0x28 - .set cfa_current_offset, cfa_current_offset - 0x28 - .else +code = 1 +.macro .pushframe param=0 + .if (\param) .cfi_adjust_cfa_offset 0x30 .set cfa_current_offset, cfa_current_offset - 0x30 + .else + .cfi_adjust_cfa_offset 0x28 + .set cfa_current_offset, cfa_current_offset - 0x28 .endif .endm From bfd0e180c35a19624755798600be991fa00c69a5 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 30 Jan 2010 03:11:39 +0000 Subject: [PATCH 073/121] use .altmacro for gas and hack the UNIMPLEMENTED macro svn path=/branches/ros-amd64-bringup/; revision=45335 --- reactos/include/reactos/asm.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/reactos/include/reactos/asm.h b/reactos/include/reactos/asm.h index 46e1e5c94cb..a3da3677b57 100644 --- a/reactos/include/reactos/asm.h +++ b/reactos/include/reactos/asm.h @@ -52,6 +52,8 @@ ENDM .intel_syntax noprefix .code64 +.altmacro + /* Hex numbers need to be in 0x1AB format */ #define HEX(x) 0x##x @@ -138,9 +140,11 @@ code = 1 .macro .endprolog .endm -.macro UNIMPLEMENTED2 file, line, func +// Note the file1. This is a hack, as "\file" doesn't work with __FILE__, when +// .altmacro is specified. +.macro UNIMPLEMENTED2 file1, line, func + jmp 3f - .equ expr, 12 1: .asciz "\func" 2: .asciz "\file" 3: From 752c8aead96c5d248d0a436a2eeaf1768c05828a Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 30 Jan 2010 03:12:26 +0000 Subject: [PATCH 074/121] trap.S is now fully MASM/ML compatible svn path=/branches/ros-amd64-bringup/; revision=45336 --- reactos/ntoskrnl/ke/amd64/trap.S | 83 ++++++++++++++++---------------- 1 file changed, 42 insertions(+), 41 deletions(-) diff --git a/reactos/ntoskrnl/ke/amd64/trap.S b/reactos/ntoskrnl/ke/amd64/trap.S index c2f82a9fea6..87bef6ff862 100644 --- a/reactos/ntoskrnl/ke/amd64/trap.S +++ b/reactos/ntoskrnl/ke/amd64/trap.S @@ -11,7 +11,7 @@ #include EXTERN _KiDispatchException:PROC -EXTERN _FrLdrDbgPrint:PROC +EXTERN _FrLdrDbgPrint:DWORD EXTERN _KeBugCheckWithTf:PROC EXTERN _MmAccessFault:PROC @@ -45,16 +45,16 @@ _MsgTrapInfo: .ascii "Trap: %s at %p\n\0" MACRO(TRAPINFO, func) +LOCAL label1, label2 #if 0 - jmp 2f - .equ expr, 12 -1: .asciz "\func" -2: + jmp label2 +label1: .asciz "\func" +label2: sub rsp, 32 lea rcx, RIP(_MsgTrapInfo) lea rdx, 1b[rip] mov r8, [rbp + KTRAP_FRAME_Rip] - call _FrLdrDbgPrint[rip] + call qword ptr RIP(_FrLdrDbgPrint) add rsp, 32 #endif ENDM @@ -86,6 +86,7 @@ ENDM * ENTER_TRAP_FRAME - Allocate SIZE_KTRAP_FRAME and save registers to it */ MACRO(ENTER_TRAP_FRAME, Flags) +LOCAL dont_swap SIZE_INITIAL_FRAME = 7 * 8 SIZE_TRAP_FRAME_ALLOC = SIZE_KTRAP_FRAME - SIZE_INITIAL_FRAME TRAPFLAGS = VAL(Flags) @@ -145,9 +146,9 @@ endif mov ax, [rbp + KTRAP_FRAME_SegCs] and al, 1 mov [rbp + KTRAP_FRAME_PreviousMode], al - jz 1f + jz dont_swap swapgs -1: +dont_swap: /* Save previous irql */ mov rax, cr8 @@ -189,7 +190,7 @@ ENDM * LEAVE_TRAP_FRAME - Restore registers and free stack space */ MACRO(LEAVE_TRAP_FRAME) - +LOCAL dont_swap_back if (TRAPFLAGS AND TRAPFLAG_SEGMENTS) /* Restore segment selectors */ mov ax, [rbp + KTRAP_FRAME_SegDs] @@ -201,9 +202,9 @@ if (TRAPFLAGS AND TRAPFLAG_SEGMENTS) endif test byte ptr [rbp + KTRAP_FRAME_PreviousMode], 1 - jz 1f + jz dont_swap_back swapgs -1: +dont_swap_back: if (TRAPFLAGS AND TRAPFLAG_NONVOLATILES) /* Restore non-volatile registers */ @@ -330,7 +331,7 @@ _InternalDispatchException: PUBLIC _KiDivideErrorFault .PROC _KiDivideErrorFault - .pushframe 0 + .pushframe /* Push pseudo error code */ push 0 .allocstack 8 @@ -343,7 +344,7 @@ PUBLIC _KiDivideErrorFault PUBLIC _KiDebugTrapOrFault .PROC _KiDebugTrapOrFault - .pushframe 0 + .pushframe /* Push pseudo error code */ push 0 .allocstack 8 @@ -377,7 +378,7 @@ KiDebugTrapOrFaultKMode: PUBLIC _KiNmiInterrupt .PROC _KiNmiInterrupt - .pushframe 0 + .pushframe /* Push pseudo error code */ push 0 .allocstack 8 @@ -390,7 +391,7 @@ PUBLIC _KiNmiInterrupt PUBLIC _KiBreakpointTrap .PROC _KiBreakpointTrap - .pushframe 0 + .pushframe /* Push pseudo error code */ push 0 .allocstack 8 @@ -402,7 +403,7 @@ PUBLIC _KiBreakpointTrap // lea rcx, RIP(_MsgBreakpointTrap) // mov rdx, rsp -// call RIP(_FrLdrDbgPrint) +// call qword ptr RIP(_FrLdrDbgPrint) /* Dispatch the exception */ mov eax, STATUS_BREAKPOINT @@ -419,7 +420,7 @@ PUBLIC _KiBreakpointTrap PUBLIC _KiOverflowTrap .PROC _KiOverflowTrap - .pushframe 0 + .pushframe /* Push pseudo error code */ push 0 .allocstack 8 @@ -431,7 +432,7 @@ PUBLIC _KiOverflowTrap PUBLIC _KiBoundFault .PROC _KiBoundFault - .pushframe 0 + .pushframe /* Push pseudo error code */ push 0 .allocstack 8 @@ -450,7 +451,7 @@ PUBLIC _KiBoundFault PUBLIC _KiInvalidOpcodeFault .PROC _KiInvalidOpcodeFault - .pushframe 0 + .pushframe /* Push pseudo error code */ push 0 .allocstack 8 @@ -464,7 +465,7 @@ PUBLIC _KiInvalidOpcodeFault mov rdx, [rbp + KTRAP_FRAME_Rip] lea rcx, RIP(_MsgInvalidOpcodeFault) - call RIP(_FrLdrDbgPrint) + call qword ptr RIP(_FrLdrDbgPrint) jmp $ /* Return */ @@ -474,7 +475,7 @@ PUBLIC _KiInvalidOpcodeFault PUBLIC _KiNpxNotAvailableFault .PROC _KiNpxNotAvailableFault - .pushframe 0 + .pushframe /* Push pseudo error code */ push 0 .allocstack 8 @@ -487,7 +488,7 @@ PUBLIC _KiNpxNotAvailableFault PUBLIC _KiDoubleFaultAbort .PROC _KiDoubleFaultAbort - .pushframe 0 + .pushframe /* Push pseudo error code */ push 0 .allocstack 8 @@ -498,7 +499,7 @@ PUBLIC _KiDoubleFaultAbort lea rcx, RIP(_MsgDoubleFault) mov rdx, [rbp + KTRAP_FRAME_FaultAddress] mov r8, rbp - call RIP(_FrLdrDbgPrint) + call qword ptr RIP(_FrLdrDbgPrint) /* Bugcheck code UNEXPECTED_KERNEL_MODE_TRAP */ mov rcx, HEX(0000007F) @@ -516,7 +517,7 @@ PUBLIC _KiDoubleFaultAbort PUBLIC _KiNpxSegmentOverrunAbort .PROC _KiNpxSegmentOverrunAbort - .pushframe 0 + .pushframe /* Push pseudo error code */ push 0 .allocstack 8 @@ -529,7 +530,7 @@ PUBLIC _KiNpxSegmentOverrunAbort PUBLIC _KiInvalidTssFault .PROC _KiInvalidTssFault - .pushframe 1 + .pushframe code /* We have an error code */ .endprolog @@ -540,7 +541,7 @@ PUBLIC _KiInvalidTssFault PUBLIC _KiSegmentNotPresentFault .PROC _KiSegmentNotPresentFault - .pushframe 1 + .pushframe /* We have an error code */ .endprolog @@ -551,7 +552,7 @@ PUBLIC _KiSegmentNotPresentFault PUBLIC _KiStackFault .PROC _KiStackFault - .pushframe 1 + .pushframe code /* We have an error code */ .endprolog @@ -562,7 +563,7 @@ PUBLIC _KiStackFault PUBLIC _KiGeneralProtectionFault .PROC _KiGeneralProtectionFault - .pushframe 1 + .pushframe code /* We have an error code */ .endprolog @@ -573,7 +574,7 @@ PUBLIC _KiGeneralProtectionFault mov rdx, [rbp + KTRAP_FRAME_Rip] lea rcx, RIP(_MsgGeneralProtFault) - call RIP(_FrLdrDbgPrint) + call qword ptr RIP(_FrLdrDbgPrint) /* Check if this was from user-mode */ cmp byte ptr [rbp + KTRAP_FRAME_PreviousMode], KernelMode @@ -675,7 +676,7 @@ KiGpfExit: PUBLIC _KiPageFault .PROC _KiPageFault - .pushframe 1 + .pushframe code /* We have an error code */ .endprolog @@ -688,7 +689,7 @@ PUBLIC _KiPageFault mov rdx, [rbp + KTRAP_FRAME_ErrorCode] mov r8, [rbp + KTRAP_FRAME_Rip] mov r9, [rbp + KTRAP_FRAME_FaultAddress] - call RIP(_FrLdrDbgPrint) + call qword ptr RIP(_FrLdrDbgPrint) #endif /* Save page fault address */ @@ -745,7 +746,7 @@ PageFaultReturn: PUBLIC _KiFloatingErrorFault .PROC _KiFloatingErrorFault - .pushframe 0 + .pushframe /* Push pseudo error code */ push 0 .allocstack 8 @@ -758,7 +759,7 @@ PUBLIC _KiFloatingErrorFault PUBLIC _KiAlignmentFault .PROC _KiAlignmentFault - .pushframe 1 + .pushframe code /* We have an error code */ .endprolog @@ -769,7 +770,7 @@ PUBLIC _KiAlignmentFault PUBLIC _KiMcheckAbort .PROC _KiMcheckAbort - .pushframe 0 + .pushframe /* Push pseudo error code */ push 0 .allocstack 8 @@ -782,7 +783,7 @@ PUBLIC _KiMcheckAbort PUBLIC _KiXmmException .PROC _KiXmmException - .pushframe 0 + .pushframe /* Push pseudo error code */ push 0 .allocstack 8 @@ -795,7 +796,7 @@ PUBLIC _KiXmmException PUBLIC _KiApcInterrupt .PROC _KiApcInterrupt - .pushframe 1 + .pushframe code .endprolog UNIMPLEMENTED KiApcInterrupt @@ -805,7 +806,7 @@ PUBLIC _KiApcInterrupt PUBLIC _KiRaiseAssertion .PROC _KiRaiseAssertion - .pushframe 1 + .pushframe code .endprolog UNIMPLEMENTED KiRaiseAssertion @@ -815,7 +816,7 @@ PUBLIC _KiRaiseAssertion PUBLIC _KiDebugServiceTrap .PROC _KiDebugServiceTrap - .pushframe 0 + .pushframe /* Push pseudo error code */ push 0 .allocstack 8 @@ -842,7 +843,7 @@ PUBLIC _KiDebugServiceTrap PUBLIC _KiDpcInterrupt .PROC _KiDpcInterrupt - .pushframe 1 + .pushframe code .endprolog UNIMPLEMENTED KiDpcInterrupt @@ -852,7 +853,7 @@ PUBLIC _KiDpcInterrupt PUBLIC _KiIpiInterrupt .PROC _KiIpiInterrupt - .pushframe 1 + .pushframe code .endprolog UNIMPLEMENTED KiIpiInterrupt @@ -862,7 +863,7 @@ PUBLIC _KiIpiInterrupt PUBLIC _KiUnexpectedInterrupt .PROC _KiUnexpectedInterrupt - .pushframe 0 + .pushframe .endprolog /* The error code is the vector */ From 2306a5788f4135db612e165b9a9464ad6b5837a8 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 30 Jan 2010 03:17:11 +0000 Subject: [PATCH 075/121] remove the RIP() hack, instead use a constant rip=0 for MASM/ML svn path=/branches/ros-amd64-bringup/; revision=45337 --- reactos/include/reactos/asm.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/reactos/include/reactos/asm.h b/reactos/include/reactos/asm.h index a3da3677b57..a8a252e5421 100644 --- a/reactos/include/reactos/asm.h +++ b/reactos/include/reactos/asm.h @@ -18,7 +18,7 @@ OPTION DOTNAME #define VAL(x) x /* MASM/ML doesn't want explicit [rip] addressing */ -#define RIP(address) [address] +rip = 0 /* Due to MASM's reverse syntax, we are forced to use a precompiler macro */ #define MACRO(name, ...) name MACRO __VA_ARGS__ @@ -60,9 +60,6 @@ ENDM /* Macro values need to be marked */ #define VAL(x) \x -/* GAS needs explicit [rip] addressing */ -#define RIP(address) address##[rip] - /* Due to MASM's reverse syntax, we are forced to use a precompiler macro */ #define MACRO(...) .macro __VA_ARGS__ #define ENDM .endm From 49da6c12d89fd18640f3208951628cdb3e8a677b Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 30 Jan 2010 03:18:20 +0000 Subject: [PATCH 076/121] and the same for trap.S svn path=/branches/ros-amd64-bringup/; revision=45338 --- reactos/ntoskrnl/ke/amd64/trap.S | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/reactos/ntoskrnl/ke/amd64/trap.S b/reactos/ntoskrnl/ke/amd64/trap.S index 87bef6ff862..801423a74b7 100644 --- a/reactos/ntoskrnl/ke/amd64/trap.S +++ b/reactos/ntoskrnl/ke/amd64/trap.S @@ -51,10 +51,10 @@ LOCAL label1, label2 label1: .asciz "\func" label2: sub rsp, 32 - lea rcx, RIP(_MsgTrapInfo) + lea rcx, _MsgTrapInfo[rip] lea rdx, 1b[rip] mov r8, [rbp + KTRAP_FRAME_Rip] - call qword ptr RIP(_FrLdrDbgPrint) + call qword ptr _FrLdrDbgPrint[rip] add rsp, 32 #endif ENDM @@ -401,9 +401,9 @@ PUBLIC _KiBreakpointTrap TRAPINFO KiBreakpointTrap -// lea rcx, RIP(_MsgBreakpointTrap) +// lea rcx, _MsgBreakpointTrap[rip] // mov rdx, rsp -// call qword ptr RIP(_FrLdrDbgPrint) +// call qword ptr _FrLdrDbgPrint[rip] /* Dispatch the exception */ mov eax, STATUS_BREAKPOINT @@ -464,8 +464,8 @@ PUBLIC _KiInvalidOpcodeFault // DISPATCH_EXCEPTION STATUS_BREAKPOINT, 3, 0, 0, 0 mov rdx, [rbp + KTRAP_FRAME_Rip] - lea rcx, RIP(_MsgInvalidOpcodeFault) - call qword ptr RIP(_FrLdrDbgPrint) + lea rcx, _MsgInvalidOpcodeFault[rip] + call qword ptr _FrLdrDbgPrint[rip] jmp $ /* Return */ @@ -496,10 +496,10 @@ PUBLIC _KiDoubleFaultAbort ENTER_TRAP_FRAME TRAPFLAG_ALL - lea rcx, RIP(_MsgDoubleFault) + lea rcx, _MsgDoubleFault[rip] mov rdx, [rbp + KTRAP_FRAME_FaultAddress] mov r8, rbp - call qword ptr RIP(_FrLdrDbgPrint) + call qword ptr _FrLdrDbgPrint[rip] /* Bugcheck code UNEXPECTED_KERNEL_MODE_TRAP */ mov rcx, HEX(0000007F) @@ -573,8 +573,8 @@ PUBLIC _KiGeneralProtectionFault TRAPINFO KiGeneralProtectionFault mov rdx, [rbp + KTRAP_FRAME_Rip] - lea rcx, RIP(_MsgGeneralProtFault) - call qword ptr RIP(_FrLdrDbgPrint) + lea rcx, _MsgGeneralProtFault[rip] + call qword ptr _FrLdrDbgPrint[rip] /* Check if this was from user-mode */ cmp byte ptr [rbp + KTRAP_FRAME_PreviousMode], KernelMode @@ -685,11 +685,11 @@ PUBLIC _KiPageFault TRAPINFO KiPageFault #if 0 - lea rcx, RIP(_MsgPageFault) + lea rcx, _MsgPageFault[rip] mov rdx, [rbp + KTRAP_FRAME_ErrorCode] mov r8, [rbp + KTRAP_FRAME_Rip] mov r9, [rbp + KTRAP_FRAME_FaultAddress] - call qword ptr RIP(_FrLdrDbgPrint) + call qword ptr _FrLdrDbgPrint[rip] #endif /* Save page fault address */ From 086a6f014095df100b8b5cad2f67db3347c4481c Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 30 Jan 2010 04:27:17 +0000 Subject: [PATCH 077/121] add else svn path=/branches/ros-amd64-bringup/; revision=45340 --- reactos/include/reactos/asm.h | 1 + 1 file changed, 1 insertion(+) diff --git a/reactos/include/reactos/asm.h b/reactos/include/reactos/asm.h index a8a252e5421..ffb56529749 100644 --- a/reactos/include/reactos/asm.h +++ b/reactos/include/reactos/asm.h @@ -159,5 +159,6 @@ code = 1 conditionals. We therefore use "if", too. .if shouldn't be used at all */ #define if .if #define endif .endif +#define else .else #endif From f155d17a5aa78e4a20f38bda9ec633bcc5f4d9d1 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 30 Jan 2010 13:21:28 +0000 Subject: [PATCH 078/121] Add exception codes for asm svn path=/branches/ros-amd64-bringup/; revision=45343 --- reactos/include/ndk/amd64/asm.h | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/reactos/include/ndk/amd64/asm.h b/reactos/include/ndk/amd64/asm.h index cb90bfe067a..9428245ca38 100644 --- a/reactos/include/ndk/amd64/asm.h +++ b/reactos/include/ndk/amd64/asm.h @@ -309,7 +309,27 @@ Author: #define EFLAGS_USER_SANITIZE 0x3F4DD7 // -// NTSTATUS and Bugcheck Codes +// Exception codes +// +#define EXCEPTION_DIVIDED_BY_ZERO 0x00000 +#define EXCEPTION_DEBUG 0x00001 +#define EXCEPTION_NMI 0x00002 +#define EXCEPTION_INT3 0x00003 +#define EXCEPTION_BOUND_CHECK 0x00005 +#define EXCEPTION_INVALID_OPCODE 0x00006 +#define EXCEPTION_NPX_NOT_AVAILABLE 0x00007 +#define EXCEPTION_DOUBLE_FAULT 0x00008 +#define EXCEPTION_NPX_OVERRUN 0x00009 +#define EXCEPTION_INVALID_TSS 0x0000A +#define EXCEPTION_SEGMENT_NOT_PRESENT 0x0000B +#define EXCEPTION_STACK_FAULT 0x0000C +#define EXCEPTION_GP_FAULT 0x0000D +#define EXCEPTION_RESERVED_TRAP 0x0000F +#define EXCEPTION_NPX_ERROR 0x00010 +#define EXCEPTION_ALIGNMENT_CHECK 0x00011 + +// +// NTSTATUS values // #define STATUS_ACCESS_VIOLATION 0xC0000005 #define STATUS_IN_PAGE_ERROR 0xC0000006 @@ -336,6 +356,11 @@ Author: #define STATUS_FLOAT_UNDERFLOW 0xC0000093 #define STATUS_FLOAT_MULTIPLE_FAULTS 0xC00002B4 #define STATUS_FLOAT_MULTIPLE_TRAPS 0xC00002B5 +#define STATUS_ASSERTION_FAILURE 0xC0000420 + +// +// Bugcheck Codes +// #define APC_INDEX_MISMATCH 0x01 #define IRQL_NOT_GREATER_OR_EQUAL 0x09 #define IRQL_NOT_LESS_OR_EQUAL 0x0A From 34ef1bef800f193ebd98c304b8e3b1fce741c5e5 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 30 Jan 2010 13:35:46 +0000 Subject: [PATCH 079/121] [NTOS] - Implement KiSystemFatalException, stubplement KiGeneralProtectionFaultHandler and KiXmmExceptionHandler, KiNpxNotAvailableFaultHandler in C - Implement KiDivideErrorFault, KiOverflowTrap, KiBoundFault, KiInvalidOpcodeFault, KiNpxNotAvailableFault, KiNpxSegmentOverrunAbort, KiInvalidTssFault, KiSegmentNotPresentFault, KiStackFault, KiAlignmentFault, KiMcheckAbort, KiXmmException, KiRaiseAssertion in assembler - Modify rsp instead of pushing a pseudo error code - Move all unwind ops into ENTER_TRAP_FRAME macro svn path=/branches/ros-amd64-bringup/; revision=45344 --- reactos/ntoskrnl/ke/amd64/except.c | 96 ++++++ reactos/ntoskrnl/ke/amd64/trap.S | 458 +++++++++++++++-------------- 2 files changed, 330 insertions(+), 224 deletions(-) diff --git a/reactos/ntoskrnl/ke/amd64/except.c b/reactos/ntoskrnl/ke/amd64/except.c index ba5a35491aa..86abc32ad8d 100644 --- a/reactos/ntoskrnl/ke/amd64/except.c +++ b/reactos/ntoskrnl/ke/amd64/except.c @@ -202,3 +202,99 @@ KeRaiseUserException(IN NTSTATUS ExceptionCode) return STATUS_UNSUCCESSFUL; } + +VOID +DECLSPEC_NORETURN +KiSystemFatalException(IN ULONG ExceptionCode, + IN PKTRAP_FRAME TrapFrame) +{ + /* Bugcheck the system */ + KeBugCheckWithTf(UNEXPECTED_KERNEL_MODE_TRAP, + ExceptionCode, + 0, + 0, + 0, + TrapFrame); +} + +NTSTATUS +NTAPI +KiNpxNotAvailableFaultHandler( + IN PKTRAP_FRAME TrapFrame) +{ + UNIMPLEMENTED; + KeBugCheckWithTf(TRAP_CAUSE_UNKNOWN, 13, 0, 0, 1, TrapFrame); + return -1; +} + + +NTSTATUS +NTAPI +KiGeneralProtectionFaultHandler( + IN PKTRAP_FRAME TrapFrame) +{ + PUCHAR Instructions; + + /* Check for user-mode GPF */ + if (TrapFrame->SegCs & 3) + { + UNIMPLEMENTED; + ASSERT(FALSE); + } + + /* Check for nested exception */ + if ((TrapFrame->Rip >= (ULONG64)KiGeneralProtectionFaultHandler) && + (TrapFrame->Rip < (ULONG64)KiGeneralProtectionFaultHandler)) + { + /* Not implemented */ + UNIMPLEMENTED; + ASSERT(FALSE); + } + + /* Get Instruction Pointer */ + Instructions = (PUCHAR)TrapFrame->Rip; + + /* Check for IRET */ + if (Instructions[0] == 0x48 && Instructions[1] == 0xCF) + { + /* Not implemented */ + UNIMPLEMENTED; + ASSERT(FALSE); + } + + /* Check for RDMSR/WRMSR */ + if ((Instructions[0] == 0xF) && // 2-byte opcode + (((Instructions[1] >> 8) == 0x30) || // RDMSR + ((Instructions[2] >> 8) == 0x32))) // WRMSR + { + /* Unknown CPU MSR, so raise an access violation */ + return STATUS_ACCESS_VIOLATION; + } + + /* Check for lazy segment load */ + if (TrapFrame->SegDs != (KGDT64_R0_DATA | RPL_MASK)) + { + /* Fix it */ + TrapFrame->SegDs = (KGDT64_R0_DATA | RPL_MASK); + return STATUS_SUCCESS; + } + else if (TrapFrame->SegEs != (KGDT64_R0_DATA | RPL_MASK)) + { + /* Fix it */ + TrapFrame->SegEs = (KGDT64_R0_DATA | RPL_MASK); + return STATUS_SUCCESS; + } + + ASSERT(FALSE); + return STATUS_UNSUCCESSFUL; +} + +NTSTATUS +NTAPI +KiXmmExceptionHandler( + IN PKTRAP_FRAME TrapFrame) +{ + UNIMPLEMENTED; + KeBugCheckWithTf(TRAP_CAUSE_UNKNOWN, 13, 0, 0, 1, TrapFrame); + return -1; +} diff --git a/reactos/ntoskrnl/ke/amd64/trap.S b/reactos/ntoskrnl/ke/amd64/trap.S index 801423a74b7..711b1769ebe 100644 --- a/reactos/ntoskrnl/ke/amd64/trap.S +++ b/reactos/ntoskrnl/ke/amd64/trap.S @@ -66,6 +66,7 @@ ENDM #define TRAPFLAG_XMM HEX(04) #define TRAPFLAG_SEGMENTS HEX(08) #define TRAPFLAG_DEBUG HEX(10) +#define TRAPFLAG_HAS_ERRORCODE HEX(100) #define TRAPFLAG_SYSTEMSERVICE (TRAPFLAG_VOLATILES|TRAPFLAG_DEBUG) #define TRAPFLAG_ALL HEX(ff) @@ -87,17 +88,26 @@ ENDM */ MACRO(ENTER_TRAP_FRAME, Flags) LOCAL dont_swap - SIZE_INITIAL_FRAME = 7 * 8 - SIZE_TRAP_FRAME_ALLOC = SIZE_KTRAP_FRAME - SIZE_INITIAL_FRAME + + /* Save the trap flags for this trap */ TRAPFLAGS = VAL(Flags) - /* Save rbp */ - push rbp - .pushreg rbp + /* Size of hardware trap frame */ +if (TRAPFLAGS AND TRAPFLAG_HAS_ERRORCODE) + .pushframe code + SIZE_INITIAL_FRAME = 6 * 8 +else + .pushframe + SIZE_INITIAL_FRAME = 5 * 8 +endif - /* Make room for a KTRAP_FRAME and function parameters */ - sub rsp, SIZE_TRAP_FRAME_ALLOC - .allocstack SIZE_TRAP_FRAME_ALLOC + /* Make room for a KTRAP_FRAME */ + sub rsp, (SIZE_KTRAP_FRAME - SIZE_INITIAL_FRAME) + .allocstack (SIZE_KTRAP_FRAME - SIZE_INITIAL_FRAME) + .endprolog + + /* Save rbp */ + mov [rsp + KTRAP_FRAME_Rbp], rbp /* Point rbp to the KTRAP_FRAME */ lea rbp, [rsp] @@ -237,8 +247,8 @@ endif /* Restore rbp */ mov rbp, [rbp + KTRAP_FRAME_Rbp] - /* Adjust stack pointer (plus one qword for rbp, one for error code) */ - add rsp, SIZE_TRAP_FRAME_ALLOC + HEX(10) + /* Adjust stack pointer */ + add rsp, KTRAP_FRAME_Rip ENDM @@ -260,7 +270,7 @@ REPEAT 256 ENDR // rbp = TrapFrame, eax = ExceptionCode, edx = NumParams, r9,r10,r11 = params -_InternalDispatchException: +.PROC _InternalDispatchException /* Allocate stack space for EXCEPTION_RECORD and KEXCEPTION_FRAME */ sub rsp, SIZE_EXCEPTION_RECORD + SIZE_KEXCEPTION_FRAME @@ -326,30 +336,36 @@ _InternalDispatchException: add rsp, SIZE_EXCEPTION_RECORD + SIZE_KEXCEPTION_FRAME ret +.ENDP _InternalDispatchException + /* SOFTWARE INTERRUPT SERVICES ***********************************************/ PUBLIC _KiDivideErrorFault .PROC _KiDivideErrorFault - .pushframe /* Push pseudo error code */ - push 0 - .allocstack 8 - .endprolog + ENTER_TRAP_FRAME TRAPFLAG_ALL - UNIMPLEMENTED KiDivideErrorFault + /* Enable interrupts */ + sti - jmp $ + /* Dispatch the exception */ + mov eax, STATUS_INTEGER_DIVIDE_BY_ZERO + mov edx, 0 + mov r9, 0 + mov r10, 0 + mov r11, 0 + call _InternalDispatchException + + /* Return */ + LEAVE_TRAP_FRAME + iretq .ENDP _KiDivideErrorFault + PUBLIC _KiDebugTrapOrFault .PROC _KiDebugTrapOrFault - .pushframe /* Push pseudo error code */ - push 0 - .allocstack 8 - .endprolog - ENTER_TRAP_FRAME TRAPFLAG_ALL TRAPINFO KiDebugTrapOrFault @@ -376,27 +392,25 @@ KiDebugTrapOrFaultKMode: iretq .ENDP _KiDebugTrapOrFault + PUBLIC _KiNmiInterrupt .PROC _KiNmiInterrupt - .pushframe /* Push pseudo error code */ - push 0 - .allocstack 8 - .endprolog + ENTER_TRAP_FRAME TRAPFLAG_ALL UNIMPLEMENTED KiNmiInterrupt jmp $ + + /* Return */ + LEAVE_TRAP_FRAME + iretq .ENDP _KiNmiInterrupt + PUBLIC _KiBreakpointTrap .PROC _KiBreakpointTrap - .pushframe /* Push pseudo error code */ - push 0 - .allocstack 8 - .endprolog - ENTER_TRAP_FRAME TRAPFLAG_ALL TRAPINFO KiBreakpointTrap @@ -418,82 +432,128 @@ PUBLIC _KiBreakpointTrap iretq .ENDP _KiBreakpointTrap + PUBLIC _KiOverflowTrap .PROC _KiOverflowTrap - .pushframe /* Push pseudo error code */ - push 0 - .allocstack 8 - .endprolog + ENTER_TRAP_FRAME TRAPFLAG_ALL - UNIMPLEMENTED KiOverflowTrap - jmp $ + /* Enable interrupts */ + sti + + /* Dispatch the exception */ + mov eax, STATUS_INTEGER_OVERFLOW + mov edx, 3 + mov r9, 0 + mov r10, 0 + mov r11, 0 + call _InternalDispatchException + + /* Return */ + LEAVE_TRAP_FRAME + iretq .ENDP _KiOverflowTrap + PUBLIC _KiBoundFault .PROC _KiBoundFault - .pushframe /* Push pseudo error code */ - push 0 - .allocstack 8 + ENTER_TRAP_FRAME TRAPFLAG_ALL - sub rsp, 32 - .allocstack 32 + /* Check if the frame was from kernelmode */ + test word ptr [rbp + KTRAP_FRAME_SegCs], 3 + jnz KiBoundFaltUserMode - mov [rsp + 8], rbx - .savereg rbx, 8 - .endprolog + /* Bugcheck */ + mov ecx, EXCEPTION_BOUND_CHECK + mov rdx, rbp + call _KiSystemFatalException - UNIMPLEMENTED KiBoundFault +KiBoundFaltUserMode: + /* Enable interrupts for user-mode */ + sti - jmp $ + /* Dispatch the exception */ + mov eax, STATUS_INTEGER_OVERFLOW + mov edx, 3 + mov r9, 0 + mov r10, 0 + mov r11, 0 + call _InternalDispatchException + + /* Return */ + LEAVE_TRAP_FRAME + iretq .ENDP _KiBoundFault + PUBLIC _KiInvalidOpcodeFault .PROC _KiInvalidOpcodeFault - .pushframe /* Push pseudo error code */ - push 0 - .allocstack 8 - .endprolog - ENTER_TRAP_FRAME TRAPFLAG_ALL TRAPINFO KiInvalidOpcodeFault -// DISPATCH_EXCEPTION STATUS_BREAKPOINT, 3, 0, 0, 0 - mov rdx, [rbp + KTRAP_FRAME_Rip] lea rcx, _MsgInvalidOpcodeFault[rip] call qword ptr _FrLdrDbgPrint[rip] - jmp $ + + /* Enable interrupts */ + sti + + /* Check if the frame was from kernelmode */ + test word ptr [rbp + KTRAP_FRAME_SegCs], 3 + jz KiInvalidOpcodeKernel + + // FIXME: handle STATUS_INVALID_LOCK_SEQUENCE + +KiInvalidOpcodeKernel: + /* Kernel mode fault */ + + /* Dispatch the exception */ + mov eax, STATUS_ILLEGAL_INSTRUCTION + mov edx, 3 + mov r9, 0 + mov r10, 0 + mov r11, 0 + call _InternalDispatchException /* Return */ LEAVE_TRAP_FRAME iretq .ENDP _KiInvalidOpcodeFault + PUBLIC _KiNpxNotAvailableFault .PROC _KiNpxNotAvailableFault - .pushframe /* Push pseudo error code */ - push 0 - .allocstack 8 - .endprolog + ENTER_TRAP_FRAME TRAPFLAG_ALL - UNIMPLEMENTED KiNpxNotAvailableFault + /* Call the C handler */ + mov rcx, rbp + call _KiNpxNotAvailableFaultHandler - jmp $ + /* Check the return status code */ + test eax, eax + jz KiNpxNotAvailableFaultExit + + /* Dispatch the exception */ + mov edx, 3 + mov r9, 0 + mov r10, 0 + mov r11, 0 + call _InternalDispatchException + +KiNpxNotAvailableFaultExit: + /* Return */ + LEAVE_TRAP_FRAME + iretq .ENDP _KiNpxNotAvailableFault + PUBLIC _KiDoubleFaultAbort .PROC _KiDoubleFaultAbort - .pushframe /* Push pseudo error code */ - push 0 - .allocstack 8 - .endprolog - ENTER_TRAP_FRAME TRAPFLAG_ALL lea rcx, _MsgDoubleFault[rip] @@ -501,119 +561,94 @@ PUBLIC _KiDoubleFaultAbort mov r8, rbp call qword ptr _FrLdrDbgPrint[rip] - /* Bugcheck code UNEXPECTED_KERNEL_MODE_TRAP */ - mov rcx, HEX(0000007F) - - /* Set double fault parameters */ - mov rdx, 8 // EXCEPTION_DOUBLE_FAULT - mov r8, 0 - mov r9, 0 - mov [rbp + KTRAP_FRAME_P5], rbp // trap frame (HACKY) - push 0 - call _KeBugCheckWithTf + /* Bugcheck */ + mov ecx, 8 // EXCEPTION_DOUBLE_FAULT + mov rdx, rbp + call _KiSystemFatalException jmp $ .ENDP _KiDoubleFaultAbort + PUBLIC _KiNpxSegmentOverrunAbort .PROC _KiNpxSegmentOverrunAbort - .pushframe /* Push pseudo error code */ - push 0 - .allocstack 8 - .endprolog + ENTER_TRAP_FRAME TRAPFLAG_ALL - UNIMPLEMENTED KiNpxSegmentOverrunAbort + /* Bugcheck */ + mov ecx, EXCEPTION_NPX_OVERRUN + mov rdx, rbp + call _KiSystemFatalException jmp $ .ENDP _KiNpxSegmentOverrunAbort + PUBLIC _KiInvalidTssFault .PROC _KiInvalidTssFault - .pushframe code /* We have an error code */ - .endprolog + ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE | TRAPFLAG_ALL) - UNIMPLEMENTED KiInvalidTssFault + /* Bugcheck */ + mov ecx, EXCEPTION_INVALID_TSS + mov rdx, rbp + call _KiSystemFatalException jmp $ .ENDP _KiInvalidTssFault + PUBLIC _KiSegmentNotPresentFault .PROC _KiSegmentNotPresentFault - .pushframe /* We have an error code */ - .endprolog + ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE | TRAPFLAG_ALL) - UNIMPLEMENTED KiSegmentNotPresentFault + /* Bugcheck */ + mov ecx, EXCEPTION_SEGMENT_NOT_PRESENT + mov rdx, rbp + call _KiSystemFatalException jmp $ .ENDP _KiSegmentNotPresentFault + PUBLIC _KiStackFault .PROC _KiStackFault - .pushframe code /* We have an error code */ - .endprolog + ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE | TRAPFLAG_ALL) - UNIMPLEMENTED KiStackFault + /* Bugcheck */ + mov ecx, EXCEPTION_STACK_FAULT + mov rdx, rbp + call _KiSystemFatalException jmp $ .ENDP _KiStackFault + PUBLIC _KiGeneralProtectionFault .PROC _KiGeneralProtectionFault - .pushframe code /* We have an error code */ - .endprolog - - cli - ENTER_TRAP_FRAME TRAPFLAG_ALL + ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE | TRAPFLAG_ALL) TRAPINFO KiGeneralProtectionFault - mov rdx, [rbp + KTRAP_FRAME_Rip] lea rcx, _MsgGeneralProtFault[rip] call qword ptr _FrLdrDbgPrint[rip] - /* Check if this was from user-mode */ - cmp byte ptr [rbp + KTRAP_FRAME_PreviousMode], KernelMode - jnz KiGpfUserMode + /* Call the C handler */ + call _KiGeneralProtectionFaultHandler - /* Get instruction */ - mov rax, [rbp + KTRAP_FRAME_Rip] - mov rax, [rax] + /* Check for success */ + test eax, eax + jge KiGpfExit - /* Check for MSR failure */ - cmp al, HEX(0F) - jz KiGpfMsr - - /* Check for IRET */ - cmp ax, HEX(0CF48) - je KiGpfIret - - /* Check for pop ds/es/fs/gs */ - xor edx, edx - cmp al, HEX(1F) - jz KiGpfPopSegDs - cmp al, HEX(07) - jz KiGpfPopSegEs - cmp ax, HEX(0A10F) - jz KiGpfPopSegFs - cmp ax, HEX(0A90F) - jz KiGpfPopSegGs - - - mov dx, HEX(002B) // KGDT64_R3_DATA | RPL_MASK - cmp [rbp + KTRAP_FRAME_SegDs], dx - jne KiGpfPopSegDs - cmp [rbp + KTRAP_FRAME_SegEs], dx - jne KiGpfPopSegEs - cmp [rbp + KTRAP_FRAME_SegGs], dx - jne KiGpfPopSegGs - mov dx, HEX(0053) // KGDT64_R3_CMTEB | RPL_MASK - cmp [rbp + KTRAP_FRAME_SegFs], dx - jne KiGpfPopSegFs + /* Dispatch the exception */ + mov edx, 3 + mov r9, 0 + mov r10, 0 + mov r11, 0 + call _InternalDispatchException KiGpfFatal: @@ -626,61 +661,17 @@ KiGpfFatal: mov [rsp + KTRAP_FRAME_P5+8], rbp // trap frame call _KeBugCheckWithTf - -KiGpfPopSegDs: - mov [rbp + KTRAP_FRAME_SegDs], dx - jmp KiGpfPopSeg - -KiGpfPopSegEs: - mov [rbp + KTRAP_FRAME_SegEs], dx - jmp KiGpfPopSeg - -KiGpfPopSegFs: - mov [rbp + KTRAP_FRAME_SegFs], dx - jmp KiGpfPopSeg - -KiGpfPopSegGs: - mov [rbp + KTRAP_FRAME_SegGs], dx - jmp KiGpfPopSeg - -KiGpfPopSeg: - jmp KiGpfExit - -KiGpfIret: - /* Get error code */ - mov ax, [rbp + KTRAP_FRAME_ErrorCode] -// and ax, ~RPL_MASK - -KiGpfMsr: - - jmp KiGpfFatal - - -KiGpfUserMode: - - /* Dispatch the exception */ - mov eax, STATUS_ACCESS_VIOLATION - mov edx, 2 - mov r9, [rbp + KTRAP_FRAME_ErrorCode] - mov r10, 0 - mov r11, 0 - call _InternalDispatchException - KiGpfExit: - /* Return */ LEAVE_TRAP_FRAME iretq - .ENDP _KiGeneralProtectionFault + PUBLIC _KiPageFault .PROC _KiPageFault - .pushframe code /* We have an error code */ - .endprolog - - ENTER_TRAP_FRAME TRAPFLAG_ALL + ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE | TRAPFLAG_ALL) TRAPINFO KiPageFault @@ -740,88 +731,114 @@ SpecialCode: call _InternalDispatchException PageFaultReturn: - LEAVE_TRAP_FRAME; + LEAVE_TRAP_FRAME iretq .ENDP _KiPageFault + PUBLIC _KiFloatingErrorFault .PROC _KiFloatingErrorFault - .pushframe /* Push pseudo error code */ - push 0 - .allocstack 8 - .endprolog + ENTER_TRAP_FRAME TRAPFLAG_ALL UNIMPLEMENTED KiFloatingErrorFault jmp $ .ENDP _KiFloatingErrorFault + PUBLIC _KiAlignmentFault .PROC _KiAlignmentFault - .pushframe code /* We have an error code */ - .endprolog + ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE | TRAPFLAG_ALL) - UNIMPLEMENTED KiAlignmentFault + /* Enable interrupts */ + sti + + /* Bugcheck */ + mov ecx, EXCEPTION_ALIGNMENT_CHECK + mov rdx, rbp + call _KiSystemFatalException jmp $ .ENDP _KiAlignmentFault + PUBLIC _KiMcheckAbort .PROC _KiMcheckAbort - .pushframe /* Push pseudo error code */ - push 0 - .allocstack 8 - .endprolog + ENTER_TRAP_FRAME TRAPFLAG_ALL - UNIMPLEMENTED KiMcheckAbort + /* Bugcheck */ + mov ecx, HEX(12) + mov rdx, rbp + call _KiSystemFatalException jmp $ .ENDP _KiMcheckAbort + PUBLIC _KiXmmException .PROC _KiXmmException - .pushframe /* Push pseudo error code */ - push 0 - .allocstack 8 - .endprolog + ENTER_TRAP_FRAME TRAPFLAG_ALL - UNIMPLEMENTED KiXmmException + /* Call the C handler */ + mov rcx, rbp + call _KiXmmExceptionHandler - jmp $ + /* Check for success */ + test eax, eax + jge KiXmmExit + + /* Dispatch the exception */ + mov edx, 3 + mov r9, 0 + mov r10, 0 + mov r11, 0 + call _InternalDispatchException + +KiXmmExit: + LEAVE_TRAP_FRAME + iretq .ENDP _KiXmmException + PUBLIC _KiApcInterrupt .PROC _KiApcInterrupt - .pushframe code - .endprolog + /* We have an error code */ + ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE | TRAPFLAG_ALL) UNIMPLEMENTED KiApcInterrupt jmp $ .ENDP _KiApcInterrupt + PUBLIC _KiRaiseAssertion .PROC _KiRaiseAssertion - .pushframe code - .endprolog + /* We have an error code */ + ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE | TRAPFLAG_ALL) - UNIMPLEMENTED KiRaiseAssertion + /* Decrement RIP to point to the INT2C instruction (2 bytes, not 1 like INT3) */ + sub qword ptr [rbp + KTRAP_FRAME_Rip], 2 + + /* Dispatch the exception */ + mov eax, STATUS_ASSERTION_FAILURE + mov edx, 0 + mov r9, 0 + mov r10, 0 + mov r11, 0 + call _InternalDispatchException - jmp $ + LEAVE_TRAP_FRAME + iretq .ENDP _KiRaiseAssertion + PUBLIC _KiDebugServiceTrap .PROC _KiDebugServiceTrap - .pushframe /* Push pseudo error code */ - push 0 - .allocstack 8 - .endprolog - ENTER_TRAP_FRAME TRAPFLAG_ALL TRAPINFO KiDebugServiceTrap @@ -841,36 +858,34 @@ PUBLIC _KiDebugServiceTrap iretq .ENDP _KiDebugServiceTrap + PUBLIC _KiDpcInterrupt .PROC _KiDpcInterrupt - .pushframe code - .endprolog + /* We have an error code */ + ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE | TRAPFLAG_ALL) UNIMPLEMENTED KiDpcInterrupt jmp $ .ENDP _KiDpcInterrupt + PUBLIC _KiIpiInterrupt .PROC _KiIpiInterrupt - .pushframe code - .endprolog + /* We have an error code */ + ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE | TRAPFLAG_ALL) UNIMPLEMENTED KiIpiInterrupt jmp $ .ENDP _KiIpiInterrupt + PUBLIC _KiUnexpectedInterrupt .PROC _KiUnexpectedInterrupt - .pushframe - .endprolog - /* The error code is the vector */ - cli - - ENTER_TRAP_FRAME TRAPFLAG_ALL + ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE | TRAPFLAG_ALL) /* Set bugcheck parameters */ mov ecx, TRAP_CAUSE_UNKNOWN @@ -881,14 +896,9 @@ PUBLIC _KiUnexpectedInterrupt mov [rbp + KTRAP_FRAME_P5 + 8], rbp // trap frame call _KeBugCheckWithTf + jmp $ .ENDP _KiUnexpectedInterrupt -PUBLIC _KiSystemFatalException -.PROC _KiSystemFatalException - .endprolog - -.ENDP _KiSystemFatalException - END From a5e16bf6a60e6fe47a136c567aaa4196f3b1001f Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 2 Feb 2010 23:48:03 +0000 Subject: [PATCH 080/121] Fix the UNIMPLEMENTED macro svn path=/branches/ros-amd64-bringup/; revision=45382 --- reactos/include/reactos/asm.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/reactos/include/reactos/asm.h b/reactos/include/reactos/asm.h index ffb56529749..daac7d26cea 100644 --- a/reactos/include/reactos/asm.h +++ b/reactos/include/reactos/asm.h @@ -137,13 +137,11 @@ code = 1 .macro .endprolog .endm -// Note the file1. This is a hack, as "\file" doesn't work with __FILE__, when -// .altmacro is specified. -.macro UNIMPLEMENTED2 file1, line, func +.macro UNIMPLEMENTED2 file, line, func jmp 3f -1: .asciz "\func" -2: .asciz "\file" +1: .asciz \func +2: .asciz \file 3: sub rsp, 0x20 lea rcx, _MsgUnimplemented[rip] From c8f9aa3f4bd2ec4cb6092f133662d71c15af991f Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Wed, 3 Feb 2010 00:04:27 +0000 Subject: [PATCH 081/121] [FREELDR] Fix KGDT64 names, initialize KGDT64_NULL and KGDT64_R3_CMCODE svn path=/branches/ros-amd64-bringup/; revision=45383 --- .../freeldr/freeldr/windows/amd64/wlmemory.c | 42 +++++++++++-------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/reactos/boot/freeldr/freeldr/windows/amd64/wlmemory.c b/reactos/boot/freeldr/freeldr/windows/amd64/wlmemory.c index 3e3288a682a..4256cf73fde 100644 --- a/reactos/boot/freeldr/freeldr/windows/amd64/wlmemory.c +++ b/reactos/boot/freeldr/freeldr/windows/amd64/wlmemory.c @@ -252,28 +252,36 @@ WinLdrSetupGdt(PVOID GdtBase, ULONG64 TssBase) PKGDTENTRY64 Entry; KDESCRIPTOR GdtDesc; - /* Setup KGDT_64_R0_CODE */ - Entry = KiGetGdtEntry(GdtBase, KGDT_64_R0_CODE); + /* Setup KGDT64_NULL */ + Entry = KiGetGdtEntry(GdtBase, KGDT64_NULL); + *(PULONG64)Entry = 0x0000000000000000ULL; + + /* Setup KGDT64_R0_CODE */ + Entry = KiGetGdtEntry(GdtBase, KGDT64_R0_CODE); *(PULONG64)Entry = 0x00209b0000000000ULL; - /* Setup KGDT_64_R0_SS */ - Entry = KiGetGdtEntry(GdtBase, KGDT_64_R0_SS); + /* Setup KGDT64_R0_DATA */ + Entry = KiGetGdtEntry(GdtBase, KGDT64_R0_DATA); *(PULONG64)Entry = 0x00cf93000000ffffULL; - /* Setup KGDT_64_DATA */ - Entry = KiGetGdtEntry(GdtBase, KGDT_64_DATA); + /* Setup KGDT64_R3_CMCODE */ + Entry = KiGetGdtEntry(GdtBase, KGDT64_R3_CMCODE); + *(PULONG64)Entry = 0x00cffb000000ffffULL; + + /* Setup KGDT64_R3_DATA */ + Entry = KiGetGdtEntry(GdtBase, KGDT64_R3_DATA); *(PULONG64)Entry = 0x00cff3000000ffffULL; - /* Setup KGDT_64_R3_CODE */ - Entry = KiGetGdtEntry(GdtBase, KGDT_64_R3_CODE); + /* Setup KGDT64_R3_CODE */ + Entry = KiGetGdtEntry(GdtBase, KGDT64_R3_CODE); *(PULONG64)Entry = 0x0020fb0000000000ULL; - /* Setup KGDT_32_R3_TEB */ - Entry = KiGetGdtEntry(GdtBase, KGDT_32_R3_TEB); + /* Setup KGDT64_R3_CMTEB */ + Entry = KiGetGdtEntry(GdtBase, KGDT64_R3_CMTEB); *(PULONG64)Entry = 0xff40f3fd50003c00ULL; /* Setup TSS entry */ - Entry = KiGetGdtEntry(GdtBase, KGDT_TSS); + Entry = KiGetGdtEntry(GdtBase, KGDT64_SYS_TSS); KiInitGdtEntry(Entry, TssBase, sizeof(KTSS), I386_TSS, 0); /* Setup GDT descriptor */ @@ -334,14 +342,14 @@ WinLdrSetProcessorContext(PVOID GdtIdt, IN ULONG64 Pcr, IN ULONG64 Tss) // __lldt(0); /* Load selectors for DS/ES/FS/GS/SS */ - Ke386SetDs(KGDT_64_DATA | RPL_MASK); // 0x2b - Ke386SetEs(KGDT_64_DATA | RPL_MASK); // 0x2b - Ke386SetFs(KGDT_32_R3_TEB | RPL_MASK); // 0x53 - Ke386SetGs(KGDT_64_DATA | RPL_MASK); // 0x2b - Ke386SetSs(KGDT_64_R0_SS); // 0x18 + Ke386SetDs(KGDT64_R3_DATA | RPL_MASK); // 0x2b + Ke386SetEs(KGDT64_R3_DATA | RPL_MASK); // 0x2b + Ke386SetFs(KGDT64_R3_CMTEB | RPL_MASK); // 0x53 + Ke386SetGs(KGDT64_R3_DATA | RPL_MASK); // 0x2b + Ke386SetSs(KGDT64_R0_DATA); // 0x18 /* Load TSR */ - __ltr(KGDT_TSS); + __ltr(KGDT64_SYS_TSS); DPRINTM(DPRINT_WINDOWS, "leave WinLdrSetProcessorContext\n"); } From 832d8290c866fd03d900ce427878d69a7c72a511 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Wed, 3 Feb 2010 00:18:24 +0000 Subject: [PATCH 082/121] [NTOS] - Fix KGDT64 names, - Add missing .ALLOCSTACK svn path=/branches/ros-amd64-bringup/; revision=45384 --- reactos/ntoskrnl/kd64/amd64/kdx64.c | 2 +- reactos/ntoskrnl/kd64/kddata.c | 14 ++++++------ reactos/ntoskrnl/ke/amd64/context.c | 32 ++++++++++++++-------------- reactos/ntoskrnl/ke/amd64/cpu.c | 4 ++-- reactos/ntoskrnl/ke/amd64/except.c | 33 ++++++++++++++--------------- reactos/ntoskrnl/ke/amd64/kiinit.c | 8 +++---- reactos/ntoskrnl/ke/amd64/trap.S | 1 + 7 files changed, 47 insertions(+), 47 deletions(-) diff --git a/reactos/ntoskrnl/kd64/amd64/kdx64.c b/reactos/ntoskrnl/kd64/amd64/kdx64.c index 9bb81b1b6ba..df27345bf92 100644 --- a/reactos/ntoskrnl/kd64/amd64/kdx64.c +++ b/reactos/ntoskrnl/kd64/amd64/kdx64.c @@ -85,7 +85,7 @@ KdpSetContextState(IN PDBGKD_ANY_WAIT_STATE_CHANGE WaitStateChange, /* Set Report Flags */ WaitStateChange->ControlReport.ReportFlags = REPORT_INCLUDES_SEGS; - if (WaitStateChange->ControlReport.SegCs == KGDT_64_R0_CODE) + if (WaitStateChange->ControlReport.SegCs == KGDT64_R0_CODE) { WaitStateChange->ControlReport.ReportFlags |= REPORT_STANDARD_CS; } diff --git a/reactos/ntoskrnl/kd64/kddata.c b/reactos/ntoskrnl/kd64/kddata.c index c5db36d4f23..edce7d7983f 100644 --- a/reactos/ntoskrnl/kd64/kddata.c +++ b/reactos/ntoskrnl/kd64/kddata.c @@ -526,14 +526,14 @@ KDDEBUGGER_DATA64 KdDebuggerDataBlock = // // AMD64 GDT/LDT/TSS constants // - KGDT_64_R0_CODE, - KGDT_64_DATA, - KGDT_64_DATA, - KGDT_64_R3_CODE, - KGDT_64_DATA, - KGDT_64_DATA, + KGDT64_R0_CODE, + KGDT64_R3_DATA, + KGDT64_R3_DATA, + KGDT64_R3_CODE, + KGDT64_R3_DATA, + KGDT64_R3_DATA, 0, - KGDT_TSS, + KGDT64_SYS_TSS, 0, 0, #else diff --git a/reactos/ntoskrnl/ke/amd64/context.c b/reactos/ntoskrnl/ke/amd64/context.c index 32758073fea..239a697e660 100644 --- a/reactos/ntoskrnl/ke/amd64/context.c +++ b/reactos/ntoskrnl/ke/amd64/context.c @@ -74,11 +74,11 @@ KeContextToTrapFrame(IN PCONTEXT Context, if ((Context->ContextFlags & CONTEXT_CONTROL) == CONTEXT_CONTROL) { /* Check if this was a Kernel Trap */ - if (Context->SegCs == KGDT_64_R0_CODE) + if (Context->SegCs == KGDT64_R0_CODE) { /* Set valid selectors */ - TrapFrame->SegCs = KGDT_64_R0_CODE; - TrapFrame->SegSs = KGDT_64_R0_SS; + TrapFrame->SegCs = KGDT64_R0_CODE; + TrapFrame->SegSs = KGDT64_R0_DATA; } else { @@ -97,13 +97,13 @@ KeContextToTrapFrame(IN PCONTEXT Context, if ((Context->ContextFlags & CONTEXT_SEGMENTS) == CONTEXT_SEGMENTS) { /* Check if this was a Kernel Trap */ - if (Context->SegCs == KGDT_64_R0_CODE) + if (Context->SegCs == KGDT64_R0_CODE) { /* Set valid selectors */ - TrapFrame->SegDs = KGDT_64_DATA | RPL_MASK; - TrapFrame->SegEs = KGDT_64_DATA | RPL_MASK; - TrapFrame->SegFs = KGDT_32_R3_TEB | RPL_MASK; - TrapFrame->SegGs = KGDT_64_DATA | RPL_MASK; + TrapFrame->SegDs = KGDT64_R3_DATA | RPL_MASK; + TrapFrame->SegEs = KGDT64_R3_DATA | RPL_MASK; + TrapFrame->SegFs = KGDT64_R3_CMTEB | RPL_MASK; + TrapFrame->SegGs = KGDT64_R3_DATA | RPL_MASK; } else { @@ -190,11 +190,11 @@ KeTrapFrameToContext(IN PKTRAP_FRAME TrapFrame, if ((Context->ContextFlags & CONTEXT_CONTROL) == CONTEXT_CONTROL) { /* Check if this was a Kernel Trap */ - if (TrapFrame->SegCs == KGDT_64_R0_CODE) + if (TrapFrame->SegCs == KGDT64_R0_CODE) { /* Set valid selectors */ - Context->SegCs = KGDT_64_R0_CODE; - Context->SegSs = KGDT_64_R0_SS; + Context->SegCs = KGDT64_R0_CODE; + Context->SegSs = KGDT64_R0_DATA; } else { @@ -213,13 +213,13 @@ KeTrapFrameToContext(IN PKTRAP_FRAME TrapFrame, if ((Context->ContextFlags & CONTEXT_SEGMENTS) == CONTEXT_SEGMENTS) { /* Check if this was a Kernel Trap */ - if (TrapFrame->SegCs == KGDT_64_R0_CODE) + if (TrapFrame->SegCs == KGDT64_R0_CODE) { /* Set valid selectors */ - Context->SegDs = KGDT_64_DATA | RPL_MASK; - Context->SegEs = KGDT_64_DATA | RPL_MASK; - Context->SegFs = KGDT_32_R3_TEB | RPL_MASK; - Context->SegGs = KGDT_64_DATA | RPL_MASK; + Context->SegDs = KGDT64_R3_DATA | RPL_MASK; + Context->SegEs = KGDT64_R3_DATA | RPL_MASK; + Context->SegFs = KGDT64_R3_CMTEB | RPL_MASK; + Context->SegGs = KGDT64_R3_DATA | RPL_MASK; } else { diff --git a/reactos/ntoskrnl/ke/amd64/cpu.c b/reactos/ntoskrnl/ke/amd64/cpu.c index aafd704455b..90a6b2c0641 100644 --- a/reactos/ntoskrnl/ke/amd64/cpu.c +++ b/reactos/ntoskrnl/ke/amd64/cpu.c @@ -379,7 +379,7 @@ KiInitializeTss(IN PKTSS64 Tss, PKGDTENTRY64 TssEntry; /* Get pointer to the GDT entry */ - TssEntry = KiGetGdtEntry(KeGetPcr()->GdtBase, KGDT_TSS); + TssEntry = KiGetGdtEntry(KeGetPcr()->GdtBase, KGDT64_SYS_TSS); /* Initialize the GDT entry */ KiInitGdtEntry(TssEntry, (ULONG64)Tss, sizeof(KTSS64), AMD64_TSS, 0); @@ -403,7 +403,7 @@ KiInitializeTss(IN PKTSS64 Tss, Tss->Ist[3] = (ULONG64)KiDoubleFaultStack; /* Load the task register */ - __ltr(KGDT_TSS); + __ltr(KGDT64_SYS_TSS); } VOID diff --git a/reactos/ntoskrnl/ke/amd64/except.c b/reactos/ntoskrnl/ke/amd64/except.c index 86abc32ad8d..97845595b43 100644 --- a/reactos/ntoskrnl/ke/amd64/except.c +++ b/reactos/ntoskrnl/ke/amd64/except.c @@ -50,10 +50,9 @@ KIDT_INIT KiInterruptInitTable[] = KIDTENTRY64 KiIdt[256]; KDESCRIPTOR KiIdtDescriptor = {{0}, sizeof(KiIdt) - 1, KiIdt}; + /* FUNCTIONS *****************************************************************/ - - VOID INIT_FUNCTION NTAPI @@ -80,7 +79,7 @@ KeInitExceptions(VOID) KiIdt[i].IstIndex = 0; } KiIdt[i].OffsetLow = Offset & 0xffff; - KiIdt[i].Selector = KGDT_64_R0_CODE; + KiIdt[i].Selector = KGDT64_R0_CODE; KiIdt[i].Type = 0x0e; KiIdt[i].Reserved0 = 0; KiIdt[i].Present = 1; @@ -242,6 +241,20 @@ KiGeneralProtectionFaultHandler( ASSERT(FALSE); } + /* Check for lazy segment load */ + if (TrapFrame->SegDs != (KGDT64_R3_DATA | RPL_MASK)) + { + /* Fix it */ + TrapFrame->SegDs = (KGDT64_R3_DATA | RPL_MASK); + return STATUS_SUCCESS; + } + else if (TrapFrame->SegEs != (KGDT64_R3_DATA | RPL_MASK)) + { + /* Fix it */ + TrapFrame->SegEs = (KGDT64_R3_DATA | RPL_MASK); + return STATUS_SUCCESS; + } + /* Check for nested exception */ if ((TrapFrame->Rip >= (ULONG64)KiGeneralProtectionFaultHandler) && (TrapFrame->Rip < (ULONG64)KiGeneralProtectionFaultHandler)) @@ -271,20 +284,6 @@ KiGeneralProtectionFaultHandler( return STATUS_ACCESS_VIOLATION; } - /* Check for lazy segment load */ - if (TrapFrame->SegDs != (KGDT64_R0_DATA | RPL_MASK)) - { - /* Fix it */ - TrapFrame->SegDs = (KGDT64_R0_DATA | RPL_MASK); - return STATUS_SUCCESS; - } - else if (TrapFrame->SegEs != (KGDT64_R0_DATA | RPL_MASK)) - { - /* Fix it */ - TrapFrame->SegEs = (KGDT64_R0_DATA | RPL_MASK); - return STATUS_SUCCESS; - } - ASSERT(FALSE); return STATUS_UNSUCCESSFUL; } diff --git a/reactos/ntoskrnl/ke/amd64/kiinit.c b/reactos/ntoskrnl/ke/amd64/kiinit.c index b80872aeed9..d35128f2c40 100644 --- a/reactos/ntoskrnl/ke/amd64/kiinit.c +++ b/reactos/ntoskrnl/ke/amd64/kiinit.c @@ -120,7 +120,7 @@ KiInitializePcr(IN PKIPCR Pcr, /* Get TSS Selector */ __str(&Tr); - ASSERT(Tr == KGDT_TSS); + ASSERT(Tr == KGDT64_SYS_TSS); /* Get TSS Entry */ TssEntry = KiGetGdtEntry(Pcr->GdtBase, Tr); @@ -390,9 +390,9 @@ KiSystemStartup(IN PLOADER_PARAMETER_BLOCK LoaderBlock) __writemsr(X86_MSR_KERNEL_GSBASE, (ULONG64)Pcr); /* Load Ring 3 selectors for DS/ES/FS */ - Ke386SetDs(KGDT_64_DATA | RPL_MASK); - Ke386SetEs(KGDT_64_DATA | RPL_MASK); - Ke386SetFs(KGDT_32_R3_TEB | RPL_MASK); + Ke386SetDs(KGDT64_R3_DATA | RPL_MASK); + Ke386SetEs(KGDT64_R3_DATA | RPL_MASK); + Ke386SetFs(KGDT64_R3_CMTEB | RPL_MASK); /* LDT is unused */ __lldt(0); diff --git a/reactos/ntoskrnl/ke/amd64/trap.S b/reactos/ntoskrnl/ke/amd64/trap.S index 711b1769ebe..76e3fe42b51 100644 --- a/reactos/ntoskrnl/ke/amd64/trap.S +++ b/reactos/ntoskrnl/ke/amd64/trap.S @@ -274,6 +274,7 @@ ENDR /* Allocate stack space for EXCEPTION_RECORD and KEXCEPTION_FRAME */ sub rsp, SIZE_EXCEPTION_RECORD + SIZE_KEXCEPTION_FRAME + .allocstack (SIZE_EXCEPTION_RECORD + SIZE_KEXCEPTION_FRAME) /* Set up EXCEPTION_RECORD */ lea rcx, [rsp + SIZE_KEXCEPTION_FRAME] From da4f165f23e02d7fb745c4e8c5f903fecc8b41c6 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Wed, 3 Feb 2010 16:50:34 +0000 Subject: [PATCH 083/121] inline -> __inline svn path=/branches/ros-amd64-bringup/; revision=45393 --- reactos/lib/rtl/amd64/unwind.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/lib/rtl/amd64/unwind.c b/reactos/lib/rtl/amd64/unwind.c index 914317f1717..d0a4f2e9c45 100644 --- a/reactos/lib/rtl/amd64/unwind.c +++ b/reactos/lib/rtl/amd64/unwind.c @@ -232,7 +232,7 @@ PopReg(PCONTEXT Context, BYTE Reg) */ BOOLEAN static -inline +__inline RtlpTryToUnwindEpilog( PCONTEXT Context, ULONG64 ImageBase, From 0efb2e9187046d4f59165480bb83b5e9e34da1d0 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Wed, 3 Feb 2010 16:57:14 +0000 Subject: [PATCH 084/121] Improve the UNIMPLEMENTED macro. Dedicated to aicom. svn path=/branches/ros-amd64-bringup/; revision=45394 --- reactos/include/reactos/asm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/include/reactos/asm.h b/reactos/include/reactos/asm.h index daac7d26cea..d0a911ec792 100644 --- a/reactos/include/reactos/asm.h +++ b/reactos/include/reactos/asm.h @@ -140,7 +140,7 @@ code = 1 .macro UNIMPLEMENTED2 file, line, func jmp 3f -1: .asciz \func +1: .asciz "\func" 2: .asciz \file 3: sub rsp, 0x20 From f495eb586acd8fd949fd4abe9647dc11cc448226 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Wed, 3 Feb 2010 18:47:30 +0000 Subject: [PATCH 085/121] Fix setjmp based on the new syntax svn path=/branches/ros-amd64-bringup/; revision=45397 --- reactos/lib/sdk/crt/setjmp/amd64/setjmp.s | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/reactos/lib/sdk/crt/setjmp/amd64/setjmp.s b/reactos/lib/sdk/crt/setjmp/amd64/setjmp.s index e9521ae6e15..800a0b152b5 100644 --- a/reactos/lib/sdk/crt/setjmp/amd64/setjmp.s +++ b/reactos/lib/sdk/crt/setjmp/amd64/setjmp.s @@ -8,10 +8,8 @@ /* INCLUDES ******************************************************************/ +#include #include -#include - -.intel_syntax noprefix #define JUMP_BUFFER_Frame 0x00 #define JUMP_BUFFER_Rbx 0x08 @@ -46,7 +44,8 @@ * Returns: 0 * Notes: Sets up the jmp_buf */ -.proc _setjmp +PUBLIC __setjmp +.proc __setjmp /* Load rsp as it was before the call into rax */ lea rax, [rsp + 8] /* Load return address into r8 */ @@ -74,7 +73,7 @@ movdqa [rcx + JUMP_BUFFER_Xmm15], xmm15 xor rax, rax ret -.endproc +.endp /* * int _setjmpex(jmp_buf _Buf,void *_Ctx); @@ -84,7 +83,8 @@ * Returns: 0 * Notes: Sets up the jmp_buf */ -.proc _setjmpex +PUBLIC __setjmpex +.proc __setjmpex /* Load rsp as it was before the call into rax */ lea rax, [rsp + 8] /* Load return address into r8 */ @@ -112,7 +112,7 @@ movdqa [rcx + JUMP_BUFFER_Xmm15], xmm15 xor rax, rax ret -.endproc +.endp /* @@ -123,7 +123,8 @@ * Returns: Doesn't return * Notes: Non-local goto */ -.proc longjmp +PUBLIC _longjmp +.proc _longjmp // FIXME: handle frame @@ -154,4 +155,4 @@ jnz 2f inc rax 2: jmp r8 -.endproc +.endp From 7f625e9e03c43be83507ac5623b67059f85c6be1 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Wed, 3 Feb 2010 18:49:44 +0000 Subject: [PATCH 086/121] Add some EXTERNs and use OR instead of | for MASM/ML compatibility svn path=/branches/ros-amd64-bringup/; revision=45398 --- reactos/ntoskrnl/ke/amd64/trap.S | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/reactos/ntoskrnl/ke/amd64/trap.S b/reactos/ntoskrnl/ke/amd64/trap.S index 76e3fe42b51..3a4296ff8e6 100644 --- a/reactos/ntoskrnl/ke/amd64/trap.S +++ b/reactos/ntoskrnl/ke/amd64/trap.S @@ -14,6 +14,10 @@ EXTERN _KiDispatchException:PROC EXTERN _FrLdrDbgPrint:DWORD EXTERN _KeBugCheckWithTf:PROC EXTERN _MmAccessFault:PROC +EXTERN _KiSystemFatalException:PROC +EXTERN _KiNpxNotAvailableFaultHandler:PROC +EXTERN _KiGeneralProtectionFaultHandler:PROC +EXTERN _KiXmmExceptionHandler:PROC /* GLOBALS *******************************************************************/ @@ -275,6 +279,7 @@ ENDR /* Allocate stack space for EXCEPTION_RECORD and KEXCEPTION_FRAME */ sub rsp, SIZE_EXCEPTION_RECORD + SIZE_KEXCEPTION_FRAME .allocstack (SIZE_EXCEPTION_RECORD + SIZE_KEXCEPTION_FRAME) + .endprolog /* Set up EXCEPTION_RECORD */ lea rcx, [rsp + SIZE_KEXCEPTION_FRAME] @@ -588,7 +593,7 @@ PUBLIC _KiNpxSegmentOverrunAbort PUBLIC _KiInvalidTssFault .PROC _KiInvalidTssFault /* We have an error code */ - ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE | TRAPFLAG_ALL) + ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL) /* Bugcheck */ mov ecx, EXCEPTION_INVALID_TSS @@ -602,7 +607,7 @@ PUBLIC _KiInvalidTssFault PUBLIC _KiSegmentNotPresentFault .PROC _KiSegmentNotPresentFault /* We have an error code */ - ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE | TRAPFLAG_ALL) + ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL) /* Bugcheck */ mov ecx, EXCEPTION_SEGMENT_NOT_PRESENT @@ -616,7 +621,7 @@ PUBLIC _KiSegmentNotPresentFault PUBLIC _KiStackFault .PROC _KiStackFault /* We have an error code */ - ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE | TRAPFLAG_ALL) + ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL) /* Bugcheck */ mov ecx, EXCEPTION_STACK_FAULT @@ -630,7 +635,7 @@ PUBLIC _KiStackFault PUBLIC _KiGeneralProtectionFault .PROC _KiGeneralProtectionFault /* We have an error code */ - ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE | TRAPFLAG_ALL) + ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL) TRAPINFO KiGeneralProtectionFault mov rdx, [rbp + KTRAP_FRAME_Rip] @@ -672,7 +677,7 @@ KiGpfExit: PUBLIC _KiPageFault .PROC _KiPageFault /* We have an error code */ - ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE | TRAPFLAG_ALL) + ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL) TRAPINFO KiPageFault @@ -751,7 +756,7 @@ PUBLIC _KiFloatingErrorFault PUBLIC _KiAlignmentFault .PROC _KiAlignmentFault /* We have an error code */ - ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE | TRAPFLAG_ALL) + ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL) /* Enable interrupts */ sti @@ -808,7 +813,7 @@ KiXmmExit: PUBLIC _KiApcInterrupt .PROC _KiApcInterrupt /* We have an error code */ - ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE | TRAPFLAG_ALL) + ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL) UNIMPLEMENTED KiApcInterrupt @@ -819,7 +824,7 @@ PUBLIC _KiApcInterrupt PUBLIC _KiRaiseAssertion .PROC _KiRaiseAssertion /* We have an error code */ - ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE | TRAPFLAG_ALL) + ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL) /* Decrement RIP to point to the INT2C instruction (2 bytes, not 1 like INT3) */ sub qword ptr [rbp + KTRAP_FRAME_Rip], 2 @@ -863,7 +868,7 @@ PUBLIC _KiDebugServiceTrap PUBLIC _KiDpcInterrupt .PROC _KiDpcInterrupt /* We have an error code */ - ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE | TRAPFLAG_ALL) + ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL) UNIMPLEMENTED KiDpcInterrupt @@ -874,7 +879,7 @@ PUBLIC _KiDpcInterrupt PUBLIC _KiIpiInterrupt .PROC _KiIpiInterrupt /* We have an error code */ - ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE | TRAPFLAG_ALL) + ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL) UNIMPLEMENTED KiIpiInterrupt @@ -886,7 +891,7 @@ PUBLIC _KiUnexpectedInterrupt .PROC _KiUnexpectedInterrupt /* The error code is the vector */ cli - ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE | TRAPFLAG_ALL) + ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL) /* Set bugcheck parameters */ mov ecx, TRAP_CAUSE_UNKNOWN From 025e922f698a09a31e5820c9759f49059eedeacb Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Wed, 3 Feb 2010 18:53:41 +0000 Subject: [PATCH 087/121] [NTOS] - Get rid of all Ke386* inline functions for amd64 - add some stubs for msvc svn path=/branches/ros-amd64-bringup/; revision=45399 --- .../include/internal/amd64/intrin_i.h | 344 +----------------- reactos/ntoskrnl/ke/amd64/kiinit.c | 5 - 2 files changed, 20 insertions(+), 329 deletions(-) diff --git a/reactos/ntoskrnl/include/internal/amd64/intrin_i.h b/reactos/ntoskrnl/include/internal/amd64/intrin_i.h index 61fa6d2443a..a4073a8694e 100644 --- a/reactos/ntoskrnl/include/internal/amd64/intrin_i.h +++ b/reactos/ntoskrnl/include/internal/amd64/intrin_i.h @@ -1,13 +1,12 @@ #ifndef _INTRIN_INTERNAL_ #define _INTRIN_INTERNAL_ -#ifdef CONFIG_SMP -#define LOCK "lock ; " -#else -#define LOCK "" -#endif - -#define KeSetCurrentIrql(x) __writecr8(x) +VOID +FORCEINLINE +KeSetCurrentIrql(KIRQL Irql) +{ + __writecr8(Irql); +} PKGDTENTRY64 FORCEINLINE @@ -103,344 +102,41 @@ static __inline__ __attribute__((always_inline)) void __str(unsigned short *Dest } -#define _Ke386GetSeg(N) ({ \ - unsigned int __d; \ - __asm__("movl %%" #N ",%0\n\t" :"=r" (__d)); \ - __d; \ - }) - -#define _Ke386SetSeg(N,X) __asm__ __volatile__("movl %0,%%" #N : :"r" (X)); - -#define _Ke386GetDr(N) ({ \ - unsigned int __d; \ - __asm__("movq %%dr" #N ",%0\n\t" :"=r" (__d)); \ - __d; \ - }) - -#define _Ke386SetDr(N,X) __asm__ __volatile__("movl %0,%%dr" #N : :"r" (X)); - - -static inline void Ki386Cpuid(ULONG Op, PULONG Eax, PULONG Ebx, PULONG Ecx, PULONG Edx) -{ - __asm__("cpuid" - : "=a" (*Eax), "=b" (*Ebx), "=c" (*Ecx), "=d" (*Edx) - : "0" (Op)); -} - -#define Ke386Rdmsr(msr,val1,val2) __asm__ __volatile__("rdmsr" : "=a" (val1), "=d" (val2) : "c" (msr)) -#define Ke386Wrmsr(msr,val1,val2) __asm__ __volatile__("wrmsr" : /* no outputs */ : "c" (msr), "a" (val1), "d" (val2)) - -#define Ke386HaltProcessor() __asm__("hlt\n\t"); - -#define Ke386FnInit() __asm__("fninit\n\t"); - - -// -// CR Macros -// -#define Ke386SetCr2(X) __asm__ __volatile__("movq %0,%%cr2" : :"r" ((void*)X)); - -// -// DR Macros -// -#define Ke386GetDr0() _Ke386GetDr(0) -#define Ke386GetDr1() _Ke386GetDr(1) -#define Ke386SetDr0(X) _Ke386SetDr(0,X) -#define Ke386SetDr1(X) _Ke386SetDr(1,X) -#define Ke386GetDr2() _Ke386GetDr(2) -#define Ke386SetDr2(X) _Ke386SetDr(2,X) -#define Ke386GetDr3() _Ke386GetDr(3) -#define Ke386SetDr3(X) _Ke386SetDr(3,X) -#define Ke386GetDr4() _Ke386GetDr(4) -#define Ke386SetDr4(X) _Ke386SetDr(4,X) -#define Ke386GetDr6() _Ke386GetDr(6) -#define Ke386SetDr6(X) _Ke386SetDr(6,X) -#define Ke386GetDr7() _Ke386GetDr(7) -#define Ke386SetDr7(X) _Ke386SetDr(7,X) - -// -// Segment Macros -// -#define Ke386GetSs() _Ke386GetSeg(ss) -#define Ke386GetFs() _Ke386GetSeg(fs) -#define Ke386SetFs(X) _Ke386SetSeg(fs, X) -#define Ke386SetGs(X) _Ke386SetSeg(gs, X) -#define Ke386SetDs(X) _Ke386SetSeg(ds, X) -#define Ke386SetEs(X) _Ke386SetSeg(es, X) -#define Ke386SetSs(X) _Ke386SetSeg(ss, X) - #elif defined(_MSC_VER) -VOID -FORCEINLINE -Ke386Wrmsr(IN ULONG Register, - IN ULONG Var1, - IN ULONG Var2) +#define UNIMPLEMENTED DbgPrint("%s is unimplemented!!!\n", __FUNCTION__); + +void FORCEINLINE __lgdt(void *Source) { - __writemsr(Register, (ULONG64)Var1 <<32 | Var2); + UNIMPLEMENTED; } -ULONGLONG -FORCEINLINE -Ke386Rdmsr(IN ULONG Register, - IN ULONG Var1, - IN ULONG Var2) +void FORCEINLINE __sgdt(void *Destination) { - return __readmsr(Register); + UNIMPLEMENTED; } -#define UNIMPLEMENTED DbgPrint("unimplemented!!!\n"); - -VOID -FORCEINLINE -Ki386Cpuid(IN ULONG Operation, - OUT PULONG Var1, - OUT PULONG Var2, - OUT PULONG Var3, - OUT PULONG Var4) +void FORCEINLINE __lldt(unsigned short Value) { - UNIMPLEMENTED; + UNIMPLEMENTED; } -VOID -FORCEINLINE -Ke386FnInit(VOID) +void FORCEINLINE __sldt(void *Destination) { - UNIMPLEMENTED; + UNIMPLEMENTED; } -VOID -FORCEINLINE -Ke386HaltProcessor(VOID) +void FORCEINLINE __ltr(unsigned short Source) { - UNIMPLEMENTED; + UNIMPLEMENTED; } -VOID -FORCEINLINE -Ke386GetInterruptDescriptorTable(OUT KDESCRIPTOR Descriptor) +void FORCEINLINE __str(unsigned short *Destination) { - UNIMPLEMENTED; + UNIMPLEMENTED; } -VOID -FORCEINLINE -Ke386SetInterruptDescriptorTable(IN KDESCRIPTOR Descriptor) -{ - UNIMPLEMENTED; -} -VOID -FORCEINLINE -Ke386GetGlobalDescriptorTable(OUT KDESCRIPTOR Descriptor) -{ - UNIMPLEMENTED; -} - -VOID -FORCEINLINE -Ke386SetGlobalDescriptorTable(IN KDESCRIPTOR Descriptor) -{ - UNIMPLEMENTED; -} - -VOID -FORCEINLINE -Ke386GetLocalDescriptorTable(OUT USHORT Descriptor) -{ - UNIMPLEMENTED; -} - -VOID -FORCEINLINE -Ke386SetLocalDescriptorTable(IN USHORT Descriptor) -{ - UNIMPLEMENTED; -} - -VOID -FORCEINLINE -Ke386SaveFlags(IN ULONG Flags) -{ - UNIMPLEMENTED; -} - -VOID -FORCEINLINE -Ke386RestoreFlags(IN ULONG Flags) -{ - UNIMPLEMENTED; -} - -VOID -FORCEINLINE -Ke386SetTr(IN USHORT Tr) -{ - UNIMPLEMENTED; -} - -USHORT -FORCEINLINE -Ke386GetTr(IN USHORT Tr) -{ - UNIMPLEMENTED; -} - -// -// CR Macros -// -VOID -FORCEINLINE -Ke386SetCr2(IN ULONG Value) -{ - UNIMPLEMENTED; -} - -// -// DR Macros -// -ULONG -FORCEINLINE -Ke386GetDr0(VOID) -{ - UNIMPLEMENTED; -} - -ULONG -FORCEINLINE -Ke386GetDr1(VOID) -{ - UNIMPLEMENTED; -} - -ULONG -FORCEINLINE -Ke386GetDr2(VOID) -{ - UNIMPLEMENTED; -} - -ULONG -FORCEINLINE -Ke386GetDr3(VOID) -{ - UNIMPLEMENTED; -} - -ULONG -FORCEINLINE -Ke386GetDr6(VOID) -{ - UNIMPLEMENTED; -} - -ULONG -FORCEINLINE -Ke386GetDr7(VOID) -{ - UNIMPLEMENTED; -} - -VOID -FORCEINLINE -Ke386SetDr0(IN ULONG Value) -{ - UNIMPLEMENTED; -} - -VOID -FORCEINLINE -Ke386SetDr1(IN ULONG Value) -{ - UNIMPLEMENTED; -} - -VOID -FORCEINLINE -Ke386SetDr2(IN ULONG Value) -{ - UNIMPLEMENTED; -} - -VOID -FORCEINLINE -Ke386SetDr3(IN ULONG Value) -{ - UNIMPLEMENTED; -} - -VOID -FORCEINLINE -Ke386SetDr6(IN ULONG Value) -{ - UNIMPLEMENTED; -} - -VOID -FORCEINLINE -Ke386SetDr7(IN ULONG Value) -{ - UNIMPLEMENTED; -} - -// -// Segment Macros -// -USHORT -FORCEINLINE -Ke386GetSs(VOID) -{ - UNIMPLEMENTED; -} - -USHORT -FORCEINLINE -Ke386GetFs(VOID) -{ - UNIMPLEMENTED; -} - -USHORT -FORCEINLINE -Ke386GetDs(VOID) -{ - UNIMPLEMENTED; -} - -USHORT -FORCEINLINE -Ke386GetEs(VOID) -{ - UNIMPLEMENTED; -} - -VOID -FORCEINLINE -Ke386SetSs(IN USHORT Value) -{ - UNIMPLEMENTED; -} - -VOID -FORCEINLINE -Ke386SetFs(IN USHORT Value) -{ - UNIMPLEMENTED; -} - -VOID -FORCEINLINE -Ke386SetDs(IN USHORT Value) -{ - UNIMPLEMENTED; -} - -VOID -FORCEINLINE -Ke386SetEs(IN USHORT Value) -{ - UNIMPLEMENTED; -} #else #error Unknown compiler for inline assembler diff --git a/reactos/ntoskrnl/ke/amd64/kiinit.c b/reactos/ntoskrnl/ke/amd64/kiinit.c index d35128f2c40..9c6d3c235c6 100644 --- a/reactos/ntoskrnl/ke/amd64/kiinit.c +++ b/reactos/ntoskrnl/ke/amd64/kiinit.c @@ -389,11 +389,6 @@ KiSystemStartup(IN PLOADER_PARAMETER_BLOCK LoaderBlock) __writemsr(X86_MSR_GSBASE, (ULONG64)Pcr); __writemsr(X86_MSR_KERNEL_GSBASE, (ULONG64)Pcr); - /* Load Ring 3 selectors for DS/ES/FS */ - Ke386SetDs(KGDT64_R3_DATA | RPL_MASK); - Ke386SetEs(KGDT64_R3_DATA | RPL_MASK); - Ke386SetFs(KGDT64_R3_CMTEB | RPL_MASK); - /* LDT is unused */ __lldt(0); From 9a5b1e6a62348dc502e3c1553d3bb193b92c76c9 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Thu, 4 Feb 2010 04:21:38 +0000 Subject: [PATCH 088/121] [FREELDR] Remove Ke386SetXx, we don't need them and we don't have anymore. svn path=/branches/ros-amd64-bringup/; revision=45406 --- reactos/boot/freeldr/freeldr/windows/amd64/wlmemory.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/reactos/boot/freeldr/freeldr/windows/amd64/wlmemory.c b/reactos/boot/freeldr/freeldr/windows/amd64/wlmemory.c index 4256cf73fde..5f979c4ca7b 100644 --- a/reactos/boot/freeldr/freeldr/windows/amd64/wlmemory.c +++ b/reactos/boot/freeldr/freeldr/windows/amd64/wlmemory.c @@ -341,13 +341,6 @@ WinLdrSetProcessorContext(PVOID GdtIdt, IN ULONG64 Pcr, IN ULONG64 Tss) /* LDT is unused */ // __lldt(0); - /* Load selectors for DS/ES/FS/GS/SS */ - Ke386SetDs(KGDT64_R3_DATA | RPL_MASK); // 0x2b - Ke386SetEs(KGDT64_R3_DATA | RPL_MASK); // 0x2b - Ke386SetFs(KGDT64_R3_CMTEB | RPL_MASK); // 0x53 - Ke386SetGs(KGDT64_R3_DATA | RPL_MASK); // 0x2b - Ke386SetSs(KGDT64_R0_DATA); // 0x18 - /* Load TSR */ __ltr(KGDT64_SYS_TSS); From e817db75e4927bb83ebe4f1e0181d2b87e53e25a Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Thu, 4 Feb 2010 04:22:58 +0000 Subject: [PATCH 089/121] [HAL] Fix KGDT64 macro name svn path=/branches/ros-amd64-bringup/; revision=45407 --- reactos/hal/halx86/generic/amd64/misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/hal/halx86/generic/amd64/misc.c b/reactos/hal/halx86/generic/amd64/misc.c index e3c50750d5e..7196560db06 100644 --- a/reactos/hal/halx86/generic/amd64/misc.c +++ b/reactos/hal/halx86/generic/amd64/misc.c @@ -53,7 +53,7 @@ HalpInitIdtEntry(PKIDTENTRY64 Idt, PVOID Address) Idt->OffsetLow = (ULONG_PTR)Address & 0xffff; Idt->OffsetMiddle = ((ULONG_PTR)Address >> 16) & 0xffff; Idt->OffsetHigh = (ULONG_PTR)Address >> 32; - Idt->Selector = KGDT_64_R0_CODE; + Idt->Selector = KGDT64_R0_CODE; Idt->IstIndex = 0; Idt->Type = 0x0e; Idt->Dpl = 0; From ad67929566576ab650bbe279391a299ba1fc3291 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Thu, 4 Feb 2010 04:31:02 +0000 Subject: [PATCH 090/121] [NDK] - fix KGDT64 names - make asm.h masm/ml compatible by using a HEX macro, that converts constants into either 0xAA or 0AAh format svn path=/branches/ros-amd64-bringup/; revision=45408 --- reactos/include/ndk/amd64/asm.h | 549 ++++++++++++++-------------- reactos/include/ndk/amd64/ketypes.h | 14 +- 2 files changed, 287 insertions(+), 276 deletions(-) diff --git a/reactos/include/ndk/amd64/asm.h b/reactos/include/ndk/amd64/asm.h index 9428245ca38..b719d0ebe34 100644 --- a/reactos/include/ndk/amd64/asm.h +++ b/reactos/include/ndk/amd64/asm.h @@ -18,270 +18,279 @@ Author: #ifndef _ASM_AMD64_H #define _ASM_AMD64_H +#ifndef HEX + #ifdef MSC_VER + #define HEX(x) x##h + #else + #define HEX(x) 0x0##x + #endif +#endif #define SIZEOF_FX_SAVE_AREA 528 // HACK // // CPU Modes // -#define KernelMode 0x0 -#define UserMode 0x1 +#define KernelMode HEX(0) +#define UserMode HEX(1) // // CPU Types // -#define CPU_INTEL 0x1 -#define CPU_AMD 0x2 +#define CPU_INTEL HEX(1) +#define CPU_AMD HEX(2) // // KTSS Offsets // -#define KTSS64_RSP0 0x04 -#define KTSS64_RSP1 0x0c -#define KTSS64_RSP2 0x14 -#define KTSS64_IST 0x1c -#define KTSS64_IO_MAP_BASE 0x66 +#define KTSS64_RSP0 HEX(04) +#define KTSS64_RSP1 HEX(0c) +#define KTSS64_RSP2 HEX(14) +#define KTSS64_IST HEX(1c) +#define KTSS64_IO_MAP_BASE HEX(66) // // KTHREAD Offsets // -#define KTHREAD_DEBUG_ACTIVE 0x03 -#define KTHREAD_INITIAL_STACK 0x28 -#define KTHREAD_STACK_LIMIT 0x30 -#define KTHREAD_WAIT_IRQL 0x156 +#define KTHREAD_DEBUG_ACTIVE HEX(03) +#define KTHREAD_INITIAL_STACK HEX(28) +#define KTHREAD_STACK_LIMIT HEX(30) +#define KTHREAD_WAIT_IRQL HEX(156) // // KPRCB Offsets // -#define KPRCB_CurrentThread 0x08 +#define KPRCB_CurrentThread HEX(08) // // KPCR Offsets // -#define KPCR_TSS_BASE 0x08 -#define KPCR_SELF 0x18 -#define KPCR_STALL_SCALE_FACTOR 0x64 -#define KPCR_PRCB 0x180 +#define KPCR_TSS_BASE HEX(08) +#define KPCR_SELF HEX(18) +#define KPCR_STALL_SCALE_FACTOR HEX(64) +#define KPCR_PRCB HEX(180 // // KTRAP_FRAME Offsets // -#define KTRAP_FRAME_P1Home 0x00 -#define KTRAP_FRAME_P2Home 0x08 -#define KTRAP_FRAME_P3Home 0x10 -#define KTRAP_FRAME_P4Home 0x18 -#define KTRAP_FRAME_P5 0x20 -#define KTRAP_FRAME_PreviousMode 0x28 -#define KTRAP_FRAME_PreviousIrql 0x29 -#define KTRAP_FRAME_FaultIndicator 0x2A -#define KTRAP_FRAME_ExceptionActive 0x2B -#define KTRAP_FRAME_MxCsr 0x2C -#define KTRAP_FRAME_Rax 0x30 -#define KTRAP_FRAME_Rcx 0x38 -#define KTRAP_FRAME_Rdx 0x40 -#define KTRAP_FRAME_R8 0x48 -#define KTRAP_FRAME_R9 0x50 -#define KTRAP_FRAME_R10 0x58 -#define KTRAP_FRAME_R11 0x60 -#define KTRAP_FRAME_GsBase 0x68 -#define KTRAP_FRAME_Xmm0 0x70 -#define KTRAP_FRAME_Xmm1 0x80 -#define KTRAP_FRAME_Xmm2 0x90 -#define KTRAP_FRAME_Xmm3 0xA0 -#define KTRAP_FRAME_Xmm4 0xB0 -#define KTRAP_FRAME_Xmm5 0xC0 -#define KTRAP_FRAME_FaultAddress 0xD0 -#define KTRAP_FRAME_Dr0 0xD8 -#define KTRAP_FRAME_Dr1 0xE0 -#define KTRAP_FRAME_Dr2 0xE8 -#define KTRAP_FRAME_Dr3 0xF0 -#define KTRAP_FRAME_Dr6 0xF8 -#define KTRAP_FRAME_Dr7 0x100 -#define KTRAP_FRAME_DebugControl 0x108 -#define KTRAP_FRAME_LastBranchToRip 0x110 -#define KTRAP_FRAME_LastBranchFromRip 0x118 -#define KTRAP_FRAME_LastExceptionToRip 0x120 -#define KTRAP_FRAME_LastExceptionFromRip 0x128 -#define KTRAP_FRAME_SegDs 0x130 -#define KTRAP_FRAME_SegEs 0x132 -#define KTRAP_FRAME_SegFs 0x134 -#define KTRAP_FRAME_SegGs 0x136 -#define KTRAP_FRAME_TrapFrame 0x138 -#define KTRAP_FRAME_Rbx 0x140 -#define KTRAP_FRAME_Rdi 0x148 -#define KTRAP_FRAME_Rsi 0x150 -#define KTRAP_FRAME_Rbp 0x158 -#define KTRAP_FRAME_ErrorCode 0x160 -#define KTRAP_FRAME_Rip 0x168 -#define KTRAP_FRAME_SegCs 0x170 -#define KTRAP_FRAME_Logging 0x173 -#define KTRAP_FRAME_EFlags 0x178 -#define KTRAP_FRAME_Rsp 0x180 -#define KTRAP_FRAME_SegSs 0x188 -#define KTRAP_FRAME_CodePatchCycle 0x18c -#define SIZE_KTRAP_FRAME 0x190 -#define KTRAP_FRAME_ALIGN 0x10 -#define KTRAP_FRAME_LENGTH 0x190 +#define KTRAP_FRAME_P1Home HEX(00) +#define KTRAP_FRAME_P2Home HEX(08) +#define KTRAP_FRAME_P3Home HEX(10) +#define KTRAP_FRAME_P4Home HEX(18) +#define KTRAP_FRAME_P5 HEX(20) +#define KTRAP_FRAME_PreviousMode HEX(28) +#define KTRAP_FRAME_PreviousIrql HEX(29) +#define KTRAP_FRAME_FaultIndicator HEX(2A) +#define KTRAP_FRAME_ExceptionActive HEX(2B) +#define KTRAP_FRAME_MxCsr HEX(2C) +#define KTRAP_FRAME_Rax HEX(30) +#define KTRAP_FRAME_Rcx HEX(38) +#define KTRAP_FRAME_Rdx HEX(40) +#define KTRAP_FRAME_R8 HEX(48) +#define KTRAP_FRAME_R9 HEX(50) +#define KTRAP_FRAME_R10 HEX(58) +#define KTRAP_FRAME_R11 HEX(60) +#define KTRAP_FRAME_GsBase HEX(68) +#define KTRAP_FRAME_Xmm0 HEX(70) +#define KTRAP_FRAME_Xmm1 HEX(80) +#define KTRAP_FRAME_Xmm2 HEX(90) +#define KTRAP_FRAME_Xmm3 HEX(A0) +#define KTRAP_FRAME_Xmm4 HEX(B0) +#define KTRAP_FRAME_Xmm5 HEX(C0) +#define KTRAP_FRAME_FaultAddress HEX(D0) +#define KTRAP_FRAME_Dr0 HEX(D8) +#define KTRAP_FRAME_Dr1 HEX(E0) +#define KTRAP_FRAME_Dr2 HEX(E8) +#define KTRAP_FRAME_Dr3 HEX(F0) +#define KTRAP_FRAME_Dr6 HEX(F8) +#define KTRAP_FRAME_Dr7 HEX(100) +#define KTRAP_FRAME_DebugControl HEX(108) +#define KTRAP_FRAME_LastBranchToRip HEX(110) +#define KTRAP_FRAME_LastBranchFromRip HEX(118) +#define KTRAP_FRAME_LastExceptionToRip HEX(120) +#define KTRAP_FRAME_LastExceptionFromRip HEX(128) +#define KTRAP_FRAME_SegDs HEX(130) +#define KTRAP_FRAME_SegEs HEX(132) +#define KTRAP_FRAME_SegFs HEX(134) +#define KTRAP_FRAME_SegGs HEX(136) +#define KTRAP_FRAME_TrapFrame HEX(138) +#define KTRAP_FRAME_Rbx HEX(140) +#define KTRAP_FRAME_Rdi HEX(148) +#define KTRAP_FRAME_Rsi HEX(150) +#define KTRAP_FRAME_Rbp HEX(158) +#define KTRAP_FRAME_ErrorCode HEX(160) +#define KTRAP_FRAME_Rip HEX(168) +#define KTRAP_FRAME_SegCs HEX(170) +#define KTRAP_FRAME_Logging HEX(173) +#define KTRAP_FRAME_EFlags HEX(178) +#define KTRAP_FRAME_Rsp HEX(180) +#define KTRAP_FRAME_SegSs HEX(188) +#define KTRAP_FRAME_CodePatchCycle HEX(18c) +#define SIZE_KTRAP_FRAME HEX(190) +#define KTRAP_FRAME_ALIGN HEX(10) +#define KTRAP_FRAME_LENGTH HEX(190) // // CONTEXT Offsets // #define CONTEXT_P1Home 0 -#define CONTEXT_P2Home 0x08 -#define CONTEXT_P3Home 0x10 -#define CONTEXT_P4Home 0x18 -#define CONTEXT_P5Home 0x20 -#define CONTEXT_P6Home 0x28 -#define CONTEXT_ContextFlags 0x30 -#define CONTEXT_MxCsr 0x34 -#define CONTEXT_SegCs 0x38 -#define CONTEXT_SegDs 0x3a -#define CONTEXT_SegEs 0x3c -#define CONTEXT_SegFs 0x3e -#define CONTEXT_SegGs 0x40 -#define CONTEXT_SegSs 0x42 -#define CONTEXT_EFlags 0x44 -#define CONTEXT_Dr0 0x48 -#define CONTEXT_Dr1 0x50 -#define CONTEXT_Dr2 0x58 -#define CONTEXT_Dr3 0x60 -#define CONTEXT_Dr6 0x68 -#define CONTEXT_Dr7 0x70 -#define CONTEXT_Rax 0x78 -#define CONTEXT_Rcx 0x80 -#define CONTEXT_Rdx 0x88 -#define CONTEXT_Rbx 0x90 -#define CONTEXT_Rsp 0x98 -#define CONTEXT_Rbp 0xa0 -#define CONTEXT_Rsi 0xa8 -#define CONTEXT_Rdi 0xb0 -#define CONTEXT_R8 0xb8 -#define CONTEXT_R9 0xc0 -#define CONTEXT_R10 0xc8 -#define CONTEXT_R11 0xd0 -#define CONTEXT_R12 0xd8 -#define CONTEXT_R13 0xe0 -#define CONTEXT_R14 0xe8 -#define CONTEXT_R15 0xf0 -#define CONTEXT_Rip 0xf8 -#define CONTEXT_Header 0x100 -#define CONTEXT_Legacy 0x120 -#define CONTEXT_Xmm0 0x1a0 -#define CONTEXT_Xmm1 0x1b0 -#define CONTEXT_Xmm2 0x1c0 -#define CONTEXT_Xmm3 0x1d0 -#define CONTEXT_Xmm4 0x1e0 -#define CONTEXT_Xmm5 0x1f0 -#define CONTEXT_Xmm6 0x200 -#define CONTEXT_Xmm7 0x210 -#define CONTEXT_Xmm8 0x220 -#define CONTEXT_Xmm9 0x230 -#define CONTEXT_Xmm10 0x240 -#define CONTEXT_Xmm11 0x250 -#define CONTEXT_Xmm12 0x260 -#define CONTEXT_Xmm13 0x270 -#define CONTEXT_Xmm14 0x280 -#define CONTEXT_Xmm15 0x290 -#define CONTEXT_VectorRegister 0x300 -#define CONTEXT_VectorControl 0x4a0 -#define CONTEXT_DebugControl 0x4a8 -#define CONTEXT_LastBranchToRip 0x4b0 -#define CONTEXT_LastBranchFromRip 0x4b8 -#define CONTEXT_LastExceptionToRip 0x4c0 -#define CONTEXT_LastExceptionFromRip 0x4c8 +#define CONTEXT_P2Home HEX(08) +#define CONTEXT_P3Home HEX(10) +#define CONTEXT_P4Home HEX(18) +#define CONTEXT_P5Home HEX(20) +#define CONTEXT_P6Home HEX(28) +#define CONTEXT_ContextFlags HEX(30) +#define CONTEXT_MxCsr HEX(34) +#define CONTEXT_SegCs HEX(38) +#define CONTEXT_SegDs HEX(3a) +#define CONTEXT_SegEs HEX(3c) +#define CONTEXT_SegFs HEX(3e) +#define CONTEXT_SegGs HEX(40) +#define CONTEXT_SegSs HEX(42) +#define CONTEXT_EFlags HEX(44) +#define CONTEXT_Dr0 HEX(48) +#define CONTEXT_Dr1 HEX(50) +#define CONTEXT_Dr2 HEX(58) +#define CONTEXT_Dr3 HEX(60) +#define CONTEXT_Dr6 HEX(68) +#define CONTEXT_Dr7 HEX(70) +#define CONTEXT_Rax HEX(78) +#define CONTEXT_Rcx HEX(80) +#define CONTEXT_Rdx HEX(88) +#define CONTEXT_Rbx HEX(90) +#define CONTEXT_Rsp HEX(98) +#define CONTEXT_Rbp HEX(a0) +#define CONTEXT_Rsi HEX(a8) +#define CONTEXT_Rdi HEX(b0) +#define CONTEXT_R8 HEX(b8) +#define CONTEXT_R9 HEX(c0) +#define CONTEXT_R10 HEX(c8) +#define CONTEXT_R11 HEX(d0) +#define CONTEXT_R12 HEX(d8) +#define CONTEXT_R13 HEX(e0) +#define CONTEXT_R14 HEX(e8) +#define CONTEXT_R15 HEX(f0) +#define CONTEXT_Rip HEX(f8) +#define CONTEXT_Header HEX(100) +#define CONTEXT_Legacy HEX(120) +#define CONTEXT_Xmm0 HEX(1a0) +#define CONTEXT_Xmm1 HEX(1b0) +#define CONTEXT_Xmm2 HEX(1c0) +#define CONTEXT_Xmm3 HEX(1d0) +#define CONTEXT_Xmm4 HEX(1e0) +#define CONTEXT_Xmm5 HEX(1f0) +#define CONTEXT_Xmm6 HEX(200) +#define CONTEXT_Xmm7 HEX(210) +#define CONTEXT_Xmm8 HEX(220) +#define CONTEXT_Xmm9 HEX(230) +#define CONTEXT_Xmm10 HEX(240) +#define CONTEXT_Xmm11 HEX(250) +#define CONTEXT_Xmm12 HEX(260) +#define CONTEXT_Xmm13 HEX(270) +#define CONTEXT_Xmm14 HEX(280) +#define CONTEXT_Xmm15 HEX(290) +#define CONTEXT_VectorRegister HEX(300) +#define CONTEXT_VectorControl HEX(4a0) +#define CONTEXT_DebugControl HEX(4a8) +#define CONTEXT_LastBranchToRip HEX(4b0) +#define CONTEXT_LastBranchFromRip HEX(4b8) +#define CONTEXT_LastExceptionToRip HEX(4c0) +#define CONTEXT_LastExceptionFromRip HEX(4c8) // // KEXCEPTION_FRAME offsets // -#define KEXCEPTION_FRAME_P1Home 0x000 -#define KEXCEPTION_FRAME_P2Home 0x008 -#define KEXCEPTION_FRAME_P3Home 0x010 -#define KEXCEPTION_FRAME_P4Home 0x018 -#define KEXCEPTION_FRAME_P5 0x020 -#define KEXCEPTION_FRAME_InitialStack 0x028 -#define KEXCEPTION_FRAME_Xmm6 0x030 -#define KEXCEPTION_FRAME_Xmm7 0x040 -#define KEXCEPTION_FRAME_Xmm8 0x050 -#define KEXCEPTION_FRAME_Xmm9 0x060 -#define KEXCEPTION_FRAME_Xmm10 0x070 -#define KEXCEPTION_FRAME_Xmm11 0x080 -#define KEXCEPTION_FRAME_Xmm12 0x090 -#define KEXCEPTION_FRAME_Xmm13 0x0A0 -#define KEXCEPTION_FRAME_Xmm14 0x0B0 -#define KEXCEPTION_FRAME_Xmm15 0x0C0 -#define KEXCEPTION_FRAME_TrapFrame 0x0D0 -#define KEXCEPTION_FRAME_CallbackStack 0x0D8 -#define KEXCEPTION_FRAME_OutputBuffer 0x0E0 -#define KEXCEPTION_FRAME_OutputLength 0x0E8 -#define KEXCEPTION_FRAME_MxCsr 0x0F0 -#define KEXCEPTION_FRAME_Rbp 0x0F8 -#define KEXCEPTION_FRAME_Rbx 0x100 -#define KEXCEPTION_FRAME_Rdi 0x108 -#define KEXCEPTION_FRAME_Rsi 0x110 -#define KEXCEPTION_FRAME_R12 0x118 -#define KEXCEPTION_FRAME_R13 0x120 -#define KEXCEPTION_FRAME_R14 0x128 -#define KEXCEPTION_FRAME_R15 0x130 -#define KEXCEPTION_FRAME_Return 0x138 -#define SIZE_KEXCEPTION_FRAME 0x140 +#define KEXCEPTION_FRAME_P1Home HEX(000) +#define KEXCEPTION_FRAME_P2Home HEX(008) +#define KEXCEPTION_FRAME_P3Home HEX(010) +#define KEXCEPTION_FRAME_P4Home HEX(018) +#define KEXCEPTION_FRAME_P5 HEX(020) +#define KEXCEPTION_FRAME_InitialStack HEX(028) +#define KEXCEPTION_FRAME_Xmm6 HEX(030) +#define KEXCEPTION_FRAME_Xmm7 HEX(040) +#define KEXCEPTION_FRAME_Xmm8 HEX(050) +#define KEXCEPTION_FRAME_Xmm9 HEX(060) +#define KEXCEPTION_FRAME_Xmm10 HEX(070) +#define KEXCEPTION_FRAME_Xmm11 HEX(080) +#define KEXCEPTION_FRAME_Xmm12 HEX(090) +#define KEXCEPTION_FRAME_Xmm13 HEX(0A0) +#define KEXCEPTION_FRAME_Xmm14 HEX(0B0) +#define KEXCEPTION_FRAME_Xmm15 HEX(0C0) +#define KEXCEPTION_FRAME_TrapFrame HEX(0D0) +#define KEXCEPTION_FRAME_CallbackStack HEX(0D8) +#define KEXCEPTION_FRAME_OutputBuffer HEX(0E0) +#define KEXCEPTION_FRAME_OutputLength HEX(0E8) +#define KEXCEPTION_FRAME_MxCsr HEX(0F0) +#define KEXCEPTION_FRAME_Rbp HEX(0F8) +#define KEXCEPTION_FRAME_Rbx HEX(100) +#define KEXCEPTION_FRAME_Rdi HEX(108) +#define KEXCEPTION_FRAME_Rsi HEX(110) +#define KEXCEPTION_FRAME_R12 HEX(118) +#define KEXCEPTION_FRAME_R13 HEX(120) +#define KEXCEPTION_FRAME_R14 HEX(128) +#define KEXCEPTION_FRAME_R15 HEX(130) +#define KEXCEPTION_FRAME_Return HEX(138) +#define SIZE_KEXCEPTION_FRAME HEX(140) // // EXCEPTION_RECORD Offsets // -#define EXCEPTION_RECORD_ExceptionCode 0x00 -#define EXCEPTION_RECORD_ExceptionFlags 0x04 -#define EXCEPTION_RECORD_ExceptionRecord 0x08 -#define EXCEPTION_RECORD_ExceptionAddress 0x10 -#define EXCEPTION_RECORD_NumberParameters 0x18 -#define EXCEPTION_RECORD_ExceptionInformation 0x20 -#define SIZE_EXCEPTION_RECORD 0x98 +#define EXCEPTION_RECORD_ExceptionCode HEX(00) +#define EXCEPTION_RECORD_ExceptionFlags HEX(04) +#define EXCEPTION_RECORD_ExceptionRecord HEX(08) +#define EXCEPTION_RECORD_ExceptionAddress HEX(10) +#define EXCEPTION_RECORD_NumberParameters HEX(18) +#define EXCEPTION_RECORD_ExceptionInformation HEX(20) +#define SIZE_EXCEPTION_RECORD HEX(98) // // CR0 // -#define CR0_PE 0x1 -#define CR0_MP 0x2 -#define CR0_EM 0x4 -#define CR0_TS 0x8 -#define CR0_ET 0x10 -#define CR0_NE 0x20 -#define CR0_WP 0x10000 -#define CR0_AM 0x40000 -#define CR0_NW 0x20000000 -#define CR0_CD 0x40000000 -#define CR0_PG 0x80000000 +#define CR0_PE HEX(1) +#define CR0_MP HEX(2) +#define CR0_EM HEX(4) +#define CR0_TS HEX(8) +#define CR0_ET HEX(10) +#define CR0_NE HEX(20) +#define CR0_WP HEX(10000) +#define CR0_AM HEX(40000) +#define CR0_NW HEX(20000000) +#define CR0_CD HEX(40000000) +#define CR0_PG HEX(80000000) +#ifdef _ASM_ // // CR4 // -#define CR4_VME 0x1 -#define CR4_PVI 0x2 -#define CR4_TSD 0x4 -#define CR4_DE 0x8 -#define CR4_PSE 0x10 -#define CR4_PAE 0x20 -#define CR4_MCE 0x40 -#define CR4_PGE 0x80 -#define CR4_FXSR 0x200 -#define CR4_XMMEXCPT 0x400 +#define CR4_VME HEX(1) +#define CR4_PVI HEX(2) +#define CR4_TSD HEX(4) +#define CR4_DE HEX(8) +#define CR4_PSE HEX(10) +#define CR4_PAE HEX(20) +#define CR4_MCE HEX(40) +#define CR4_PGE HEX(80) +#define CR4_FXSR HEX(200) +#define CR4_XMMEXCPT HEX(400) +#endif // // Generic Definitions // -#define PRIMARY_VECTOR_BASE 0x30 -#define MAXIMUM_IDTVECTOR 0xFF +#define PRIMARY_VECTOR_BASE HEX(30) +#define MAXIMUM_IDTVECTOR HEX(FF) // // Usermode callout frame definitions // -#define CBSTACK_STACK 0x0 -#define CBSTACK_TRAP_FRAME 0x8 -#define CBSTACK_CALLBACK_STACK 0x10 -#define CBSTACK_RBP 0x18 -#define CBSTACK_RESULT 0x20 -#define CBSTACK_RESULT_LENGTH 0x28 +#define CBSTACK_STACK HEX(0) +#define CBSTACK_TRAP_FRAME HEX(8) +#define CBSTACK_CALLBACK_STACK HEX(10) +#define CBSTACK_RBP HEX(18) +#define CBSTACK_RESULT HEX(20) +#define CBSTACK_RESULT_LENGTH HEX(28) /* Following ones are ASM only! ***********************************************/ @@ -296,80 +305,80 @@ Author: // // EFLAGS // -#define EFLAGS_TF 0x100 -#define EFLAGS_INTERRUPT_MASK 0x200 -#define EFLAGS_NESTED_TASK 0x4000 -#define EFLAGS_V86_MASK 0x20000 -#define EFLAGS_ALIGN_CHECK 0x40000 -#define EFLAGS_VIF 0x80000 -#define EFLAGS_VIP 0x100000 -#define EFLAG_SIGN 0x8000 -#define EFLAG_ZERO 0x4000 +#define EFLAGS_TF HEX(100) +#define EFLAGS_INTERRUPT_MASK HEX(200) +#define EFLAGS_NESTED_TASK HEX(4000) +#define EFLAGS_V86_MASK HEX(20000) +#define EFLAGS_ALIGN_CHECK HEX(40000) +#define EFLAGS_VIF HEX(80000) +#define EFLAGS_VIP HEX(100000) +#define EFLAG_SIGN HEX(8000) +#define EFLAG_ZERO HEX(4000) #define EFLAG_SELECT (EFLAG_SIGN + EFLAG_ZERO) -#define EFLAGS_USER_SANITIZE 0x3F4DD7 +#define EFLAGS_USER_SANITIZE HEX(3F4DD7) // // Exception codes // -#define EXCEPTION_DIVIDED_BY_ZERO 0x00000 -#define EXCEPTION_DEBUG 0x00001 -#define EXCEPTION_NMI 0x00002 -#define EXCEPTION_INT3 0x00003 -#define EXCEPTION_BOUND_CHECK 0x00005 -#define EXCEPTION_INVALID_OPCODE 0x00006 -#define EXCEPTION_NPX_NOT_AVAILABLE 0x00007 -#define EXCEPTION_DOUBLE_FAULT 0x00008 -#define EXCEPTION_NPX_OVERRUN 0x00009 -#define EXCEPTION_INVALID_TSS 0x0000A -#define EXCEPTION_SEGMENT_NOT_PRESENT 0x0000B -#define EXCEPTION_STACK_FAULT 0x0000C -#define EXCEPTION_GP_FAULT 0x0000D -#define EXCEPTION_RESERVED_TRAP 0x0000F -#define EXCEPTION_NPX_ERROR 0x00010 -#define EXCEPTION_ALIGNMENT_CHECK 0x00011 +#define EXCEPTION_DIVIDED_BY_ZERO HEX(00000) +#define EXCEPTION_DEBUG HEX(00001) +#define EXCEPTION_NMI HEX(00002) +#define EXCEPTION_INT3 HEX(00003) +#define EXCEPTION_BOUND_CHECK HEX(00005) +#define EXCEPTION_INVALID_OPCODE HEX(00006) +#define EXCEPTION_NPX_NOT_AVAILABLE HEX(00007) +#define EXCEPTION_DOUBLE_FAULT HEX(00008) +#define EXCEPTION_NPX_OVERRUN HEX(00009) +#define EXCEPTION_INVALID_TSS HEX(0000A) +#define EXCEPTION_SEGMENT_NOT_PRESENT HEX(0000B) +#define EXCEPTION_STACK_FAULT HEX(0000C) +#define EXCEPTION_GP_FAULT HEX(0000D) +#define EXCEPTION_RESERVED_TRAP HEX(0000F) +#define EXCEPTION_NPX_ERROR HEX(00010) +#define EXCEPTION_ALIGNMENT_CHECK HEX(00011) // // NTSTATUS values // -#define STATUS_ACCESS_VIOLATION 0xC0000005 -#define STATUS_IN_PAGE_ERROR 0xC0000006 -#define STATUS_GUARD_PAGE_VIOLATION 0x80000001 -#define STATUS_PRIVILEGED_INSTRUCTION 0xC0000096 -#define STATUS_STACK_OVERFLOW 0xC00000FD -#define KI_EXCEPTION_ACCESS_VIOLATION 0x10000004 -#define STATUS_INVALID_SYSTEM_SERVICE 0xC000001C -#define STATUS_NO_CALLBACK_ACTIVE 0xC0000258 -#define STATUS_CALLBACK_POP_STACK 0xC0000423 -#define STATUS_ARRAY_BOUNDS_EXCEEDED 0xC000008C -#define STATUS_ILLEGAL_INSTRUCTION 0xC000001D -#define STATUS_INVALID_LOCK_SEQUENCE 0xC000001E -#define STATUS_BREAKPOINT 0x80000003 -#define STATUS_SINGLE_STEP 0x80000004 -#define STATUS_INTEGER_DIVIDE_BY_ZERO 0xC0000094 -#define STATUS_INTEGER_OVERFLOW 0xC0000095 -#define STATUS_FLOAT_DENORMAL_OPERAND 0xC000008D -#define STATUS_FLOAT_DIVIDE_BY_ZERO 0xC000008E -#define STATUS_FLOAT_INEXACT_RESULT 0xC000008F -#define STATUS_FLOAT_INVALID_OPERATION 0xC0000090 -#define STATUS_FLOAT_OVERFLOW 0xC0000091 -#define STATUS_FLOAT_STACK_CHECK 0xC0000092 -#define STATUS_FLOAT_UNDERFLOW 0xC0000093 -#define STATUS_FLOAT_MULTIPLE_FAULTS 0xC00002B4 -#define STATUS_FLOAT_MULTIPLE_TRAPS 0xC00002B5 -#define STATUS_ASSERTION_FAILURE 0xC0000420 +#define STATUS_ACCESS_VIOLATION HEX(C0000005) +#define STATUS_IN_PAGE_ERROR HEX(C0000006) +#define STATUS_GUARD_PAGE_VIOLATION HEX(80000001) +#define STATUS_PRIVILEGED_INSTRUCTION HEX(C0000096) +#define STATUS_STACK_OVERFLOW HEX(C00000FD) +#define KI_EXCEPTION_ACCESS_VIOLATION HEX(10000004) +#define STATUS_INVALID_SYSTEM_SERVICE HEX(C000001C) +#define STATUS_NO_CALLBACK_ACTIVE HEX(C0000258) +#define STATUS_CALLBACK_POP_STACK HEX(C0000423) +#define STATUS_ARRAY_BOUNDS_EXCEEDED HEX(C000008C) +#define STATUS_ILLEGAL_INSTRUCTION HEX(C000001D) +#define STATUS_INVALID_LOCK_SEQUENCE HEX(C000001E) +#define STATUS_BREAKPOINT HEX(80000003) +#define STATUS_SINGLE_STEP HEX(80000004) +#define STATUS_INTEGER_DIVIDE_BY_ZERO HEX(C0000094) +#define STATUS_INTEGER_OVERFLOW HEX(C0000095) +#define STATUS_FLOAT_DENORMAL_OPERAND HEX(C000008D) +#define STATUS_FLOAT_DIVIDE_BY_ZERO HEX(C000008E) +#define STATUS_FLOAT_INEXACT_RESULT HEX(C000008F) +#define STATUS_FLOAT_INVALID_OPERATION HEX(C0000090) +#define STATUS_FLOAT_OVERFLOW HEX(C0000091) +#define STATUS_FLOAT_STACK_CHECK HEX(C0000092) +#define STATUS_FLOAT_UNDERFLOW HEX(C0000093) +#define STATUS_FLOAT_MULTIPLE_FAULTS HEX(C00002B4) +#define STATUS_FLOAT_MULTIPLE_TRAPS HEX(C00002B5) +#define STATUS_ASSERTION_FAILURE HEX(C0000420) // // Bugcheck Codes // -#define APC_INDEX_MISMATCH 0x01 -#define IRQL_NOT_GREATER_OR_EQUAL 0x09 -#define IRQL_NOT_LESS_OR_EQUAL 0x0A -#define TRAP_CAUSE_UNKNOWN 0x12 -#define KMODE_EXCEPTION_NOT_HANDLED 0x13 -#define IRQL_GT_ZERO_AT_SYSTEM_SERVICE 0x4A -#define UNEXPECTED_KERNEL_MODE_TRAP 0x7F -#define ATTEMPTED_SWITCH_FROM_DPC 0xB8 -#define HARDWARE_INTERRUPT_STORM 0xF2 +#define APC_INDEX_MISMATCH HEX(01) +#define IRQL_NOT_GREATER_OR_EQUAL HEX(09) +#define IRQL_NOT_LESS_OR_EQUAL HEX(0A) +#define TRAP_CAUSE_UNKNOWN HEX(12) +#define KMODE_EXCEPTION_NOT_HANDLED HEX(13) +#define IRQL_GT_ZERO_AT_SYSTEM_SERVICE HEX(4A) +#define UNEXPECTED_KERNEL_MODE_TRAP HEX(7F) +#define ATTEMPTED_SWITCH_FROM_DPC HEX(B8) +#define HARDWARE_INTERRUPT_STORM HEX(F2) // // IRQL Levels @@ -387,24 +396,24 @@ Author: // // Quantum Decrements // -#define CLOCK_QUANTUM_DECREMENT 0x3 +#define CLOCK_QUANTUM_DECREMENT HEX(3) // // Machine types // -#define MACHINE_TYPE_ISA 0x0000 -#define MACHINE_TYPE_EISA 0x0001 -#define MACHINE_TYPE_MCA 0x0002 +#define MACHINE_TYPE_ISA HEX(0000) +#define MACHINE_TYPE_EISA HEX(0001) +#define MACHINE_TYPE_MCA HEX(0002) // // Kernel Feature Bits // -#define KF_RDTSC 0x00000002 +#define KF_RDTSC HEX(00000002) // // Kernel Stack Size // -#define KERNEL_STACK_SIZE 0x6000 +#define KERNEL_STACK_SIZE HEX(6000) #endif // __ASM__ diff --git a/reactos/include/ndk/amd64/ketypes.h b/reactos/include/ndk/amd64/ketypes.h index fdd2d86b7b1..f1a3edb593e 100644 --- a/reactos/include/ndk/amd64/ketypes.h +++ b/reactos/include/ndk/amd64/ketypes.h @@ -58,12 +58,14 @@ Author: // #define RPL_MASK 0x0003 #define MODE_MASK 0x0001 -#define KGDT_64_R0_CODE 0x0010 -#define KGDT_64_R0_SS 0x0018 -#define KGDT_64_DATA 0x0028 // 2b -#define KGDT_64_R3_CODE 0x0030 // 33 -#define KGDT_TSS 0x0040 -#define KGDT_32_R3_TEB 0x0050 // 53 +#define KGDT64_NULL 0x0000 +#define KGDT64_R0_CODE 0x0010 +#define KGDT64_R0_DATA 0x0018 +#define KGDT64_R3_CMCODE 0x0020 +#define KGDT64_R3_DATA 0x0028 +#define KGDT64_R3_CODE 0x0030 +#define KGDT64_SYS_TSS 0x0040 +#define KGDT64_R3_CMTEB 0x0050 // // CR4 From cb076d0fef0735faf996152a95d0c0e9241551ec Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Thu, 4 Feb 2010 04:45:58 +0000 Subject: [PATCH 091/121] [CRT] Add back sin and cos to libcntpr, as they are needed by win32k atm ... svn path=/branches/ros-amd64-bringup/; revision=45409 --- reactos/lib/sdk/crt/libcntpr.rbuild | 2 ++ 1 file changed, 2 insertions(+) diff --git a/reactos/lib/sdk/crt/libcntpr.rbuild b/reactos/lib/sdk/crt/libcntpr.rbuild index 2ef42f05913..b18c5e87c15 100644 --- a/reactos/lib/sdk/crt/libcntpr.rbuild +++ b/reactos/lib/sdk/crt/libcntpr.rbuild @@ -59,6 +59,8 @@ + cos.c + sin.c alldiv.S atan.S From 28c8b7fbec5cd409882855fc97a9f78a31a4a694 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Thu, 4 Feb 2010 04:58:09 +0000 Subject: [PATCH 092/121] [AMD64] Switch from underscore prefixed symbols to unprefixed symbols. (MSVC compatibility) svn path=/branches/ros-amd64-bringup/; revision=45410 --- reactos/ReactOS-amd64.rbuild | 3 + .../boot/freeldr/freeldr/arch/amd64/arch.S | 76 +++--- .../boot/freeldr/freeldr/arch/amd64/boot.S | 6 +- .../boot/freeldr/freeldr/arch/amd64/drvmap.S | 8 +- .../boot/freeldr/freeldr/arch/amd64/i386cpu.S | 6 +- .../boot/freeldr/freeldr/arch/amd64/i386pnp.S | 6 +- .../freeldr/freeldr/arch/amd64/i386trap.S | 4 +- .../boot/freeldr/freeldr/arch/amd64/int386.S | 2 +- reactos/boot/freeldr/freeldr/arch/amd64/mb.S | 24 +- reactos/hal/halx86/generic/amd64/irq.S | 86 +++--- reactos/hal/halx86/generic/amd64/systimer.S | 39 +-- reactos/hal/halx86/mp/amd64/mps.S | 75 +++--- reactos/include/reactos/asm.h | 21 +- .../include/freebsd/src/sys/sys/kernel.h | 5 + reactos/lib/rtl/amd64/debug_asm.S | 49 ++-- reactos/lib/rtl/amd64/except_asm.S | 23 +- reactos/lib/rtl/amd64/rtlmem.S | 36 ++- reactos/lib/rtl/amd64/slist.S | 91 ++++--- reactos/lib/sdk/crt/except/amd64/chkstk_asm.s | 7 +- reactos/lib/sdk/crt/math/amd64/alldiv.S | 12 +- reactos/lib/sdk/crt/math/amd64/atan.S | 10 +- reactos/lib/sdk/crt/math/amd64/atan2.S | 10 +- reactos/lib/sdk/crt/math/amd64/ceil.S | 9 +- reactos/lib/sdk/crt/math/amd64/ceilf.S | 10 +- reactos/lib/sdk/crt/math/amd64/exp.S | 9 +- reactos/lib/sdk/crt/math/amd64/fabs.S | 9 +- reactos/lib/sdk/crt/math/amd64/floor.S | 10 +- reactos/lib/sdk/crt/math/amd64/floorf.S | 10 +- reactos/lib/sdk/crt/math/amd64/fmod.S | 10 +- reactos/lib/sdk/crt/math/amd64/fmodf.S | 10 +- reactos/lib/sdk/crt/math/amd64/ldexp.S | 10 +- reactos/lib/sdk/crt/math/amd64/log.S | 10 +- reactos/lib/sdk/crt/math/amd64/log10.S | 9 +- reactos/lib/sdk/crt/math/amd64/pow.S | 9 +- reactos/lib/sdk/crt/math/amd64/sqrt.S | 10 +- reactos/lib/sdk/crt/math/amd64/sqrtf.S | 9 +- reactos/lib/sdk/crt/math/amd64/tan.S | 10 +- reactos/lib/sdk/crt/setjmp/amd64/setjmp.s | 18 +- reactos/ntoskrnl/ke/amd64/boot.S | 19 +- reactos/ntoskrnl/ke/amd64/ctxswitch.S | 22 +- reactos/ntoskrnl/ke/amd64/trap.S | 246 +++++++++--------- reactos/ntoskrnl/mm/amd64/page.c | 5 - reactos/tools/nci/ncitool.c | 4 +- .../tools/rbuild/backend/mingw/linkers/ld.mak | 10 +- reactos/tools/rbuild/module.cpp | 2 +- 45 files changed, 523 insertions(+), 546 deletions(-) diff --git a/reactos/ReactOS-amd64.rbuild b/reactos/ReactOS-amd64.rbuild index c2b0e711477..4faae306bdd 100644 --- a/reactos/ReactOS-amd64.rbuild +++ b/reactos/ReactOS-amd64.rbuild @@ -34,6 +34,7 @@ -U_X86_ -Wno-format + -fno-leading-underscore @@ -42,6 +43,8 @@ -section-alignment=0x1000 --unique=.eh_frame -static + -fno-leading-underscore + --exclude-all-symbols diff --git a/reactos/boot/freeldr/freeldr/arch/amd64/arch.S b/reactos/boot/freeldr/freeldr/arch/amd64/arch.S index 0f6c257e34a..9def109221c 100644 --- a/reactos/boot/freeldr/freeldr/arch/amd64/arch.S +++ b/reactos/boot/freeldr/freeldr/arch/amd64/arch.S @@ -21,22 +21,22 @@ RealEntryPoint: mov ss, ax /* checkPoint Charlie - where it all began... */ - mov si, offset _CheckPoint0 + mov si, offset CheckPoint0 call writestr - + /* Setup a real mode stack */ mov sp, stack16 /* Zero BootDrive and BootPartition */ xor eax, eax - mov _BootDrive, eax - mov _BootPartition, eax + mov BootDrive, eax + mov BootPartition, eax /* Store the boot drive */ - mov _BootDrive, dl + mov BootDrive, dl /* Store the boot partition */ - mov _BootPartition, dh + mov BootPartition, dh /* Load the GDT */ lgdt gdtptr @@ -46,13 +46,13 @@ RealEntryPoint: call x86_16_EnableA20 /* checkPoint Charlie - where it all began... */ - mov si, offset _CheckPoint1 + mov si, offset CheckPoint1 call writestr call x86_16_BuildPageTables /* checkPoint Charlie - where it all began... */ - mov si, offset _CheckPoint2 + mov si, offset CheckPoint2 call writestr /* Check if CPU supports CPUID */ @@ -89,26 +89,26 @@ RealEntryPoint: /* X64 Processor */ /* checkPoint Charlie - where it all began... */ - mov si, offset _CheckPoint3 + mov si, offset CheckPoint3 call writestr - jmp _switch64 + jmp switch64 NO_X64_SUPPORT_DETECTED: - mov si, offset _NotAnX64Processor // Loading message + mov si, offset NotAnX64Processor // Loading message call writestr - jmp _fail + jmp fail NO_CPUID_SUPPORT_DETECTED: - mov si, offset _NoCPUIDSupport // Loading message - call writestr + mov si, offset NoCPUIDSupport // Loading message + call writestr -_fail: - jmp _fail +fail: + jmp fail nop nop -_switch64: +switch64: call x86_16_SwitchToLong .code64 @@ -119,7 +119,7 @@ _switch64: /* GO! */ xor rcx, rcx - call _BootMain + call BootMain /* Checkpoint */ // mov ax, LMODE_DS @@ -174,14 +174,14 @@ x86_16_BuildPageTables: push es /* Get segment of pml4 */ - mov eax, offset _pml4_startup + mov eax, offset pml4_startup shr eax, 4 mov es, ax cld xor di, di /* One entry in the PML4 pointing to PDP */ - mov eax, offset _pdp_startup + mov eax, offset pdp_startup or eax, 0x00f stosd /* clear rest */ @@ -190,7 +190,7 @@ x86_16_BuildPageTables: rep stosd /* One entry in the PDP pointing to PD */ - mov eax, offset _pd_startup + mov eax, offset pd_startup or eax, 0x00f stosd /* clear rest */ @@ -268,7 +268,7 @@ x86_16_SwitchToLong: mov eax, 0x00a0 // Set PAE and PGE: 10100000b mov cr4, eax - mov edx, offset _pml4_startup // Point cr3 at PML4 + mov edx, offset pml4_startup // Point cr3 at PML4 mov cr3, edx mov ecx, 0xC0000080 // Specify EFER MSR @@ -405,42 +405,42 @@ gdtptr: .long gdt /* Base Address */ -.global _BootDrive -_BootDrive: +.global BootDrive +BootDrive: .long 0 -.global _BootPartition -_BootPartition: +.global BootPartition +BootPartition: .long 0 -.global _NotAnX64Processor -_NotAnX64Processor: +.global NotAnX64Processor +NotAnX64Processor: .ascii "FreeLoader: No x64-compatible CPU detected! Exiting..." .byte 0x0d, 0x0a, 0 -.global _NoCPUIDSupport -_NoCPUIDSupport: +.global NoCPUIDSupport +NoCPUIDSupport: .ascii "FreeLoader: No CPUID instruction support detected! Exiting..." .byte 0x0d, 0x0a, 0 /////////////////////////// Checkpoint messages /////////////////////////////// -.global _CheckPoint0 -_CheckPoint0: +.global CheckPoint0 +CheckPoint0: .ascii "Starting FreeLoader..." .byte 0x0d, 0x0a, 0 -.global _CheckPoint1 -_CheckPoint1: +.global CheckPoint1 +CheckPoint1: .ascii "FreeLoader[16-bit]: building page tables..." .byte 0x0d, 0x0a, 0 -.global _CheckPoint2 -_CheckPoint2: +.global CheckPoint2 +CheckPoint2: .ascii "FreeLoader[16-bit]: checking CPU for x64 long mode..." .byte 0x0d, 0x0a, 0 -.global _CheckPoint3 -_CheckPoint3: +.global CheckPoint3 +CheckPoint3: .ascii "FreeLoader: Switching to x64 long mode..." .byte 0x0d, 0x0a, 0 diff --git a/reactos/boot/freeldr/freeldr/arch/amd64/boot.S b/reactos/boot/freeldr/freeldr/arch/amd64/boot.S index ce7bb355c90..eb3ba3c3c64 100644 --- a/reactos/boot/freeldr/freeldr/arch/amd64/boot.S +++ b/reactos/boot/freeldr/freeldr/arch/amd64/boot.S @@ -24,14 +24,14 @@ #include -EXTERN(_ChainLoadBiosBootSectorCode) +EXTERN(ChainLoadBiosBootSectorCode) .code64 call x86_64_SwitchToReal .code16 /* Set the boot drive */ - mov dl, _BootDrive + mov dl, BootDrive /* Load segment registers */ cli @@ -46,7 +46,7 @@ EXTERN(_ChainLoadBiosBootSectorCode) // ljmpl $0x0000,$0x7C00 jmp 0x7c00:0x0000 -EXTERN(_SoftReboot) +EXTERN(SoftReboot) .code64 call x86_64_SwitchToReal diff --git a/reactos/boot/freeldr/freeldr/arch/amd64/drvmap.S b/reactos/boot/freeldr/freeldr/arch/amd64/drvmap.S index d6b081ca60b..6871fe0f62d 100644 --- a/reactos/boot/freeldr/freeldr/arch/amd64/drvmap.S +++ b/reactos/boot/freeldr/freeldr/arch/amd64/drvmap.S @@ -24,7 +24,7 @@ #include -EXTERN(_DriveMapInt13HandlerStart) +EXTERN(DriveMapInt13HandlerStart) Int13Handler: pushw %bp @@ -82,7 +82,7 @@ CallOldInt13Handler: /* Call old int 13h handler with new drive number */ .byte 0x9a /* lcall */ -EXTERN(_DriveMapOldInt13HandlerAddress) +EXTERN(DriveMapOldInt13HandlerAddress) .word 0 .word 0 @@ -105,7 +105,7 @@ CallersFlags: PassedInDriveNumber: .byte 0 -EXTERN(_DriveMapInt13HandlerMapList) +EXTERN(DriveMapInt13HandlerMapList) Int13HandlerMapCount: .byte 0 @@ -129,4 +129,4 @@ Int13HandlerDrive4: Int13HandlerDriveNew4: .byte 0 -EXTERN(_DriveMapInt13HandlerEnd) +EXTERN(DriveMapInt13HandlerEnd) diff --git a/reactos/boot/freeldr/freeldr/arch/amd64/i386cpu.S b/reactos/boot/freeldr/freeldr/arch/amd64/i386cpu.S index 6dfb91dbf4a..ee3ee6fe256 100644 --- a/reactos/boot/freeldr/freeldr/arch/amd64/i386cpu.S +++ b/reactos/boot/freeldr/freeldr/arch/amd64/i386cpu.S @@ -33,7 +33,7 @@ * 0x00000400: Found 80486 CPU without CPUID support */ -EXTERN(_CpuidSupported) +EXTERN(CpuidSupported) .code32 pushl %ecx /* save ECX */ @@ -80,7 +80,7 @@ NoCpuid: * VOID GetCpuid(U32 Level, U32 *eax, U32 *ebx, U32 *ecx, U32 *edx); */ -EXTERN(_GetCpuid) +EXTERN(GetCpuid) .code32 pushl %ebp @@ -123,7 +123,7 @@ EXTERN(_GetCpuid) * U64 RDTSC(VOID); */ -EXTERN(_RDTSC) +EXTERN(RDTSC) .code32 rdtsc ret diff --git a/reactos/boot/freeldr/freeldr/arch/amd64/i386pnp.S b/reactos/boot/freeldr/freeldr/arch/amd64/i386pnp.S index ff0ae71eb1a..19589275bac 100644 --- a/reactos/boot/freeldr/freeldr/arch/amd64/i386pnp.S +++ b/reactos/boot/freeldr/freeldr/arch/amd64/i386pnp.S @@ -35,7 +35,7 @@ _pnp_bios_entry_point: _pnp_bios_data_segment: .word 0 -EXTERN(_PnpBiosSupported) +EXTERN(PnpBiosSupported) .code64 push rdi @@ -113,7 +113,7 @@ _pnp_node_size: _pnp_node_count: .word 0 -EXTERN(_PnpBiosGetDeviceNodeCount) +EXTERN(PnpBiosGetDeviceNodeCount) .code64 push rbp @@ -182,7 +182,7 @@ _pnp_buffer_offset: _pnp_node_number: .byte 0 -EXTERN(_PnpBiosGetDeviceNode) +EXTERN(PnpBiosGetDeviceNode) .code64 push rbp diff --git a/reactos/boot/freeldr/freeldr/arch/amd64/i386trap.S b/reactos/boot/freeldr/freeldr/arch/amd64/i386trap.S index 833fcc37104..195bf097cd0 100644 --- a/reactos/boot/freeldr/freeldr/arch/amd64/i386trap.S +++ b/reactos/boot/freeldr/freeldr/arch/amd64/i386trap.S @@ -273,7 +273,7 @@ i386CommonExceptionHandler: SAVE_CPU_REGS pushl $SCREEN_ATTR - call _MachVideoClearScreen + call MachVideoClearScreen add $4,%esp movl $i386ExceptionHandlerText,%esi @@ -485,7 +485,7 @@ i386PrintChar: pushl $SCREEN_ATTR andl $0xff,%eax pushl %eax - call _MachVideoPutChar + call MachVideoPutChar addl $16,%esp ret diff --git a/reactos/boot/freeldr/freeldr/arch/amd64/int386.S b/reactos/boot/freeldr/freeldr/arch/amd64/int386.S index 1c1f2dbdf0a..a22e409c61c 100644 --- a/reactos/boot/freeldr/freeldr/arch/amd64/int386.S +++ b/reactos/boot/freeldr/freeldr/arch/amd64/int386.S @@ -63,7 +63,7 @@ Int386_regsout: /* * int Int386(int ivec, REGS* in, REGS* out); */ -EXTERN(_Int386) +EXTERN(Int386) .code64 /* Get the function parameters */ diff --git a/reactos/boot/freeldr/freeldr/arch/amd64/mb.S b/reactos/boot/freeldr/freeldr/arch/amd64/mb.S index 368338ed33b..2d515e90053 100644 --- a/reactos/boot/freeldr/freeldr/arch/amd64/mb.S +++ b/reactos/boot/freeldr/freeldr/arch/amd64/mb.S @@ -29,35 +29,35 @@ * This boots the kernel */ .code64 - .globl _PageDirectoryStart + .globl PageDirectoryStart - .globl _pml4_startup - .globl _pdp_startup - .globl _pd_startup + .globl pml4_startup + .globl pdp_startup + .globl pd_startup - .globl _PageDirectoryEnd + .globl PageDirectoryEnd // // Boot information structure // -EXTERN(_reactos_memory_map_descriptor_size) +EXTERN(reactos_memory_map_descriptor_size) .long 0 -EXTERN(_reactos_memory_map) +EXTERN(reactos_memory_map) .rept (32 * /*sizeof(memory_map_t)*/24) .byte 0 .endr .bss -_PageDirectoryStart: -_pml4_startup: +PageDirectoryStart: +pml4_startup: .fill 4096, 1, 0 -_pdp_startup: +pdp_startup: .fill 4096, 1, 0 -_pd_startup: +pd_startup: .fill 4096, 1, 0 -_PageDirectoryEnd: +PageDirectoryEnd: diff --git a/reactos/hal/halx86/generic/amd64/irq.S b/reactos/hal/halx86/generic/amd64/irq.S index 15934cde4dd..55f20b93d00 100644 --- a/reactos/hal/halx86/generic/amd64/irq.S +++ b/reactos/hal/halx86/generic/amd64/irq.S @@ -7,65 +7,40 @@ /* INCLUDES ******************************************************************/ -#include -#include -.intel_syntax noprefix - -.macro UNIMPLEMENTED func - jmp 2f -1: - .ascii "Sorry, asm function " - .ascii func - .ascii " is unimplemented!\n\0" -2: - movabs rcx, offset 1b - call _DbgPrint - ret -.endm - - - -/* GLOBALS *******************************************************************/ - +#include +#include /* FUNCTIONS *****************************************************************/ -.global _HalEnableInterrupt -.func _HalEnableInterrupt -_HalEnableInterrupt: - UNIMPLEMENTED "HalEnableInterrupt" -.endfunc +PUBLIC HalEnableInterrupt +HalEnableInterrupt: + UNIMPLEMENTED HalEnableInterrupt + ret -.global _HalDisableInterrupt -.func _HalDisableInterrupt -_HalDisableInterrupt: - UNIMPLEMENTED "HalDisableInterrupt" -.endfunc +PUBLIC HalDisableInterrupt +HalDisableInterrupt: + UNIMPLEMENTED HalDisableInterrupt + ret -.global _HalRequestSoftwareInterrupt -.func _HalRequestSoftwareInterrupt -_HalRequestSoftwareInterrupt: - UNIMPLEMENTED "HalRequestSoftwareInterrupt" -.endfunc +PUBLIC HalRequestSoftwareInterrupt +HalRequestSoftwareInterrupt: + UNIMPLEMENTED HalRequestSoftwareInterrupt + ret -.global _HalSendSoftwareInterrupt -.func _HalSendSoftwareInterrupt -_HalSendSoftwareInterrupt: - UNIMPLEMENTED "HalSendSoftwareInterrupt" -.endfunc +PUBLIC HalSendSoftwareInterrupt +HalSendSoftwareInterrupt: + UNIMPLEMENTED HalSendSoftwareInterrupt + ret -.global _HalEndSystemInterrupt -.func _HalEndSystemInterrupt -_HalEndSystemInterrupt: - UNIMPLEMENTED "HalEndSystemInterrupt" -.endfunc +PUBLIC HalEndSystemInterrupt +HalEndSystemInterrupt: + UNIMPLEMENTED HalEndSystemInterrupt + ret - -.globl _HalClearSoftwareInterrupt -.func _HalClearSoftwareInterrupt -_HalClearSoftwareInterrupt: - UNIMPLEMENTED "HalClearSoftwareInterrupt" +PUBLIC HalClearSoftwareInterrupt +HalClearSoftwareInterrupt: + UNIMPLEMENTED HalClearSoftwareInterrupt /* Get IRR mask */ mov eax, 1 @@ -75,11 +50,8 @@ _HalClearSoftwareInterrupt: /* Set IRR */ // and gs:[KPCR_IRR], eax ret -.endfunc - -.globl _HalBeginSystemInterrupt -.func _HalBeginSystemInterrupt -_HalBeginSystemInterrupt: - UNIMPLEMENTED "HalBeginSystemInterrupt" -.endfunc +PUBLIC HalBeginSystemInterrupt +HalBeginSystemInterrupt: + UNIMPLEMENTED HalBeginSystemInterrupt + ret diff --git a/reactos/hal/halx86/generic/amd64/systimer.S b/reactos/hal/halx86/generic/amd64/systimer.S index 2a7dcff56f3..3041d734956 100644 --- a/reactos/hal/halx86/generic/amd64/systimer.S +++ b/reactos/hal/halx86/generic/amd64/systimer.S @@ -7,8 +7,8 @@ /* INCLUDES ******************************************************************/ -#include -#include +#include +#include /* GLOBALS *******************************************************************/ @@ -24,22 +24,16 @@ _MsgUnimplemented: .text .code64 -.global _HalpCalibrateStallExecution@0 -.func HalpCalibrateStallExecution@0 -_HalpCalibrateStallExecution@0: - -.endfunc - -.globl _HalpProfileInterrupt -.func HalpProfileInterrupt -_HalpProfileInterrupt: - -.endfunc +PUBLIC HalpCalibrateStallExecution@0 +HalpCalibrateStallExecution@0: -.globl _KeStallExecutionProcessor -.func KeStallExecutionProcessor -_KeStallExecutionProcessor: +PUBLIC HalpProfileInterrupt +HalpProfileInterrupt: + + +PUBLIC KeStallExecutionProcessor +KeStallExecutionProcessor: /* Get the number of microseconds required */ jecxz Done @@ -65,12 +59,10 @@ SubtractLoop: Done: /* Return */ ret 4 -.endfunc -.globl _HalpQuery8254Counter -.func HalpQuery8254Counter -_HalpQuery8254Counter: +PUBLIC HalpQuery8254Counter +HalpQuery8254Counter: /* Save EFLAGS and disable interrupts */ pushfq @@ -92,12 +84,9 @@ _HalpQuery8254Counter: mov eax, ecx popfq ret -.endfunc -.globl _HalpClockInterrupt -.func HalpClockInterrupt -_HalpClockInterrupt: +PUBLIC HalpClockInterrupt +HalpClockInterrupt: UNIMPLEMENTED _HalpClockInterrupt iret -.endfunc diff --git a/reactos/hal/halx86/mp/amd64/mps.S b/reactos/hal/halx86/mp/amd64/mps.S index 219d651498c..35436520ae6 100644 --- a/reactos/hal/halx86/mp/amd64/mps.S +++ b/reactos/hal/halx86/mp/amd64/mps.S @@ -8,84 +8,85 @@ /* INCLUDES ******************************************************************/ -#include +#include +#include /* FUNCTIONS *****************************************************************/ #define BEFORE \ cld; \ - pushq %rax; \ - pushq %rbx; \ - pushq %rcx; \ - pushq %rdx; \ - pushq %rsi; \ - pushq %rdi; \ - pushq %fs; \ - pushq %gs; \ + push rax; \ + push rbx; \ + push rcx; \ + push rdx; \ + push rsi; \ + push rdi; \ + push fs; \ + push gs; \ #define AFTER \ - popq %gs; \ - popq %fs; \ - popq %rdi; \ - popq %rsi; \ - popq %rdx; \ - popq %rcx; \ - popq %rbx; \ - popq %rax; \ + pop gs; \ + pop fs; \ + pop rdi; \ + pop rsi; \ + pop rdx; \ + pop rcx; \ + pop rbx; \ + pop rax; \ #ifdef CONFIG_SMP -.global _MpsIpiInterrupt -_MpsIpiInterrupt: +PUBLIC MpsIpiInterrupt +MpsIpiInterrupt: /* Save registers */ BEFORE /* Call the C handler */ - call _MpsIpiHandler + call MpsIpiHandler /* Return to the caller */ AFTER iret #endif -.globl _MpsErrorInterrupt -_MpsErrorInterrupt: +PUBLIC MpsErrorInterrupt +MpsErrorInterrupt: /* Save registers */ BEFORE /* Call the C handler */ - call _MpsErrorHandler + call MpsErrorHandler /* Return to the caller */ AFTER iret -.globl _MpsSpuriousInterrupt -_MpsSpuriousInterrupt: +PUBLIC MpsSpuriousInterrupt +MpsSpuriousInterrupt: /* Save registers */ BEFORE /* Call the C handler */ - call _MpsSpuriousHandler + call MpsSpuriousHandler /* Return to the caller */ AFTER iret -.global _MpsTimerInterrupt -_MpsTimerInterrupt: +PUBLIC MpsTimerInterrupt +MpsTimerInterrupt: /* Save registers */ BEFORE - movl $0xef,%ebx - movl $0xceafbeef,%eax - pushq %rax - pushq %rsp - pushq %rbx - call _MpsTimerHandler - popq %rax - popq %rax - popq %rax + mov ebx, 0xef + mov eax, 0xceafbeef + push rax + push rsp + push rbx + call MpsTimerHandler + pop rax + pop rax + pop rax /* Return to the caller */ AFTER diff --git a/reactos/include/reactos/asm.h b/reactos/include/reactos/asm.h index d0a911ec792..42b55783f66 100644 --- a/reactos/include/reactos/asm.h +++ b/reactos/include/reactos/asm.h @@ -24,8 +24,9 @@ rip = 0 #define MACRO(name, ...) name MACRO __VA_ARGS__ /* To avoid reverse syntax we provide a new macro .PROC, replacing PROC... */ -.PROC MACRO namex - namex PROC FRAME +.PROC MACRO name + name PROC FRAME + _name: ENDM /* ... and .ENDP, replacing ENDP */ @@ -43,6 +44,16 @@ ENDM DB text, 0 ENDM +.text MACRO +ENDM + +.code64 MACRO + .code +ENDM + +UNIMPLEMENTED MACRO name +ENDM + /* We need this to distinguish repeat from macros */ #define ENDR ENDM @@ -79,7 +90,9 @@ ENDM .endm /* MASM compatible PUBLIC */ -#define PUBLIC .global +.macro PUBLIC symbol + .global \symbol +.endm /* MASM compatible ALIGN */ #define ALIGN .align @@ -148,7 +161,7 @@ code = 1 lea rdx, 1b[rip] lea r8, 2b[rip] mov r9, \line - call _DbgPrint + call DbgPrint add rsp, 0x20 .endm #define UNIMPLEMENTED UNIMPLEMENTED2 __FILE__, __LINE__, diff --git a/reactos/lib/drivers/oskittcp/include/freebsd/src/sys/sys/kernel.h b/reactos/lib/drivers/oskittcp/include/freebsd/src/sys/sys/kernel.h index 2d42aee9f5c..18f031a900c 100644 --- a/reactos/lib/drivers/oskittcp/include/freebsd/src/sys/sys/kernel.h +++ b/reactos/lib/drivers/oskittcp/include/freebsd/src/sys/sys/kernel.h @@ -83,9 +83,14 @@ extern long timedelta; #ifdef _MSC_VER #define MAKE_SET(set, sym, type) #else +#if defined(_M_AMD64) +#define MAKE_SET(set, sym, type) \ + asm(".stabs \"" #set "\", " #type ", 0, 0, " #sym) +#else #define MAKE_SET(set, sym, type) \ asm(".stabs \"_" #set "\", " #type ", 0, 0, _" #sym) #endif +#endif #define TEXT_SET(set, sym) MAKE_SET(set, sym, 23) #define DATA_SET(set, sym) MAKE_SET(set, sym, 25) #define BSS_SET(set, sym) MAKE_SET(set, sym, 27) diff --git a/reactos/lib/rtl/amd64/debug_asm.S b/reactos/lib/rtl/amd64/debug_asm.S index 82c96474b2b..c115feb12fc 100644 --- a/reactos/lib/rtl/amd64/debug_asm.S +++ b/reactos/lib/rtl/amd64/debug_asm.S @@ -3,54 +3,47 @@ * PROJECT: ReactOS Run-Time Library * PURPOSE: Debug Routines * FILE: lib/rtl/i386/debug.S - * PROGRAMER: Alex Ionescu (alex@relsoft.net) + * PROGRAMER: Timo Kreuzer (timo.kreuzer@reactos.org) */ -.intel_syntax noprefix +#include /* GLOBALS ****************************************************************/ -.globl _DbgBreakPoint -.globl _DbgBreakPointWithStatus -.globl _DbgUserBreakPoint -.globl _DebugService -.globl _DebugService2 -.globl _DbgBreakPointNoBugCheck -.globl _RtlpBreakWithStatusInstruction +PUBLIC DbgBreakPoint +PUBLIC DbgBreakPointWithStatus +PUBLIC DbgUserBreakPoint +PUBLIC DebugService +PUBLIC DebugService2 +PUBLIC DbgBreakPointNoBugCheck +PUBLIC RtlpBreakWithStatusInstruction /* FUNCTIONS ***************************************************************/ -.func DbgBreakPointNoBugCheck -_DbgBreakPointNoBugCheck: +.code64 + +DbgBreakPointNoBugCheck: int 3 ret -.endfunc -.func DbgBreakPoint -_DbgBreakPoint: -_DbgUserBreakPoint: +DbgBreakPoint: +DbgUserBreakPoint: int 3 ret -.endfunc -.func DbgBreakPointWithStatus -_DbgBreakPointWithStatus: +DbgBreakPointWithStatus: mov eax, ecx - -_RtlpBreakWithStatusInstruction: +RtlpBreakWithStatusInstruction: int 3 ret -.endfunc -.func DebugService2 -_DebugService2: +DebugService2: ret /* Call the interrupt */ // mov eax, [rbp+8] // int 0x2D // int 3 -.endfunc /****************************************************************************** * NTSTATUS NTAPI DebugService( @@ -60,8 +53,7 @@ _DebugService2: * IN PVOID Argument1, // = [rsp + 32] * IN PVOID Argument2); // [rsp + 40] */ -.func DebugService -_DebugService: +DebugService: /* Prepare registers for interrupt */ mov eax, ecx // Service @@ -71,9 +63,10 @@ _DebugService: mov r9, [rsp + 40] // Argument2 /* Call the Interrupt */ - int 0x2D + int HEX(2D) int 3 /* Return */ ret -.endfunc + +END diff --git a/reactos/lib/rtl/amd64/except_asm.S b/reactos/lib/rtl/amd64/except_asm.S index 2937335a45d..a4b35079fcd 100644 --- a/reactos/lib/rtl/amd64/except_asm.S +++ b/reactos/lib/rtl/amd64/except_asm.S @@ -8,24 +8,25 @@ /* INCLUDES ******************************************************************/ -#include -.intel_syntax noprefix +#include +#include /* FUNCTIONS *****************************************************************/ +.code64 + /* * VOID NTAPI * RtlCaptureContext( * PCONTEXT ContextRecord); */ -.func RtlCaptureContext -.global _RtlCaptureContext -_RtlCaptureContext: - .cfi_startproc +PUBLIC RtlCaptureContext +.PROC RtlCaptureContext /* Push rflags */ pushfq - .cfi_adjust_cfa_offset 8 + .ALLOCSTACK 8 + .ENDPROLOG /* Save the basic register context */ mov [rcx + CONTEXT_Rax], rax @@ -47,7 +48,7 @@ _RtlCaptureContext: mov [rcx + CONTEXT_R9], r9 /* Load former stack pointer in rax */ - lea rax, [rsp + 0x10] + lea rax, [rsp + 16] mov [rcx + CONTEXT_R10], r10 mov [rcx + CONTEXT_R11], r11 @@ -95,6 +96,8 @@ _RtlCaptureContext: /* Cleanup stack and return */ add rsp, 8 ret - .cfi_endproc -.endfunc +.ENDP RtlCaptureContext + +END + diff --git a/reactos/lib/rtl/amd64/rtlmem.S b/reactos/lib/rtl/amd64/rtlmem.S index 81154735373..d0a82068251 100644 --- a/reactos/lib/rtl/amd64/rtlmem.S +++ b/reactos/lib/rtl/amd64/rtlmem.S @@ -8,10 +8,12 @@ /* INCLUDES ******************************************************************/ -#include +#include +#include /* FUNCTIONS *****************************************************************/ -.intel_syntax noprefix + +.code64 /* SIZE_T * RtlCompareMemory( @@ -27,6 +29,7 @@ .pushreg rsi push rdi .pushreg rdi + .ENDPROLOG /* Setup registers for compare */ mov rsi, rcx @@ -38,41 +41,48 @@ /* Get number of qwords */ mov rcx, r8 shr rcx, 3 - jz 2f + jz RtlCompareMemory2 /* Compare qwords */ repe cmpsq - jnz 4f + jnz RtlCompareMemory4 -2: /* Compare rest */ +RtlCompareMemory2: + /* Compare rest */ mov rcx, r8 and rcx, 7 - jz 3f + jz RtlCompareMemory3 repe cmpsb - jnz 5f + jnz RtlCompareMemory5 -3: /* All equal */ +RtlCompareMemory3: + /* All equal */ /* Return the full count */ mov rax, rcx - jmp 6f + jmp RtlCompareMemory6 -4: /* Not equal after comparing qwords */ +RtlCompareMemory4: + /* Not equal after comparing qwords */ /* Compare the last qword */ sub rsi, 8 sub rdi, 8 mov rcx, 8 repe cmpsb -5: /* Not equal after comparing bytes */ +RtlCompareMemory5: + /* Not equal after comparing bytes */ /* Return difference */ sub rdi, rdx dec rdi mov rax, rdi -6: /* Cleanup and return */ +RtlCompareMemory6: + /* Cleanup and return */ pop rdi pop rsi ret -.endproc +.endp RtlCompareMemory + +END diff --git a/reactos/lib/rtl/amd64/slist.S b/reactos/lib/rtl/amd64/slist.S index 3488fb5a8f3..766813667d5 100644 --- a/reactos/lib/rtl/amd64/slist.S +++ b/reactos/lib/rtl/amd64/slist.S @@ -6,9 +6,8 @@ * PROGRAMMERS: Timo Kreuzer */ -#include -#include -.intel_syntax noprefix +#include +#include #define SLIST8A_DEPTH_MASK 0x000000000000FFFF #define SLIST8A_DEPTH_INC 0x0000000000000001 @@ -32,15 +31,15 @@ /* FUNCTIONS ****************************************************************/ -.global _ExpInterlockedPopEntrySList -.global _ExpInterlockedPopEntrySListResume -.global _ExpInterlockedPopEntrySListFault -.global _ExpInterlockedPopEntrySListEnd -.global _ExpInterlockedPopEntrySListResume16 -.global _ExpInterlockedPopEntrySListFault16 -.global _ExpInterlockedPopEntrySListEnd16 -.global _ExpInterlockedPushEntrySList -.global _ExpInterlockedFlushSList +.global ExpInterlockedPopEntrySList +.global ExpInterlockedPopEntrySListResume +.global ExpInterlockedPopEntrySListFault +.global ExpInterlockedPopEntrySListEnd +.global ExpInterlockedPopEntrySListResume16 +.global ExpInterlockedPopEntrySListFault16 +.global ExpInterlockedPopEntrySListEnd16 +.global ExpInterlockedPushEntrySList +.global ExpInterlockedFlushSList /* PSLIST_ENTRY * NTAPI @@ -48,7 +47,7 @@ * IN PSLIST_HEADER ListHead); */ .proc RtlInterlockedPopEntrySList -_ExpInterlockedPopEntrySList: +ExpInterlockedPopEntrySList: /* Load ListHead->Region into rdx */ mov rdx, [rcx + 8] @@ -58,16 +57,16 @@ _ExpInterlockedPopEntrySList: /* Check what kind of header this is */ test rdx, SLIST8B_HEADERTYPE_MASK - jnz _RtlInterlockedPopEntrySList16 + jnz RtlInterlockedPopEntrySList16 /* We have an 8 byte header */ -_ExpInterlockedPopEntrySListResume: +ExpInterlockedPopEntrySListResume: /* Check if ListHead->NextEntry is NULL */ mov r9, rax and r9, SLIST8A_NEXTENTRY_MASK - jz _RtlInterlockedPopEntrySListEmpty + jz RtlInterlockedPopEntrySListEmpty /* Copy Depth and Sequence number and adjust Depth */ lea r8, [rax - SLIST8A_DEPTH_INC] @@ -83,7 +82,7 @@ _ExpInterlockedPopEntrySListResume: /* Combine to new pointer in rdx */ or rdx, r9 -_ExpInterlockedPopEntrySListFault: +ExpInterlockedPopEntrySListFault: /* Load the next NextEntry pointer to r9 */ mov r9, [rdx] @@ -94,13 +93,13 @@ _ExpInterlockedPopEntrySListFault: /* Combine into r8 */ or r8, r9 -_ExpInterlockedPopEntrySListEnd: +ExpInterlockedPopEntrySListEnd: /* If [rcx] equals rax, exchange it with r8 */ lock cmpxchg [rcx], r8 /* If not equal, retry with rax, being the content of [rcx] now */ - jnz _ExpInterlockedPopEntrySListResume + jnz ExpInterlockedPopEntrySListResume /* Shift the pointer bits in place */ and rax, SLIST8A_NEXTENTRY_MASK @@ -114,11 +113,11 @@ _ExpInterlockedPopEntrySListEnd: or rax, rdx ret -_RtlInterlockedPopEntrySListEmpty: +RtlInterlockedPopEntrySListEmpty: xor rax, rax ret -_RtlInterlockedPopEntrySList16: +RtlInterlockedPopEntrySList16: /* This is a 16 byte header */ /* Save rbx */ @@ -127,14 +126,14 @@ _RtlInterlockedPopEntrySList16: /* Copy rcx to r8, as we need rcx for the exchange */ mov r8, rcx -_ExpInterlockedPopEntrySListResume16: +ExpInterlockedPopEntrySListResume16: /* Check if ListHead->NextEntry is NULL */ mov r9, rdx and r9, SLIST16B_NEXTENTY_MASK - jz _RtlInterlockedPopEntrySListEmpty16 + jz RtlInterlockedPopEntrySListEmpty16 -_ExpInterlockedPopEntrySListFault16: +ExpInterlockedPopEntrySListFault16: /* Get next pointer */ mov rcx, [r9] @@ -145,13 +144,13 @@ _ExpInterlockedPopEntrySListFault16: /* Copy Depth and Sequence number and adjust Depth */ lea rbx, [rax - SLIST16A_DEPTH_INC] -_ExpInterlockedPopEntrySListEnd16: +ExpInterlockedPopEntrySListEnd16: /* If [r8] equals rdx:rax, exchange it with rcx:rbx */ lock cmpxchg16b [r8] /* If not equal, retry with rdx:rax, being the content of [r8] now */ - jnz _ExpInterlockedPopEntrySListResume16 + jnz ExpInterlockedPopEntrySListResume16 /* Copy the old NextEntry pointer to rax */ mov rax, rdx @@ -161,12 +160,12 @@ _ExpInterlockedPopEntrySListEnd16: pop rbx ret -_RtlInterlockedPopEntrySListEmpty16: +RtlInterlockedPopEntrySListEmpty16: xor rax, rax pop rbx ret -.endproc +.endp RtlInterlockedPopEntrySList /* PSLIST_ENTRY @@ -176,7 +175,7 @@ _RtlInterlockedPopEntrySListEmpty16: * IN PSLIST_ENTRY ListEntry); */ .proc RtlInterlockedPushEntrySList -_ExpInterlockedPushEntrySList: +ExpInterlockedPushEntrySList: /* Load ListHead->Alignment into rax */ mov rax, [rcx] @@ -186,16 +185,16 @@ _ExpInterlockedPushEntrySList: /* Check what kind of header this is */ test r9, SLIST8B_HEADERTYPE_MASK - jnz _RtlInterlockedPushEntrySList16 + jnz RtlInterlockedPushEntrySList16 /* We have an 8 byte header */ -_RtlInterlockedPushEntrySListLoop: +RtlInterlockedPushEntrySListLoop: /* Get ListHead->NextEntry */ mov r8, rax and r8, SLIST8A_NEXTENTRY_MASK - jz _RtlInterlockedPushEntrySListEmpty + jz RtlInterlockedPushEntrySListEmpty /* Shift the NextEntry pointer */ shr r8, SLIST8A_NEXTENTRY_SHIFT @@ -207,7 +206,7 @@ _RtlInterlockedPushEntrySListLoop: /* Combine to new pointer and save as ListEntry->NextEntry */ or r8, r9 -_RtlInterlockedPushEntrySListEmpty: +RtlInterlockedPushEntrySListEmpty: /* Store the NextEntry pointer in the new ListEntry */ mov [rdx], r8 @@ -230,13 +229,13 @@ _RtlInterlockedPushEntrySListEmpty: lock cmpxchg [rcx], r8 /* If not equal, retry with rax, being the content of [rcx] now */ - jnz _RtlInterlockedPushEntrySListLoop + jnz RtlInterlockedPushEntrySListLoop /* Return the old NextEntry pointer */ mov rax, r9 ret -_RtlInterlockedPushEntrySList16: +RtlInterlockedPushEntrySList16: /* This is a 16 byte header */ /* Save rbx */ @@ -252,7 +251,7 @@ _RtlInterlockedPushEntrySList16: mov rdx, [r8 + 8] -_RtlInterlockedPushEntrySListLoop16: +RtlInterlockedPushEntrySListLoop16: /* Move ListHead->NextEntry to rbx */ mov rbx, rdx @@ -268,7 +267,7 @@ _RtlInterlockedPushEntrySListLoop16: lock cmpxchg16b [r8] /* If not equal, retry with rdx:rax, being the content of [r8] now */ - jnz _RtlInterlockedPushEntrySListLoop16 + jnz RtlInterlockedPushEntrySListLoop16 /* Copy the old NextEntry pointer to rax */ mov rax, rdx @@ -278,7 +277,7 @@ _RtlInterlockedPushEntrySListLoop16: pop rbx ret -.endproc +.endp RtlInterlockedPushEntrySList /* PSLIST_ENTRY * NTAPI @@ -286,18 +285,18 @@ _RtlInterlockedPushEntrySListLoop16: * IN PSINGLE_LIST_ENTRY ListHead); */ .proc RtlInterlockedFlushSList -_ExpInterlockedFlushSList: +ExpInterlockedFlushSList: /* Load ListHead->Region into rdx */ mov rax, [rcx + 8] /* Check what kind of header this is */ test rax, SLIST8B_HEADERTYPE_MASK - jnz _RtlInterlockedFlushSList16 + jnz RtlInterlockedFlushSList16 /* We have an 8 byte header */ -_RtlInterlockedFlushSListLoop: +RtlInterlockedFlushSListLoop: /* Zero ListHead->Alignment */ xor r8, r8 @@ -306,7 +305,7 @@ _RtlInterlockedFlushSListLoop: lock cmpxchg [rcx], r8 /* If not equal, retry with rax, being the content of [rcx] now */ - jnz _RtlInterlockedFlushSListLoop + jnz RtlInterlockedFlushSListLoop /* Use rcx as pointer template */ mov rdx, ~SLIST8_POINTER_MASK @@ -316,7 +315,7 @@ _RtlInterlockedFlushSListLoop: or rax, rdx ret -_RtlInterlockedFlushSList16: +RtlInterlockedFlushSList16: /* We have a 16 byte header */ push rbx @@ -324,13 +323,13 @@ _RtlInterlockedFlushSList16: xor rbx, rbx mov rcx, 0x3 -_RtlInterlockedFlushSListLoop16: +RtlInterlockedFlushSListLoop16: /* If [r8] equals rdx:rax, exchange it with rcx:rbx */ lock cmpxchg16b [r8] /* If not equal, retry with rdx:rax, being the content of [r8] now */ - jnz _RtlInterlockedFlushSListLoop16 + jnz RtlInterlockedFlushSListLoop16 /* Copy the old NextEntry pointer to rax */ mov rax, rdx @@ -340,4 +339,4 @@ _RtlInterlockedFlushSListLoop16: pop rbx ret -.endproc +.endp RtlInterlockedFlushSList diff --git a/reactos/lib/sdk/crt/except/amd64/chkstk_asm.s b/reactos/lib/sdk/crt/except/amd64/chkstk_asm.s index 9501c3555ef..c0c59b88cd7 100644 --- a/reactos/lib/sdk/crt/except/amd64/chkstk_asm.s +++ b/reactos/lib/sdk/crt/except/amd64/chkstk_asm.s @@ -8,8 +8,7 @@ /* INCLUDES ******************************************************************/ -#include -#include +#include .intel_syntax noprefix @@ -21,11 +20,11 @@ _MsgUnimplemented: .proc _chkstk UNIMPLEMENTED chkstk ret -.endproc +.endp .proc _alloca_probe UNIMPLEMENTED alloca_probe ret -.endproc +.endp /* EOF */ diff --git a/reactos/lib/sdk/crt/math/amd64/alldiv.S b/reactos/lib/sdk/crt/math/amd64/alldiv.S index 7221f5cc6b0..831ef50981b 100644 --- a/reactos/lib/sdk/crt/math/amd64/alldiv.S +++ b/reactos/lib/sdk/crt/math/amd64/alldiv.S @@ -8,21 +8,21 @@ /* INCLUDES ******************************************************************/ +#include #include -#include - -.intel_syntax noprefix /* DATA *********************************************************************/ - .globl __fltused -__fltused: +PUBLIC _fltused +_fltused: .long 0x9875 /* FUNCTIONS ****************************************************************/ +.code64 + .proc alldiv UNIMPLEMENTED alldiv ret -.endproc +.endp alldiv diff --git a/reactos/lib/sdk/crt/math/amd64/atan.S b/reactos/lib/sdk/crt/math/amd64/atan.S index ef871c356fb..3ba194931f4 100644 --- a/reactos/lib/sdk/crt/math/amd64/atan.S +++ b/reactos/lib/sdk/crt/math/amd64/atan.S @@ -8,14 +8,14 @@ /* INCLUDES ******************************************************************/ +#include #include -#include -.intel_syntax noprefix +/* FUNCTIONS ****************************************************************/ +.code64 -.proc atan +PUBLIC atan +atan: UNIMPLEMENTED atan ret - -.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/atan2.S b/reactos/lib/sdk/crt/math/amd64/atan2.S index 15ac4b8422c..7cd29b93269 100644 --- a/reactos/lib/sdk/crt/math/amd64/atan2.S +++ b/reactos/lib/sdk/crt/math/amd64/atan2.S @@ -8,14 +8,14 @@ /* INCLUDES ******************************************************************/ +#include #include -#include -.intel_syntax noprefix +/* FUNCTIONS ****************************************************************/ +.code64 -.proc atan2 +PUBLIC atan2 +atan2: UNIMPLEMENTED atan2 ret - -.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/ceil.S b/reactos/lib/sdk/crt/math/amd64/ceil.S index 1948364686e..dbee413f491 100644 --- a/reactos/lib/sdk/crt/math/amd64/ceil.S +++ b/reactos/lib/sdk/crt/math/amd64/ceil.S @@ -8,14 +8,15 @@ /* INCLUDES ******************************************************************/ +#include #include -#include -.intel_syntax noprefix +/* FUNCTIONS ****************************************************************/ +.code64 -.proc ceil +PUBLIC ceil +ceil: UNIMPLEMENTED ceil ret -.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/ceilf.S b/reactos/lib/sdk/crt/math/amd64/ceilf.S index 9c887798d71..e3a948fff8a 100644 --- a/reactos/lib/sdk/crt/math/amd64/ceilf.S +++ b/reactos/lib/sdk/crt/math/amd64/ceilf.S @@ -8,13 +8,15 @@ /* INCLUDES ******************************************************************/ +#include #include -#include -.intel_syntax noprefix +/* FUNCTIONS ****************************************************************/ +.code64 -.proc ceilf +PUBLIC ceilf +ceilf: /* Put parameter on the stack */ movss [rsp - 0x10], xmm0 fld dword ptr [rsp] @@ -36,5 +38,3 @@ fstp dword ptr [rsp - 0x10] movss xmm0, [rsp - 0x10] ret - -.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/exp.S b/reactos/lib/sdk/crt/math/amd64/exp.S index bd4a8d0e69b..ca3dc993182 100644 --- a/reactos/lib/sdk/crt/math/amd64/exp.S +++ b/reactos/lib/sdk/crt/math/amd64/exp.S @@ -8,14 +8,15 @@ /* INCLUDES ******************************************************************/ +#include #include -#include -.intel_syntax noprefix +/* FUNCTIONS ****************************************************************/ +.code64 -.proc exp +PUBLIC exp +exp: UNIMPLEMENTED exp ret -.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/fabs.S b/reactos/lib/sdk/crt/math/amd64/fabs.S index 2282de1488d..e58b960ecab 100644 --- a/reactos/lib/sdk/crt/math/amd64/fabs.S +++ b/reactos/lib/sdk/crt/math/amd64/fabs.S @@ -8,14 +8,15 @@ /* INCLUDES ******************************************************************/ +#include #include -#include -.intel_syntax noprefix +/* FUNCTIONS ****************************************************************/ +.code64 -.proc fabs +PUBLIC fabs +fabs: UNIMPLEMENTED fabs ret -.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/floor.S b/reactos/lib/sdk/crt/math/amd64/floor.S index a08e4fc84ed..f1c3b9305af 100644 --- a/reactos/lib/sdk/crt/math/amd64/floor.S +++ b/reactos/lib/sdk/crt/math/amd64/floor.S @@ -8,14 +8,14 @@ /* INCLUDES ******************************************************************/ +#include #include -#include -.intel_syntax noprefix +/* FUNCTIONS ****************************************************************/ +.code64 -.proc floor +PUBLIC floor +floor: UNIMPLEMENTED floor ret - -.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/floorf.S b/reactos/lib/sdk/crt/math/amd64/floorf.S index 900f8e62024..e2d02202df7 100644 --- a/reactos/lib/sdk/crt/math/amd64/floorf.S +++ b/reactos/lib/sdk/crt/math/amd64/floorf.S @@ -8,13 +8,15 @@ /* INCLUDES ******************************************************************/ +#include #include -#include -.intel_syntax noprefix +/* FUNCTIONS ****************************************************************/ +.code64 -.proc floorf +PUBLIC floorf +floorf: /* Put parameter on the stack */ movss [rsp - 0x10], xmm0 fld dword ptr [rsp] @@ -36,5 +38,3 @@ fstp dword ptr [rsp - 0x10] movss xmm0, [rsp - 0x10] ret - -.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/fmod.S b/reactos/lib/sdk/crt/math/amd64/fmod.S index 1ad26d93511..4ca67f55bfb 100644 --- a/reactos/lib/sdk/crt/math/amd64/fmod.S +++ b/reactos/lib/sdk/crt/math/amd64/fmod.S @@ -8,14 +8,12 @@ /* INCLUDES ******************************************************************/ +#include #include -#include -.intel_syntax noprefix +/* DATA *********************************************************************/ - -.proc fmod +PUBLIC fmod +fmod: UNIMPLEMENTED fmod ret - -.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/fmodf.S b/reactos/lib/sdk/crt/math/amd64/fmodf.S index 966ceffec40..e109c387cc8 100644 --- a/reactos/lib/sdk/crt/math/amd64/fmodf.S +++ b/reactos/lib/sdk/crt/math/amd64/fmodf.S @@ -8,14 +8,12 @@ /* INCLUDES ******************************************************************/ +#include #include -#include -.intel_syntax noprefix +/* DATA *********************************************************************/ - -.proc fmodf +PUBLIC fmodf +fmodf: UNIMPLEMENTED fmodf ret - -.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/ldexp.S b/reactos/lib/sdk/crt/math/amd64/ldexp.S index 9d4649c66eb..d0265629bf6 100644 --- a/reactos/lib/sdk/crt/math/amd64/ldexp.S +++ b/reactos/lib/sdk/crt/math/amd64/ldexp.S @@ -8,14 +8,12 @@ /* INCLUDES ******************************************************************/ +#include #include -#include -.intel_syntax noprefix +/* DATA *********************************************************************/ - -.proc ldexp +PUBLIC ldexp +ldexp: UNIMPLEMENTED ldexp ret - -.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/log.S b/reactos/lib/sdk/crt/math/amd64/log.S index f4190d3e286..9fa02763b9e 100644 --- a/reactos/lib/sdk/crt/math/amd64/log.S +++ b/reactos/lib/sdk/crt/math/amd64/log.S @@ -8,14 +8,12 @@ /* INCLUDES ******************************************************************/ +#include #include -#include -.intel_syntax noprefix +/* DATA *********************************************************************/ - -.proc log +PUBLIC log +log: UNIMPLEMENTED log ret - -.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/log10.S b/reactos/lib/sdk/crt/math/amd64/log10.S index 1f9c77aaf5f..007f0d80e98 100644 --- a/reactos/lib/sdk/crt/math/amd64/log10.S +++ b/reactos/lib/sdk/crt/math/amd64/log10.S @@ -8,14 +8,13 @@ /* INCLUDES ******************************************************************/ +#include #include -#include -.intel_syntax noprefix +/* DATA *********************************************************************/ - -.proc log10 +PUBLIC log10 +log10: UNIMPLEMENTED log10 ret -.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/pow.S b/reactos/lib/sdk/crt/math/amd64/pow.S index 05ef3f9c693..37988801b11 100644 --- a/reactos/lib/sdk/crt/math/amd64/pow.S +++ b/reactos/lib/sdk/crt/math/amd64/pow.S @@ -8,14 +8,13 @@ /* INCLUDES ******************************************************************/ +#include #include -#include -.intel_syntax noprefix +/* DATA *********************************************************************/ - -.proc pow +PUBLIC pow +pow: UNIMPLEMENTED pow ret -.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/sqrt.S b/reactos/lib/sdk/crt/math/amd64/sqrt.S index 48db2fde91e..758d8768d4f 100644 --- a/reactos/lib/sdk/crt/math/amd64/sqrt.S +++ b/reactos/lib/sdk/crt/math/amd64/sqrt.S @@ -8,14 +8,12 @@ /* INCLUDES ******************************************************************/ +#include #include -#include -.intel_syntax noprefix +/* DATA *********************************************************************/ - -.proc sqrt +PUBLIC sqrt +sqrt: UNIMPLEMENTED sqrt ret - -.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/sqrtf.S b/reactos/lib/sdk/crt/math/amd64/sqrtf.S index 50ea81033ac..a4ee3fa6cc5 100644 --- a/reactos/lib/sdk/crt/math/amd64/sqrtf.S +++ b/reactos/lib/sdk/crt/math/amd64/sqrtf.S @@ -8,13 +8,12 @@ /* INCLUDES ******************************************************************/ +#include #include -#include -.intel_syntax noprefix +/* DATA *********************************************************************/ - -.proc sqrtf +PUBLIC sqrtf +sqrtf: sqrtss xmm0, xmm0 ret -.endproc diff --git a/reactos/lib/sdk/crt/math/amd64/tan.S b/reactos/lib/sdk/crt/math/amd64/tan.S index 225c3acc66a..a7c66d0ccd7 100644 --- a/reactos/lib/sdk/crt/math/amd64/tan.S +++ b/reactos/lib/sdk/crt/math/amd64/tan.S @@ -8,14 +8,12 @@ /* INCLUDES ******************************************************************/ +#include #include -#include -.intel_syntax noprefix +/* DATA *********************************************************************/ - -.proc tan +PUBLIC tan +tan: UNIMPLEMENTED tan ret - -.endproc diff --git a/reactos/lib/sdk/crt/setjmp/amd64/setjmp.s b/reactos/lib/sdk/crt/setjmp/amd64/setjmp.s index 800a0b152b5..9d63eb27157 100644 --- a/reactos/lib/sdk/crt/setjmp/amd64/setjmp.s +++ b/reactos/lib/sdk/crt/setjmp/amd64/setjmp.s @@ -44,8 +44,8 @@ * Returns: 0 * Notes: Sets up the jmp_buf */ -PUBLIC __setjmp -.proc __setjmp +PUBLIC _setjmp +.proc _setjmp /* Load rsp as it was before the call into rax */ lea rax, [rsp + 8] /* Load return address into r8 */ @@ -73,7 +73,7 @@ PUBLIC __setjmp movdqa [rcx + JUMP_BUFFER_Xmm15], xmm15 xor rax, rax ret -.endp +.endp _setjmp /* * int _setjmpex(jmp_buf _Buf,void *_Ctx); @@ -83,8 +83,8 @@ PUBLIC __setjmp * Returns: 0 * Notes: Sets up the jmp_buf */ -PUBLIC __setjmpex -.proc __setjmpex +PUBLIC _setjmpex +.proc _setjmpex /* Load rsp as it was before the call into rax */ lea rax, [rsp + 8] /* Load return address into r8 */ @@ -112,7 +112,7 @@ PUBLIC __setjmpex movdqa [rcx + JUMP_BUFFER_Xmm15], xmm15 xor rax, rax ret -.endp +.endp _setjmpex /* @@ -123,8 +123,8 @@ PUBLIC __setjmpex * Returns: Doesn't return * Notes: Non-local goto */ -PUBLIC _longjmp -.proc _longjmp +PUBLIC longjmp +.proc longjmp // FIXME: handle frame @@ -155,4 +155,4 @@ PUBLIC _longjmp jnz 2f inc rax 2: jmp r8 -.endp +.endp longjmp diff --git a/reactos/ntoskrnl/ke/amd64/boot.S b/reactos/ntoskrnl/ke/amd64/boot.S index 19b99adb4c2..d99b9d5aebf 100644 --- a/reactos/ntoskrnl/ke/amd64/boot.S +++ b/reactos/ntoskrnl/ke/amd64/boot.S @@ -8,15 +8,16 @@ /* INCLUDES ******************************************************************/ -#include -.intel_syntax noprefix -.code64 +#include +#include + /* GLOBALS *******************************************************************/ /* FUNCTIONS *****************************************************************/ +.code64 .text /** @@ -29,9 +30,8 @@ * IN CCHAR Number, * IN PLOADER_PARAMETER_BLOCK LoaderBlock) */ -.globl _KiSetupStackAndInitializeKernel -.func KiSetupStackAndInitializeKernel -_KiSetupStackAndInitializeKernel: +PUBLIC KiSetupStackAndInitializeKernel +.PROC KiSetupStackAndInitializeKernel /* Save current stack */ mov rsi, rsp @@ -53,6 +53,9 @@ _KiSetupStackAndInitializeKernel: movsq movsq - jmp _KiInitializeKernelAndGotoIdleLoop + jmp KiInitializeKernelAndGotoIdleLoop + +.ENDP KiSetupStackAndInitializeKernel + +END -.endfunc diff --git a/reactos/ntoskrnl/ke/amd64/ctxswitch.S b/reactos/ntoskrnl/ke/amd64/ctxswitch.S index 72b0b7d3a8b..84f549958a5 100644 --- a/reactos/ntoskrnl/ke/amd64/ctxswitch.S +++ b/reactos/ntoskrnl/ke/amd64/ctxswitch.S @@ -44,8 +44,8 @@ * *--*/ .func KiThreadStartup -.globl _KiThreadStartup -_KiThreadStartup: +.globl KiThreadStartup +KiThreadStartup: /* * Clear all the non-volatile registers, so the thread won't be tempted to @@ -85,7 +85,7 @@ _KiThreadStartup: /* Exit back to user-mode */ // jmp _KiServiceExit2 -UNIMPLEMENTED "KiThreadStartup->KiServiceExit2" +UNIMPLEMENTED KiThreadStartup->KiServiceExit2 BadThread: @@ -112,10 +112,10 @@ BadThread: * Absolutely all registers except ESP can be trampled here for maximum code flexibility. * *--*/ -.globl _KiSwapContextInternal -.func _KiSwapContextInternal, _KiSwapContextInternal -_KiSwapContextInternal: - UNIMPLEMENTED "KiSwapContextInternal" +.globl KiSwapContextInternal +.func KiSwapContextInternal +KiSwapContextInternal: + UNIMPLEMENTED KiSwapContextInternal ret .endfunc @@ -147,9 +147,9 @@ _KiSwapContextInternal: * another thread switches to IT. * *--*/ -.globl _KiSwapContext -.func _KiSwapContext, _KiSwapContext -_KiSwapContext: +.globl KiSwapContext +.func KiSwapContext +KiSwapContext: /* Save 10 registers */ sub rsp, 10 * 8 @@ -180,7 +180,7 @@ _KiSwapContext: movzx ecx, byte ptr [edi+KTHREAD_WAIT_IRQL] /* Do the swap with the registers correctly setup */ - call _KiSwapContextInternal + call KiSwapContextInternal /* Restore the registers */ mov rbp, [rsp+0] diff --git a/reactos/ntoskrnl/ke/amd64/trap.S b/reactos/ntoskrnl/ke/amd64/trap.S index 3a4296ff8e6..051daed266f 100644 --- a/reactos/ntoskrnl/ke/amd64/trap.S +++ b/reactos/ntoskrnl/ke/amd64/trap.S @@ -10,20 +10,20 @@ #include #include -EXTERN _KiDispatchException:PROC -EXTERN _FrLdrDbgPrint:DWORD -EXTERN _KeBugCheckWithTf:PROC -EXTERN _MmAccessFault:PROC -EXTERN _KiSystemFatalException:PROC -EXTERN _KiNpxNotAvailableFaultHandler:PROC -EXTERN _KiGeneralProtectionFaultHandler:PROC -EXTERN _KiXmmExceptionHandler:PROC +EXTERN KiDispatchException:PROC +EXTERN FrLdrDbgPrint:DWORD +EXTERN KeBugCheckWithTf:PROC +EXTERN MmAccessFault:PROC +EXTERN KiSystemFatalException:PROC +EXTERN KiNpxNotAvailableFaultHandler:PROC +EXTERN KiGeneralProtectionFaultHandler:PROC +EXTERN KiXmmExceptionHandler:PROC /* GLOBALS *******************************************************************/ .data -PUBLIC _MsgUnimplemented +PUBLIC MsgUnimplemented _MsgUnimplemented: .ascii "WARNING: %s at %s:%d is UNIMPLEMENTED!\n" @@ -58,7 +58,7 @@ label2: lea rcx, _MsgTrapInfo[rip] lea rdx, 1b[rip] mov r8, [rbp + KTRAP_FRAME_Rip] - call qword ptr _FrLdrDbgPrint[rip] + call qword ptr FrLdrDbgPrint[rip] add rsp, 32 #endif ENDM @@ -263,18 +263,18 @@ ENDM ALIGN 8 -PUBLIC _InterruptDispatchTable -_InterruptDispatchTable: +PUBLIC InterruptDispatchTable +InterruptDispatchTable: Vector = 0 REPEAT 256 push Vector - jmp _KiUnexpectedInterrupt + jmp KiUnexpectedInterrupt ALIGN 8 Vector = Vector+1 ENDR // rbp = TrapFrame, eax = ExceptionCode, edx = NumParams, r9,r10,r11 = params -.PROC _InternalDispatchException +.PROC InternalDispatchException /* Allocate stack space for EXCEPTION_RECORD and KEXCEPTION_FRAME */ sub rsp, SIZE_EXCEPTION_RECORD + SIZE_KEXCEPTION_FRAME @@ -322,7 +322,7 @@ ENDR mov r8, rbp // TrapFrame mov r9b, [r8 + KTRAP_FRAME_PreviousMode] // PreviousMode mov byte ptr [rsp + KEXCEPTION_FRAME_P5], 1 // FirstChance - call _KiDispatchException + call KiDispatchException /* Restore registers */ mov r12, [rsp + KEXCEPTION_FRAME_R12] @@ -342,13 +342,13 @@ ENDR add rsp, SIZE_EXCEPTION_RECORD + SIZE_KEXCEPTION_FRAME ret -.ENDP _InternalDispatchException +.ENDP InternalDispatchException /* SOFTWARE INTERRUPT SERVICES ***********************************************/ -PUBLIC _KiDivideErrorFault -.PROC _KiDivideErrorFault +PUBLIC KiDivideErrorFault +.PROC KiDivideErrorFault /* Push pseudo error code */ ENTER_TRAP_FRAME TRAPFLAG_ALL @@ -361,16 +361,16 @@ PUBLIC _KiDivideErrorFault mov r9, 0 mov r10, 0 mov r11, 0 - call _InternalDispatchException + call InternalDispatchException /* Return */ LEAVE_TRAP_FRAME iretq -.ENDP _KiDivideErrorFault +.ENDP KiDivideErrorFault -PUBLIC _KiDebugTrapOrFault -.PROC _KiDebugTrapOrFault +PUBLIC KiDebugTrapOrFault +.PROC KiDebugTrapOrFault /* Push pseudo error code */ ENTER_TRAP_FRAME TRAPFLAG_ALL @@ -391,16 +391,16 @@ KiDebugTrapOrFaultKMode: mov r9, 0 mov r10, 0 mov r11, 0 - call _InternalDispatchException + call InternalDispatchException /* Return */ LEAVE_TRAP_FRAME iretq -.ENDP _KiDebugTrapOrFault +.ENDP KiDebugTrapOrFault -PUBLIC _KiNmiInterrupt -.PROC _KiNmiInterrupt +PUBLIC KiNmiInterrupt +.PROC KiNmiInterrupt /* Push pseudo error code */ ENTER_TRAP_FRAME TRAPFLAG_ALL @@ -411,11 +411,11 @@ PUBLIC _KiNmiInterrupt /* Return */ LEAVE_TRAP_FRAME iretq -.ENDP _KiNmiInterrupt +.ENDP KiNmiInterrupt -PUBLIC _KiBreakpointTrap -.PROC _KiBreakpointTrap +PUBLIC KiBreakpointTrap +.PROC KiBreakpointTrap /* Push pseudo error code */ ENTER_TRAP_FRAME TRAPFLAG_ALL @@ -423,7 +423,7 @@ PUBLIC _KiBreakpointTrap // lea rcx, _MsgBreakpointTrap[rip] // mov rdx, rsp -// call qword ptr _FrLdrDbgPrint[rip] +// call qword ptr FrLdrDbgPrint[rip] /* Dispatch the exception */ mov eax, STATUS_BREAKPOINT @@ -431,16 +431,16 @@ PUBLIC _KiBreakpointTrap mov r9, 0 mov r10, 0 mov r11, 0 - call _InternalDispatchException + call InternalDispatchException /* Return */ LEAVE_TRAP_FRAME iretq -.ENDP _KiBreakpointTrap +.ENDP KiBreakpointTrap -PUBLIC _KiOverflowTrap -.PROC _KiOverflowTrap +PUBLIC KiOverflowTrap +.PROC KiOverflowTrap /* Push pseudo error code */ ENTER_TRAP_FRAME TRAPFLAG_ALL @@ -453,16 +453,16 @@ PUBLIC _KiOverflowTrap mov r9, 0 mov r10, 0 mov r11, 0 - call _InternalDispatchException + call InternalDispatchException /* Return */ LEAVE_TRAP_FRAME iretq -.ENDP _KiOverflowTrap +.ENDP KiOverflowTrap -PUBLIC _KiBoundFault -.PROC _KiBoundFault +PUBLIC KiBoundFault +.PROC KiBoundFault /* Push pseudo error code */ ENTER_TRAP_FRAME TRAPFLAG_ALL @@ -473,7 +473,7 @@ PUBLIC _KiBoundFault /* Bugcheck */ mov ecx, EXCEPTION_BOUND_CHECK mov rdx, rbp - call _KiSystemFatalException + call KiSystemFatalException KiBoundFaltUserMode: /* Enable interrupts for user-mode */ @@ -485,16 +485,16 @@ KiBoundFaltUserMode: mov r9, 0 mov r10, 0 mov r11, 0 - call _InternalDispatchException + call InternalDispatchException /* Return */ LEAVE_TRAP_FRAME iretq -.ENDP _KiBoundFault +.ENDP KiBoundFault -PUBLIC _KiInvalidOpcodeFault -.PROC _KiInvalidOpcodeFault +PUBLIC KiInvalidOpcodeFault +.PROC KiInvalidOpcodeFault /* Push pseudo error code */ ENTER_TRAP_FRAME TRAPFLAG_ALL @@ -502,7 +502,7 @@ PUBLIC _KiInvalidOpcodeFault mov rdx, [rbp + KTRAP_FRAME_Rip] lea rcx, _MsgInvalidOpcodeFault[rip] - call qword ptr _FrLdrDbgPrint[rip] + call qword ptr FrLdrDbgPrint[rip] /* Enable interrupts */ sti @@ -522,22 +522,22 @@ KiInvalidOpcodeKernel: mov r9, 0 mov r10, 0 mov r11, 0 - call _InternalDispatchException + call InternalDispatchException /* Return */ LEAVE_TRAP_FRAME iretq -.ENDP _KiInvalidOpcodeFault +.ENDP KiInvalidOpcodeFault -PUBLIC _KiNpxNotAvailableFault -.PROC _KiNpxNotAvailableFault +PUBLIC KiNpxNotAvailableFault +.PROC KiNpxNotAvailableFault /* Push pseudo error code */ ENTER_TRAP_FRAME TRAPFLAG_ALL /* Call the C handler */ mov rcx, rbp - call _KiNpxNotAvailableFaultHandler + call KiNpxNotAvailableFaultHandler /* Check the return status code */ test eax, eax @@ -548,102 +548,102 @@ PUBLIC _KiNpxNotAvailableFault mov r9, 0 mov r10, 0 mov r11, 0 - call _InternalDispatchException + call InternalDispatchException KiNpxNotAvailableFaultExit: /* Return */ LEAVE_TRAP_FRAME iretq -.ENDP _KiNpxNotAvailableFault +.ENDP KiNpxNotAvailableFault -PUBLIC _KiDoubleFaultAbort -.PROC _KiDoubleFaultAbort +PUBLIC KiDoubleFaultAbort +.PROC KiDoubleFaultAbort /* Push pseudo error code */ ENTER_TRAP_FRAME TRAPFLAG_ALL lea rcx, _MsgDoubleFault[rip] mov rdx, [rbp + KTRAP_FRAME_FaultAddress] mov r8, rbp - call qword ptr _FrLdrDbgPrint[rip] + call qword ptr FrLdrDbgPrint[rip] /* Bugcheck */ mov ecx, 8 // EXCEPTION_DOUBLE_FAULT mov rdx, rbp - call _KiSystemFatalException + call KiSystemFatalException jmp $ -.ENDP _KiDoubleFaultAbort +.ENDP KiDoubleFaultAbort -PUBLIC _KiNpxSegmentOverrunAbort -.PROC _KiNpxSegmentOverrunAbort +PUBLIC KiNpxSegmentOverrunAbort +.PROC KiNpxSegmentOverrunAbort /* Push pseudo error code */ ENTER_TRAP_FRAME TRAPFLAG_ALL /* Bugcheck */ mov ecx, EXCEPTION_NPX_OVERRUN mov rdx, rbp - call _KiSystemFatalException + call KiSystemFatalException jmp $ -.ENDP _KiNpxSegmentOverrunAbort +.ENDP KiNpxSegmentOverrunAbort -PUBLIC _KiInvalidTssFault -.PROC _KiInvalidTssFault +PUBLIC KiInvalidTssFault +.PROC KiInvalidTssFault /* We have an error code */ ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL) /* Bugcheck */ mov ecx, EXCEPTION_INVALID_TSS mov rdx, rbp - call _KiSystemFatalException + call KiSystemFatalException jmp $ -.ENDP _KiInvalidTssFault +.ENDP KiInvalidTssFault -PUBLIC _KiSegmentNotPresentFault -.PROC _KiSegmentNotPresentFault +PUBLIC KiSegmentNotPresentFault +.PROC KiSegmentNotPresentFault /* We have an error code */ ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL) /* Bugcheck */ mov ecx, EXCEPTION_SEGMENT_NOT_PRESENT mov rdx, rbp - call _KiSystemFatalException + call KiSystemFatalException jmp $ -.ENDP _KiSegmentNotPresentFault +.ENDP KiSegmentNotPresentFault -PUBLIC _KiStackFault -.PROC _KiStackFault +PUBLIC KiStackFault +.PROC KiStackFault /* We have an error code */ ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL) /* Bugcheck */ mov ecx, EXCEPTION_STACK_FAULT mov rdx, rbp - call _KiSystemFatalException + call KiSystemFatalException jmp $ -.ENDP _KiStackFault +.ENDP KiStackFault -PUBLIC _KiGeneralProtectionFault -.PROC _KiGeneralProtectionFault +PUBLIC KiGeneralProtectionFault +.PROC KiGeneralProtectionFault /* We have an error code */ ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL) TRAPINFO KiGeneralProtectionFault mov rdx, [rbp + KTRAP_FRAME_Rip] lea rcx, _MsgGeneralProtFault[rip] - call qword ptr _FrLdrDbgPrint[rip] + call qword ptr FrLdrDbgPrint[rip] /* Call the C handler */ - call _KiGeneralProtectionFaultHandler + call KiGeneralProtectionFaultHandler /* Check for success */ test eax, eax @@ -654,7 +654,7 @@ PUBLIC _KiGeneralProtectionFault mov r9, 0 mov r10, 0 mov r11, 0 - call _InternalDispatchException + call InternalDispatchException KiGpfFatal: @@ -665,17 +665,17 @@ KiGpfFatal: mov r9, [rbp + KTRAP_FRAME_ErrorCode] // error code sub rsp, 8 mov [rsp + KTRAP_FRAME_P5+8], rbp // trap frame - call _KeBugCheckWithTf + call KeBugCheckWithTf KiGpfExit: /* Return */ LEAVE_TRAP_FRAME iretq -.ENDP _KiGeneralProtectionFault +.ENDP KiGeneralProtectionFault -PUBLIC _KiPageFault -.PROC _KiPageFault +PUBLIC KiPageFault +.PROC KiPageFault /* We have an error code */ ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL) @@ -686,7 +686,7 @@ PUBLIC _KiPageFault mov rdx, [rbp + KTRAP_FRAME_ErrorCode] mov r8, [rbp + KTRAP_FRAME_Rip] mov r9, [rbp + KTRAP_FRAME_FaultAddress] - call qword ptr _FrLdrDbgPrint[rip] + call qword ptr FrLdrDbgPrint[rip] #endif /* Save page fault address */ @@ -700,7 +700,7 @@ PUBLIC _KiPageFault mov r8b, [rbp + KTRAP_FRAME_SegCs] // Mode and r8b, 1 mov r9, rbp // TrapInformation - call _MmAccessFault + call MmAccessFault /* Check for success */ test eax, eax @@ -724,7 +724,7 @@ InPageException: mov r11d, eax // Param3 = Status mov eax, STATUS_IN_PAGE_ERROR // ExceptionCode mov edx, 3 // ParamCount - call _InternalDispatchException + call InternalDispatchException jmp PageFaultReturn AccessViolation: @@ -734,27 +734,27 @@ AccessViolation: SpecialCode: /* Setup a normal page fault exception */ mov edx, 2 // ParamCount - call _InternalDispatchException + call InternalDispatchException PageFaultReturn: LEAVE_TRAP_FRAME iretq -.ENDP _KiPageFault +.ENDP KiPageFault -PUBLIC _KiFloatingErrorFault -.PROC _KiFloatingErrorFault +PUBLIC KiFloatingErrorFault +.PROC KiFloatingErrorFault /* Push pseudo error code */ ENTER_TRAP_FRAME TRAPFLAG_ALL UNIMPLEMENTED KiFloatingErrorFault jmp $ -.ENDP _KiFloatingErrorFault +.ENDP KiFloatingErrorFault -PUBLIC _KiAlignmentFault -.PROC _KiAlignmentFault +PUBLIC KiAlignmentFault +.PROC KiAlignmentFault /* We have an error code */ ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL) @@ -764,34 +764,34 @@ PUBLIC _KiAlignmentFault /* Bugcheck */ mov ecx, EXCEPTION_ALIGNMENT_CHECK mov rdx, rbp - call _KiSystemFatalException + call KiSystemFatalException jmp $ -.ENDP _KiAlignmentFault +.ENDP KiAlignmentFault -PUBLIC _KiMcheckAbort -.PROC _KiMcheckAbort +PUBLIC KiMcheckAbort +.PROC KiMcheckAbort /* Push pseudo error code */ ENTER_TRAP_FRAME TRAPFLAG_ALL /* Bugcheck */ mov ecx, HEX(12) mov rdx, rbp - call _KiSystemFatalException + call KiSystemFatalException jmp $ -.ENDP _KiMcheckAbort +.ENDP KiMcheckAbort -PUBLIC _KiXmmException -.PROC _KiXmmException +PUBLIC KiXmmException +.PROC KiXmmException /* Push pseudo error code */ ENTER_TRAP_FRAME TRAPFLAG_ALL /* Call the C handler */ mov rcx, rbp - call _KiXmmExceptionHandler + call KiXmmExceptionHandler /* Check for success */ test eax, eax @@ -802,27 +802,27 @@ PUBLIC _KiXmmException mov r9, 0 mov r10, 0 mov r11, 0 - call _InternalDispatchException + call InternalDispatchException KiXmmExit: LEAVE_TRAP_FRAME iretq -.ENDP _KiXmmException +.ENDP KiXmmException -PUBLIC _KiApcInterrupt -.PROC _KiApcInterrupt +PUBLIC KiApcInterrupt +.PROC KiApcInterrupt /* We have an error code */ ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL) UNIMPLEMENTED KiApcInterrupt jmp $ -.ENDP _KiApcInterrupt +.ENDP KiApcInterrupt -PUBLIC _KiRaiseAssertion -.PROC _KiRaiseAssertion +PUBLIC KiRaiseAssertion +.PROC KiRaiseAssertion /* We have an error code */ ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL) @@ -835,15 +835,15 @@ PUBLIC _KiRaiseAssertion mov r9, 0 mov r10, 0 mov r11, 0 - call _InternalDispatchException + call InternalDispatchException LEAVE_TRAP_FRAME iretq -.ENDP _KiRaiseAssertion +.ENDP KiRaiseAssertion -PUBLIC _KiDebugServiceTrap -.PROC _KiDebugServiceTrap +PUBLIC KiDebugServiceTrap +.PROC KiDebugServiceTrap /* Push pseudo error code */ ENTER_TRAP_FRAME TRAPFLAG_ALL @@ -858,37 +858,37 @@ PUBLIC _KiDebugServiceTrap mov r9, [rbp+KTRAP_FRAME_Rax] // Service mov r10, [rbp+KTRAP_FRAME_Rcx] // Buffer mov r11, [rbp+KTRAP_FRAME_Rdx] // Length - call _InternalDispatchException + call InternalDispatchException LEAVE_TRAP_FRAME; iretq -.ENDP _KiDebugServiceTrap +.ENDP KiDebugServiceTrap -PUBLIC _KiDpcInterrupt -.PROC _KiDpcInterrupt +PUBLIC KiDpcInterrupt +.PROC KiDpcInterrupt /* We have an error code */ ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL) UNIMPLEMENTED KiDpcInterrupt jmp $ -.ENDP _KiDpcInterrupt +.ENDP KiDpcInterrupt -PUBLIC _KiIpiInterrupt -.PROC _KiIpiInterrupt +PUBLIC KiIpiInterrupt +.PROC KiIpiInterrupt /* We have an error code */ ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL) UNIMPLEMENTED KiIpiInterrupt jmp $ -.ENDP _KiIpiInterrupt +.ENDP KiIpiInterrupt -PUBLIC _KiUnexpectedInterrupt -.PROC _KiUnexpectedInterrupt +PUBLIC KiUnexpectedInterrupt +.PROC KiUnexpectedInterrupt /* The error code is the vector */ cli ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL) @@ -900,10 +900,10 @@ PUBLIC _KiUnexpectedInterrupt mov r9, 0 // The enabled and asserted status bits sub rsp, 8 mov [rbp + KTRAP_FRAME_P5 + 8], rbp // trap frame - call _KeBugCheckWithTf + call KeBugCheckWithTf jmp $ -.ENDP _KiUnexpectedInterrupt +.ENDP KiUnexpectedInterrupt diff --git a/reactos/ntoskrnl/mm/amd64/page.c b/reactos/ntoskrnl/mm/amd64/page.c index d83cace3412..a96e519140a 100644 --- a/reactos/ntoskrnl/mm/amd64/page.c +++ b/reactos/ntoskrnl/mm/amd64/page.c @@ -13,11 +13,6 @@ #define NDEBUG #include -#if defined (ALLOC_PRAGMA) -#pragma alloc_text(INIT, MmInitGlobalKernelPageDirectory) -#pragma alloc_text(INIT, MiInitPageDirectoryMap) -#endif - #undef InterlockedExchangePte #define InterlockedExchangePte(pte1, pte2) \ InterlockedExchange64(&pte1->u.Long, pte2.u.Long) diff --git a/reactos/tools/nci/ncitool.c b/reactos/tools/nci/ncitool.c index d002a18c157..07838af1efa 100644 --- a/reactos/tools/nci/ncitool.c +++ b/reactos/tools/nci/ncitool.c @@ -103,7 +103,7 @@ " ret $0x%x\n\n" #define KernelModeStub_amd64 " movl $0x%x, %%eax\n" \ - " call _KiSystemService\n" \ + " call KiSystemService\n" \ " ret $0x%x\n\n" /* For now, use the usermode stub. We'll optimize later */ @@ -143,7 +143,7 @@ struct ncitool_data_t ncitool_data[] = { { "i386", 4, KernelModeStub_x86, UserModeStub_x86, ".global _%s@%d\n", "_%s@%d:\n" }, { "amd64", 4, KernelModeStub_amd64, UserModeStub_amd64, - ".global _%s\n", "_%s:\n" }, + ".global %s\n", "%s:\n" }, { "powerpc", 4, KernelModeStub_ppc, UserModeStub_ppc, "\t.globl %s\n", "%s:\n" }, { "mips", 4, KernelModeStub_mips, UserModeStub_mips, diff --git a/reactos/tools/rbuild/backend/mingw/linkers/ld.mak b/reactos/tools/rbuild/backend/mingw/linkers/ld.mak index 9c2a0bd1986..d97e40bd2ec 100644 --- a/reactos/tools/rbuild/backend/mingw/linkers/ld.mak +++ b/reactos/tools/rbuild/backend/mingw/linkers/ld.mak @@ -6,6 +6,10 @@ LDFLAG_WINDOWS:=--subsystem=windows LDFLAG_NATIVE:=--subsystem=native LDFLAG_EXCLUDE_ALL_SYMBOLS=-exclude-all-symbols +DLLTOOL_FLAGS=--kill-at +ifeq ($(ARCH),amd64) + DLLTOOL_FLAGS= --no-leading-underscore +endif #~ #(module, objs, deps, ldflags, output, def, libs, entry, base) #(module, objs, deps, ldflags, output, def, libs, entry, base, extralibs) @@ -14,15 +18,15 @@ define RBUILD_LINK ifneq ($(6),) ${call RBUILD_intermediate_dir,$(5)}$$(SEP)lib${call RBUILD_name,$(5)}.a: $(6) | ${call RBUILD_intermediate_path,$(5)} $$(ECHO_IMPLIB) - $${dlltool} --def $(6) --kill-at --output-lib=$$@ + $${dlltool} --def $(6) $(DLLTOOL_FLAGS) --output-lib=$$@ ${call RBUILD_intermediate_dir,$(5)}$$(SEP)lib${call RBUILD_name,$(5)}.delayimp.a: $(6) | ${call RBUILD_intermediate_path,$(5)} $$(ECHO_IMPLIB) - $${dlltool} --def $(6) --kill-at --output-delaylib=$$@ + $${dlltool} --def $(6) $(DLLTOOL_FLAGS) --output-delaylib=$$@ ${call RBUILD_intermediate_path_noext,$(5)}.exp: $(6) | ${call RBUILD_intermediate_path,$(5)} $$(ECHO_IMPLIB) - $${dlltool} --def $(6) --kill-at --output-exp=$$@ + $${dlltool} --def $(6) $(DLLTOOL_FLAGS) --output-exp=$$@ $(1)_CLEANFILES+=\ ${call RBUILD_intermediate_dir,$(5)}$$(SEP)lib$(notdir $(5)).a \ diff --git a/reactos/tools/rbuild/module.cpp b/reactos/tools/rbuild/module.cpp index e8d8e250722..5e4071d65dd 100644 --- a/reactos/tools/rbuild/module.cpp +++ b/reactos/tools/rbuild/module.cpp @@ -1364,7 +1364,7 @@ Module::GetEntryPoint() const if (entrypoint == "0" || entrypoint == "0x0") return "0"; - if (Environment::GetArch() != "arm") + if (Environment::GetArch() != "arm" && Environment::GetArch() != "amd64") result = "_"; result += entrypoint; From 139c298d14963195c6b0216ef092db41039de46e Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Fri, 5 Feb 2010 01:36:20 +0000 Subject: [PATCH 093/121] [RTL] MSVC compatibility fixes: inline -> __inline svn path=/branches/ros-amd64-bringup/; revision=45426 --- reactos/lib/rtl/actctx.c | 12 ++++++------ reactos/lib/rtl/heap.c | 2 +- reactos/lib/rtl/timerqueue.c | 6 +++--- reactos/lib/rtl/version.c | 2 +- reactos/lib/rtl/wait.c | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/reactos/lib/rtl/actctx.c b/reactos/lib/rtl/actctx.c index 4508876b4fe..7ad78d32612 100644 --- a/reactos/lib/rtl/actctx.c +++ b/reactos/lib/rtl/actctx.c @@ -234,23 +234,23 @@ static WCHAR *xmlstrdupW(const xmlstr_t* str) return strW; } -static inline BOOL xmlstr_cmp(const xmlstr_t* xmlstr, const WCHAR *str) +static __inline BOOL xmlstr_cmp(const xmlstr_t* xmlstr, const WCHAR *str) { return !strncmpW(xmlstr->ptr, str, xmlstr->len) && !str[xmlstr->len]; } -static inline BOOL xmlstr_cmpi(const xmlstr_t* xmlstr, const WCHAR *str) +static __inline BOOL xmlstr_cmpi(const xmlstr_t* xmlstr, const WCHAR *str) { return !strncmpiW(xmlstr->ptr, str, xmlstr->len) && !str[xmlstr->len]; } -static inline BOOL xmlstr_cmp_end(const xmlstr_t* xmlstr, const WCHAR *str) +static __inline BOOL xmlstr_cmp_end(const xmlstr_t* xmlstr, const WCHAR *str) { return (xmlstr->len && xmlstr->ptr[0] == '/' && !strncmpW(xmlstr->ptr + 1, str, xmlstr->len - 1) && !str[xmlstr->len - 1]); } -static inline BOOL isxmlspace( WCHAR ch ) +static __inline BOOL isxmlspace( WCHAR ch ) { return (ch == ' ' || ch == '\r' || ch == '\n' || ch == '\t'); } @@ -498,7 +498,7 @@ static WCHAR *build_assembly_dir(struct assembly_identity* ai) return ret; } -static inline void append_string( WCHAR *buffer, const WCHAR *prefix, const WCHAR *str ) +static __inline void append_string( WCHAR *buffer, const WCHAR *prefix, const WCHAR *str ) { WCHAR *p = buffer; @@ -562,7 +562,7 @@ static ACTIVATION_CONTEXT *check_actctx( HANDLE h ) return ret; } -static inline void actctx_addref( ACTIVATION_CONTEXT *actctx ) +static __inline void actctx_addref( ACTIVATION_CONTEXT *actctx ) { _InterlockedExchangeAdd( &actctx->ref_count, 1 ); } diff --git a/reactos/lib/rtl/heap.c b/reactos/lib/rtl/heap.c index f4b079494a3..94c55ad4ca7 100644 --- a/reactos/lib/rtl/heap.c +++ b/reactos/lib/rtl/heap.c @@ -219,7 +219,7 @@ static __inline unsigned int get_freelist_index( SIZE_T size ) } /* get the memory protection type to use for a given heap */ -static inline ULONG get_protection_type( DWORD flags ) +static __inline ULONG get_protection_type( DWORD flags ) { return (flags & HEAP_CREATE_ENABLE_EXECUTE) ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE; } diff --git a/reactos/lib/rtl/timerqueue.c b/reactos/lib/rtl/timerqueue.c index 1cad82fe337..7ad25a87fae 100644 --- a/reactos/lib/rtl/timerqueue.c +++ b/reactos/lib/rtl/timerqueue.c @@ -27,7 +27,7 @@ RtlpInitializeTimerThread(VOID) return STATUS_NOT_IMPLEMENTED; } -static inline PLARGE_INTEGER get_nt_timeout( PLARGE_INTEGER pTime, ULONG timeout ) +static __inline PLARGE_INTEGER get_nt_timeout( PLARGE_INTEGER pTime, ULONG timeout ) { if (timeout == INFINITE) return NULL; pTime->QuadPart = (ULONGLONG)timeout * -10000; @@ -101,7 +101,7 @@ static DWORD WINAPI timer_callback_wrapper(LPVOID p) return 0; } -static inline ULONGLONG queue_current_time(void) +static __inline ULONGLONG queue_current_time(void) { LARGE_INTEGER now; NtQuerySystemTime(&now); @@ -134,7 +134,7 @@ static void queue_add_timer(struct queue_timer *t, ULONGLONG time, NtSetEvent(q->event, NULL); } -static inline void queue_move_timer(struct queue_timer *t, ULONGLONG time, +static __inline void queue_move_timer(struct queue_timer *t, ULONGLONG time, BOOL set_event) { /* We MUST hold the queue cs while calling this function. */ diff --git a/reactos/lib/rtl/version.c b/reactos/lib/rtl/version.c index 0be7352c6fc..f97da444ae8 100644 --- a/reactos/lib/rtl/version.c +++ b/reactos/lib/rtl/version.c @@ -22,7 +22,7 @@ RtlGetVersion( /* FUNCTIONS ****************************************************************/ -static inline NTSTATUS version_compare_values(ULONG left, ULONG right, UCHAR condition) +static __inline NTSTATUS version_compare_values(ULONG left, ULONG right, UCHAR condition) { switch (condition) { case VER_EQUAL: diff --git a/reactos/lib/rtl/wait.c b/reactos/lib/rtl/wait.c index 543d5a44769..ca7248b064a 100644 --- a/reactos/lib/rtl/wait.c +++ b/reactos/lib/rtl/wait.c @@ -31,7 +31,7 @@ typedef struct _RTLP_WAIT /* PRIVATE FUNCTIONS *******************************************************/ -static inline PLARGE_INTEGER get_nt_timeout( PLARGE_INTEGER pTime, ULONG timeout ) +static __inline PLARGE_INTEGER get_nt_timeout( PLARGE_INTEGER pTime, ULONG timeout ) { if (timeout == INFINITE) return NULL; pTime->QuadPart = (ULONGLONG)timeout * -10000; From bf7d707939565d03f2a5a2164ad269bf2d9049f4 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Fri, 5 Feb 2010 01:39:05 +0000 Subject: [PATCH 094/121] [NTOS] - Make assembly ML64 safe - remove 2 stubs, add 2 others svn path=/branches/ros-amd64-bringup/; revision=45427 --- reactos/ntoskrnl/ke/amd64/boot.S | 9 ++++++--- reactos/ntoskrnl/ke/amd64/ctxswitch.S | 18 ++++++++--------- reactos/ntoskrnl/ke/amd64/stubs.c | 13 +++---------- reactos/ntoskrnl/ke/amd64/trap.S | 28 +++++++++++++-------------- 4 files changed, 31 insertions(+), 37 deletions(-) diff --git a/reactos/ntoskrnl/ke/amd64/boot.S b/reactos/ntoskrnl/ke/amd64/boot.S index d99b9d5aebf..f1715c6663e 100644 --- a/reactos/ntoskrnl/ke/amd64/boot.S +++ b/reactos/ntoskrnl/ke/amd64/boot.S @@ -11,6 +11,7 @@ #include #include +EXTERN KiInitializeKernelAndGotoIdleLoop:PROC /* GLOBALS *******************************************************************/ @@ -37,13 +38,15 @@ PUBLIC KiSetupStackAndInitializeKernel mov rsi, rsp /* Setup the new stack */ - mov ax, 0x18 + mov ax, HEX(18) mov ss, ax mov rsp, r8 - sub rsp, 0x300 // FIXME + sub rsp, HEX(300) // FIXME /* Copy stack parameters to the new stack */ - sub rsp, 0x38 + sub rsp, HEX(38) + .ENDPROLOG + mov rdi, rsp movsq movsq diff --git a/reactos/ntoskrnl/ke/amd64/ctxswitch.S b/reactos/ntoskrnl/ke/amd64/ctxswitch.S index 84f549958a5..61ce1473e53 100644 --- a/reactos/ntoskrnl/ke/amd64/ctxswitch.S +++ b/reactos/ntoskrnl/ke/amd64/ctxswitch.S @@ -14,6 +14,8 @@ /* FUNCTIONS ****************************************************************/ +.code64 + /*++ * KiThreadStartup * @@ -43,8 +45,7 @@ * If a return from a system thread is detected, a bug check will occur. * *--*/ - .func KiThreadStartup -.globl KiThreadStartup +PUBLIC KiThreadStartup KiThreadStartup: /* @@ -85,13 +86,12 @@ KiThreadStartup: /* Exit back to user-mode */ // jmp _KiServiceExit2 -UNIMPLEMENTED KiThreadStartup->KiServiceExit2 +UNIMPLEMENTED KiThreadStartup_KiServiceExit2 BadThread: /* A system thread returned...this is very bad! */ int 3 -.endfunc /*++ @@ -112,13 +112,11 @@ BadThread: * Absolutely all registers except ESP can be trampled here for maximum code flexibility. * *--*/ -.globl KiSwapContextInternal -.func KiSwapContextInternal +PUBLIC KiSwapContextInternal KiSwapContextInternal: UNIMPLEMENTED KiSwapContextInternal ret -.endfunc /** * KiSwapContext @@ -147,8 +145,7 @@ KiSwapContextInternal: * another thread switches to IT. * *--*/ -.globl KiSwapContext -.func KiSwapContext +PUBLIC KiSwapContext KiSwapContext: /* Save 10 registers */ @@ -198,4 +195,5 @@ KiSwapContext: /* Clean stack */ add esp, 10 * 8 ret -.endfunc + +END diff --git a/reactos/ntoskrnl/ke/amd64/stubs.c b/reactos/ntoskrnl/ke/amd64/stubs.c index 1aea2cb674c..c53af48445d 100644 --- a/reactos/ntoskrnl/ke/amd64/stubs.c +++ b/reactos/ntoskrnl/ke/amd64/stubs.c @@ -165,22 +165,15 @@ __security_check_cookie() { } +BOOLEAN CcPfEnablePrefetcher; -NTKERNELAPI -PSLIST_ENTRY -ExpInterlockedPopEntrySList( - PSLIST_HEADER ListHead) +unsigned long __readfsdword(const unsigned long Offset) { return 0; } -NTKERNELAPI -PSLIST_ENTRY -ExpInterlockedPushEntrySList( - PSLIST_HEADER ListHead, - PSLIST_ENTRY ListEntry) +void main() { - return 0; } #endif diff --git a/reactos/ntoskrnl/ke/amd64/trap.S b/reactos/ntoskrnl/ke/amd64/trap.S index 051daed266f..5088a51b554 100644 --- a/reactos/ntoskrnl/ke/amd64/trap.S +++ b/reactos/ntoskrnl/ke/amd64/trap.S @@ -24,28 +24,28 @@ EXTERN KiXmmExceptionHandler:PROC .data PUBLIC MsgUnimplemented -_MsgUnimplemented: +MsgUnimplemented: .ascii "WARNING: %s at %s:%d is UNIMPLEMENTED!\n" -_MsgPageFault: +MsgPageFault: .ascii "Page fault! Code = 0x%x, RIP = %p, FaultingAddress = %p\n\0" -_MsgGeneralProtFault: +MsgGeneralProtFault: .ascii "General protection fault at %p!\n\0" -_MsgBreakpointTrap: +MsgBreakpointTrap: .ascii "BreakpointTrap at %p\n\0" -_MsgUnexpectedInterrupt: +MsgUnexpectedInterrupt: .ascii "UnexpectedInterrupt Vector=0x%02lx\n\0" -_MsgInvalidOpcodeFault: +MsgInvalidOpcodeFault: .ascii "Invalid opcode fault at %p!\n\0" -_MsgDoubleFault: +MsgDoubleFault: .ascii "Double fault at %p, rbp=%p!\n\0" -_MsgTrapInfo: +MsgTrapInfo: .ascii "Trap: %s at %p\n\0" MACRO(TRAPINFO, func) @@ -55,7 +55,7 @@ LOCAL label1, label2 label1: .asciz "\func" label2: sub rsp, 32 - lea rcx, _MsgTrapInfo[rip] + lea rcx, MsgTrapInfo[rip] lea rdx, 1b[rip] mov r8, [rbp + KTRAP_FRAME_Rip] call qword ptr FrLdrDbgPrint[rip] @@ -421,7 +421,7 @@ PUBLIC KiBreakpointTrap TRAPINFO KiBreakpointTrap -// lea rcx, _MsgBreakpointTrap[rip] +// lea rcx, MsgBreakpointTrap[rip] // mov rdx, rsp // call qword ptr FrLdrDbgPrint[rip] @@ -501,7 +501,7 @@ PUBLIC KiInvalidOpcodeFault TRAPINFO KiInvalidOpcodeFault mov rdx, [rbp + KTRAP_FRAME_Rip] - lea rcx, _MsgInvalidOpcodeFault[rip] + lea rcx, MsgInvalidOpcodeFault[rip] call qword ptr FrLdrDbgPrint[rip] /* Enable interrupts */ @@ -562,7 +562,7 @@ PUBLIC KiDoubleFaultAbort /* Push pseudo error code */ ENTER_TRAP_FRAME TRAPFLAG_ALL - lea rcx, _MsgDoubleFault[rip] + lea rcx, MsgDoubleFault[rip] mov rdx, [rbp + KTRAP_FRAME_FaultAddress] mov r8, rbp call qword ptr FrLdrDbgPrint[rip] @@ -639,7 +639,7 @@ PUBLIC KiGeneralProtectionFault TRAPINFO KiGeneralProtectionFault mov rdx, [rbp + KTRAP_FRAME_Rip] - lea rcx, _MsgGeneralProtFault[rip] + lea rcx, MsgGeneralProtFault[rip] call qword ptr FrLdrDbgPrint[rip] /* Call the C handler */ @@ -682,7 +682,7 @@ PUBLIC KiPageFault TRAPINFO KiPageFault #if 0 - lea rcx, _MsgPageFault[rip] + lea rcx, MsgPageFault[rip] mov rdx, [rbp + KTRAP_FRAME_ErrorCode] mov r8, [rbp + KTRAP_FRAME_Rip] mov r9, [rbp + KTRAP_FRAME_FaultAddress] From 7e65e8ce41d407b5222fd0c5bad035b637149198 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Fri, 5 Feb 2010 02:51:38 +0000 Subject: [PATCH 095/121] [RTL] Make slist.S ML64 compatible svn path=/branches/ros-amd64-bringup/; revision=45428 --- reactos/lib/rtl/amd64/slist.S | 81 +++++++++++++++++------------------ 1 file changed, 40 insertions(+), 41 deletions(-) diff --git a/reactos/lib/rtl/amd64/slist.S b/reactos/lib/rtl/amd64/slist.S index 766813667d5..2e8898a909d 100644 --- a/reactos/lib/rtl/amd64/slist.S +++ b/reactos/lib/rtl/amd64/slist.S @@ -9,44 +9,46 @@ #include #include -#define SLIST8A_DEPTH_MASK 0x000000000000FFFF -#define SLIST8A_DEPTH_INC 0x0000000000000001 -#define SLIST8A_SEQUENCE_MASK 0x0000000001FF0000 -#define SLIST8A_SEQUENCE_INC 0x0000000000010000 -#define SLIST8A_NEXTENTRY_MASK 0xFFFFFFFFFE000000 +#define SLIST8A_DEPTH_MASK HEX(000000000000FFFF) +#define SLIST8A_DEPTH_INC HEX(0000000000000001) +#define SLIST8A_SEQUENCE_MASK HEX(0000000001FF0000) +#define SLIST8A_SEQUENCE_INC HEX(0000000000010000) +#define SLIST8A_NEXTENTRY_MASK HEX(FFFFFFFFFE000000) #define SLIST8A_NEXTENTRY_SHIFT 21 -#define SLIST8B_HEADERTYPE_MASK 0x0000000000000001 -#define SLIST8B_INIT_MASK 0x0000000000000002 -#define SLIST8B_REGION_MASK 0xE000000000000000 -#define SLIST8_POINTER_MASK 0x000007FFFFFFFFF0 +#define SLIST8B_HEADERTYPE_MASK HEX(0000000000000001) +#define SLIST8B_INIT_MASK HEX(0000000000000002) +#define SLIST8B_REGION_MASK HEX(E000000000000000) +#define SLIST8_POINTER_MASK HEX(000007FFFFFFFFF0) -#define SLIST16A_DEPTH_MASK 0x000000000000FFFF -#define SLIST16A_DEPTH_INC 0x0000000000000001 -#define SLIST16A_SEQUENCE_MASK 0xFFFFFFFFFFFF0000 -#define SLIST16A_SEQUENCE_INC 0x0000000000010000 -#define SLIST16B_HEADERTYPE_MASK 0x0000000000000001 -#define SLIST16B_INIT_MASK 0x0000000000000002 -#define SLIST16B_NEXTENTY_MASK 0xFFFFFFFFFFFFFFF0 +#define SLIST16A_DEPTH_MASK HEX(000000000000FFFF) +#define SLIST16A_DEPTH_INC HEX(0000000000000001) +#define SLIST16A_SEQUENCE_MASK HEX(FFFFFFFFFFFF0000) +#define SLIST16A_SEQUENCE_INC HEX(0000000000010000) +#define SLIST16B_HEADERTYPE_MASK HEX(0000000000000001) +#define SLIST16B_INIT_MASK HEX(0000000000000002) +#define SLIST16B_NEXTENTY_MASK HEX(FFFFFFFFFFFFFFF0) /* FUNCTIONS ****************************************************************/ -.global ExpInterlockedPopEntrySList -.global ExpInterlockedPopEntrySListResume -.global ExpInterlockedPopEntrySListFault -.global ExpInterlockedPopEntrySListEnd -.global ExpInterlockedPopEntrySListResume16 -.global ExpInterlockedPopEntrySListFault16 -.global ExpInterlockedPopEntrySListEnd16 -.global ExpInterlockedPushEntrySList -.global ExpInterlockedFlushSList +.code64 + +PUBLIC ExpInterlockedPopEntrySList +PUBLIC ExpInterlockedPopEntrySListResume +PUBLIC ExpInterlockedPopEntrySListFault +PUBLIC ExpInterlockedPopEntrySListEnd +PUBLIC ExpInterlockedPopEntrySListResume16 +PUBLIC ExpInterlockedPopEntrySListFault16 +PUBLIC ExpInterlockedPopEntrySListEnd16 +PUBLIC ExpInterlockedPushEntrySList +PUBLIC ExpInterlockedFlushSList /* PSLIST_ENTRY * NTAPI * RtlInterlockedPopEntrySList( * IN PSLIST_HEADER ListHead); */ -.proc RtlInterlockedPopEntrySList +RtlInterlockedPopEntrySList: ExpInterlockedPopEntrySList: /* Load ListHead->Region into rdx */ @@ -70,10 +72,10 @@ ExpInterlockedPopEntrySListResume: /* Copy Depth and Sequence number and adjust Depth */ lea r8, [rax - SLIST8A_DEPTH_INC] - and r8, SLIST8A_SEQUENCE_MASK | SLIST8A_DEPTH_MASK + and r8, (SLIST8A_SEQUENCE_MASK OR SLIST8A_DEPTH_MASK) /* Create a pointer template from rcx in rdx */ - mov rdx, ~SLIST8_POINTER_MASK + mov rdx, (NOT SLIST8_POINTER_MASK) and rdx, rcx /* Shift the NextEntry pointer */ @@ -106,7 +108,7 @@ ExpInterlockedPopEntrySListEnd: shr rax, SLIST8A_NEXTENTRY_SHIFT /* Use rcx as pointer template */ - mov rdx, ~SLIST8_POINTER_MASK + mov rdx, (NOT SLIST8_POINTER_MASK) and rdx, rcx /* Combine result and return */ @@ -139,7 +141,7 @@ ExpInterlockedPopEntrySListFault16: mov rcx, [r9] /* Set ListHead->HeaderType = 1 and ListHead->Init = 1 */ - or rcx, 0x3 + or rcx, 3 /* Copy Depth and Sequence number and adjust Depth */ lea rbx, [rax - SLIST16A_DEPTH_INC] @@ -165,8 +167,6 @@ RtlInterlockedPopEntrySListEmpty16: pop rbx ret -.endp RtlInterlockedPopEntrySList - /* PSLIST_ENTRY * NTAPI @@ -174,7 +174,7 @@ RtlInterlockedPopEntrySListEmpty16: * IN PSLIST_HEADER ListHead, * IN PSLIST_ENTRY ListEntry); */ -.proc RtlInterlockedPushEntrySList +RtlInterlockedPushEntrySList: ExpInterlockedPushEntrySList: /* Load ListHead->Alignment into rax */ @@ -200,7 +200,7 @@ RtlInterlockedPushEntrySListLoop: shr r8, SLIST8A_NEXTENTRY_SHIFT /* Create a pointer template from rcx in rdx */ - mov r9, ~SLIST8_POINTER_MASK + mov r9, (NOT SLIST8_POINTER_MASK) and r9, rcx /* Combine to new pointer and save as ListEntry->NextEntry */ @@ -217,7 +217,7 @@ RtlInterlockedPushEntrySListEmpty: /* Copy and adjust depth and sequence number */ lea r9, [rax + SLIST8A_DEPTH_INC + SLIST8A_SEQUENCE_INC] - and r9, SLIST8A_SEQUENCE_MASK | SLIST8A_DEPTH_MASK + and r9, SLIST8A_SEQUENCE_MASK OR SLIST8A_DEPTH_MASK /* Combine to exchange value in r8 */ or r8, r9 @@ -247,7 +247,7 @@ RtlInterlockedPushEntrySList16: /* Set ListHead->HeaderType = 1 and ListHead->Init = 1 */ mov rcx, rdx - or rcx, 0x3 + or rcx, 3 mov rdx, [r8 + 8] @@ -277,14 +277,13 @@ RtlInterlockedPushEntrySListLoop16: pop rbx ret -.endp RtlInterlockedPushEntrySList /* PSLIST_ENTRY * NTAPI * RtlInterlockedFlushSList( * IN PSINGLE_LIST_ENTRY ListHead); */ -.proc RtlInterlockedFlushSList +RtlInterlockedFlushSList: ExpInterlockedFlushSList: /* Load ListHead->Region into rdx */ @@ -308,7 +307,7 @@ RtlInterlockedFlushSListLoop: jnz RtlInterlockedFlushSListLoop /* Use rcx as pointer template */ - mov rdx, ~SLIST8_POINTER_MASK + mov rdx, (not SLIST8_POINTER_MASK) or rdx, rcx /* Combine result and return */ @@ -321,7 +320,7 @@ RtlInterlockedFlushSList16: mov rdx, [rcx + 8] xor rbx, rbx - mov rcx, 0x3 + mov rcx, 3 RtlInterlockedFlushSListLoop16: @@ -339,4 +338,4 @@ RtlInterlockedFlushSListLoop16: pop rbx ret -.endp RtlInterlockedFlushSList +END From a43ba572f37e472cea5167916695006fb2a83c88 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Fri, 5 Feb 2010 02:53:23 +0000 Subject: [PATCH 096/121] fix UNIMPLEMENTED macro yet another time svn path=/branches/ros-amd64-bringup/; revision=45429 --- reactos/include/reactos/asm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/include/reactos/asm.h b/reactos/include/reactos/asm.h index 42b55783f66..6df3821ec86 100644 --- a/reactos/include/reactos/asm.h +++ b/reactos/include/reactos/asm.h @@ -157,7 +157,7 @@ code = 1 2: .asciz \file 3: sub rsp, 0x20 - lea rcx, _MsgUnimplemented[rip] + lea rcx, MsgUnimplemented[rip] lea rdx, 1b[rip] lea r8, 2b[rip] mov r9, \line From 3e8181cc616717f2dae5816e8c5b8e2ff7527a84 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Fri, 5 Feb 2010 02:56:55 +0000 Subject: [PATCH 097/121] - Add #pragma intrinsic for msvc intrinsics svn path=/branches/ros-amd64-bringup/; revision=45430 --- reactos/include/crt/msc/intrin.h | 139 ++++++++++++++++++++++++++++++- 1 file changed, 136 insertions(+), 3 deletions(-) diff --git a/reactos/include/crt/msc/intrin.h b/reactos/include/crt/msc/intrin.h index f4d0f973969..14d469fd809 100644 --- a/reactos/include/crt/msc/intrin.h +++ b/reactos/include/crt/msc/intrin.h @@ -7,160 +7,284 @@ extern "C" { /*** Stack frame juggling ***/ void * _ReturnAddress(void); +#pragma intrinsic(_ReturnAddress) void * _AddressOfReturnAddress(void); +#pragma intrinsic(_AddressOfReturnAddress) unsigned int __getcallerseflags(void); +#pragma intrinsic(__getcallerseflags) /*** Atomic operations ***/ void _ReadWriteBarrier(void); +#pragma intrinsic(_ReadWriteBarrier) void _ReadBarrier(void); +#pragma intrinsic(_ReadBarrier) void _WriteBarrier(void); +#pragma intrinsic(_WriteBarrier) char _InterlockedCompareExchange8(volatile char * const Destination, const char Exchange, const char Comperand); +#pragma intrinsic(_InterlockedCompareExchange8) short _InterlockedCompareExchange16(volatile short * const Destination, const short Exchange, const short Comperand); +#pragma intrinsic(_InterlockedCompareExchange16) long _InterlockedCompareExchange(volatile long * const Destination, const long Exchange, const long Comperand); +#pragma intrinsic(_InterlockedCompareExchange) void * _InterlockedCompareExchangePointer(void * volatile * const Destination, void * const Exchange, void * const Comperand); +#pragma intrinsic(_InterlockedCompareExchangePointer) long _InterlockedExchange(volatile long * const Target, const long Value); +#pragma intrinsic(_InterlockedExchange) void * _InterlockedExchangePointer(void * volatile * const Target, void * const Value); +#pragma intrinsic(_InterlockedExchangePointer) long _InterlockedExchangeAdd16(volatile short * const Addend, const short Value); +#pragma intrinsic(_InterlockedExchangeAdd16) long _InterlockedExchangeAdd(volatile long * const Addend, const long Value); +#pragma intrinsic(_InterlockedExchangeAdd) char _InterlockedAnd8(volatile char * const value, const char mask); +#pragma intrinsic(_InterlockedAnd8) short _InterlockedAnd16(volatile short * const value, const short mask); +#pragma intrinsic(_InterlockedAnd16) long _InterlockedAnd(volatile long * const value, const long mask); +#pragma intrinsic(_InterlockedAnd) char _InterlockedOr8(volatile char * const value, const char mask); +#pragma intrinsic(_InterlockedOr8) short _InterlockedOr16(volatile short * const value, const short mask); +#pragma intrinsic(_InterlockedOr16) long _InterlockedOr(volatile long * const value, const long mask); +#pragma intrinsic(_InterlockedOr) char _InterlockedXor8(volatile char * const value, const char mask); +#pragma intrinsic(_InterlockedXor8) short _InterlockedXor16(volatile short * const value, const short mask); +#pragma intrinsic(_InterlockedXor16) long _InterlockedXor(volatile long * const value, const long mask); +#pragma intrinsic(_InterlockedXor) long _InterlockedAddLargeStatistic(volatile __int64 * const Addend, const long Value); +#pragma intrinsic(_InterlockedAddLargeStatistic) long _InterlockedDecrement(volatile long * const lpAddend); +#pragma intrinsic(_InterlockedDecrement) long _InterlockedIncrement(volatile long * const lpAddend); +#pragma intrinsic(_InterlockedIncrement) short _InterlockedDecrement16(volatile short * const lpAddend); +#pragma intrinsic(_InterlockedDecrement16) short _InterlockedIncrement16(volatile short * const lpAddend); +#pragma intrinsic(_InterlockedIncrement16) unsigned char _interlockedbittestandreset(volatile long * a, const long b); +#pragma intrinsic(_interlockedbittestandreset) unsigned char _interlockedbittestandset(volatile long * a, const long b); +#pragma intrinsic(_interlockedbittestandset) #if defined(_M_AMD64) __int64 _InterlockedExchange64(volatile __int64 * const Target, const __int64 Value); +#pragma intrinsic(_InterlockedExchange64) __int64 _InterlockedExchangeAdd64(volatile __int64 * const Addend, const __int64 Value); -long _InterlockedAnd64(volatile __int64 * const value, const __int64 mask); +#pragma intrinsic(_InterlockedExchangeAdd64) +__int64 _InterlockedAnd64(volatile __int64 * const value, const __int64 mask); +#pragma intrinsic(_InterlockedAnd64) long _InterlockedOr64(volatile __int64 * const value, const __int64 mask); +#pragma intrinsic(_InterlockedOr64) __int64 _InterlockedCompareExchange64(volatile __int64 * const Destination, const __int64 Exchange, const __int64 Comperand); +#pragma intrinsic(_InterlockedCompareExchange64) __int64 _InterlockedDecrement64(volatile __int64 * const lpAddend); +#pragma intrinsic(_InterlockedDecrement64) __int64 _InterlockedIncrement64(volatile __int64 * const lpAddend); +#pragma intrinsic(_InterlockedIncrement64) unsigned char _interlockedbittestandreset64(volatile __int64 * a, const __int64 b); +#pragma intrinsic(_interlockedbittestandreset64) unsigned char _interlockedbittestandset64(volatile __int64 * a, const __int64 b); +#pragma intrinsic(_interlockedbittestandset64) #endif /*** String operations ***/ void __stosb(unsigned char * Dest, const unsigned char Data, size_t Count); +#pragma intrinsic(__stosb) void __stosw(unsigned short * Dest, const unsigned short Data, size_t Count); +#pragma intrinsic(__stosw) void __stosd(unsigned long * Dest, const unsigned long Data, size_t Count); +#pragma intrinsic(__stosd) void __movsb(unsigned char * Destination, const unsigned char * Source, size_t Count); +#pragma intrinsic(__movsb) void __movsw(unsigned short * Destination, const unsigned short * Source, size_t Count); +#pragma intrinsic(__movsw) void __movsd(unsigned long * Destination, const unsigned long * Source, size_t Count); +#pragma intrinsic(__movsd) #if defined(_M_AMD64) /*** GS segment addressing ***/ void __writegsbyte(const unsigned long Offset, const unsigned char Data); +#pragma intrinsic(__writegsbyte) void __writegsword(const unsigned long Offset, const unsigned short Data); +#pragma intrinsic(__writegsword) void __writegsdword(const unsigned long Offset, const unsigned long Data); +#pragma intrinsic(__writegsdword) void __writegsqword(const unsigned long Offset, const unsigned __int64 Data); +#pragma intrinsic(__writegsqword) unsigned char __readgsbyte(const unsigned long Offset); +#pragma intrinsic(__readgsbyte) unsigned short __readgsword(const unsigned long Offset); +#pragma intrinsic(__readgsword) unsigned long __readgsdword(const unsigned long Offset); +#pragma intrinsic(__readgsdword) unsigned __int64 __readgsqword(const unsigned long Offset); +#pragma intrinsic(__readgsqword) void __incgsbyte(const unsigned long Offset); +#pragma intrinsic(__incgsbyte) void __incgsword(const unsigned long Offset); +#pragma intrinsic(__incgsword) void __incgsdword(const unsigned long Offset); +#pragma intrinsic(__incgsdword) void __addgsbyte(const unsigned long Offset, const unsigned char Data); +#pragma intrinsic(__addgsbyte) void __addgsword(const unsigned long Offset, const unsigned short Data); +#pragma intrinsic(__addgsword) void __addgsdword(const unsigned long Offset, const unsigned int Data); +#pragma intrinsic(__addgsdword) void __addgsqword(const unsigned long Offset, const unsigned __int64 Data); +#pragma intrinsic(__addgsqword) #endif -#if defined(_M_IX86) +//#if defined(_M_IX86) /*** FS segment addressing ***/ void __writefsbyte(const unsigned long Offset, const unsigned char Data); +#pragma intrinsic(__writefsbyte) void __writefsword(const unsigned long Offset, const unsigned short Data); +#pragma intrinsic(__writefsword) void __writefsdword(const unsigned long Offset, const unsigned long Data); +#pragma intrinsic(__writefsdword) unsigned char __readfsbyte(const unsigned long Offset); +#pragma intrinsic(__readfsbyte) unsigned short __readfsword(const unsigned long Offset); +#pragma intrinsic(__readfsword) unsigned long __readfsdword(const unsigned long Offset); +#pragma intrinsic(__readfsdword) void __incfsbyte(const unsigned long Offset); +#pragma intrinsic(__incfsbyte) void __incfsword(const unsigned long Offset); +#pragma intrinsic(__incfsword) void __incfsdword(const unsigned long Offset); +#pragma intrinsic(__incfsdword) void __addfsbyte(const unsigned long Offset, const unsigned char Data); +#pragma intrinsic(__addfsbyte) void __addfsword(const unsigned long Offset, const unsigned short Data); +#pragma intrinsic(__addfsword) void __addfsdword(const unsigned long Offset, const unsigned int Data); -#endif +#pragma intrinsic(__addfsdword) +//#endif /*** Bit manipulation ***/ unsigned char _BitScanForward(unsigned long * const Index, const unsigned long Mask); +#pragma intrinsic(_BitScanForward) unsigned char _BitScanReverse(unsigned long * const Index, const unsigned long Mask); +#pragma intrinsic(_BitScanReverse) unsigned char _bittest(const long * const a, const long b); +#pragma intrinsic(_bittest) unsigned char _bittestandcomplement(long * const a, const long b); +#pragma intrinsic(_bittestandcomplement) unsigned char _bittestandreset(long * const a, const long b); +#pragma intrinsic(_bittestandreset) unsigned char _bittestandset(long * const a, const long b); +#pragma intrinsic(_bittestandset) unsigned char _rotl8(unsigned char value, unsigned char shift); +#pragma intrinsic(_rotl8) unsigned short _rotl16(unsigned short value, unsigned char shift); +#pragma intrinsic(_rotl16) unsigned int _rotl(unsigned int value, int shift); +#pragma intrinsic(_rotl) unsigned int _rotr(unsigned int value, int shift); +#pragma intrinsic(_rotr) unsigned char _rotr8(unsigned char value, unsigned char shift); +#pragma intrinsic(_rotr8) unsigned short _rotr16(unsigned short value, unsigned char shift); +#pragma intrinsic(_rotr16) unsigned __int64 __ll_lshift(const unsigned __int64 Mask, const int Bit); +#pragma intrinsic(__ll_lshift) __int64 __ll_rshift(const __int64 Mask, const int Bit); +#pragma intrinsic(__ll_rshift) unsigned __int64 __ull_rshift(const unsigned __int64 Mask, int Bit); +#pragma intrinsic(__ull_rshift) unsigned short _byteswap_ushort(unsigned short value); +#pragma intrinsic(_byteswap_ushort) unsigned long _byteswap_ulong(unsigned long value); +#pragma intrinsic(_byteswap_ulong) unsigned __int64 _byteswap_uint64(unsigned __int64 value); +#pragma intrinsic(_byteswap_uint64) /*** 64-bit math ***/ __int64 __emul(const int a, const int b); +#pragma intrinsic(__emul) unsigned __int64 __emulu(const unsigned int a, const unsigned int b); +#pragma intrinsic(__emulu) /*** Port I/O ***/ unsigned char __inbyte(const unsigned short Port); +#pragma intrinsic(__inbyte) unsigned short __inword(const unsigned short Port); +#pragma intrinsic(__inword) unsigned long __indword(const unsigned short Port); +#pragma intrinsic(__indword) void __inbytestring(unsigned short Port, unsigned char * Buffer, unsigned long Count); +#pragma intrinsic(__inbytestring) void __inwordstring(unsigned short Port, unsigned short * Buffer, unsigned long Count); +#pragma intrinsic(__inwordstring) void __indwordstring(unsigned short Port, unsigned long * Buffer, unsigned long Count); +#pragma intrinsic(__indwordstring) void __outbyte(unsigned short const Port, const unsigned char Data); +#pragma intrinsic(__outbyte) void __outword(unsigned short const Port, const unsigned short Data); +#pragma intrinsic(__outword) void __outdword(unsigned short const Port, const unsigned long Data); +#pragma intrinsic(__outdword) void __outbytestring(unsigned short const Port, const unsigned char * const Buffer, const unsigned long Count); +#pragma intrinsic(__outbytestring) void __outwordstring(unsigned short const Port, const unsigned short * const Buffer, const unsigned long Count); +#pragma intrinsic(__outwordstring) void __outdwordstring(unsigned short const Port, const unsigned long * const Buffer, const unsigned long Count); +#pragma intrinsic(__outdwordstring) /*** System information ***/ void __cpuid(int CPUInfo[], const int InfoType); +#pragma intrinsic(__cpuid) unsigned __int64 __rdtsc(void); +#pragma intrinsic(__rdtsc) void __writeeflags(uintptr_t Value); +#pragma intrinsic(__writeeflags) uintptr_t __readeflags(void); +#pragma intrinsic(__readeflags) /*** Interrupts ***/ void __debugbreak(void); +#pragma intrinsic(__debugbreak) void __int2c(void); +#pragma intrinsic(__int2c) void _disable(void); +#pragma intrinsic(_disable) void _enable(void); +#pragma intrinsic(_enable) void __halt(void); +#pragma intrinsic(__halt) /*** Protected memory management ***/ void __writecr0(const unsigned __int64 Data); +#pragma intrinsic(__writecr0) void __writecr3(const unsigned __int64 Data); +#pragma intrinsic(__writecr3) void __writecr4(const unsigned __int64 Data); +#pragma intrinsic(__writecr4) #ifdef _M_AMD64 void __writecr8(const unsigned __int64 Data); +#pragma intrinsic(__writecr8) unsigned __int64 __readcr0(void); +#pragma intrinsic(__readcr0) unsigned __int64 __readcr2(void); +#pragma intrinsic(__readcr2) unsigned __int64 __readcr3(void); +#pragma intrinsic(__readcr3) unsigned __int64 __readcr4(void); +#pragma intrinsic(__readcr4) unsigned __int64 __readcr8(void); +#pragma intrinsic(__readcr8) unsigned __int64 __readdr(unsigned int reg); +#pragma intrinsic(__readdr) void __writedr(unsigned reg, unsigned __int64 value); +#pragma intrinsic(__writedr) #else unsigned long __readcr0(void); unsigned long __readcr2(void); @@ -171,16 +295,25 @@ void __writedr(unsigned reg, unsigned int value); #endif void __invlpg(void * const Address); +#pragma intrinsic(__invlpg) /*** System operations ***/ unsigned __int64 __readmsr(const int reg); +#pragma intrinsic(__readmsr) void __writemsr(const unsigned long Register, const unsigned __int64 Value); +#pragma intrinsic(__writemsr) unsigned __int64 __readpmc(const int counter); +#pragma intrinsic(__readpmc) unsigned long __segmentlimit(const unsigned long a); +#pragma intrinsic(__segmentlimit) void __wbinvd(void); +#pragma intrinsic(__wbinvd) void __lidt(void *Source); +#pragma intrinsic(__lidt) void __sidt(void *Destination); +#pragma intrinsic(__sidt) void _mm_pause(void); +#pragma intrinsic(_mm_pause) #ifdef __cplusplus } From 4088be01fedf82d5754f5615ca3cb044d569ce8e Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Fri, 5 Feb 2010 03:03:38 +0000 Subject: [PATCH 098/121] [FREELDR] - Add DPRINT_WINDOWS DPRINT_PELOADER (the only useful) to DEBUG_ALL and DEBUG_CUSTOM - Enable a few useful DPRINTs svn path=/branches/ros-amd64-bringup/; revision=45431 --- reactos/boot/freeldr/freeldr/debug.c | 6 ++--- .../boot/freeldr/freeldr/windows/peloader.c | 25 ++++++++++--------- reactos/boot/freeldr/freeldr/windows/winldr.c | 8 ++++++ 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/reactos/boot/freeldr/freeldr/debug.c b/reactos/boot/freeldr/freeldr/debug.c index 4053e45e7b7..86a4574d71b 100644 --- a/reactos/boot/freeldr/freeldr/debug.c +++ b/reactos/boot/freeldr/freeldr/debug.c @@ -32,15 +32,13 @@ #if defined (DEBUG_ALL) ULONG DebugPrintMask = DPRINT_WARNING | DPRINT_MEMORY | DPRINT_FILESYSTEM | DPRINT_UI | DPRINT_DISK | DPRINT_CACHE | DPRINT_REACTOS | - DPRINT_LINUX | DPRINT_HWDETECT; + DPRINT_LINUX | DPRINT_HWDETECT | DPRINT_WINDOWS | DPRINT_PELOADER; #elif defined (DEBUG_INIFILE) ULONG DebugPrintMask = DPRINT_INIFILE; #elif defined (DEBUG_REACTOS) ULONG DebugPrintMask = DPRINT_REACTOS | DPRINT_REGISTRY; #elif defined (DEBUG_CUSTOM) -ULONG DebugPrintMask = DPRINT_WARNING | - DPRINT_UI | DPRINT_CACHE | DPRINT_REACTOS | - DPRINT_LINUX; +ULONG DebugPrintMask = DPRINT_WARNING | DPRINT_WINDOWS | DPRINT_PELOADER; #else //#elif defined (DEBUG_NONE) ULONG DebugPrintMask = 0; #endif diff --git a/reactos/boot/freeldr/freeldr/windows/peloader.c b/reactos/boot/freeldr/freeldr/windows/peloader.c index f4c731e7254..42ca170bb17 100644 --- a/reactos/boot/freeldr/freeldr/windows/peloader.c +++ b/reactos/boot/freeldr/freeldr/windows/peloader.c @@ -507,8 +507,8 @@ WinLdrpBindImportName(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock, LONG High, Low, Middle, Result; ULONG Hint; - //DPRINTM(DPRINT_PELOADER, "WinLdrpBindImportName(): DllBase 0x%X, ImageBase 0x%X, ThunkData 0x%X, ExportDirectory 0x%X, ExportSize %d, ProcessForwards 0x%X\n", - // DllBase, ImageBase, ThunkData, ExportDirectory, ExportSize, ProcessForwards); + DPRINTM(DPRINT_PELOADER, "WinLdrpBindImportName(): DllBase 0x%X, ImageBase 0x%X, ThunkData 0x%X, ExportDirectory 0x%X, ExportSize %d, ProcessForwards 0x%X\n", + DllBase, ImageBase, ThunkData, ExportDirectory, ExportSize, ProcessForwards); /* Check passed DllBase param */ if(DllBase == NULL) @@ -525,7 +525,7 @@ WinLdrpBindImportName(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock, { /* Yes, calculate the ordinal */ Ordinal = (ULONG)(IMAGE_ORDINAL(ThunkData->u1.Ordinal) - (UINT32)ExportDirectory->Base); - //DPRINTM(DPRINT_PELOADER, "WinLdrpBindImportName(): Ordinal %d\n", Ordinal); + DPRINTM(DPRINT_PELOADER, "WinLdrpBindImportName(): Ordinal %d\n", Ordinal); } else { @@ -543,12 +543,12 @@ WinLdrpBindImportName(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock, NameTable = (PULONG)VaToPa(RVA(DllBase, ExportDirectory->AddressOfNames)); OrdinalTable = (PUSHORT)VaToPa(RVA(DllBase, ExportDirectory->AddressOfNameOrdinals)); - //DPRINTM(DPRINT_PELOADER, "NameTable 0x%X, OrdinalTable 0x%X, ED->AddressOfNames 0x%X, ED->AOFO 0x%X\n", - // NameTable, OrdinalTable, ExportDirectory->AddressOfNames, ExportDirectory->AddressOfNameOrdinals); + DPRINTM(DPRINT_PELOADER, "NameTable 0x%X, OrdinalTable 0x%X, ED->AddressOfNames 0x%X, ED->AOFO 0x%X\n", + NameTable, OrdinalTable, ExportDirectory->AddressOfNames, ExportDirectory->AddressOfNameOrdinals); /* Get the hint, convert it to a physical pointer */ Hint = ((PIMAGE_IMPORT_BY_NAME)VaToPa((PVOID)ThunkData->u1.AddressOfData))->Hint; - //DPRINTM(DPRINT_PELOADER, "HintIndex %d\n", Hint); + DPRINTM(DPRINT_PELOADER, "HintIndex %d\n", Hint); /* If Hint is less than total number of entries in the export directory, and import name == export name, then we can just get it from the OrdinalTable */ @@ -561,19 +561,20 @@ WinLdrpBindImportName(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock, ) { Ordinal = OrdinalTable[Hint]; - //DPRINTM(DPRINT_PELOADER, "WinLdrpBindImportName(): Ordinal %d\n", Ordinal); + DPRINTM(DPRINT_PELOADER, "WinLdrpBindImportName(): Ordinal %d\n", Ordinal); } else { /* It's not the easy way, we have to lookup import name in the name table. Let's use a binary search for this task. */ - //DPRINTM(DPRINT_PELOADER, "WinLdrpBindImportName() looking up the import name using binary search...\n"); - /* Low boundary is set to 0, and high boundary to the maximum index */ Low = 0; High = ExportDirectory->NumberOfNames - 1; + DPRINTM(DPRINT_PELOADER, "WinLdrpBindImportName() looking up import '%s' in #0..#%d\n", + VaToPa(&((PIMAGE_IMPORT_BY_NAME)VaToPa(ThunkData->u1.AddressOfData))->Name[0]), High); + /* Perform a binary-search loop */ while (High >= Low) { @@ -584,9 +585,9 @@ WinLdrpBindImportName(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock, Result = strcmp(VaToPa(&((PIMAGE_IMPORT_BY_NAME)VaToPa((PVOID)ThunkData->u1.AddressOfData))->Name[0]), (PCHAR)VaToPa(RVA(DllBase, NameTable[Middle]))); - /*DPRINTM(DPRINT_PELOADER, "Binary search: comparing Import '__', Export '%s'\n",*/ - /*VaToPa(&((PIMAGE_IMPORT_BY_NAME)VaToPa(ThunkData->u1.AddressOfData))->Name[0]),*/ - /*(PCHAR)VaToPa(RVA(DllBase, NameTable[Middle])));*/ + DPRINTM(DPRINT_PELOADER, "Binary search: comparing Import '%s', Export #%ld:'%s' -> %d\n", + VaToPa(&((PIMAGE_IMPORT_BY_NAME)VaToPa(ThunkData->u1.AddressOfData))->Name[0]), + Middle, (PCHAR)VaToPa(RVA(DllBase, NameTable[Middle])), Result); /*DPRINTM(DPRINT_PELOADER, "TE->u1.AOD %p, fulladdr %p\n", ThunkData->u1.AddressOfData, diff --git a/reactos/boot/freeldr/freeldr/windows/winldr.c b/reactos/boot/freeldr/freeldr/windows/winldr.c index 704035a4420..4d9651518e9 100644 --- a/reactos/boot/freeldr/freeldr/windows/winldr.c +++ b/reactos/boot/freeldr/freeldr/windows/winldr.c @@ -256,7 +256,10 @@ WinLdrLoadDeviceDriver(PLOADER_PARAMETER_BLOCK LoaderBlock, sprintf(FullPath,"%s%S", BootPath, FilePath->Buffer); Status = WinLdrLoadImage(FullPath, LoaderBootDriver, &DriverBase); if (!Status) + { + DPRINTM(DPRINT_WINDOWS, "WinLdrLoadImage() failed\n"); return FALSE; + } // Allocate a DTE for it Status = WinLdrAllocateDataTableEntry(LoaderBlock, DllName, DllName, DriverBase, DriverDTE); @@ -310,6 +313,7 @@ WinLdrLoadBootDrivers(PLOADER_PARAMETER_BLOCK LoaderBlock, //FIXME: Maybe remove it from the list and try to continue? if (!Status) { + DPRINTM(DPRINT_WARNING, "Can't load boot driver: %wZ\n", &BootDriver->FilePath); UiMessageBox("Can't load boot driver!"); return FALSE; } @@ -583,12 +587,16 @@ LoadAndBootWindows(PCSTR OperatingSystemName, /* Turn on paging mode of CPU*/ WinLdrTurnOnPaging(LoaderBlock, PcrBasePage, TssBasePage, GdtIdt); +DbgPrint("Heeelooo\n"); + /* Save final value of LoaderPagesSpanned */ LoaderBlock->Extension->LoaderPagesSpanned = LoaderPagesSpanned; DPRINTM(DPRINT_WINDOWS, "Hello from paged mode, KiSystemStartup %p, LoaderBlockVA %p!\n", KiSystemStartup, LoaderBlockVA); +DbgPrint("Heeelooo\n"); + WinLdrpDumpMemoryDescriptors(LoaderBlockVA); WinLdrpDumpBootDriver(LoaderBlockVA); WinLdrpDumpArcDisks(LoaderBlockVA); From 2e6b7c8bf1a916b9470d4d2997feb700d13d44ff Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Fri, 5 Feb 2010 03:04:18 +0000 Subject: [PATCH 099/121] - comment out an #error, looks like we don't need this - comment out MINGW_ATTRIB_DEPRECATED definition svn path=/branches/ros-amd64-bringup/; revision=45432 --- reactos/include/crt/_mingw.h | 4 ++-- reactos/include/crt/vadefs.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/reactos/include/crt/_mingw.h b/reactos/include/crt/_mingw.h index 4e4824f70d0..684fb988f4d 100644 --- a/reactos/include/crt/_mingw.h +++ b/reactos/include/crt/_mingw.h @@ -118,8 +118,8 @@ #if __MINGW_GNUC_PREREQ (3, 1) #define __MINGW_ATTRIB_DEPRECATED __attribute__ ((__deprecated__)) -#elif __MINGW_MSC_PREREQ(12, 0) -#define __MINGW_ATTRIB_DEPRECATED __declspec(deprecated) +//#elif __MINGW_MSC_PREREQ(12, 0) +//#define __MINGW_ATTRIB_DEPRECATED __declspec(deprecated) #else #define __MINGW_ATTRIB_DEPRECATED #endif diff --git a/reactos/include/crt/vadefs.h b/reactos/include/crt/vadefs.h index ddc3e3af0a7..95abcfb9340 100644 --- a/reactos/include/crt/vadefs.h +++ b/reactos/include/crt/vadefs.h @@ -82,7 +82,7 @@ extern "C" { #elif defined(_MSC_VER) #if defined(_M_IA64) || defined(_M_AMD64) || defined(_M_CEE) -#error Please implement me +//#error Please implement me #endif #define _crt_va_start(v,l) ((void)((v) = (va_list)_ADDRESSOF(l) + _INTSIZEOF(l))) From 046981b86f941eaaf865fd72fca2642eb0218db6 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Fri, 5 Feb 2010 03:05:51 +0000 Subject: [PATCH 100/121] [NTOS] On MSVC implement _lgdt, __sgdt, __lldt, __sldt, __ltr and __str as assembly functions, because there is no inline assembly. The MSVC/ML64 built kernel now boots and WinDbg connects. svn path=/branches/ros-amd64-bringup/; revision=45433 --- .../include/internal/amd64/intrin_i.h | 31 +++------------ reactos/ntoskrnl/ke/amd64/trap.S | 38 +++++++++++++++++++ 2 files changed, 44 insertions(+), 25 deletions(-) diff --git a/reactos/ntoskrnl/include/internal/amd64/intrin_i.h b/reactos/ntoskrnl/include/internal/amd64/intrin_i.h index a4073a8694e..d3dca40eaf2 100644 --- a/reactos/ntoskrnl/include/internal/amd64/intrin_i.h +++ b/reactos/ntoskrnl/include/internal/amd64/intrin_i.h @@ -106,36 +106,17 @@ static __inline__ __attribute__((always_inline)) void __str(unsigned short *Dest #define UNIMPLEMENTED DbgPrint("%s is unimplemented!!!\n", __FUNCTION__); -void FORCEINLINE __lgdt(void *Source) -{ - UNIMPLEMENTED; -} +void __lgdt(void *Source); -void FORCEINLINE __sgdt(void *Destination) -{ - UNIMPLEMENTED; -} +void __sgdt(void *Destination); -void FORCEINLINE __lldt(unsigned short Value) -{ - UNIMPLEMENTED; -} +void __lldt(unsigned short Value); -void FORCEINLINE __sldt(void *Destination) -{ - UNIMPLEMENTED; -} +void __sldt(void *Destination); -void FORCEINLINE __ltr(unsigned short Source) -{ - UNIMPLEMENTED; -} - -void FORCEINLINE __str(unsigned short *Destination) -{ - UNIMPLEMENTED; -} +void __ltr(unsigned short Source); +void __str(unsigned short *Destination); #else diff --git a/reactos/ntoskrnl/ke/amd64/trap.S b/reactos/ntoskrnl/ke/amd64/trap.S index 5088a51b554..5c776039951 100644 --- a/reactos/ntoskrnl/ke/amd64/trap.S +++ b/reactos/ntoskrnl/ke/amd64/trap.S @@ -905,6 +905,44 @@ PUBLIC KiUnexpectedInterrupt jmp $ .ENDP KiUnexpectedInterrupt +#ifdef _MSC_VER +//void __lgdt(void *Source); +PUBLIC __lgdt +__lgdt: + lgdt fword ptr [rcx] + ret + +//void __sgdt(void *Destination); +PUBLIC __sgdt +__sgdt: + sgdt fword ptr [rcx] + ret + +// void __lldt(unsigned short Value) +PUBLIC __lldt +__lldt: + lldt cx + ret + +//void __sldt(void *Destination); +PUBLIC __sldt +__sldt: + sldt word ptr [rcx] + ret + +//void __ltr(unsigned short Source); +PUBLIC __ltr +__ltr: + ltr cx + ret + +//void __str(unsigned short *Destination); +PUBLIC __str +__str: + str word ptr [rcx] + ret + +#endif END From 0ddbbb06b6a8107135496e8492c18663b618b6f0 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 6 Feb 2010 00:05:48 +0000 Subject: [PATCH 101/121] Use .asciz instead of .ascii, because ML doesn't understand "\0" svn path=/branches/ros-amd64-bringup/; revision=45439 --- reactos/ntoskrnl/ke/amd64/trap.S | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/reactos/ntoskrnl/ke/amd64/trap.S b/reactos/ntoskrnl/ke/amd64/trap.S index 5c776039951..532f6bbdb91 100644 --- a/reactos/ntoskrnl/ke/amd64/trap.S +++ b/reactos/ntoskrnl/ke/amd64/trap.S @@ -25,28 +25,28 @@ EXTERN KiXmmExceptionHandler:PROC PUBLIC MsgUnimplemented MsgUnimplemented: -.ascii "WARNING: %s at %s:%d is UNIMPLEMENTED!\n" +.asciz "WARNING: %s at %s:%d is UNIMPLEMENTED!\n" MsgPageFault: -.ascii "Page fault! Code = 0x%x, RIP = %p, FaultingAddress = %p\n\0" +.asciz "Page fault! Code = 0x%x, RIP = %p, FaultingAddress = %p\n" MsgGeneralProtFault: -.ascii "General protection fault at %p!\n\0" +.asciz "General protection fault at %p!\n" MsgBreakpointTrap: -.ascii "BreakpointTrap at %p\n\0" +.asciz "BreakpointTrap at %p\n" MsgUnexpectedInterrupt: -.ascii "UnexpectedInterrupt Vector=0x%02lx\n\0" +.asciz "UnexpectedInterrupt Vector=0x%02lx\n" MsgInvalidOpcodeFault: -.ascii "Invalid opcode fault at %p!\n\0" +.asciz "Invalid opcode fault at %p!\n" MsgDoubleFault: -.ascii "Double fault at %p, rbp=%p!\n\0" +.asciz "Double fault at %p, rbp=%p!\n" MsgTrapInfo: -.ascii "Trap: %s at %p\n\0" +.asciz "Trap: %s at %p\n" MACRO(TRAPINFO, func) LOCAL label1, label2 From 066e30ede189fb251c7fab53eabae6e1a71614ec Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 6 Feb 2010 01:22:07 +0000 Subject: [PATCH 102/121] Move definitinf of BitScanforward and BitScanReverse out of gcc specific area svn path=/branches/ros-amd64-bringup/; revision=45441 --- reactos/include/psdk/winnt.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reactos/include/psdk/winnt.h b/reactos/include/psdk/winnt.h index 6a7a442bc53..78700be1071 100644 --- a/reactos/include/psdk/winnt.h +++ b/reactos/include/psdk/winnt.h @@ -4988,11 +4988,11 @@ InterlockedBitTestAndReset(IN LONG volatile *Base, #endif } +#endif + #define BitScanForward _BitScanForward #define BitScanReverse _BitScanReverse -#endif - /* TODO: Other architectures than X86 */ #if defined(_M_IX86) #define PF_TEMPORAL_LEVEL_1 From 548ef27d5cbd7c4b24929b9764bc0f90cf304f2b Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 6 Feb 2010 01:24:30 +0000 Subject: [PATCH 103/121] Add _crt_va_start, _crt_va_arg, _crt_va_end and __va_copy definitions for (MSVC & AMD64) svn path=/branches/ros-amd64-bringup/; revision=45442 --- reactos/include/crt/vadefs.h | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/reactos/include/crt/vadefs.h b/reactos/include/crt/vadefs.h index 95abcfb9340..8aef490a323 100644 --- a/reactos/include/crt/vadefs.h +++ b/reactos/include/crt/vadefs.h @@ -81,14 +81,23 @@ extern "C" { #define __va_copy(d,s) __builtin_va_copy(d,s) #elif defined(_MSC_VER) -#if defined(_M_IA64) || defined(_M_AMD64) || defined(_M_CEE) -//#error Please implement me -#endif - +#if defiend(_M_IX86) #define _crt_va_start(v,l) ((void)((v) = (va_list)_ADDRESSOF(l) + _INTSIZEOF(l))) #define _crt_va_arg(v,l) (*(l *)(((v) += _INTSIZEOF(l)) - _INTSIZEOF(l))) #define _crt_va_end(v) ((void)((v) = (va_list)0)) #define __va_copy(d,s) ((void)((d) = (s))) +#elif defined(_M_AMD64) +#define _ISSTRUCT(t) ((sizeof(t) > sizeof(void*)) || (sizeof(t) & (sizeof(t)-1)) != 0) +#define _crt_va_start(v,l) ((void)((v) = (va_list)_ADDRESSOF(l) + _PTRSIZEOF(l))) +#define _crt_va_arg(v,t) _ISSTRUCT(t) ? \ + (**(t**)(((v) += sizeof(void*)) - sizeof(void*))) : \ + (*(t*)(((v) += sizeof(void*)) - sizeof(void*))) +#define _crt_va_end(v) ((void)((v) = (va_list)0)) +#define __va_copy(d,s) ((void)((d) = (s))) +#else //if defined(_M_IA64) || defined(_M_CEE) +#error Please implement me +#endif + #endif #if !defined(va_copy) && (!defined(__STRICT_ANSI__) || __STDC_VERSION__ + 0 >= 199900L) From cb79d231d7b1920b2cc8b2ada31c83e18f68b32a Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 6 Feb 2010 01:26:52 +0000 Subject: [PATCH 104/121] [HAL] - Simplify check for matching kernel/hal - Remove underscore from _MsgUnimplemented svn path=/branches/ros-amd64-bringup/; revision=45443 --- reactos/hal/halx86/generic/amd64/halinit.c | 29 ++++++--------------- reactos/hal/halx86/generic/amd64/systimer.S | 4 +-- 2 files changed, 10 insertions(+), 23 deletions(-) diff --git a/reactos/hal/halx86/generic/amd64/halinit.c b/reactos/hal/halx86/generic/amd64/halinit.c index 2c8ca6c19a3..c582fa48ee7 100644 --- a/reactos/hal/halx86/generic/amd64/halinit.c +++ b/reactos/hal/halx86/generic/amd64/halinit.c @@ -15,6 +15,11 @@ /* GLOBALS *******************************************************************/ BOOLEAN HalpPciLockSettings; +#ifdef CONFIG_SMP +#define HAL_BUILD_TYPE (0 | DBG) +#else +#define HAL_BUILD_TYPE (2 | DBG) +#endif /* PRIVATE FUNCTIONS *********************************************************/ @@ -59,30 +64,12 @@ HalInitSystem(IN ULONG BootPhase, /* Get command-line parameters */ HalpGetParameters(LoaderBlock); -#if DBG - /* Checked HAL requires checked kernel */ - if (!(Prcb->BuildType & PRCB_BUILD_DEBUG)) + /* Check if HAL and kernel have identical build type */ + if (Prcb->BuildType != HAL_BUILD_TYPE) { /* No match, bugcheck */ - KeBugCheckEx(MISMATCHED_HAL, 2, Prcb->BuildType, 1, 0); + KeBugCheckEx(MISMATCHED_HAL, 2, Prcb->BuildType, HAL_BUILD_TYPE, 0); } -#else - /* Release build requires release HAL */ - if (Prcb->BuildType & PRCB_BUILD_DEBUG) - { - /* No match, bugcheck */ - KeBugCheckEx(MISMATCHED_HAL, 2, Prcb->BuildType, 0, 0); - } -#endif - -#ifdef CONFIG_SMP - /* SMP HAL requires SMP kernel */ - if (Prcb->BuildType & PRCB_BUILD_UNIPROCESSOR) - { - /* No match, bugcheck */ - KeBugCheckEx(MISMATCHED_HAL, 2, Prcb->BuildType, 0, 0); - } -#endif /* Validate the PRCB */ if (Prcb->MajorVersion != PRCB_MAJOR_VERSION) diff --git a/reactos/hal/halx86/generic/amd64/systimer.S b/reactos/hal/halx86/generic/amd64/systimer.S index 3041d734956..1cb3b6e02a3 100644 --- a/reactos/hal/halx86/generic/amd64/systimer.S +++ b/reactos/hal/halx86/generic/amd64/systimer.S @@ -14,8 +14,8 @@ .data -.global _MsgUnimplemented -_MsgUnimplemented: +.global MsgUnimplemented +MsgUnimplemented: .asciz "WARNING: %s at %s:%d is UNIMPLEMENTED!\n" From 0e4459beb1693a6e9bb5d72f0bbddef05c638578 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 6 Feb 2010 01:28:58 +0000 Subject: [PATCH 105/121] [CRT] - Remove underscore from _MsgUnimplemented svn path=/branches/ros-amd64-bringup/; revision=45444 --- reactos/lib/sdk/crt/except/amd64/chkstk_asm.s | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reactos/lib/sdk/crt/except/amd64/chkstk_asm.s b/reactos/lib/sdk/crt/except/amd64/chkstk_asm.s index c0c59b88cd7..4008d4f5eab 100644 --- a/reactos/lib/sdk/crt/except/amd64/chkstk_asm.s +++ b/reactos/lib/sdk/crt/except/amd64/chkstk_asm.s @@ -12,8 +12,8 @@ .intel_syntax noprefix -.global _MsgUnimplemented -_MsgUnimplemented: +.global MsgUnimplemented +MsgUnimplemented: .asciz "WARNING: %s at %s:%d is UNIMPLEMENTED!\n" From 88e4860fb601a8d0791ae1e7ffb7f721c5f3323d Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 6 Feb 2010 01:29:37 +0000 Subject: [PATCH 106/121] [RTL] __inline__ -> __inline svn path=/branches/ros-amd64-bringup/; revision=45445 --- reactos/lib/rtl/bitmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reactos/lib/rtl/bitmap.c b/reactos/lib/rtl/bitmap.c index c0aef4f7a71..42c03abe2b0 100644 --- a/reactos/lib/rtl/bitmap.c +++ b/reactos/lib/rtl/bitmap.c @@ -43,7 +43,7 @@ BitCountTable[256] = /* PRIVATE FUNCTIONS ********************************************************/ -static __inline__ +static __inline ULONG RtlpGetLengthOfRunClear( IN PRTL_BITMAP BitMapHeader, @@ -92,7 +92,7 @@ RtlpGetLengthOfRunClear( return Length; } -static __inline__ +static __inline ULONG RtlpGetLengthOfRunSet( IN PRTL_BITMAP BitMapHeader, From 2b502990b8fac3cfe14c9ae167ef186a5b1fe7d6 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 6 Feb 2010 01:31:38 +0000 Subject: [PATCH 107/121] [NTOS] - Move DECLSPEC_ALIGN before the variable name svn path=/branches/ros-amd64-bringup/; revision=45446 --- reactos/ntoskrnl/ke/amd64/kiinit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reactos/ntoskrnl/ke/amd64/kiinit.c b/reactos/ntoskrnl/ke/amd64/kiinit.c index 9c6d3c235c6..d2704638f50 100644 --- a/reactos/ntoskrnl/ke/amd64/kiinit.c +++ b/reactos/ntoskrnl/ke/amd64/kiinit.c @@ -31,8 +31,8 @@ extern ADDRESS_RANGE KeMemoryMap[64]; KIPCR KiInitialPcr; /* Boot and double-fault/NMI/DPC stack */ -UCHAR P0BootStackData[KERNEL_STACK_SIZE] DECLSPEC_ALIGN(16) = {0}; -UCHAR KiDoubleFaultStackData[KERNEL_STACK_SIZE] DECLSPEC_ALIGN(16) = {0}; +UCHAR DECLSPEC_ALIGN(16) P0BootStackData[KERNEL_STACK_SIZE] = {0}; +UCHAR DECLSPEC_ALIGN(16) KiDoubleFaultStackData[KERNEL_STACK_SIZE] = {0}; ULONG_PTR P0BootStack = (ULONG_PTR)&P0BootStackData[KERNEL_STACK_SIZE]; ULONG_PTR KiDoubleFaultStack = (ULONG_PTR)&KiDoubleFaultStackData[KERNEL_STACK_SIZE]; From add3de6c67179eb7e89fd37117d80d5698491f0b Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 6 Feb 2010 01:39:31 +0000 Subject: [PATCH 108/121] Add missing _PTRSIZEOF svn path=/branches/ros-amd64-bringup/; revision=45447 --- reactos/include/crt/vadefs.h | 1 + 1 file changed, 1 insertion(+) diff --git a/reactos/include/crt/vadefs.h b/reactos/include/crt/vadefs.h index 8aef490a323..aa1b5116ace 100644 --- a/reactos/include/crt/vadefs.h +++ b/reactos/include/crt/vadefs.h @@ -87,6 +87,7 @@ extern "C" { #define _crt_va_end(v) ((void)((v) = (va_list)0)) #define __va_copy(d,s) ((void)((d) = (s))) #elif defined(_M_AMD64) +#define _PTRSIZEOF(n) ((sizeof(n) + sizeof(void*) - 1) & ~(sizeof(void*) - 1)) #define _ISSTRUCT(t) ((sizeof(t) > sizeof(void*)) || (sizeof(t) & (sizeof(t)-1)) != 0) #define _crt_va_start(v,l) ((void)((v) = (va_list)_ADDRESSOF(l) + _PTRSIZEOF(l))) #define _crt_va_arg(v,t) _ISSTRUCT(t) ? \ From 6bfc56886ac748f2f335f1fd184c07718a5e786d Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 6 Feb 2010 19:12:02 +0000 Subject: [PATCH 109/121] [RTL] Prevent RtlLargeInteger functions to be "occupied" by inline functions. svn path=/branches/ros-amd64-bringup/; revision=45463 --- reactos/lib/rtl/largeint.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/reactos/lib/rtl/largeint.c b/reactos/lib/rtl/largeint.c index cc7475241ac..a1f5c0261de 100644 --- a/reactos/lib/rtl/largeint.c +++ b/reactos/lib/rtl/largeint.c @@ -7,6 +7,12 @@ /* INCLUDES *****************************************************************/ +/* Prevent that inline function with the same names are created */ +#define RtlConvertLongToLargeInteger RtlConvertLongToLargeInteger_inline +#define RtlEnlargedIntegerMultiply RtlEnlargedIntegerMultiply_inline +#define RtlEnlargedUnsignedDivide RtlEnlargedUnsignedDivide_inline +#define RtlEnlargedUnsignedMultiply RtlEnlargedUnsignedMultiply_inline + #include #define NDEBUG @@ -17,6 +23,7 @@ /* * @implemented */ +#undef RtlConvertLongToLargeInteger LARGE_INTEGER NTAPI RtlConvertLongToLargeInteger ( @@ -49,6 +56,7 @@ RtlConvertUlongToLargeInteger ( /* * @implemented */ +#undef RtlEnlargedIntegerMultiply LARGE_INTEGER NTAPI RtlEnlargedIntegerMultiply ( @@ -66,6 +74,7 @@ RtlEnlargedIntegerMultiply ( /* * @implemented */ +#undef RtlEnlargedUnsignedDivide ULONG NTAPI RtlEnlargedUnsignedDivide ( @@ -83,6 +92,7 @@ RtlEnlargedUnsignedDivide ( /* * @implemented */ +#undef RtlEnlargedUnsignedMultiply LARGE_INTEGER NTAPI RtlEnlargedUnsignedMultiply ( From b63bed2d3889abd4c154b44344619757712bfcb0 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 6 Feb 2010 19:13:54 +0000 Subject: [PATCH 110/121] [X86EMU] Beginning of a real mode x86 emulator for BIOS calls. svn path=/branches/ros-amd64-bringup/; revision=45464 --- reactos/lib/x86emu/op_cmp.h | 12 ++ reactos/lib/x86emu/op_jump.h | 39 ++++ reactos/lib/x86emu/op_mov.h | 45 +++++ reactos/lib/x86emu/op_stack.h | 110 ++++++++++++ reactos/lib/x86emu/vmstate.h | 108 +++++++++++ reactos/lib/x86emu/x86emu.c | 299 +++++++++++++++++++++++++++++++ reactos/lib/x86emu/x86emu.h | 230 ++++++++++++++++++++++++ reactos/lib/x86emu/x86emu.rbuild | 7 + 8 files changed, 850 insertions(+) create mode 100644 reactos/lib/x86emu/op_cmp.h create mode 100644 reactos/lib/x86emu/op_jump.h create mode 100644 reactos/lib/x86emu/op_mov.h create mode 100644 reactos/lib/x86emu/op_stack.h create mode 100644 reactos/lib/x86emu/vmstate.h create mode 100644 reactos/lib/x86emu/x86emu.c create mode 100644 reactos/lib/x86emu/x86emu.h create mode 100644 reactos/lib/x86emu/x86emu.rbuild diff --git a/reactos/lib/x86emu/op_cmp.h b/reactos/lib/x86emu/op_cmp.h new file mode 100644 index 00000000000..a25ab2bc116 --- /dev/null +++ b/reactos/lib/x86emu/op_cmp.h @@ -0,0 +1,12 @@ + +VOID +FORCEINLINE +Opcode_3D_CMP(PX86_VM_STATE VmState, PCHAR IntructionPointer) +{ + USHORT Value; + + Value = *(USHORT*)(IntructionPointer + 1); + VmState_CMP16(VmState, VmState->Registers.Eax, Value); + VmState_AdvanceIp(VmState, 3); + DPRINT("CMP AX, 0x%x\n", Value); +} diff --git a/reactos/lib/x86emu/op_jump.h b/reactos/lib/x86emu/op_jump.h new file mode 100644 index 00000000000..93929a03365 --- /dev/null +++ b/reactos/lib/x86emu/op_jump.h @@ -0,0 +1,39 @@ + +VOID +FORCEINLINE +Opcode_E9_JMP16(PX86_VM_STATE VmState, PCHAR IntructionPointer) +{ + SHORT Offset; + + Offset = *(PSHORT)(IntructionPointer + 1); + DPRINT("JMP %04x\n", VmState->Registers.Ip + Offset + 3); + VmState_AdvanceIp(VmState, Offset + 3); +} + +VOID +FORCEINLINE +Opcode_75_JNZ8(PX86_VM_STATE VmState, PCHAR IntructionPointer) +{ + DPRINT("JNZ %04x\n", VmState->Registers.Ip + IntructionPointer[1] + 2); + + if (!VmState->Registers.Eflags.Zf) + { + VmState_AdvanceIp(VmState, IntructionPointer[1] + 2); + } + else + VmState_AdvanceIp(VmState, 2); +} + +VOID +FORCEINLINE +Opcode_74_JZ8(PX86_VM_STATE VmState, PCHAR IntructionPointer) +{ + DPRINT("JZ %04x\n", VmState->Registers.Ip + IntructionPointer[1] + 2); + + if (VmState->Registers.Eflags.Zf) + { + VmState_AdvanceIp(VmState, IntructionPointer[1] + 2); + } + else + VmState_AdvanceIp(VmState, 2); +} diff --git a/reactos/lib/x86emu/op_mov.h b/reactos/lib/x86emu/op_mov.h new file mode 100644 index 00000000000..ebc771feeba --- /dev/null +++ b/reactos/lib/x86emu/op_mov.h @@ -0,0 +1,45 @@ + +VOID +FORCEINLINE +Opcode_BB_MOV(PX86_VM_STATE VmState, PCHAR IntructionPointer) +{ + USHORT Value; + + Value = *(USHORT*)(IntructionPointer + 1); + VmState->Registers.Bx = Value; + VmState_AdvanceIp(VmState, 3); + DPRINT("MOV BX, 0x%x\n", Value); +} + +VOID +FORCEINLINE +Opcode_8E_MOV(PX86_VM_STATE VmState, PCHAR IntructionPointer) +{ + MODRM ModRm; + UCHAR Value; + + ModRm.Byte = IntructionPointer[1]; + + if (ModRm.mod == 3) + { + DPRINT("MOV ??, ??\n", IntructionPointer[2]); + Value = VmState_GetVal8(VmState, ModRm); + // ... + VmState_AdvanceIp(VmState, 2); + return; + } + DPRINT1("UNKNOWN\n"); +} + +VOID +FORCEINLINE +Opcode_89_MOV(PX86_VM_STATE VmState, PCHAR IntructionPointer) +{ + MODRM ModRm; + USHORT Value; + + ModRm.Byte = IntructionPointer[1]; + Value = VmState_GetRegVal16(VmState, ModRm); + + VmState_AdvanceIp(VmState, 2); +} diff --git a/reactos/lib/x86emu/op_stack.h b/reactos/lib/x86emu/op_stack.h new file mode 100644 index 00000000000..bc2ae1b34dd --- /dev/null +++ b/reactos/lib/x86emu/op_stack.h @@ -0,0 +1,110 @@ + + +VOID +FORCEINLINE +Opcode_9C_PUSHF(PX86_VM_STATE VmState, PCHAR IntructionPointer) +{ + DPRINT("PUSHF\n"); + VmState_Push(VmState, VmState->Registers.Eflags.Short); + VmState_AdvanceIp(VmState, 1); +} + +VOID +FORCEINLINE +Opcode_9D_POPF(PX86_VM_STATE VmState, PCHAR IntructionPointer) +{ + DPRINT("POPF\n"); + VmState->Registers.Eflags.Short = VmState_Pop(VmState); + VmState_AdvanceIp(VmState, 1); +} + +VOID +FORCEINLINE +Opcode_1E_PUSH_DS(PX86_VM_STATE VmState, PCHAR IntructionPointer) +{ + DPRINT("PUSH DS\n"); + VmState_Push(VmState, VmState->Registers.SegDs); + VmState_AdvanceIp(VmState, 1); +} + +VOID +FORCEINLINE +Opcode_1F_POP_DS(PX86_VM_STATE VmState, PCHAR IntructionPointer) +{ + DPRINT("POP DS\n"); + VmState->Registers.SegDs = VmState_Pop(VmState); + VmState_AdvanceIp(VmState, 1); +} + +VOID +FORCEINLINE +Opcode_06_PUSH_ES(PX86_VM_STATE VmState, PCHAR IntructionPointer) +{ + DPRINT("PUSH ES\n"); + VmState_Push(VmState, VmState->Registers.SegEs); + VmState_AdvanceIp(VmState, 1); +} + +VOID +FORCEINLINE +Opcode_07_POP_ES(PX86_VM_STATE VmState, PCHAR IntructionPointer) +{ + DPRINT("POP ES\n"); + VmState->Registers.SegEs = VmState_Pop(VmState); + VmState_AdvanceIp(VmState, 1); +} + +VOID +FORCEINLINE +Opcode_60_PUSHA(PX86_VM_STATE VmState, PCHAR IntructionPointer) +{ + USHORT OrigSp; + DPRINT("PUSHA\n"); + + OrigSp = VmState->Registers.Sp; + VmState_Push(VmState, VmState->Registers.Ax); + VmState_Push(VmState, VmState->Registers.Cx); + VmState_Push(VmState, VmState->Registers.Dx); + VmState_Push(VmState, VmState->Registers.Bx); + VmState_Push(VmState, OrigSp); + VmState_Push(VmState, VmState->Registers.Bp); + VmState_Push(VmState, VmState->Registers.Si); + VmState_Push(VmState, VmState->Registers.Di); + VmState_AdvanceIp(VmState, 1); +} + +VOID +FORCEINLINE +Opcode_61_POPA(PX86_VM_STATE VmState, PCHAR IntructionPointer) +{ + USHORT OrigSp; + DPRINT("POPA\n"); + + VmState->Registers.Di = VmState_Pop(VmState); + VmState->Registers.Si = VmState_Pop(VmState); + VmState->Registers.Bp = VmState_Pop(VmState); + OrigSp = VmState_Pop(VmState); + VmState->Registers.Bx = VmState_Pop(VmState); + VmState->Registers.Dx = VmState_Pop(VmState); + VmState->Registers.Cx = VmState_Pop(VmState); + VmState->Registers.Ax = VmState_Pop(VmState); + VmState_AdvanceIp(VmState, 1); +} + +VOID +FORCEINLINE +Opcode_55_PUSH_BP(PX86_VM_STATE VmState, PCHAR IntructionPointer) +{ + DPRINT("PUSH BP\n"); + VmState_Push(VmState, VmState->Registers.Bp); + VmState_AdvanceIp(VmState, 1); +} + +VOID +FORCEINLINE +Opcode_xx_POP_BP(PX86_VM_STATE VmState, PCHAR IntructionPointer) +{ + DPRINT("POP BP\n"); + VmState->Registers.Bp = VmState_Pop(VmState); + VmState_AdvanceIp(VmState, 1); +} diff --git a/reactos/lib/x86emu/vmstate.h b/reactos/lib/x86emu/vmstate.h new file mode 100644 index 00000000000..213b35c1c3a --- /dev/null +++ b/reactos/lib/x86emu/vmstate.h @@ -0,0 +1,108 @@ + +UCHAR +FORCEINLINE +VmState_GetRegVal8(PX86_VM_STATE VmState, MODRM ModRm) +{ + PUCHAR Pointer; + + Pointer = (PUCHAR)&VmState->Registers + RegisterTable[0][ModRm.reg]; + return *Pointer; +} + +UCHAR +FORCEINLINE +VmState_GetRegVal16(PX86_VM_STATE VmState, MODRM ModRm) +{ + return VmState->IndexedRegisters[ModRm.reg].Word; +} + + +VOID +FORCEINLINE +VmState_EnablePrefix(PX86_VM_STATE VmState, ULONG Prefix) +{ + //DPRINT("_EnablePrefix\n"); +} + +VOID +FORCEINLINE +VmState_ClearPrefixes(PX86_VM_STATE VmState) +{ + //DPRINT1("_ClearPrefixes\n"); +} + +FORCEINLINE +VOID +VmState_AdvanceIp(PX86_VM_STATE VmState, SHORT Advance) +{ + VmState->Registers.Ip += Advance; +} + +FORCEINLINE +VOID +VmState_SetIp(PX86_VM_STATE VmState, USHORT Value) +{ + VmState->Registers.Ip = Value; +} + +FORCEINLINE +PCHAR +VmState_GetIp(PX86_VM_STATE VmState) +{ + return (PCHAR)VmState->MemBuffer + + VmState->Registers.ShiftedCs + + VmState->Registers.Eip; +} + +FORCEINLINE +VOID +VmState_Push(PX86_VM_STATE VmState, USHORT Value) +{ + PUSHORT StackPointer; + //DPRINT1("Pushing %x %x %x\n", Value, VmState->Registers.ShiftedSs, VmState->Registers.Sp); + StackPointer = (PVOID)((PCHAR)VmState->MemBuffer + + VmState->Registers.ShiftedSs + + VmState->Registers.Sp); // FIXME: overflow + *StackPointer = Value; + VmState->Registers.Sp--; +} + +FORCEINLINE +USHORT +VmState_Pop(PX86_VM_STATE VmState) +{ + PUSHORT StackPointer; + //DPRINT1("Popping %x\n", Value); + StackPointer = (PVOID)((PCHAR)VmState->MemBuffer + + VmState->Registers.ShiftedSs + + VmState->Registers.Sp); + VmState->Registers.Sp--; + return *StackPointer; +} + +UCHAR +FORCEINLINE +VmState_GetVal8(PX86_VM_STATE VmState, MODRM ModRm) +{ + return 0; +} + +FORCEINLINE +VOID +VmState_CMP8(PX86_VM_STATE VmState, UCHAR Value1, UCHAR Value2) +{ + VmState->Registers.Eflags.Zf = ((Value1 - Value2) == 0); + VmState->Registers.Eflags.Cf = ((Value1 - Value2) > Value1); + VmState->Registers.Eflags.Sf = ((CHAR)(Value1 - Value2) < 0); + VmState->Registers.Eflags.Of = ((CHAR)(Value1 - Value2) > (CHAR)Value1); +} + +FORCEINLINE +VOID +VmState_CMP16(PX86_VM_STATE VmState, USHORT Value1, USHORT Value2) +{ + VmState->Registers.Eflags.Zf = ((Value1 - Value2) == 0); + VmState->Registers.Eflags.Cf = ((Value1 - Value2) > Value1); + VmState->Registers.Eflags.Sf = ((SHORT)(Value1 - Value2) < 0); + VmState->Registers.Eflags.Of = ((SHORT)(Value1 - Value2) > (SHORT)Value1); +} diff --git a/reactos/lib/x86emu/x86emu.c b/reactos/lib/x86emu/x86emu.c new file mode 100644 index 00000000000..dd3ec83a0e1 --- /dev/null +++ b/reactos/lib/x86emu/x86emu.c @@ -0,0 +1,299 @@ +/* + * PROJECT: x86 CPU emulator + * LICENSE: GPL, See COPYING in the top level directory + * FILE: lib/x86emu/x86emu.c + * PURPOSE: + * PROGRAMMERS: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include +//#define NDEBUG +#include + +#undef DPRINT +#define DPRINT DbgPrint + +/* GLOBALS *******************************************************************/ + +static const ULONG RegisterTable[3][8] = +{ + { + FIELD_OFFSET(X86_REGISTERS, Al), + FIELD_OFFSET(X86_REGISTERS, Cl), + FIELD_OFFSET(X86_REGISTERS, Dl), + FIELD_OFFSET(X86_REGISTERS, Bl), + FIELD_OFFSET(X86_REGISTERS, Ah), + FIELD_OFFSET(X86_REGISTERS, Ch), + FIELD_OFFSET(X86_REGISTERS, Dh), + FIELD_OFFSET(X86_REGISTERS, Bh), + }, + { + FIELD_OFFSET(X86_REGISTERS, Ax), + FIELD_OFFSET(X86_REGISTERS, Cx), + FIELD_OFFSET(X86_REGISTERS, Dx), + FIELD_OFFSET(X86_REGISTERS, Bx), + FIELD_OFFSET(X86_REGISTERS, Sp), + FIELD_OFFSET(X86_REGISTERS, Bp), + FIELD_OFFSET(X86_REGISTERS, Si), + FIELD_OFFSET(X86_REGISTERS, Di), + }, + { + FIELD_OFFSET(X86_REGISTERS, Eax), + FIELD_OFFSET(X86_REGISTERS, Ecx), + FIELD_OFFSET(X86_REGISTERS, Edx), + FIELD_OFFSET(X86_REGISTERS, Ebx), + FIELD_OFFSET(X86_REGISTERS, Esp), + FIELD_OFFSET(X86_REGISTERS, Ebp), + FIELD_OFFSET(X86_REGISTERS, Esi), + FIELD_OFFSET(X86_REGISTERS, Edi), + } +}; + +/* INLINE FUNCTONS ***********************************************************/ + +#include "vmstate.h" +#include "op_cmp.h" +#include "op_stack.h" +#include "op_jump.h" +#include "op_mov.h" + +VOID +FORCEINLINE +Opcode_E8_CALL16(PX86_VM_STATE VmState, PCHAR IntructionPointer) +{ + SHORT Offset; + + Offset = *(PSHORT)(IntructionPointer + 1) + 3; + DPRINT("CALL %x\n", VmState->Registers.Ip + Offset); + VmState_Push(VmState, VmState->Registers.Ip + 3); + VmState_AdvanceIp(VmState, Offset); +} + +VOID +FORCEINLINE +Opcode_80(PX86_VM_STATE VmState, PCHAR IntructionPointer) +{ + MODRM ModRm; + UCHAR Value; + + ModRm.Byte = IntructionPointer[1]; + + if (ModRm.reg == 7) + { + /* We have an 8 bit CMP */ + DPRINT("CMP ??. 0x%x\n", IntructionPointer[2]); + Value = VmState_GetVal8(VmState, ModRm); + VmState_CMP8(VmState, Value, IntructionPointer[2]); + VmState_AdvanceIp(VmState, 3); + return; + } + DPRINT1("UNKNOWN\n"); +} + +VOID +FORCEINLINE +Opcode_F3_REP(PX86_VM_STATE VmState, PCHAR IntructionPointer) +{ + UCHAR ByteVal; + + ByteVal = IntructionPointer[1]; + switch (ByteVal) + { + case 0x6C: /* REP INSB */ + case 0x6D: /* REP INSW/D */ + case 0xAC: /* REP LODSB */ + case 0xAD: /* REP LODSWDQ */ + case 0xA4: /* REP MOVSB */ + case 0xA5: /* REP MOVSW/D/Q */ + case 0x6E: /* REP OUTSB */ + case 0x6F: /* REP OUTSW/D */ + case 0xAA: /* REP STOSB */ + case 0xAB: /* REP STOSW/D/Q */ + break; + } + +} + + + + + +VOID +NTAPI +x86Emulator(PX86_VM_STATE VmState) +{ + PCHAR InstructionPointer; + UCHAR ByteVal; + +// x86EmuInitializeState(); + + for (;;) + { + InstructionPointer = VmState_GetIp(VmState); + ByteVal = *InstructionPointer; + + DPRINT("%04x:%04x %02x ", VmState->Registers.SegCs, VmState->Registers.Eip, ByteVal); + + switch (ByteVal) + { + case 0x06: /* PUSH ES */ + Opcode_06_PUSH_ES(VmState, InstructionPointer); + break; + + case 0x07: /* POP ES */ + Opcode_07_POP_ES(VmState, InstructionPointer); + break; + +// case 0x14: /* ADC AL, imm8 */ +// VmState_AdvanceIp(VmState, 2); +// break; + + case 0x15: /* ADC AX, imm16 */ + //_OpcodeADC16(&VmState->Registers.Al, WORD(&InstructionPointer[1])); + VmState_AdvanceIp(VmState, 3); + break; + + case 0x1E: /* PUSH DS */ + Opcode_1E_PUSH_DS(VmState, InstructionPointer); + break; + + case 0x1F: /* POP DS */ + Opcode_1F_POP_DS(VmState, InstructionPointer); + break; + + case 0x26: /* Force ES segment */ + case 0x2e: /* Force CS segment */ + VmState_EnablePrefix(VmState, PREFIX_SEGMENT_CS); + VmState_AdvanceIp(VmState, 1); + continue; + + case 0x36: /* Force SS segment */ + VmState->Registers.ShiftedMs = VmState->Registers.ShiftedSs; + VmState_AdvanceIp(VmState, 1); + continue; + + case 0x37: /* AAA */ + + case 0x3D: /* CMP (E)AX, imm16/32 */ + Opcode_3D_CMP(VmState, InstructionPointer); + break; + + case 0x3E: /* Force DS segment */ + VmState->Registers.ShiftedMs = VmState->Registers.ShiftedDs; + VmState_AdvanceIp(VmState, 1); + continue; + + case 0x3F: /* AAS */ + VmState_AdvanceIp(VmState, 1); + break; + + /* 0x40 ... 0x4F are REX prefixes */ + + case 0x55: /* PUSH BP */ + Opcode_55_PUSH_BP(VmState, InstructionPointer); + break; + + case 0x60: /* PUSHA */ + Opcode_60_PUSHA(VmState, InstructionPointer); + break; + + case 0x61: /* POPA */ + Opcode_61_POPA(VmState, InstructionPointer); + break; + + case 0x64: /* Force FS segment */ + case 0x65: /* Force GS segment */ + + case 0x66: /* Operand size override */ + VmState_EnablePrefix(VmState, PREFIX_SIZE_OVERRIDE); + VmState_AdvanceIp(VmState, 1); + continue; + + case 0x67: /* Address size prefix */ + VmState_EnablePrefix(VmState, PREFIX_ADDRESS_OVERRIDE); + VmState_AdvanceIp(VmState, 1); + continue; + + case 0x74: /* JZ */ + Opcode_74_JZ8(VmState, InstructionPointer); + break; + + case 0x75: /* JNZ */ + Opcode_75_JNZ8(VmState, InstructionPointer); + break; + + case 0x80: /* ... */ + Opcode_80(VmState, InstructionPointer); + break; + + case 0x89: /* MOV regmem16, reg16 */ + Opcode_89_MOV(VmState, InstructionPointer); + break; + + case 0x8E: /* MOV seg, reg16 */ + Opcode_8E_MOV(VmState, InstructionPointer); + break; + + case 0x9C: /* PUSHF */ + Opcode_9C_PUSHF(VmState, InstructionPointer); + break; + + case 0x9D: /* POPF */ + Opcode_9D_POPF(VmState, InstructionPointer); + break; + + case 0xBB: /* MOV BX, imm16 */ + Opcode_BB_MOV(VmState, InstructionPointer); + break; + + case 0xCF: /* IRET */ + DPRINT("IRET\n"); + return; + + case 0xD4: /* AAM */ + /* Check for D4 0A */ + + case 0xD5: /* AAD */ + /* Check for D5 0A */ + + case 0xE8: + Opcode_E8_CALL16(VmState, InstructionPointer); + break; + + case 0xE9: /* JMP off16 */ + Opcode_E9_JMP16(VmState, InstructionPointer); + break; + + case 0xF0: /* LOCK (ignored) */ + DPRINT("LOCK "); + VmState_AdvanceIp(VmState, 1); + continue; + + case 0xF2: /* REPNZ/REPNE */ + DPRINT("REPNE "); + VmState_EnablePrefix(VmState, PREFIX_REP); + VmState_AdvanceIp(VmState, 1); + continue; + + case 0xF3: /* REP */ + Opcode_F3_REP(VmState, InstructionPointer); + break; + + + default: + DPRINT("Unknown opcode 0x%x\n", ByteVal); + VmState_AdvanceIp(VmState, 1); + //x86EmuRaiseException(EXCEPTION_INVALID_OPCODE, ByteVal); + //return; + } + + /* Clear prefixes and continue with next intruction */ + VmState_ClearPrefixes(VmState); + +//ResetMs: + VmState->Registers.ShiftedMs = VmState->Registers.ShiftedDs; + + } +} diff --git a/reactos/lib/x86emu/x86emu.h b/reactos/lib/x86emu/x86emu.h new file mode 100644 index 00000000000..9e9bb12df21 --- /dev/null +++ b/reactos/lib/x86emu/x86emu.h @@ -0,0 +1,230 @@ + + +#ifndef _X86EMU_H_ +#define _X86EMU_H_ + +#include +#include + +typedef union +{ + USHORT Short; + ULONG Long; + struct + { + ULONG Cf:1; + ULONG Pf:1; + ULONG Af:1; + ULONG Zf:1; + ULONG Sf:1; + ULONG Tf:1; + ULONG If:1; + ULONG Df:1; + ULONG Of:1; + ULONG Iopl:3; + ULONG Nt:1; + ULONG Rf:1; + ULONG Vm:1; + ULONG Ac:1; + ULONG Vif:1; + ULONG Vip:1; + ULONG Id:1; + }; +} EFLAGS; + +typedef union +{ + ULONG Dword; + USHORT Word; + UCHAR Byte; + struct + { + UCHAR Low; + UCHAR High; + }; +} REGU; + +typedef union +{ + struct + { + UCHAR mod:2; + UCHAR reg:3; + UCHAR rm:3; + }; + UCHAR Byte; +} MODRM; + +typedef struct +{ + union + { + ULONG Eax; + USHORT Ax; + struct + { + UCHAR Al; + UCHAR Ah; + }; + }; + union + { + ULONG Ecx; + USHORT Cx; + struct + { + UCHAR Cl; + UCHAR Ch; + }; + }; + union + { + ULONG Edx; + USHORT Dx; + struct + { + UCHAR Dl; + UCHAR Dh; + }; + }; + union + { + ULONG Ebx; + USHORT Bx; + struct + { + UCHAR Bl; + UCHAR Bh; + }; + }; + union + { + ULONG Ebp; + USHORT Bp; + }; + union + { + ULONG Esi; + USHORT Si; + }; + union + { + ULONG Edi; + USHORT Di; + }; + union + { + struct + { + ULONG ReservedDsMBZ:4; + ULONG SegDs:16; + }; + ULONG ShiftedDs; + }; + union + { + struct + { + ULONG ReservedEsMBZ:4; + ULONG SegEs:16; + }; + ULONG ShiftedEs; + }; + + /* Extended */ + union + { + struct + { + ULONG ReservedCsMBZ:4; + ULONG SegCs:16; + }; + ULONG ShiftedCs; + }; + union + { + struct + { + ULONG ReservedSsMBZ:4; + ULONG SegSs:16; + }; + ULONG ShiftedSs; + }; + + union + { + struct + { + ULONG ReservedMsMBZ:4; + ULONG SegMs:16; + }; + ULONG ShiftedMs; + }; + + union + { + ULONG Eip; + USHORT Ip; + }; + + union + { + ULONG Esp; + USHORT Sp; + }; + + EFLAGS Eflags; + +} X86_REGISTERS, *PX86_REGISTERS; + +enum +{ + X86_VMFLAGS_RETURN_ON_IRET = 1, +}; + +typedef struct +{ + union + { + X86_BIOS_REGISTERS BiosRegisters; + X86_REGISTERS Registers; + REGU IndexedRegisters[8]; + }; + + struct + { + ULONG ReturnOnIret:1; + } Flags; + + PVOID MemBuffer; + +#if 1 + PCHAR Mnemonic; + PCHAR DstReg; + PCHAR SrcReg; + ULONG SrcEncodung; + ULONG DstEncoding; + ULONG Length; +#endif +} X86_VM_STATE, *PX86_VM_STATE; + +enum +{ + PREFIX_SIZE_OVERRIDE = 0x010001, + PREFIX_ADDRESS_OVERRIDE = 0x020002, + PREFIX_SEGMENT_CS = 0x040004, + PREFIX_SEGMENT_DS = 0x040008, + PREFIX_SEGMENT_ES = 0x040010, + PREFIX_SEGMNET_FS = 0x040020, + PREFIX_SEGMENT_GS = 0x040040, + PREFIX_SEGMENT_SS = 0x040080, + PREFIX_LOCK = 0x080100, + PREFIX_REP = 0x100200, +} PREFIX_STATE; + + +VOID +NTAPI +x86Emulator(PX86_VM_STATE VmState); + +#endif diff --git a/reactos/lib/x86emu/x86emu.rbuild b/reactos/lib/x86emu/x86emu.rbuild new file mode 100644 index 00000000000..d671b68cc9a --- /dev/null +++ b/reactos/lib/x86emu/x86emu.rbuild @@ -0,0 +1,7 @@ + + + + + . + x86emu.c + From 077f4e3c7918d55a35c77f9b1e662816209f8374 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 6 Feb 2010 19:14:12 +0000 Subject: [PATCH 111/121] Add x86emu to build svn path=/branches/ros-amd64-bringup/; revision=45465 --- reactos/lib/lib.rbuild | 3 +++ 1 file changed, 3 insertions(+) diff --git a/reactos/lib/lib.rbuild b/reactos/lib/lib.rbuild index 42e49d6ab2f..1fed5596c44 100644 --- a/reactos/lib/lib.rbuild +++ b/reactos/lib/lib.rbuild @@ -67,4 +67,7 @@ + + + From ae3d0930ce7fff8b6884ea13f6e499873dce5d63 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 6 Feb 2010 19:16:23 +0000 Subject: [PATCH 112/121] [HAL] Add the x86 emulator to x86BiosCall. It can call into int 10 and executes a few instructions. svn path=/branches/ros-amd64-bringup/; revision=45466 --- reactos/hal/halx86/generic/amd64/x86bios.c | 2 +- reactos/hal/halx86/generic/amd64/x86emu.h | 221 --------------------- reactos/hal/halx86/hal_generic.rbuild | 2 - reactos/hal/halx86/halamd64.rbuild | 9 + 4 files changed, 10 insertions(+), 224 deletions(-) delete mode 100644 reactos/hal/halx86/generic/amd64/x86emu.h diff --git a/reactos/hal/halx86/generic/amd64/x86bios.c b/reactos/hal/halx86/generic/amd64/x86bios.c index 16e120ff8e0..3b43bf1d95f 100644 --- a/reactos/hal/halx86/generic/amd64/x86bios.c +++ b/reactos/hal/halx86/generic/amd64/x86bios.c @@ -254,7 +254,7 @@ x86BiosCall( VmState.Flags.ReturnOnIret = 1; /* Call the x86 emulator */ -// x86Emulator(&VmState); + x86Emulator(&VmState); /* Copy registers back to caller */ *Registers = VmState.BiosRegisters; diff --git a/reactos/hal/halx86/generic/amd64/x86emu.h b/reactos/hal/halx86/generic/amd64/x86emu.h deleted file mode 100644 index 7e475c1b04f..00000000000 --- a/reactos/hal/halx86/generic/amd64/x86emu.h +++ /dev/null @@ -1,221 +0,0 @@ - -typedef union -{ - USHORT Short; - ULONG Long; - struct - { - ULONG Cf:1; - ULONG Pf:1; - ULONG Af:1; - ULONG Zf:1; - ULONG Sf:1; - ULONG Tf:1; - ULONG If:1; - ULONG Df:1; - ULONG Of:1; - ULONG Iopl:3; - ULONG Nt:1; - ULONG Rf:1; - ULONG Vm:1; - ULONG Ac:1; - ULONG Vif:1; - ULONG Vip:1; - ULONG Id:1; - }; -} EFLAGS; - -typedef union -{ - ULONG Dword; - USHORT Word; - UCHAR Byte; - struct - { - UCHAR Low; - UCHAR High; - }; -} REGU; - -typedef union -{ - struct - { - UCHAR mod:2; - UCHAR reg:3; - UCHAR rm:3; - }; - UCHAR Byte; -} MODRM; - -typedef struct -{ - union - { - ULONG Eax; - USHORT Ax; - struct - { - UCHAR Al; - UCHAR Ah; - }; - }; - union - { - ULONG Ecx; - USHORT Cx; - struct - { - UCHAR Cl; - UCHAR Ch; - }; - }; - union - { - ULONG Edx; - USHORT Dx; - struct - { - UCHAR Dl; - UCHAR Dh; - }; - }; - union - { - ULONG Ebx; - USHORT Bx; - struct - { - UCHAR Bl; - UCHAR Bh; - }; - }; - union - { - ULONG Ebp; - USHORT Bp; - }; - union - { - ULONG Esi; - USHORT Si; - }; - union - { - ULONG Edi; - USHORT Di; - }; - union - { - struct - { - ULONG ReservedDsMBZ:4; - ULONG SegDs:16; - }; - ULONG ShiftedDs; - }; - union - { - struct - { - ULONG ReservedEsMBZ:4; - ULONG SegEs:16; - }; - ULONG ShiftedEs; - }; - - /* Extended */ - union - { - struct - { - ULONG ReservedCsMBZ:4; - ULONG SegCs:16; - }; - ULONG ShiftedCs; - }; - union - { - struct - { - ULONG ReservedSsMBZ:4; - ULONG SegSs:16; - }; - ULONG ShiftedSs; - }; - - union - { - struct - { - ULONG ReservedMsMBZ:4; - ULONG SegMs:16; - }; - ULONG ShiftedMs; - }; - - union - { - ULONG Eip; - USHORT Ip; - }; - - union - { - ULONG Esp; - USHORT Sp; - }; - - EFLAGS Eflags; - -} X86_REGISTERS, *PX86_REGISTERS; - -enum -{ - X86_VMFLAGS_RETURN_ON_IRET = 1, -}; - -typedef struct -{ - union - { - X86_BIOS_REGISTERS BiosRegisters; - X86_REGISTERS Registers; - REGU IndexedRegisters[8]; - }; - - struct - { - ULONG ReturnOnIret:1; - } Flags; - - PVOID MemBuffer; - -#if 1 - PCHAR Mnemonic; - PCHAR DstReg; - PCHAR SrcReg; - ULONG SrcEncodung; - ULONG DstEncoding; - ULONG Length; -#endif -} X86_VM_STATE, *PX86_VM_STATE; - -enum -{ - PREFIX_SIZE_OVERRIDE = 0x010001, - PREFIX_ADDRESS_OVERRIDE = 0x020002, - PREFIX_SEGMENT_CS = 0x040004, - PREFIX_SEGMENT_DS = 0x040008, - PREFIX_SEGMENT_ES = 0x040010, - PREFIX_SEGMNET_FS = 0x040020, - PREFIX_SEGMENT_GS = 0x040040, - PREFIX_SEGMENT_SS = 0x040080, - PREFIX_LOCK = 0x080100, - PREFIX_REP = 0x100200, -} PREFIX_STATE; - - -VOID -NTAPI -x86Emulator(PX86_VM_STATE VmState); diff --git a/reactos/hal/halx86/hal_generic.rbuild b/reactos/hal/halx86/hal_generic.rbuild index fd6d526c201..f760546e991 100644 --- a/reactos/hal/halx86/hal_generic.rbuild +++ b/reactos/hal/halx86/hal_generic.rbuild @@ -5,7 +5,6 @@ include include - bushndlr.c @@ -43,7 +42,6 @@ misc.c systimer.S usage.c - x86bios.c diff --git a/reactos/hal/halx86/halamd64.rbuild b/reactos/hal/halx86/halamd64.rbuild index 2db1ca91afd..a4d9eb771df 100644 --- a/reactos/hal/halx86/halamd64.rbuild +++ b/reactos/hal/halx86/halamd64.rbuild @@ -5,11 +5,14 @@ include include + . + hal_generic hal_generic_up ntoskrnl + x86emu halinit_up.c @@ -21,4 +24,10 @@ mps.S + + + x86bios.c + + + From 2a4563b90d179a6c9d089d433ad46069c922a7d0 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Mon, 8 Feb 2010 15:50:27 +0000 Subject: [PATCH 113/121] [HAL] Add a file, I forgot svn path=/branches/ros-amd64-bringup/; revision=45499 --- reactos/hal/halx86/generic/amd64/apic.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 reactos/hal/halx86/generic/amd64/apic.c diff --git a/reactos/hal/halx86/generic/amd64/apic.c b/reactos/hal/halx86/generic/amd64/apic.c new file mode 100644 index 00000000000..03cf769a399 --- /dev/null +++ b/reactos/hal/halx86/generic/amd64/apic.c @@ -0,0 +1,20 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: hal/apic.c + * PURPOSE: Hardware Abstraction Layer DLL + * PROGRAMMER: Timo Kreuzer + */ + +#include + +//#define NDEBUG +#include + +VOID +NTAPI +HalpInitializePICs(IN BOOLEAN EnableInterrupts) +{ + UNIMPLEMENTED; +} + From 27d9c840b8a74bebaf6ca29bdd561c533af874bc Mon Sep 17 00:00:00 2001 From: Samuel Serapion Date: Mon, 15 Feb 2010 06:14:17 +0000 Subject: [PATCH 114/121] Reduce diferences with trunk. svn path=/branches/ros-amd64-bringup/; revision=45596 --- .../tools/rbuild/backend/mingw/linkers/ld.mak | 2 +- reactos/tools/rbuild/backend/mingw/mingw.cpp | 5 +- .../rbuild/backend/mingw/modulehandler.cpp | 50 ++++++++----------- 3 files changed, 27 insertions(+), 30 deletions(-) diff --git a/reactos/tools/rbuild/backend/mingw/linkers/ld.mak b/reactos/tools/rbuild/backend/mingw/linkers/ld.mak index ad95cfb0337..88da818491e 100644 --- a/reactos/tools/rbuild/backend/mingw/linkers/ld.mak +++ b/reactos/tools/rbuild/backend/mingw/linkers/ld.mak @@ -87,4 +87,4 @@ endef #~ #(module, def, deps, ldflags, libs, entry, base) #~ RBUILD_LINK_RULE=${call RBUILD_LINK,$(1),$(value $(1)_OBJS),$(3),$(4),$(value $(1)_TARGET),$(2),$(5) $(value $(1)_LIBS) $(5),$(6),$(7)} #(module, def, deps, ldflags, libs, entry, base, extralibs) -RBUILD_LINK_RULE=${call RBUILD_LINK,$(1),$(value $(1)_OBJS),$(3),$(4),$(value $(1)_TARGET),$(2),$(value $(1)_LIBS),$(6),$(7),$(5)} +RBUILD_LINK_RULE=${call RBUILD_LINK,$(1),$(value $(1)_OBJS),$(3),$(4),$(value $(1)_TARGET),$(2),$(value $(1)_LIBS),$(6),$(7),$(5)} \ No newline at end of file diff --git a/reactos/tools/rbuild/backend/mingw/mingw.cpp b/reactos/tools/rbuild/backend/mingw/mingw.cpp index bb5d1fc5ca8..2ffc0ee5932 100644 --- a/reactos/tools/rbuild/backend/mingw/mingw.cpp +++ b/reactos/tools/rbuild/backend/mingw/mingw.cpp @@ -487,8 +487,11 @@ MingwBackend::GenerateGlobalVariables () const fputs ( "BUILTIN_CXXINCLUDES+= $(TARGET_CPPFLAGS)\n", fMakefile ); fprintf ( fMakefile, "PROJECT_CCLIBS := \"$(shell ${TARGET_CC} -print-libgcc-file-name)\"\n" ); + fprintf ( fMakefile, "PROJECT_CXXLIBS := \"$(shell ${TARGET_CPP} -print-file-name=libstdc++.a)\" \"$(shell ${TARGET_CPP} -print-libgcc-file-name)\" \"$(shell ${TARGET_CPP} -print-file-name=libmingw32.a)\" \"$(shell ${TARGET_CPP} -print-file-name=libmingwex.a)\" " ); + /* hack to get libgcc_eh.a, should check mingw version or something */ if (Environment::GetArch() == "amd64") + fprintf ( fMakefile, " \"$(shell ${TARGET_CPP} -print-file-name=libgcc_eh.a)\"" ); /* hack to get _get_output_format, needed by libmingwex */ else if (Environment::GetArch() == "i386") fprintf ( fMakefile, "\"$(shell ${TARGET_CPP} -print-file-name=ofmt_stub.a)\""); @@ -977,7 +980,7 @@ MingwBackend::IsSupportedBinutilsVersion ( const string& binutilsVersion ) { int digit = binutilsVersion.find_last_of("."); if(digit == -1) - { + { printf("Unable to detect binutils version!\n"); return false; } diff --git a/reactos/tools/rbuild/backend/mingw/modulehandler.cpp b/reactos/tools/rbuild/backend/mingw/modulehandler.cpp index 254ade6aab1..bea9ae665b4 100644 --- a/reactos/tools/rbuild/backend/mingw/modulehandler.cpp +++ b/reactos/tools/rbuild/backend/mingw/modulehandler.cpp @@ -1471,11 +1471,11 @@ MingwModuleHandler::GenerateLinkerCommand () const module.name.c_str(), definitionFilename.c_str(), module.xmlbuildFile.c_str(), - linkerScriptArgument.c_str (), + linkerScriptArgument.c_str(), extraLibraries.c_str(), module.GetEntryPoint().c_str(), module.baseaddress.c_str() ); - } +} void MingwModuleHandler::GenerateObjectFileTargets ( const IfableData& data ) @@ -1782,12 +1782,6 @@ MingwModuleHandler::GenerateOtherMacros () &module.linkerFlags, used_defs ); - /* LD automatically exports all symbols by default if -shared is specified. Prevent it from doing - this by adding the option -exclude-all-symbols (available since Binutils 20091017). */ - // FIXME: Should only be applied for -shared modules, when there's a smart way to check for them. - if ( ModuleHandlerInformations[module.type].DefaultHost == HostFalse && !module.importLibrary ) - fprintf ( fMakefile, "%s_LDFLAGS+=$(LDFLAG_EXCLUDE_ALL_SYMBOLS)\n", module.name.c_str() ); - fprintf ( fMakefile, "\n\n" ); } @@ -1822,7 +1816,7 @@ MingwModuleHandler::GenerateRules () const FileLocation* ar_target = GenerateArchiveTarget (); if ( ar_target ) - delete ar_target; + delete ar_target; } @@ -2195,9 +2189,9 @@ MingwKernelModuleHandler::Process () void MingwKernelModuleHandler::GenerateKernelModuleTarget () { - GenerateRules (); + GenerateRules (); GenerateLinkerCommand (); - } +} MingwKernelModeDLLModuleHandler::MingwKernelModeDLLModuleHandler ( @@ -2224,9 +2218,9 @@ MingwKernelModeDLLModuleHandler::Process () void MingwKernelModeDLLModuleHandler::GenerateKernelModeDLLModuleTarget () { - GenerateRules (); + GenerateRules (); GenerateLinkerCommand (); - } +} MingwNativeDLLModuleHandler::MingwNativeDLLModuleHandler ( @@ -2252,9 +2246,9 @@ MingwNativeDLLModuleHandler::Process () void MingwNativeDLLModuleHandler::GenerateNativeDLLModuleTarget () { - GenerateRules (); + GenerateRules (); GenerateLinkerCommand (); - } +} MingwNativeCUIModuleHandler::MingwNativeCUIModuleHandler ( @@ -2280,9 +2274,9 @@ MingwNativeCUIModuleHandler::Process () void MingwNativeCUIModuleHandler::GenerateNativeCUIModuleTarget () { - GenerateRules (); + GenerateRules (); GenerateLinkerCommand (); - } +} MingwWin32DLLModuleHandler::MingwWin32DLLModuleHandler ( @@ -2349,9 +2343,9 @@ MingwWin32DLLModuleHandler::Process () void MingwWin32DLLModuleHandler::GenerateWin32DLLModuleTarget () { - GenerateRules (); + GenerateRules (); GenerateLinkerCommand (); - } +} void @@ -2369,9 +2363,9 @@ MingwWin32OCXModuleHandler::Process () void MingwWin32OCXModuleHandler::GenerateWin32OCXModuleTarget () { - GenerateRules (); + GenerateRules (); GenerateLinkerCommand (); - } +} MingwWin32CUIModuleHandler::MingwWin32CUIModuleHandler ( @@ -2396,9 +2390,9 @@ MingwWin32CUIModuleHandler::Process () void MingwWin32CUIModuleHandler::GenerateWin32CUIModuleTarget () { - GenerateRules (); + GenerateRules (); GenerateLinkerCommand (); - } +} MingwWin32GUIModuleHandler::MingwWin32GUIModuleHandler ( @@ -2423,9 +2417,9 @@ MingwWin32GUIModuleHandler::Process () void MingwWin32GUIModuleHandler::GenerateWin32GUIModuleTarget () { - GenerateRules (); + GenerateRules (); GenerateLinkerCommand (); - } +} MingwBootLoaderModuleHandler::MingwBootLoaderModuleHandler ( @@ -3024,9 +3018,9 @@ MingwTestModuleHandler::GetModuleSpecificCompilationUnits ( vector Date: Mon, 15 Feb 2010 16:23:55 +0000 Subject: [PATCH 115/121] forgot this file svn path=/branches/ros-amd64-bringup/; revision=45597 --- .../tools/rbuild/backend/msvc/vcprojmaker.cpp | 276 ++++++++---------- 1 file changed, 121 insertions(+), 155 deletions(-) diff --git a/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp b/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp index 29a0c78fe3f..582601b3a77 100644 --- a/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp +++ b/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp @@ -461,8 +461,8 @@ void VCProjMaker::_generate_standard_configuration( const Module& module, vcdir = DEF_SSEP + _get_vc_dir(); } - fprintf ( OUT, "\t\t\r\n"); - fprintf ( OUT, "\t\t\t\r\n" ); + fprintf ( OUT, "\t\t\t\r\n" ); if ( binaryType != Lib ) { @@ -613,164 +607,136 @@ void VCProjMaker::_generate_standard_configuration( const Module& module, if (configuration.VSProjectVersion == "9.00") { - fprintf ( OUT, "\t\t\t\r\n", module.name.c_str() ); + fprintf ( OUT, "\t\t\t\tRandomizedBaseAddress=\"0\"\r\n" ); + fprintf ( OUT, "\t\t\t\tDataExecutionPrevention=\"0\"\r\n" ); } - else + + if (module.importLibrary != NULL) + fprintf ( OUT, "\t\t\t\tModuleDefinitionFile=\"%s\"\r\n", importLib.c_str()); + + fprintf ( OUT, "\t\t\t\tAdditionalDependencies=\"" ); + bool use_msvcrt_lib = false; + for ( i = 0; i < libraries.size(); i++ ) { - fprintf ( OUT, "\t\t\t 0 ) + fprintf ( OUT, " " ); + string libpath = libraries[i].c_str(); + libpath = libpath.erase (0, libpath.find_last_of ("\\") + 1 ); + if ( libpath == "msvcrt.lib" ) { - fprintf ( OUT, "\t\t\t\tRandomizedBaseAddress=\"0\"\r\n" ); - fprintf ( OUT, "\t\t\t\tDataExecutionPrevention=\"0\"\r\n" ); + use_msvcrt_lib = true; } + fprintf ( OUT, "%s", libpath.c_str() ); + } + fprintf ( OUT, "\"\r\n" ); - if (module.importLibrary != NULL) - fprintf ( OUT, "\t\t\t\tModuleDefinitionFile=\"%s\"\r\n", importLib.c_str()); + fprintf ( OUT, "\t\t\t\tAdditionalLibraryDirectories=\"" ); - fprintf ( OUT, "\t\t\t\tAdditionalDependencies=\"" ); - bool use_msvcrt_lib = false; - for ( i = 0; i < libraries.size(); i++ ) - { - if ( i > 0 ) - fprintf ( OUT, " " ); - string libpath = libraries[i].c_str(); - libpath = libpath.erase (0, libpath.find_last_of ("\\") + 1 ); - if ( libpath == "msvcrt.lib" ) - { - use_msvcrt_lib = true; - } - fprintf ( OUT, "%s", libpath.c_str() ); - } - fprintf ( OUT, "\"\r\n" ); - - fprintf ( OUT, "\t\t\t\tAdditionalLibraryDirectories=\"" ); - - // Add conventional libraries dirs - for (i = 0; i < libraries.size (); i++) - { - if ( i > 0 ) - fprintf ( OUT, ";" ); + // Add conventional libraries dirs + for (i = 0; i < libraries.size (); i++) + { + if ( i > 0 ) + fprintf ( OUT, ";" ); string libpath = libraries[i].c_str(); libpath = libpath.substr (0, libpath.find_last_of ("\\") ); fprintf ( OUT, "%s", libpath.c_str() ); } - fprintf ( OUT, "\"\r\n" ); + fprintf ( OUT, "\"\r\n" ); fprintf ( OUT, "\t\t\t\tOutputFile=\"$(OutDir)/%s%s\"\r\n", module.name.c_str(), module_type.c_str() ); if ( binaryType == Sys ) - { + { if (module.GetEntryPoint() == "0") - fprintf ( OUT, "\t\t\t\tAdditionalOptions=\" /noentry /ALIGN:0x20 /SECTION:INIT,D /IGNORE:4001,4037,4039,4065,4070,4078,4087,4089,4096\"\r\n" ); - else - fprintf ( OUT, "\t\t\t\tAdditionalOptions=\" /ALIGN:0x20 /SECTION:INIT,D /IGNORE:4001,4037,4039,4065,4070,4078,4087,4089,4096\"\r\n" ); + fprintf ( OUT, "\t\t\t\tAdditionalOptions=\" /noentry /ALIGN:0x20 /SECTION:INIT,D /IGNORE:4001,4037,4039,4065,4070,4078,4087,4089,4096\"\r\n" ); + else + fprintf ( OUT, "\t\t\t\tAdditionalOptions=\" /ALIGN:0x20 /SECTION:INIT,D /IGNORE:4001,4037,4039,4065,4070,4078,4087,4089,4096\"\r\n" ); + fprintf ( OUT, "\t\t\t\tIgnoreAllDefaultLibraries=\"TRUE\"\r\n" ); + fprintf ( OUT, "\t\t\t\tGenerateManifest=\"FALSE\"\r\n" ); + fprintf ( OUT, "\t\t\t\tSubSystem=\"%d\"\r\n", 3 ); + fprintf ( OUT, "\t\t\t\tDriver=\"%d\"\r\n", 1 ); + fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"%s\"\r\n", module.GetEntryPoint() == "" ? "DriverEntry" : module.GetEntryPoint().c_str ()); + fprintf ( OUT, "\t\t\t\tBaseAddress=\"%s\"\r\n", baseaddr == "" ? "0x10000" : baseaddr.c_str ()); + } + else if ( binaryType == Exe ) + { + if ( module.type == Kernel ) + { + fprintf ( OUT, "\t\t\t\tAdditionalOptions=\" /SECTION:INIT,D /ALIGN:0x80\"\r\n" ); fprintf ( OUT, "\t\t\t\tIgnoreAllDefaultLibraries=\"TRUE\"\r\n" ); fprintf ( OUT, "\t\t\t\tGenerateManifest=\"FALSE\"\r\n" ); fprintf ( OUT, "\t\t\t\tSubSystem=\"%d\"\r\n", 3 ); fprintf ( OUT, "\t\t\t\tDriver=\"%d\"\r\n", 1 ); - fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"%s\"\r\n", module.GetEntryPoint() == "" ? "DriverEntry" : module.GetEntryPoint().c_str ()); - fprintf ( OUT, "\t\t\t\tBaseAddress=\"%s\"\r\n", baseaddr == "" ? "0x10000" : baseaddr.c_str ()); + fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"KiSystemStartup\"\r\n" ); + fprintf ( OUT, "\t\t\t\tBaseAddress=\"%s\"\r\n", baseaddr.c_str ()); } - else if ( binaryType == Exe ) + else if ( module.type == NativeCUI ) { - if ( module.type == Kernel ) - { - fprintf ( OUT, "\t\t\t\tAdditionalOptions=\" /SECTION:INIT,D /ALIGN:0x80\"\r\n" ); - fprintf ( OUT, "\t\t\t\tIgnoreAllDefaultLibraries=\"TRUE\"\r\n" ); - fprintf ( OUT, "\t\t\t\tGenerateManifest=\"FALSE\"\r\n" ); - fprintf ( OUT, "\t\t\t\tSubSystem=\"%d\"\r\n", 3 ); - fprintf ( OUT, "\t\t\t\tDriver=\"%d\"\r\n", 1 ); - fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"KiSystemStartup\"\r\n" ); - fprintf ( OUT, "\t\t\t\tBaseAddress=\"%s\"\r\n", baseaddr.c_str ()); - } - else if ( module.type == NativeCUI ) - { - fprintf ( OUT, "\t\t\t\tAdditionalOptions=\" /ALIGN:0x20\"\r\n" ); - fprintf ( OUT, "\t\t\t\tSubSystem=\"%d\"\r\n", 1 ); - fprintf ( OUT, "\t\t\t\tGenerateManifest=\"FALSE\"\r\n" ); - fprintf ( OUT, "\t\t\t\tIgnoreAllDefaultLibraries=\"TRUE\"\r\n" ); - fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"NtProcessStartup\"\r\n" ); - fprintf ( OUT, "\t\t\t\tBaseAddress=\"%s\"\r\n", baseaddr.c_str ()); - } - else if ( module.type == Win32CUI || module.type == Win32GUI || module.type == Win32SCR) - { - if ( use_msvcrt_lib ) - { - fprintf ( OUT, "\t\t\t\tIgnoreAllDefaultLibraries=\"TRUE\"\r\n" ); - } - fprintf ( OUT, "\t\t\t\tSubSystem=\"%d\"\r\n", 2 ); - } + fprintf ( OUT, "\t\t\t\tAdditionalOptions=\" /ALIGN:0x20\"\r\n" ); + fprintf ( OUT, "\t\t\t\tSubSystem=\"%d\"\r\n", 1 ); + fprintf ( OUT, "\t\t\t\tGenerateManifest=\"FALSE\"\r\n" ); + fprintf ( OUT, "\t\t\t\tIgnoreAllDefaultLibraries=\"TRUE\"\r\n" ); + fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"NtProcessStartup\"\r\n" ); + fprintf ( OUT, "\t\t\t\tBaseAddress=\"%s\"\r\n", baseaddr.c_str ()); } - else if ( binaryType == Dll ) + else if ( module.type == Win32CUI || module.type == Win32GUI || module.type == Win32SCR) { - if (module.GetEntryPoint() == "0") - fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"\"\r\n" ); - else - { - // get rid of DllMain@12 because MSVC needs to link to _DllMainCRTStartup@12 - // when using CRT - if (module.GetEntryPoint() == "DllMain@12") - fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"\"\r\n" ); - else - fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"%s\"\r\n", module.GetEntryPoint().c_str ()); - } - fprintf ( OUT, "\t\t\t\tBaseAddress=\"%s\"\r\n", baseaddr == "" ? "0x40000" : baseaddr.c_str ()); if ( use_msvcrt_lib ) { fprintf ( OUT, "\t\t\t\tIgnoreAllDefaultLibraries=\"TRUE\"\r\n" ); } + fprintf ( OUT, "\t\t\t\tSubSystem=\"%d\"\r\n", 2 ); + } + } + else if ( binaryType == Dll ) + { + if (module.GetEntryPoint() == "0") + fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"\"\r\n" ); + else + { + // get rid of DllMain@12 because MSVC needs to link to _DllMainCRTStartup@12 + // when using CRT + if (module.GetEntryPoint() == "DllMain@12") + fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"\"\r\n" ); + else + fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"%s\"\r\n", module.GetEntryPoint().c_str ()); + } + fprintf ( OUT, "\t\t\t\tBaseAddress=\"%s\"\r\n", baseaddr == "" ? "0x40000" : baseaddr.c_str ()); + if ( use_msvcrt_lib ) + { + fprintf ( OUT, "\t\t\t\tIgnoreAllDefaultLibraries=\"TRUE\"\r\n" ); } - fprintf ( OUT, "\t\t\t\tTargetMachine=\"%d\"/>\r\n", 1 ); } fprintf ( OUT, "\t\t\t/>\r\n" ); } - fprintf ( OUT, "\t\t\t\r\n " ); + fprintf ( OUT, "\t\t\t\r\n" ); + if (configuration.VSProjectVersion == "8.00") + { fprintf ( OUT, "\t\t\t\r\n" ); - if (configuration.VSProjectVersion == "8.00") - { - fprintf ( OUT, "\t\t\t\r\n" ); - } - fprintf ( OUT, "\t\t\t\r\n" ); - fprintf ( OUT, "\t\t\t\r\n" ); - fprintf ( OUT, "\t\t\t\r\n" ); - fprintf ( OUT, "\t\t\t\r\n" ); - fprintf ( OUT, "\t\t\t\r\n" ); - fprintf ( OUT, "\t\t\r\n" ); + fprintf ( OUT, "\t\t\t\tName=\"VCManifestTool\"\r\n" ); + fprintf ( OUT, "\t\t\t\tEmbedManifest=\"false\"/>\r\n" ); } fprintf ( OUT, "\t\t\r\n" ); } @@ -790,7 +756,7 @@ VCProjMaker::_generate_makefile_configuration( const Module& module, const MSVCC if ( intenv == "obj-i386" ) intdir = path_basedir + "obj-i386"; /* append relative dir from project dir */ - else + else intdir = intenv; if ( outenv == "output-i386" ) @@ -799,23 +765,23 @@ VCProjMaker::_generate_makefile_configuration( const Module& module, const MSVCC outdir = outenv; if ( configuration.UseVSVersionInPath ) - { + { vcdir = DEF_SSEP + _get_vc_dir(); - } + } fprintf ( OUT, "\t\trelative_path.c_str (), cfg.name.c_str() ); fprintf ( OUT, "\t\t\tIntermediateDirectory=\"%s\\%s\\%s\"\r\n", intdir.c_str (), module.output->relative_path.c_str (), cfg.name.c_str() ); - } - else - { + } + else + { fprintf ( OUT, "\t\t\tOutputDirectory=\"%s\\%s\"\r\n", outdir.c_str (), module.output->relative_path.c_str () ); fprintf ( OUT, "\t\t\tIntermediateDirectory=\"%s\\%s\"\r\n", intdir.c_str (), module.output->relative_path.c_str () ); - } + } fprintf ( OUT, "\t\t\tConfigurationType=\"0\"\r\n"); fprintf ( OUT, "\t\t\t>\r\n" ); @@ -834,6 +800,6 @@ VCProjMaker::_generate_makefile_configuration( const Module& module, const MSVCC fprintf ( OUT, "\t\t\t\tForcedUsingAssemblies=\"\"\r\n"); fprintf ( OUT, "\t\t\t\tCompileAsManaged=\"\"\r\n"); - fprintf ( OUT, "\t\t\t/>\r\n" ); - fprintf ( OUT, "\t\t\r\n" ); - } + fprintf ( OUT, "\t\t\t/>\r\n" ); + fprintf ( OUT, "\t\t\r\n" ); +} From 671649213736af49bed28b0f3354c7e71fa95f87 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 23 Mar 2010 21:31:39 +0000 Subject: [PATCH 116/121] Fix some MSC intrinsics svn path=/branches/ros-amd64-bringup/; revision=46366 --- reactos/include/crt/msc/intrin.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/reactos/include/crt/msc/intrin.h b/reactos/include/crt/msc/intrin.h index 14d469fd809..f85fb228d10 100644 --- a/reactos/include/crt/msc/intrin.h +++ b/reactos/include/crt/msc/intrin.h @@ -21,20 +21,22 @@ void _ReadBarrier(void); void _WriteBarrier(void); #pragma intrinsic(_WriteBarrier) -char _InterlockedCompareExchange8(volatile char * const Destination, const char Exchange, const char Comperand); -#pragma intrinsic(_InterlockedCompareExchange8) short _InterlockedCompareExchange16(volatile short * const Destination, const short Exchange, const short Comperand); #pragma intrinsic(_InterlockedCompareExchange16) long _InterlockedCompareExchange(volatile long * const Destination, const long Exchange, const long Comperand); #pragma intrinsic(_InterlockedCompareExchange) +#if defined(_AMD64_) || defined(_IA64_) void * _InterlockedCompareExchangePointer(void * volatile * const Destination, void * const Exchange, void * const Comperand); #pragma intrinsic(_InterlockedCompareExchangePointer) -long _InterlockedExchange(volatile long * const Target, const long Value); -#pragma intrinsic(_InterlockedExchange) void * _InterlockedExchangePointer(void * volatile * const Target, void * const Value); #pragma intrinsic(_InterlockedExchangePointer) -long _InterlockedExchangeAdd16(volatile short * const Addend, const short Value); -#pragma intrinsic(_InterlockedExchangeAdd16) +#else +#define _InterlockedCompareExchangePointer _InterlockedCompareExchange +#define _InterlockedExchangePointer _InterlockedExchange +#endif +long _InterlockedExchange(volatile long * const Target, const long Value); +#pragma intrinsic(_InterlockedExchange) + long _InterlockedExchangeAdd(volatile long * const Addend, const long Value); #pragma intrinsic(_InterlockedExchangeAdd) char _InterlockedAnd8(volatile char * const value, const char mask); From 4cc21097018a42e518c462fb7c44d07541436817 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 23 Mar 2010 21:32:01 +0000 Subject: [PATCH 117/121] Fix a typo svn path=/branches/ros-amd64-bringup/; revision=46367 --- reactos/include/crt/vadefs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/include/crt/vadefs.h b/reactos/include/crt/vadefs.h index aa1b5116ace..280d0ffab7b 100644 --- a/reactos/include/crt/vadefs.h +++ b/reactos/include/crt/vadefs.h @@ -81,7 +81,7 @@ extern "C" { #define __va_copy(d,s) __builtin_va_copy(d,s) #elif defined(_MSC_VER) -#if defiend(_M_IX86) +#if defined(_M_IX86) #define _crt_va_start(v,l) ((void)((v) = (va_list)_ADDRESSOF(l) + _INTSIZEOF(l))) #define _crt_va_arg(v,l) (*(l *)(((v) += _INTSIZEOF(l)) - _INTSIZEOF(l))) #define _crt_va_end(v) ((void)((v) = (va_list)0)) From f56486bc2048a773dd8a386471dd00fb39e2ec37 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 23 Mar 2010 21:38:25 +0000 Subject: [PATCH 118/121] [wingdi] GetFontUnicodeRanges is _WIN32_WINNT >= 0x0500 svn path=/branches/ros-amd64-bringup/; revision=46368 --- reactos/include/psdk/wingdi.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/reactos/include/psdk/wingdi.h b/reactos/include/psdk/wingdi.h index ef233abde14..68d3166197e 100644 --- a/reactos/include/psdk/wingdi.h +++ b/reactos/include/psdk/wingdi.h @@ -2975,7 +2975,9 @@ UINT WINAPI GetEnhMetaFilePaletteEntries(HENHMETAFILE,UINT,LPPALETTEENTRY); UINT WINAPI GetEnhMetaFilePixelFormat(HENHMETAFILE,UINT,PIXELFORMATDESCRIPTOR*); DWORD WINAPI GetFontData(HDC,DWORD,DWORD,PVOID,DWORD); DWORD WINAPI GetFontLanguageInfo(HDC); +#if (_WIN32_WINNT >= 0x0500) DWORD WINAPI GetFontUnicodeRanges(HDC,LPGLYPHSET); +#endif DWORD WINAPI GetGlyphIndicesA(HDC,LPCSTR,INT,LPWORD,DWORD); DWORD WINAPI GetGlyphIndicesW(HDC,LPCWSTR,INT,LPWORD,DWORD); DWORD WINAPI GetGlyphOutlineA(HDC,UINT,UINT,LPGLYPHMETRICS,DWORD,PVOID,const MAT2*); From 15e28917ea5a5ff60866944723eb92223221e9d6 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 23 Mar 2010 21:38:52 +0000 Subject: [PATCH 119/121] fix a typo svn path=/branches/ros-amd64-bringup/; revision=46369 --- reactos/include/ddk/winddk.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/include/ddk/winddk.h b/reactos/include/ddk/winddk.h index 60ca7983e37..d3cf6623974 100644 --- a/reactos/include/ddk/winddk.h +++ b/reactos/include/ddk/winddk.h @@ -43,7 +43,7 @@ extern "C" { #define IN #define OUT #define OPTIONAL -#define UNALLIGNED +#define UNALIGNED #define CONST const From a86904e856ad4153f2407f00716aad2a7a3d7600 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 23 Mar 2010 23:45:57 +0000 Subject: [PATCH 120/121] Merge trunk HEAD (r46369) (part 1/x) svn path=/branches/ros-amd64-bringup/; revision=46375 --- reactos/tools/rbuild/backend/backend.h | 6 ++---- reactos/tools/rbuild/backend/codeblocks/codeblocks.h | 8 ++------ .../tools/rbuild/backend/dependencymap/dependencymap.h | 8 ++------ reactos/tools/rbuild/backend/mingw/compilers/gcc.mak | 6 +++--- reactos/tools/rbuild/backend/mingw/mingw.cpp | 5 ++++- reactos/tools/rbuild/backend/mingw/mingw.h | 6 ++---- reactos/tools/rbuild/backend/mingw/modulehandler.h | 6 ++---- reactos/tools/rbuild/backend/mingw/rule.h | 5 +---- reactos/tools/rbuild/backend/msbuild/msbuild.h | 8 ++------ reactos/tools/rbuild/backend/msvc/msvc.h | 5 ++--- .../tools/rbuild/backend/versionreport/versionreport.h | 7 ++----- reactos/tools/rbuild/exception.h | 6 ++---- reactos/tools/rbuild/pch.h | 6 ++---- reactos/tools/rbuild/rbuild.h | 6 ++---- reactos/tools/rbuild/test.h | 6 ++---- 15 files changed, 32 insertions(+), 62 deletions(-) diff --git a/reactos/tools/rbuild/backend/backend.h b/reactos/tools/rbuild/backend/backend.h index 87755e89409..7e9da13ed1d 100644 --- a/reactos/tools/rbuild/backend/backend.h +++ b/reactos/tools/rbuild/backend/backend.h @@ -15,8 +15,8 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __BACKEND_H -#define __BACKEND_H + +#pragma once #include "../rbuild.h" @@ -75,5 +75,3 @@ public: Project& ProjectNode; Configuration& configuration; }; - -#endif /* __BACKEND_H */ diff --git a/reactos/tools/rbuild/backend/codeblocks/codeblocks.h b/reactos/tools/rbuild/backend/codeblocks/codeblocks.h index 3848560f49e..c0d0c26309b 100644 --- a/reactos/tools/rbuild/backend/codeblocks/codeblocks.h +++ b/reactos/tools/rbuild/backend/codeblocks/codeblocks.h @@ -16,8 +16,8 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __CODEBLOCKS_H__ -#define __CODEBLOCKS_H__ + +#pragma once #include #include @@ -98,7 +98,3 @@ class CBBackend : public Backend bool _copy_file ( const std::string& inputname, const std::string& targetname ) const; const Property* _lookup_property ( const Module& module, const std::string& name ) const; }; - - -#endif // __MSVC_H__ - diff --git a/reactos/tools/rbuild/backend/dependencymap/dependencymap.h b/reactos/tools/rbuild/backend/dependencymap/dependencymap.h index 1610d37a448..96114f514fd 100644 --- a/reactos/tools/rbuild/backend/dependencymap/dependencymap.h +++ b/reactos/tools/rbuild/backend/dependencymap/dependencymap.h @@ -15,8 +15,8 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __DEPMAP_H__ -#define __DEPMAP_H__ + +#pragma once #include #include @@ -62,7 +62,3 @@ class DepMapBackend : public Backend }; }; - - -#endif // __DEPMAP_H__ - diff --git a/reactos/tools/rbuild/backend/mingw/compilers/gcc.mak b/reactos/tools/rbuild/backend/mingw/compilers/gcc.mak index f54acd005a7..1f2a09f7f98 100644 --- a/reactos/tools/rbuild/backend/mingw/compilers/gcc.mak +++ b/reactos/tools/rbuild/backend/mingw/compilers/gcc.mak @@ -17,7 +17,7 @@ endif BUILTIN_CXXFLAGS+= -fno-optimize-sibling-calls # Add -fno-set-stack-executable required for x86/MinGW -ifneq (,$(filter $(ARCH), i386)) +ifneq (,$(filter $(ARCH),amd64 i386)) BUILTIN_CFLAGS+= -fno-set-stack-executable BUILTIN_CXXFLAGS+= -fno-set-stack-executable endif @@ -129,7 +129,7 @@ ${call RBUILD_intermediate_dir,$(2)}$$(SEP).gch_$(1)$$(SEP)$(notdir $(2)).gch.d: ${call RBUILD_intermediate_dir,$(2)}$$(SEP).gch_$(1)$$(SEP)$(notdir $(2)).gch: $(2) ${call RBUILD_intermediate_dir,$(2)}$$(SEP).gch_$(1)$$(SEP)$(notdir $(2)).gch.d $(3) | ${call RBUILD_intermediate_dir,$(2)}$$(SEP).gch_$(1) $$(ECHO_PCH) - $${gcc} -MF $$@ ${call RBUILD_cflags,$(1),$(4)} -x c-header -M -MP -MT $$@ $$< + $${gcc} -o $$@ ${call RBUILD_cflags,$(1),$(4)} -x c-header $$< else @@ -156,7 +156,7 @@ ${call RBUILD_intermediate_dir,$(2)}$$(SEP).gch_$(1)$$(SEP)$(notdir $(2)).gch.d: ${call RBUILD_intermediate_dir,$(2)}$$(SEP).gch_$(1)$$(SEP)$(notdir $(2)).gch: $(2) ${call RBUILD_intermediate_dir,$(2)}$$(SEP).gch_$(1)$$(SEP)$(notdir $(2)).gch.d $(3) | ${call RBUILD_intermediate_dir,$(2)}$$(SEP).gch_$(1) $$(ECHO_PCH) - $${gpp} -MF $$@ ${call RBUILD_cxxflags,$(1),$(4)} -x c++-header -M -MP -MT $$@ $$< + $${gpp} -o $$@ ${call RBUILD_cxxflags,$(1),$(4)} -x c++-header $$< else diff --git a/reactos/tools/rbuild/backend/mingw/mingw.cpp b/reactos/tools/rbuild/backend/mingw/mingw.cpp index 2ffc0ee5932..fa428a2aaf5 100644 --- a/reactos/tools/rbuild/backend/mingw/mingw.cpp +++ b/reactos/tools/rbuild/backend/mingw/mingw.cpp @@ -487,8 +487,11 @@ MingwBackend::GenerateGlobalVariables () const fputs ( "BUILTIN_CXXINCLUDES+= $(TARGET_CPPFLAGS)\n", fMakefile ); fprintf ( fMakefile, "PROJECT_CCLIBS := \"$(shell ${TARGET_CC} -print-libgcc-file-name)\"\n" ); - fprintf ( fMakefile, "PROJECT_CXXLIBS := \"$(shell ${TARGET_CPP} -print-file-name=libstdc++.a)\" \"$(shell ${TARGET_CPP} -print-libgcc-file-name)\" \"$(shell ${TARGET_CPP} -print-file-name=libmingw32.a)\" \"$(shell ${TARGET_CPP} -print-file-name=libmingwex.a)\" " ); + // We use our proprietary "ofmt_stub.a" to implement a stub for "_get_output_format" required by "libmingwex.a". + // This archive just contains the compiled "ofmt_stub.s" supplied with the MinGW Runtime sources. + fprintf ( fMakefile, "PROJECT_CXXLIBS := \"$(shell ${TARGET_CPP} -print-file-name=libstdc++.a)\" \"$(shell ${TARGET_CPP} -print-libgcc-file-name)\" \"$(shell ${TARGET_CPP} -print-file-name=libmingw32.a)\" \"$(shell ${TARGET_CPP} -print-file-name=libmingwex.a)\" \"$(shell ${TARGET_CPP} -print-file-name=ofmt_stub.a)\" \"$(shell ${TARGET_CPP} -print-file-name=libcoldname.a)\"\n" ); + /* hack to get libgcc_eh.a, should check mingw version or something */ if (Environment::GetArch() == "amd64") fprintf ( fMakefile, " \"$(shell ${TARGET_CPP} -print-file-name=libgcc_eh.a)\"" ); diff --git a/reactos/tools/rbuild/backend/mingw/mingw.h b/reactos/tools/rbuild/backend/mingw/mingw.h index 4e313946d1d..e73973f8d7d 100644 --- a/reactos/tools/rbuild/backend/mingw/mingw.h +++ b/reactos/tools/rbuild/backend/mingw/mingw.h @@ -15,8 +15,8 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef MINGW_H -#define MINGW_H + +#pragma once #include "../backend.h" @@ -150,5 +150,3 @@ struct ModuleHandlerInformations }; extern const struct ModuleHandlerInformations ModuleHandlerInformations[]; - -#endif /* MINGW_H */ diff --git a/reactos/tools/rbuild/backend/mingw/modulehandler.h b/reactos/tools/rbuild/backend/mingw/modulehandler.h index 797f075812a..b67f63f4b7a 100644 --- a/reactos/tools/rbuild/backend/mingw/modulehandler.h +++ b/reactos/tools/rbuild/backend/mingw/modulehandler.h @@ -15,8 +15,8 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef MINGW_MODULEHANDLER_H -#define MINGW_MODULEHANDLER_H + +#pragma once #include "../backend.h" #include "mingw.h" @@ -370,5 +370,3 @@ public: MingwElfExecutableModuleHandler ( const Module& module ); virtual void Process (); }; - -#endif /* MINGW_MODULEHANDLER_H */ diff --git a/reactos/tools/rbuild/backend/mingw/rule.h b/reactos/tools/rbuild/backend/mingw/rule.h index fa56b0d9319..1c9c9a5bf86 100644 --- a/reactos/tools/rbuild/backend/mingw/rule.h +++ b/reactos/tools/rbuild/backend/mingw/rule.h @@ -16,8 +16,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef MINGW_RULE_H -#define MINGW_RULE_H +#pragma once #include "mingw.h" @@ -46,5 +45,3 @@ private: const std::string command; string_list generatedFiles; }; - -#endif diff --git a/reactos/tools/rbuild/backend/msbuild/msbuild.h b/reactos/tools/rbuild/backend/msbuild/msbuild.h index 62522789a6e..d1cd1f08fe6 100644 --- a/reactos/tools/rbuild/backend/msbuild/msbuild.h +++ b/reactos/tools/rbuild/backend/msbuild/msbuild.h @@ -15,8 +15,8 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __MSBUILD_H__ -#define __MSBUILD_H__ + +#pragma once #include #include @@ -66,7 +66,3 @@ class MsBuildBackend : public Backend }; }; - - -#endif // __MsBuild_H__ - diff --git a/reactos/tools/rbuild/backend/msvc/msvc.h b/reactos/tools/rbuild/backend/msvc/msvc.h index 4be80c64c99..a917c12e187 100644 --- a/reactos/tools/rbuild/backend/msvc/msvc.h +++ b/reactos/tools/rbuild/backend/msvc/msvc.h @@ -16,8 +16,8 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __MSVC_H__ -#define __MSVC_H__ + +#pragma once #include #include @@ -253,4 +253,3 @@ class PropsMaker void _generate_footer(); }; -#endif // __MSVC_H__ diff --git a/reactos/tools/rbuild/backend/versionreport/versionreport.h b/reactos/tools/rbuild/backend/versionreport/versionreport.h index 2b677b8e5b7..24d4addefb1 100644 --- a/reactos/tools/rbuild/backend/versionreport/versionreport.h +++ b/reactos/tools/rbuild/backend/versionreport/versionreport.h @@ -15,8 +15,8 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __VREPORT_H__ -#define __VREPORT_H__ + +#pragma once #include #include @@ -63,6 +63,3 @@ class VReportBackend : public Backend }; }; - - -#endif // __VREPORT_H__ diff --git a/reactos/tools/rbuild/exception.h b/reactos/tools/rbuild/exception.h index 9adde7d7cc2..c09528553f5 100644 --- a/reactos/tools/rbuild/exception.h +++ b/reactos/tools/rbuild/exception.h @@ -15,8 +15,8 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __EXCEPTION_H -#define __EXCEPTION_H + +#pragma once #include "pch.h" #include "xml.h" @@ -144,5 +144,3 @@ public: std::string BuildTool; std::string Version; }; - -#endif /* __EXCEPTION_H */ diff --git a/reactos/tools/rbuild/pch.h b/reactos/tools/rbuild/pch.h index 298699e45bc..e98342b1b8b 100644 --- a/reactos/tools/rbuild/pch.h +++ b/reactos/tools/rbuild/pch.h @@ -15,8 +15,8 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef PCH_H -#define PCH_H + +#pragma once #ifdef _MSC_VER #pragma warning ( disable : 4786 ) // identifier was truncated to '255' characters in the debug information @@ -79,5 +79,3 @@ inline char *strupr(char *x) #define MAX_PATH PATH_MAX #define _MAX_PATH PATH_MAX #endif - -#endif//PCH_H diff --git a/reactos/tools/rbuild/rbuild.h b/reactos/tools/rbuild/rbuild.h index 9ecb9520e82..e5be60ce897 100644 --- a/reactos/tools/rbuild/rbuild.h +++ b/reactos/tools/rbuild/rbuild.h @@ -15,8 +15,8 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __RBUILD_H -#define __RBUILD_H + +#pragma once #include "pch.h" @@ -1098,5 +1098,3 @@ NormalizeFilename ( const std::string& filename ); extern std::string ToLower ( std::string filename ); - -#endif /* __RBUILD_H */ diff --git a/reactos/tools/rbuild/test.h b/reactos/tools/rbuild/test.h index fd9cdfca32f..69e131f44ed 100644 --- a/reactos/tools/rbuild/test.h +++ b/reactos/tools/rbuild/test.h @@ -15,8 +15,8 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TEST_H -#define __TEST_H + +#pragma once #include "rbuild.h" #include "backend/mingw/mingw.h" @@ -160,5 +160,3 @@ class CompilationUnitTest : public BaseTest public: void Run (); }; - -#endif /* __TEST_H */ From d99dcece8ab1b7f5a36d5d0106905a37f092795b Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 23 Mar 2010 23:57:55 +0000 Subject: [PATCH 121/121] Merge trunk HEAD (r46369) (part 3/x) svn path=/branches/ros-amd64-bringup/; revision=46377 --- reactos/dll/win32/localui/localui.c | 10 +++------- reactos/dll/win32/localui/localui.h | 2 ++ reactos/dll/win32/localui/localui.rc | 10 ++++++---- reactos/dll/win32/localui/ui_Da.rc | 2 ++ reactos/dll/win32/localui/ui_De.rc | 14 +++++++++----- reactos/dll/win32/localui/ui_En.rc | 2 ++ reactos/dll/win32/localui/ui_Fr.rc | 5 +++-- reactos/dll/win32/localui/ui_Ko.rc | 2 ++ reactos/dll/win32/localui/ui_Lt.rc | 3 +-- reactos/dll/win32/localui/ui_Nl.rc | 2 ++ reactos/dll/win32/localui/ui_No.rc | 2 ++ reactos/dll/win32/localui/ui_Pl.rc | 2 ++ reactos/dll/win32/localui/ui_Pt.rc | 2 ++ reactos/dll/win32/localui/ui_Ro.rc | 4 ++-- reactos/dll/win32/localui/ui_Ru.rc | 27 ++++++++++++++++----------- reactos/dll/win32/localui/ui_Si.rc | 4 ++-- reactos/dll/win32/localui/ui_Sv.rc | 2 ++ reactos/dll/win32/localui/ui_Zh.rc | 4 ++-- 18 files changed, 62 insertions(+), 37 deletions(-) diff --git a/reactos/dll/win32/localui/localui.c b/reactos/dll/win32/localui/localui.c index 2acfc7ecafa..b9e4c4ee324 100644 --- a/reactos/dll/win32/localui/localui.c +++ b/reactos/dll/win32/localui/localui.c @@ -503,7 +503,6 @@ static BOOL WINAPI localui_AddPortUI(PCWSTR pName, HWND hWnd, PCWSTR pMonitorNam { addportui_t data; HANDLE hXcv; - LPWSTR ptr = NULL; DWORD needed; DWORD dummy; DWORD status; @@ -529,14 +528,11 @@ static BOOL WINAPI localui_AddPortUI(PCWSTR pName, HWND hWnd, PCWSTR pMonitorNam (PBYTE) &dummy, 0, &needed, &status); TRACE("got %u with status %u\n", res, status); - if (res && (status == ERROR_SUCCESS)) { + if (res && (status == ERROR_SUCCESS) && ppPortName) { /* Native localui uses GlobalAlloc also. The caller must GlobalFree the buffer */ - ptr = GlobalAlloc(GPTR, (lstrlenW(data.portname)+1) * sizeof(WCHAR)); - if (ptr) { - lstrcpyW(ptr, data.portname); - if (ppPortName) *ppPortName = ptr; - } + *ppPortName = GlobalAlloc(GPTR, (lstrlenW(data.portname)+1) * sizeof(WCHAR)); + if (*ppPortName) lstrcpyW(*ppPortName, data.portname); } if (res && (status == ERROR_ALREADY_EXISTS)) { diff --git a/reactos/dll/win32/localui/localui.h b/reactos/dll/win32/localui/localui.h index aa244bdc824..25424da568c 100644 --- a/reactos/dll/win32/localui/localui.h +++ b/reactos/dll/win32/localui/localui.h @@ -21,6 +21,8 @@ #ifndef __WINE_LOCALUI__ #define __WINE_LOCALUI__ +#include +#include /* ## Resource-ID ## */ #define ADDPORT_DIALOG 100 diff --git a/reactos/dll/win32/localui/localui.rc b/reactos/dll/win32/localui/localui.rc index 9963acb20ae..f229f722cc9 100644 --- a/reactos/dll/win32/localui/localui.rc +++ b/reactos/dll/win32/localui/localui.rc @@ -39,17 +39,19 @@ #include "ui_Da.rc" -#include "ui_De.rc" #include "ui_En.rc" -#include "ui_Fr.rc" #include "ui_Ko.rc" -#include "ui_Lt.rc" #include "ui_Nl.rc" #include "ui_No.rc" #include "ui_Pl.rc" #include "ui_Pt.rc" +#include "ui_Sv.rc" + +/* UTF-8 */ +#include "ui_De.rc" +#include "ui_Fr.rc" +#include "ui_Lt.rc" #include "ui_Ro.rc" #include "ui_Ru.rc" #include "ui_Si.rc" -#include "ui_Sv.rc" #include "ui_Zh.rc" diff --git a/reactos/dll/win32/localui/ui_Da.rc b/reactos/dll/win32/localui/ui_Da.rc index 97299266959..861ba8f2ddf 100644 --- a/reactos/dll/win32/localui/ui_Da.rc +++ b/reactos/dll/win32/localui/ui_Da.rc @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "localui.h" + LANGUAGE LANG_DANISH, SUBLANG_DEFAULT ADDPORT_DIALOG DIALOG LOADONCALL MOVEABLE DISCARDABLE 6, 18, 245, 47 diff --git a/reactos/dll/win32/localui/ui_De.rc b/reactos/dll/win32/localui/ui_De.rc index 2fe35fc4e77..74148c3441b 100644 --- a/reactos/dll/win32/localui/ui_De.rc +++ b/reactos/dll/win32/localui/ui_De.rc @@ -18,14 +18,18 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "localui.h" + +#pragma code_page(65001) + LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL ADDPORT_DIALOG DIALOG LOADONCALL MOVEABLE DISCARDABLE 6, 18, 245, 47 STYLE DS_CONTEXTHELP | DS_MODALFRAME | DS_SETFONT | DS_SETFOREGROUND | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "Lokalen Anschluss hinzufgen" +CAPTION "Lokalen Anschluss hinzufügen" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "&Lokaler Anschuss, der hinzugefgt werden soll:", -1, 7, 13, 194, 13, WS_VISIBLE + LTEXT "&Lokaler Anschuss, der hinzugefügt werden soll:", -1, 7, 13, 194, 13, WS_VISIBLE EDITTEXT ADDPORT_EDIT, 6, 28, 174, 12, WS_VISIBLE | ES_AUTOHSCROLL DEFPUSHBUTTON "OK", IDOK, 188, 10, 50, 14, WS_VISIBLE PUSHBUTTON "Abbrechen", IDCANCEL, 188, 27, 50, 14, WS_VISIBLE @@ -37,8 +41,8 @@ STYLE DS_CONTEXTHELP | DS_MODALFRAME | DS_SETFONT | DS_SETFOREGROUND | WS_POPUPW CAPTION "LPT-Anschluss konfigurieren" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "Zeitberschreitung (Sekunden)", LPTCONFIG_GROUP, 6, 6, 150, 35, BS_GROUPBOX - LTEXT "&bertragung wiederholen:", -1, 14, 22, 90, 13, WS_VISIBLE + GROUPBOX "Zeitüberschreitung (Sekunden)", LPTCONFIG_GROUP, 6, 6, 150, 35, BS_GROUPBOX + LTEXT "Ü&bertragung wiederholen:", -1, 14, 22, 90, 13, WS_VISIBLE EDITTEXT LPTCONFIG_EDIT, 112, 20, 32, 13, WS_VISIBLE | ES_NUMBER DEFPUSHBUTTON "OK", IDOK, 164, 10, 50, 14, WS_VISIBLE PUSHBUTTON "Abbrechen", IDCANCEL, 164, 27, 50, 14, WS_VISIBLE @@ -48,7 +52,7 @@ END STRINGTABLE DISCARDABLE { IDS_LOCALPORT "Lokaler Anschluss" - IDS_INVALIDNAME "'%s' ist kein gltiger Anschlussname" + IDS_INVALIDNAME "'%s' ist kein gültiger Anschlussname" IDS_PORTEXISTS "Der Anschluss %s existiert bereits" IDS_NOTHINGTOCONFIG "Dieser Anschluss hat keine Optionen zum Konfigurieren" } diff --git a/reactos/dll/win32/localui/ui_En.rc b/reactos/dll/win32/localui/ui_En.rc index c2de6263a8a..5a218680472 100644 --- a/reactos/dll/win32/localui/ui_En.rc +++ b/reactos/dll/win32/localui/ui_En.rc @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "localui.h" + LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT ADDPORT_DIALOG DIALOG LOADONCALL MOVEABLE DISCARDABLE 6, 18, 245, 47 diff --git a/reactos/dll/win32/localui/ui_Fr.rc b/reactos/dll/win32/localui/ui_Fr.rc index 261fa0b7dd2..70e4baf06ee 100644 --- a/reactos/dll/win32/localui/ui_Fr.rc +++ b/reactos/dll/win32/localui/ui_Fr.rc @@ -17,6 +17,9 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ + +#include "localui.h" + #pragma code_page(65001) LANGUAGE LANG_FRENCH, SUBLANG_NEUTRAL @@ -53,5 +56,3 @@ STRINGTABLE DISCARDABLE IDS_PORTEXISTS "Le port %s existe déjà" IDS_NOTHINGTOCONFIG "Ce port n'a pas d'options de configuration" } - -#pragma code_page(default) diff --git a/reactos/dll/win32/localui/ui_Ko.rc b/reactos/dll/win32/localui/ui_Ko.rc index 9a380308422..d86b7ef58a5 100644 --- a/reactos/dll/win32/localui/ui_Ko.rc +++ b/reactos/dll/win32/localui/ui_Ko.rc @@ -19,6 +19,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "localui.h" + LANGUAGE LANG_KOREAN, SUBLANG_DEFAULT ADDPORT_DIALOG DIALOG LOADONCALL MOVEABLE DISCARDABLE 6, 18, 245, 47 diff --git a/reactos/dll/win32/localui/ui_Lt.rc b/reactos/dll/win32/localui/ui_Lt.rc index 698918afb85..ff789e17fba 100644 --- a/reactos/dll/win32/localui/ui_Lt.rc +++ b/reactos/dll/win32/localui/ui_Lt.rc @@ -53,8 +53,7 @@ END STRINGTABLE DISCARDABLE { IDS_LOCALPORT "Vietinis prievadas" - IDS_INVALIDNAME "'%s' yra netinkamas prievado vardas" + IDS_INVALIDNAME "„%s“ yra netinkamas prievado vardas" IDS_PORTEXISTS "Prievadas %s jau egzistuoja" IDS_NOTHINGTOCONFIG "Šis prievadas neturi parinkčių konfigūravimui" } -#pragma code_page(default) diff --git a/reactos/dll/win32/localui/ui_Nl.rc b/reactos/dll/win32/localui/ui_Nl.rc index 59c58ffd3aa..21d7cc84fae 100644 --- a/reactos/dll/win32/localui/ui_Nl.rc +++ b/reactos/dll/win32/localui/ui_Nl.rc @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "localui.h" + LANGUAGE LANG_DUTCH, SUBLANG_NEUTRAL ADDPORT_DIALOG DIALOG LOADONCALL MOVEABLE DISCARDABLE 6, 18, 245, 47 diff --git a/reactos/dll/win32/localui/ui_No.rc b/reactos/dll/win32/localui/ui_No.rc index 3a46bc8ee88..8ed9e00c8aa 100644 --- a/reactos/dll/win32/localui/ui_No.rc +++ b/reactos/dll/win32/localui/ui_No.rc @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "localui.h" + LANGUAGE LANG_NORWEGIAN, SUBLANG_NORWEGIAN_BOKMAL ADDPORT_DIALOG DIALOG LOADONCALL MOVEABLE DISCARDABLE 6, 18, 245, 47 diff --git a/reactos/dll/win32/localui/ui_Pl.rc b/reactos/dll/win32/localui/ui_Pl.rc index 74a5015e00a..822763d7dae 100644 --- a/reactos/dll/win32/localui/ui_Pl.rc +++ b/reactos/dll/win32/localui/ui_Pl.rc @@ -19,6 +19,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "localui.h" + LANGUAGE LANG_POLISH, SUBLANG_DEFAULT ADDPORT_DIALOG DIALOG LOADONCALL MOVEABLE DISCARDABLE 6, 18, 245, 47 diff --git a/reactos/dll/win32/localui/ui_Pt.rc b/reactos/dll/win32/localui/ui_Pt.rc index 7bad5211ead..7f1684820f7 100644 --- a/reactos/dll/win32/localui/ui_Pt.rc +++ b/reactos/dll/win32/localui/ui_Pt.rc @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "localui.h" + LANGUAGE LANG_PORTUGUESE, SUBLANG_NEUTRAL ADDPORT_DIALOG DIALOG LOADONCALL MOVEABLE DISCARDABLE 6, 18, 245, 47 diff --git a/reactos/dll/win32/localui/ui_Ro.rc b/reactos/dll/win32/localui/ui_Ro.rc index 43edfe6a4b1..a1b1c771fa1 100644 --- a/reactos/dll/win32/localui/ui_Ro.rc +++ b/reactos/dll/win32/localui/ui_Ro.rc @@ -17,6 +17,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "localui.h" + LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL #pragma code_page(65001) @@ -53,5 +55,3 @@ STRINGTABLE DISCARDABLE IDS_PORTEXISTS "Portul %s existsă deja" IDS_NOTHINGTOCONFIG "Acest port nu are opțiuni de configurat" } - -#pragma code_page(default) diff --git a/reactos/dll/win32/localui/ui_Ru.rc b/reactos/dll/win32/localui/ui_Ru.rc index 96e78f1971b..04f87b68e70 100644 --- a/reactos/dll/win32/localui/ui_Ru.rc +++ b/reactos/dll/win32/localui/ui_Ru.rc @@ -18,37 +18,42 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "localui.h" + +/* UTF-8 */ +#pragma code_page(65001) + LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT ADDPORT_DIALOG DIALOG LOADONCALL MOVEABLE DISCARDABLE 6, 18, 245, 47 STYLE DS_CONTEXTHELP | DS_MODALFRAME | DS_SETFONT | DS_SETFOREGROUND | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Добавить локальный порт" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " & :", -1, 7, 13, 194, 13, WS_VISIBLE + LTEXT "Введите &название локального порта:", -1, 7, 13, 194, 13, WS_VISIBLE EDITTEXT ADDPORT_EDIT, 6, 28, 174, 12, WS_VISIBLE | ES_AUTOHSCROLL DEFPUSHBUTTON "OK", IDOK, 199, 10, 40, 14, WS_VISIBLE - PUSHBUTTON "", IDCANCEL, 199, 27, 40, 14, WS_VISIBLE + PUSHBUTTON "Отменить", IDCANCEL, 199, 27, 40, 14, WS_VISIBLE END LPTCONFIG_DIALOG DIALOG LOADONCALL MOVEABLE DISCARDABLE 6, 18, 220, 47 STYLE DS_CONTEXTHELP | DS_MODALFRAME | DS_SETFONT | DS_SETFOREGROUND | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Установки параллельного порта" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "- ()", LPTCONFIG_GROUP, 6, 6, 150, 35, BS_GROUPBOX - LTEXT "& :", -1, 14, 22, 90, 13, WS_VISIBLE + GROUPBOX "Тайм-аут (секунд)", LPTCONFIG_GROUP, 6, 6, 150, 35, BS_GROUPBOX + LTEXT "&Попыток пересылки:", -1, 14, 22, 90, 13, WS_VISIBLE EDITTEXT LPTCONFIG_EDIT, 112, 20, 32, 13, WS_VISIBLE | ES_NUMBER DEFPUSHBUTTON "OK", IDOK, 164, 10, 50, 14, WS_VISIBLE - PUSHBUTTON "", IDCANCEL, 164, 27, 50, 14, WS_VISIBLE + PUSHBUTTON "Отмена", IDCANCEL, 164, 27, 50, 14, WS_VISIBLE END STRINGTABLE DISCARDABLE { - IDS_LOCALPORT " " - IDS_INVALIDNAME " '%s'" - IDS_PORTEXISTS " '%s' " - IDS_NOTHINGTOCONFIG " " + IDS_LOCALPORT "Локальный порт" + IDS_INVALIDNAME "Не правильное название порта '%s'" + IDS_PORTEXISTS "Порт '%s' уже существует" + IDS_NOTHINGTOCONFIG "Этот порт не имеет настроек" } diff --git a/reactos/dll/win32/localui/ui_Si.rc b/reactos/dll/win32/localui/ui_Si.rc index 961a2e046d4..6810c7ce733 100644 --- a/reactos/dll/win32/localui/ui_Si.rc +++ b/reactos/dll/win32/localui/ui_Si.rc @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "localui.h" + #pragma code_page(65001) LANGUAGE LANG_SLOVENIAN, SUBLANG_DEFAULT @@ -54,5 +56,3 @@ STRINGTABLE DISCARDABLE IDS_PORTEXISTS "Vrata z imenom %s že obstajajo" IDS_NOTHINGTOCONFIG "Ta vrata nimajo možnosti nastavitve" } - -#pragma code_page(default) diff --git a/reactos/dll/win32/localui/ui_Sv.rc b/reactos/dll/win32/localui/ui_Sv.rc index 3cd22fd8c70..e137079ffe4 100644 --- a/reactos/dll/win32/localui/ui_Sv.rc +++ b/reactos/dll/win32/localui/ui_Sv.rc @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "localui.h" + LANGUAGE LANG_SWEDISH, SUBLANG_NEUTRAL ADDPORT_DIALOG DIALOG LOADONCALL MOVEABLE DISCARDABLE 6, 18, 245, 47 diff --git a/reactos/dll/win32/localui/ui_Zh.rc b/reactos/dll/win32/localui/ui_Zh.rc index 197ac1dd38d..f43dde9afbd 100644 --- a/reactos/dll/win32/localui/ui_Zh.rc +++ b/reactos/dll/win32/localui/ui_Zh.rc @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "localui.h" + /* Chinese text is encoded in UTF-8 */ #pragma code_page(65001) @@ -90,5 +92,3 @@ STRINGTABLE DISCARDABLE IDS_PORTEXISTS "端口 %s 已經存在" IDS_NOTHINGTOCONFIG "這個端口沒有可設定選項" } - -#pragma code_page(default)