mirror of
https://github.com/reactos/reactos.git
synced 2025-04-20 04:20:46 +00:00
Make some i386 code conditional
Add missing svn:eol-style=native property svn path=/trunk/; revision=28778
This commit is contained in:
parent
2d5d8783a9
commit
b2454a486f
11 changed files with 659 additions and 603 deletions
|
@ -124,6 +124,7 @@ _module_name_from_addr(const void* addr, void **module_start_addr,
|
||||||
return psz;
|
return psz;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _M_IX86
|
||||||
static VOID
|
static VOID
|
||||||
_dump_context(PCONTEXT pc)
|
_dump_context(PCONTEXT pc)
|
||||||
{
|
{
|
||||||
|
@ -138,6 +139,13 @@ _dump_context(PCONTEXT pc)
|
||||||
pc->Ebp, pc->Esi, pc->Esp);
|
pc->Ebp, pc->Esi, pc->Esp);
|
||||||
DbgPrint("EDI: %.8x EFLAGS: %.8x\n", pc->Edi, pc->EFlags);
|
DbgPrint("EDI: %.8x EFLAGS: %.8x\n", pc->Edi, pc->EFlags);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
#warning Unknown architecture
|
||||||
|
static VOID
|
||||||
|
_dump_context(PCONTEXT pc)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static LONG
|
static LONG
|
||||||
BasepCheckForReadOnlyResource(IN PVOID Ptr)
|
BasepCheckForReadOnlyResource(IN PVOID Ptr)
|
||||||
|
@ -237,9 +245,9 @@ UnhandledExceptionFilter(struct _EXCEPTION_POINTERS *ExceptionInfo)
|
||||||
{
|
{
|
||||||
#ifdef _X86_
|
#ifdef _X86_
|
||||||
PULONG Frame;
|
PULONG Frame;
|
||||||
|
#endif
|
||||||
PVOID StartAddr;
|
PVOID StartAddr;
|
||||||
CHAR szMod[128] = "";
|
CHAR szMod[128] = "";
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Print a stack trace. */
|
/* Print a stack trace. */
|
||||||
DbgPrint("Unhandled exception\n");
|
DbgPrint("Unhandled exception\n");
|
||||||
|
|
|
@ -108,10 +108,12 @@
|
||||||
<file>utils.c</file>
|
<file>utils.c</file>
|
||||||
</directory>
|
</directory>
|
||||||
<directory name="thread">
|
<directory name="thread">
|
||||||
|
<if property="ARCH" value="i386">
|
||||||
<directory name="i386">
|
<directory name="i386">
|
||||||
<file>fiber.S</file>
|
<file>fiber.S</file>
|
||||||
<file>thread.S</file>
|
<file>thread.S</file>
|
||||||
</directory>
|
</directory>
|
||||||
|
</if>
|
||||||
</directory>
|
</directory>
|
||||||
</module>
|
</module>
|
||||||
<module name="kernel32" type="win32dll" baseaddress="${BASEADDRESS_KERNEL32}" installbase="system32" installname="kernel32.dll">
|
<module name="kernel32" type="win32dll" baseaddress="${BASEADDRESS_KERNEL32}" installbase="system32" installname="kernel32.dll">
|
||||||
|
|
|
@ -257,6 +257,7 @@ DllMain(HANDLE hDll,
|
||||||
{
|
{
|
||||||
case DLL_PROCESS_ATTACH:
|
case DLL_PROCESS_ATTACH:
|
||||||
|
|
||||||
|
#ifdef _M_IX86
|
||||||
/* OK, yes, this is really retarded but it works for now */
|
/* OK, yes, this is really retarded but it works for now */
|
||||||
InWindows = NtCurrentPeb()->BeingDebugged;
|
InWindows = NtCurrentPeb()->BeingDebugged;
|
||||||
|
|
||||||
|
@ -290,6 +291,7 @@ DllMain(HANDLE hDll,
|
||||||
*Eip = (ULONG)BaseProcessStartThunk;
|
*Eip = (ULONG)BaseProcessStartThunk;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Don't bother us for each thread */
|
/* Don't bother us for each thread */
|
||||||
LdrDisableThreadCalloutsForDll((PVOID)hDll);
|
LdrDisableThreadCalloutsForDll((PVOID)hDll);
|
||||||
|
|
|
@ -9,7 +9,9 @@
|
||||||
/* INCLUDES ****************************************************************/
|
/* INCLUDES ****************************************************************/
|
||||||
|
|
||||||
#include <k32.h>
|
#include <k32.h>
|
||||||
|
#ifdef _M_IX86
|
||||||
#include "i386/ketypes.h"
|
#include "i386/ketypes.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include "../include/debug.h"
|
#include "../include/debug.h"
|
||||||
|
@ -334,6 +336,7 @@ BasepInitializeContext(IN PCONTEXT Context,
|
||||||
IN PVOID StackAddress,
|
IN PVOID StackAddress,
|
||||||
IN ULONG ContextType)
|
IN ULONG ContextType)
|
||||||
{
|
{
|
||||||
|
#ifdef _M_IX86
|
||||||
DPRINT("BasepInitializeContext: %p\n", Context);
|
DPRINT("BasepInitializeContext: %p\n", Context);
|
||||||
|
|
||||||
/* Setup the Initial Win32 Thread Context */
|
/* Setup the Initial Win32 Thread Context */
|
||||||
|
@ -371,6 +374,11 @@ BasepInitializeContext(IN PCONTEXT Context,
|
||||||
|
|
||||||
/* Give it some room for the Parameter */
|
/* Give it some room for the Parameter */
|
||||||
Context->Esp -= sizeof(PVOID);
|
Context->Esp -= sizeof(PVOID);
|
||||||
|
#else
|
||||||
|
#warning Unknown architecture
|
||||||
|
UNIMPLEMENTED;
|
||||||
|
DbgBreakPoint();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -251,12 +251,18 @@ VOID
|
||||||
WINAPI
|
WINAPI
|
||||||
BaseFiberStartup(VOID)
|
BaseFiberStartup(VOID)
|
||||||
{
|
{
|
||||||
|
#ifdef _M_IX86
|
||||||
PFIBER Fiber = GetFiberData();
|
PFIBER Fiber = GetFiberData();
|
||||||
|
|
||||||
/* Call the Thread Startup Routine */
|
/* Call the Thread Startup Routine */
|
||||||
DPRINT1("Starting Fiber\n");
|
DPRINT1("Starting Fiber\n");
|
||||||
BaseThreadStartup((LPTHREAD_START_ROUTINE)Fiber->Context.Eax,
|
BaseThreadStartup((LPTHREAD_START_ROUTINE)Fiber->Context.Eax,
|
||||||
(LPVOID)Fiber->Context.Ebx);
|
(LPVOID)Fiber->Context.Ebx);
|
||||||
|
#else
|
||||||
|
#warning Unknown architecture
|
||||||
|
UNIMPLEMENTED;
|
||||||
|
DbgBreakPoint();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -150,7 +150,7 @@ extern unsigned long __cdecl DbgPrint(const char * format, ...);
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#error Unsupported platform.
|
#define _SEH_TRACE_CONTEXT(FRAME_, CONTEXT_)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define _SEH_TRACE_UNWIND(FRAME_, ARGS_) \
|
#define _SEH_TRACE_UNWIND(FRAME_, ARGS_) \
|
||||||
|
|
|
@ -27,9 +27,13 @@ RtlRaiseException(PEXCEPTION_RECORD ExceptionRecord)
|
||||||
CONTEXT Context;
|
CONTEXT Context;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
/* Capture the context and fixup ESP */
|
/* Capture the context */
|
||||||
RtlCaptureContext(&Context);
|
RtlCaptureContext(&Context);
|
||||||
|
|
||||||
|
#ifdef _M_IX86
|
||||||
|
/* Fixup ESP */
|
||||||
Context.Esp += sizeof(ULONG);
|
Context.Esp += sizeof(ULONG);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Save the exception address */
|
/* Save the exception address */
|
||||||
ExceptionRecord->ExceptionAddress = RtlpGetExceptionAddress();
|
ExceptionRecord->ExceptionAddress = RtlpGetExceptionAddress();
|
||||||
|
@ -75,8 +79,10 @@ RtlRaiseStatus(NTSTATUS Status)
|
||||||
/* Capture the context */
|
/* Capture the context */
|
||||||
RtlCaptureContext(&Context);
|
RtlCaptureContext(&Context);
|
||||||
|
|
||||||
|
#ifdef _M_IX86
|
||||||
/* Add one argument to ESP */
|
/* Add one argument to ESP */
|
||||||
Context.Esp += sizeof(PVOID);
|
Context.Esp += sizeof(PVOID);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Create an exception record */
|
/* Create an exception record */
|
||||||
ExceptionRecord.ExceptionAddress = RtlpGetExceptionAddress();
|
ExceptionRecord.ExceptionAddress = RtlpGetExceptionAddress();
|
||||||
|
@ -123,10 +129,16 @@ RtlWalkFrameChain(OUT PVOID *Callers,
|
||||||
ULONG i = 0;
|
ULONG i = 0;
|
||||||
|
|
||||||
/* Get current EBP */
|
/* Get current EBP */
|
||||||
|
#if defined(_M_IX86)
|
||||||
#if defined __GNUC__
|
#if defined __GNUC__
|
||||||
__asm__("mov %%ebp, %0" : "=r" (Stack) : );
|
__asm__("mov %%ebp, %0" : "=r" (Stack) : );
|
||||||
#elif defined(_MSC_VER)
|
#elif defined(_MSC_VER)
|
||||||
__asm mov Stack, ebp
|
__asm mov Stack, ebp
|
||||||
|
#endif
|
||||||
|
#elif defined(_M_MIPS)
|
||||||
|
__asm__("move $sp, %0" : "=r" (Stack) : );
|
||||||
|
#else
|
||||||
|
#error Unknown architecture
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Set it as the stack begin limit as well */
|
/* Set it as the stack begin limit as well */
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <basetsd.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <basetsd.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
|
|
||||||
/* DEFINES *****************************************************************/
|
/* DEFINES *****************************************************************/
|
||||||
|
|
||||||
|
#ifdef _M_IX86
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#define FLOAT_TO_INT(in,out) \
|
#define FLOAT_TO_INT(in,out) \
|
||||||
__asm__ __volatile__ ("fistpl %0" : "=m" (out) : "t" (in) : "st");
|
__asm__ __volatile__ ("fistpl %0" : "=m" (out) : "t" (in) : "st");
|
||||||
|
@ -43,6 +44,10 @@
|
||||||
__asm fld in \
|
__asm fld in \
|
||||||
__asm fistp out
|
__asm fistp out
|
||||||
#endif
|
#endif
|
||||||
|
#else
|
||||||
|
#define FLOAT_TO_INT(in,out) \
|
||||||
|
out = (long)in;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* the following deal with IEEE single-precision numbers */
|
/* the following deal with IEEE single-precision numbers */
|
||||||
#define EXCESS 126L
|
#define EXCESS 126L
|
||||||
|
|
|
@ -62,6 +62,12 @@
|
||||||
" mtlr 0\n" \
|
" mtlr 0\n" \
|
||||||
" addi 1,1,16\n" \
|
" addi 1,1,16\n" \
|
||||||
" blr\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)
|
#elif defined(_MSC_VER)
|
||||||
#define UserModeStub_x86 " asm { \n" \
|
#define UserModeStub_x86 " asm { \n" \
|
||||||
" mov eax, %xh\n" \
|
" mov eax, %xh\n" \
|
||||||
|
@ -87,6 +93,10 @@
|
||||||
|
|
||||||
#define KernelModeStub_ppc " bl KiSystemService\n" \
|
#define KernelModeStub_ppc " bl KiSystemService\n" \
|
||||||
" rfi\n"
|
" rfi\n"
|
||||||
|
|
||||||
|
#define KernelModeStub_mips " j KiSystemService\n" \
|
||||||
|
" nop\n"
|
||||||
|
|
||||||
#elif defined(_MSC_VER)
|
#elif defined(_MSC_VER)
|
||||||
#define KernelModeStub_x86 " asm { \n" \
|
#define KernelModeStub_x86 " asm { \n" \
|
||||||
" mov eax, %xh\n" \
|
" mov eax, %xh\n" \
|
||||||
|
@ -115,6 +125,8 @@ struct ncitool_data_t ncitool_data[] = {
|
||||||
".global _%s@%d\n", "_%s@%d:\n" },
|
".global _%s@%d\n", "_%s@%d:\n" },
|
||||||
{ "powerpc", 4, KernelModeStub_ppc, UserModeStub_ppc,
|
{ "powerpc", 4, KernelModeStub_ppc, UserModeStub_ppc,
|
||||||
"\t.globl %s\n", "%s:\n" },
|
"\t.globl %s\n", "%s:\n" },
|
||||||
|
{ "mips", 4, KernelModeStub_mips, UserModeStub_mips,
|
||||||
|
"\t.globl %s\n", "%s:\n" },
|
||||||
{ 0, }
|
{ 0, }
|
||||||
};
|
};
|
||||||
int arch_sel = 0;
|
int arch_sel = 0;
|
||||||
|
|
Loading…
Reference in a new issue