mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
Miscellaneous fixes:
- activated dependency tracking for ntdll [tested] - fixed trivial warning [tested] - build rules now define appropriate _M_<arch> macro, for compatibility with the Microsoft DDK [tested] - faster implementation of NtCurrentPeb() on the x86 [tested] - NtCurrentTeb() implementations for the Alpha AXP and MIPS R4000 architectures svn path=/trunk/; revision=4477
This commit is contained in:
parent
323478bacf
commit
01da24f40c
5 changed files with 98 additions and 20 deletions
|
@ -228,19 +228,72 @@ typedef struct _TEB
|
|||
PVOID WineDebugInfo; // Needed for WINE DLL's
|
||||
} TEB, *PTEB;
|
||||
|
||||
|
||||
#define NtCurrentPeb() (NtCurrentTeb()->Peb)
|
||||
|
||||
static inline PTEB NtCurrentTeb(VOID)
|
||||
static inline PTEB NtCurrentTeb(void)
|
||||
{
|
||||
int x;
|
||||
|
||||
__asm__ __volatile__("movl %%fs:0x18, %0\n\t"
|
||||
: "=r" (x) /* can't have two memory operands */
|
||||
: /* no inputs */
|
||||
);
|
||||
|
||||
return((PTEB)x);
|
||||
PTEB pTeb;
|
||||
|
||||
#if defined(_M_IX86)
|
||||
/* on the x86, the TEB is contained in the FS segment */
|
||||
/* FIXME: instead of hardcoded offsets, use offsetof() - if possible */
|
||||
/*
|
||||
FIXME: GCC should allow defining a variable that directly maps to a register.
|
||||
It could make for even faster code
|
||||
*/
|
||||
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"movl %%fs:0x18, %0\n" /* fs:18h == Teb->Tib.Self */
|
||||
: "=r" (pTeb) /* can't have two memory operands */
|
||||
: /* no inputs */
|
||||
);
|
||||
|
||||
return pTeb;
|
||||
|
||||
#elif defined(_M_ALPHA)
|
||||
/* on the Alpha AXP, we call the rdteb PAL to retrieve the address of the TEB */
|
||||
/* FIXME: this is probably wrong */
|
||||
__asm__ __volatile__("call_pal rdteb\n");
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"mov %0, $0\n"
|
||||
: "=r" (pTeb)
|
||||
:
|
||||
);
|
||||
|
||||
#elif defined(_M_MIPS)
|
||||
/* on the MIPS R4000, the TEB is loaded at a fixed address (?) */
|
||||
/* FIXME: again, not terribly sure about this */
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"lw %0, 0x7FFFF4A8\n"
|
||||
: "=r" (pTeb)
|
||||
:
|
||||
);
|
||||
|
||||
/* #elif defined(_M_PPC) */
|
||||
/* FIXME: sorry, I couldn't disassemble the PPC ntdll.dll */
|
||||
#else
|
||||
#error Unsupported architecture or no architecture specified.
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _M_IX86
|
||||
static inline PPEB NtCurrentPeb(void)
|
||||
{
|
||||
PPEB pPeb;
|
||||
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"movl %%fs:0x30, %0\n" /* fs:30h == Teb->Peb */
|
||||
: "=r" (pPeb) /* can't have two memory operands */
|
||||
: /* no inputs */
|
||||
);
|
||||
|
||||
return pPeb;
|
||||
}
|
||||
#else
|
||||
/* generic NtCurrentPeb() */
|
||||
static inline PPEB NtCurrentPeb(void) { return NtCurrentTeb()->Peb; }
|
||||
#endif
|
||||
|
||||
#endif /* __INCLUDE_INTERNAL_TEB */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: makefile,v 1.78 2003/04/02 00:06:00 hyperion Exp $
|
||||
# $Id: makefile,v 1.79 2003/04/02 21:55:15 hyperion Exp $
|
||||
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
|
@ -73,10 +73,15 @@ TARGET_OBJECTS = \
|
|||
ldr/utils.o \
|
||||
$(CSR_OBJECTS)
|
||||
|
||||
DEP_OBJECTS = $(TARGET_OBJECTS)
|
||||
DEP_EXCLUDE_FILTER = napi.%
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
include $(TOOLS_PATH)/depend.mk
|
||||
|
||||
%/TAGS:
|
||||
etags -o $(@D)/TAGS $(@D)/\*.c
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: resource.c,v 1.3 2002/09/08 10:23:06 chorns Exp $
|
||||
/* $Id: resource.c,v 1.4 2003/04/02 21:55:15 hyperion Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -299,4 +299,4 @@ RtlDumpResource(PRTL_RESOURCE Resource)
|
|||
}
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
/* EOF */
|
||||
|
|
|
@ -89,11 +89,11 @@ MC = $(TOOLS_PATH)/wmc/wmc
|
|||
# Maybe we can delete these soon
|
||||
|
||||
ifeq ($(HOST),mingw32-linux)
|
||||
CFLAGS := $(CFLAGS) -I$(PATH_TO_TOP)/include -pipe -march=i386
|
||||
CFLAGS := $(CFLAGS) -I$(PATH_TO_TOP)/include -pipe -march=i386 -D_M_IX86
|
||||
endif
|
||||
|
||||
ifeq ($(HOST),mingw32-windows)
|
||||
CFLAGS := $(CFLAGS) -I$(PATH_TO_TOP)/include -pipe -march=i386
|
||||
CFLAGS := $(CFLAGS) -I$(PATH_TO_TOP)/include -pipe -march=i386 -D_M_IX86
|
||||
endif
|
||||
|
||||
CXXFLAGS = $(CFLAGS)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: helper.mk,v 1.28 2003/04/01 08:13:30 gvg Exp $
|
||||
# $Id: helper.mk,v 1.29 2003/04/02 21:55:16 hyperion Exp $
|
||||
#
|
||||
# Helper makefile for ReactOS modules
|
||||
# Variables this makefile accepts:
|
||||
|
@ -52,6 +52,26 @@ ifeq ($(TARGET_PATH),)
|
|||
TARGET_PATH := .
|
||||
endif
|
||||
|
||||
ifeq ($(ARCH),i386)
|
||||
MK_ARCH_ID := _M_IX86
|
||||
endif
|
||||
|
||||
ifeq ($(ARCH),alpha)
|
||||
MK_ARCH_ID := _M_ALPHA
|
||||
endif
|
||||
|
||||
ifeq ($(ARCH),mips)
|
||||
MK_ARCH_ID := _M_MIPS
|
||||
endif
|
||||
|
||||
ifeq ($(ARCH),powerpc)
|
||||
MK_ARCH_ID := _M_PPC
|
||||
endif
|
||||
|
||||
# unknown architecture
|
||||
ifeq ($(MK_ARCH_ID),)
|
||||
MK_ARCH_ID := _M_UNKNOWN
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET_TYPE),program)
|
||||
MK_MODE := user
|
||||
|
@ -450,7 +470,7 @@ include $(PATH_TO_TOP)/config
|
|||
|
||||
|
||||
TARGET_CFLAGS += $(MK_CFLAGS)
|
||||
TARGET_CFLAGS += -pipe -march=$(ARCH)
|
||||
TARGET_CFLAGS += -pipe -march=$(ARCH) -D$(MK_ARCH_ID)
|
||||
ifeq ($(DBG),1)
|
||||
TARGET_ASFLAGS += -g
|
||||
TARGET_CFLAGS += -g
|
||||
|
@ -458,7 +478,7 @@ TARGET_LFLAGS += -g
|
|||
endif
|
||||
|
||||
TARGET_CPPFLAGS += $(MK_CPPFLAGS)
|
||||
TARGET_CPPFLAGS += -pipe -march=$(ARCH)
|
||||
TARGET_CPPFLAGS += -pipe -march=$(ARCH) -D$(MK_ARCH_ID)
|
||||
|
||||
TARGET_RCFLAGS += $(MK_RCFLAGS)
|
||||
|
||||
|
|
Loading…
Reference in a new issue