Make some i386 code conditional

Add missing svn:eol-style=native property

svn path=/trunk/; revision=28778
This commit is contained in:
Hervé Poussineau 2007-09-02 18:05:16 +00:00
parent 2d5d8783a9
commit b2454a486f
11 changed files with 659 additions and 603 deletions

View file

@ -124,6 +124,7 @@ _module_name_from_addr(const void* addr, void **module_start_addr,
return psz;
}
#ifdef _M_IX86
static VOID
_dump_context(PCONTEXT pc)
{
@ -138,6 +139,13 @@ _dump_context(PCONTEXT pc)
pc->Ebp, pc->Esi, pc->Esp);
DbgPrint("EDI: %.8x EFLAGS: %.8x\n", pc->Edi, pc->EFlags);
}
#else
#warning Unknown architecture
static VOID
_dump_context(PCONTEXT pc)
{
}
#endif
static LONG
BasepCheckForReadOnlyResource(IN PVOID Ptr)
@ -237,9 +245,9 @@ UnhandledExceptionFilter(struct _EXCEPTION_POINTERS *ExceptionInfo)
{
#ifdef _X86_
PULONG Frame;
#endif
PVOID StartAddr;
CHAR szMod[128] = "";
#endif
/* Print a stack trace. */
DbgPrint("Unhandled exception\n");

View file

@ -108,10 +108,12 @@
<file>utils.c</file>
</directory>
<directory name="thread">
<if property="ARCH" value="i386">
<directory name="i386">
<file>fiber.S</file>
<file>thread.S</file>
</directory>
</if>
</directory>
</module>
<module name="kernel32" type="win32dll" baseaddress="${BASEADDRESS_KERNEL32}" installbase="system32" installname="kernel32.dll">

View file

@ -257,6 +257,7 @@ DllMain(HANDLE hDll,
{
case DLL_PROCESS_ATTACH:
#ifdef _M_IX86
/* OK, yes, this is really retarded but it works for now */
InWindows = NtCurrentPeb()->BeingDebugged;
@ -290,6 +291,7 @@ DllMain(HANDLE hDll,
*Eip = (ULONG)BaseProcessStartThunk;
}
}
#endif
/* Don't bother us for each thread */
LdrDisableThreadCalloutsForDll((PVOID)hDll);

View file

@ -9,7 +9,9 @@
/* INCLUDES ****************************************************************/
#include <k32.h>
#ifdef _M_IX86
#include "i386/ketypes.h"
#endif
#define NDEBUG
#include "../include/debug.h"
@ -334,6 +336,7 @@ BasepInitializeContext(IN PCONTEXT Context,
IN PVOID StackAddress,
IN ULONG ContextType)
{
#ifdef _M_IX86
DPRINT("BasepInitializeContext: %p\n", Context);
/* Setup the Initial Win32 Thread Context */
@ -371,6 +374,11 @@ BasepInitializeContext(IN PCONTEXT Context,
/* Give it some room for the Parameter */
Context->Esp -= sizeof(PVOID);
#else
#warning Unknown architecture
UNIMPLEMENTED;
DbgBreakPoint();
#endif
}
/*

View file

@ -251,12 +251,18 @@ VOID
WINAPI
BaseFiberStartup(VOID)
{
#ifdef _M_IX86
PFIBER Fiber = GetFiberData();
/* Call the Thread Startup Routine */
DPRINT1("Starting Fiber\n");
BaseThreadStartup((LPTHREAD_START_ROUTINE)Fiber->Context.Eax,
(LPVOID)Fiber->Context.Ebx);
#else
#warning Unknown architecture
UNIMPLEMENTED;
DbgBreakPoint();
#endif
}
/* EOF */

View file

@ -150,7 +150,7 @@ extern unsigned long __cdecl DbgPrint(const char * format, ...);
} \
}
#else
#error Unsupported platform.
#define _SEH_TRACE_CONTEXT(FRAME_, CONTEXT_)
#endif
#define _SEH_TRACE_UNWIND(FRAME_, ARGS_) \

View file

@ -27,9 +27,13 @@ RtlRaiseException(PEXCEPTION_RECORD ExceptionRecord)
CONTEXT Context;
NTSTATUS Status;
/* Capture the context and fixup ESP */
/* Capture the context */
RtlCaptureContext(&Context);
#ifdef _M_IX86
/* Fixup ESP */
Context.Esp += sizeof(ULONG);
#endif
/* Save the exception address */
ExceptionRecord->ExceptionAddress = RtlpGetExceptionAddress();
@ -75,8 +79,10 @@ RtlRaiseStatus(NTSTATUS Status)
/* Capture the context */
RtlCaptureContext(&Context);
#ifdef _M_IX86
/* Add one argument to ESP */
Context.Esp += sizeof(PVOID);
#endif
/* Create an exception record */
ExceptionRecord.ExceptionAddress = RtlpGetExceptionAddress();
@ -123,10 +129,16 @@ RtlWalkFrameChain(OUT PVOID *Callers,
ULONG i = 0;
/* Get current EBP */
#if defined(_M_IX86)
#if defined __GNUC__
__asm__("mov %%ebp, %0" : "=r" (Stack) : );
#elif defined(_MSC_VER)
__asm mov Stack, ebp
#endif
#elif defined(_M_MIPS)
__asm__("move $sp, %0" : "=r" (Stack) : );
#else
#error Unknown architecture
#endif
/* Set it as the stack begin limit as well */

View file

@ -1,5 +1,6 @@
#include <string.h>
#include <ctype.h>
#include <basetsd.h>
/*
* @implemented

View file

@ -1,6 +1,6 @@
#include <string.h>
#include <ctype.h>
#include <basetsd.h>
/*
* @implemented

View file

@ -35,6 +35,7 @@
/* DEFINES *****************************************************************/
#ifdef _M_IX86
#ifdef __GNUC__
#define FLOAT_TO_INT(in,out) \
__asm__ __volatile__ ("fistpl %0" : "=m" (out) : "t" (in) : "st");
@ -43,6 +44,10 @@
__asm fld in \
__asm fistp out
#endif
#else
#define FLOAT_TO_INT(in,out) \
out = (long)in;
#endif
/* the following deal with IEEE single-precision numbers */
#define EXCESS 126L

View file

@ -62,6 +62,12 @@
" mtlr 0\n" \
" addi 1,1,16\n" \
" blr\n"
#define UserModeStub_mips " li $8, KUSER_SHARED_SYSCALL\n" \
" lw $8,0($8)\n" \
" j $8\n" \
" nop\n"
#elif defined(_MSC_VER)
#define UserModeStub_x86 " asm { \n" \
" mov eax, %xh\n" \
@ -87,6 +93,10 @@
#define KernelModeStub_ppc " bl KiSystemService\n" \
" rfi\n"
#define KernelModeStub_mips " j KiSystemService\n" \
" nop\n"
#elif defined(_MSC_VER)
#define KernelModeStub_x86 " asm { \n" \
" mov eax, %xh\n" \
@ -115,6 +125,8 @@ struct ncitool_data_t ncitool_data[] = {
".global _%s@%d\n", "_%s@%d:\n" },
{ "powerpc", 4, KernelModeStub_ppc, UserModeStub_ppc,
"\t.globl %s\n", "%s:\n" },
{ "mips", 4, KernelModeStub_mips, UserModeStub_mips,
"\t.globl %s\n", "%s:\n" },
{ 0, }
};
int arch_sel = 0;