Author: tkreuzer
Date: Thu Feb 10 10:30:43 2011
New Revision: 50640
URL:
http://svn.reactos.org/svn/reactos?rev=50640&view=rev
Log:
Merge all amd64 related changes from cmake branch
Modified:
trunk/reactos/include/ndk/amd64/ketypes.h
trunk/reactos/include/xdk/amd64/ke.h
trunk/reactos/lib/sdk/crt/except/amd64/chkstk_asm.s
trunk/reactos/lib/sdk/crt/except/amd64/seh.s
trunk/reactos/lib/sdk/crt/math/amd64/alldiv.S
trunk/reactos/lib/sdk/crt/math/amd64/atan.S
trunk/reactos/lib/sdk/crt/math/amd64/atan2.S
trunk/reactos/lib/sdk/crt/math/amd64/ceil.S
trunk/reactos/lib/sdk/crt/math/amd64/ceilf.S
trunk/reactos/lib/sdk/crt/math/amd64/exp.S
trunk/reactos/lib/sdk/crt/math/amd64/fabs.S
trunk/reactos/lib/sdk/crt/math/amd64/floor.S
trunk/reactos/lib/sdk/crt/math/amd64/floorf.S
trunk/reactos/lib/sdk/crt/math/amd64/fmod.S
trunk/reactos/lib/sdk/crt/math/amd64/fmodf.S
trunk/reactos/lib/sdk/crt/math/amd64/ldexp.S
trunk/reactos/lib/sdk/crt/math/amd64/log.S
trunk/reactos/lib/sdk/crt/math/amd64/log10.S
trunk/reactos/lib/sdk/crt/math/amd64/pow.S
trunk/reactos/lib/sdk/crt/math/amd64/sqrt.S
trunk/reactos/lib/sdk/crt/math/amd64/sqrtf.S
trunk/reactos/lib/sdk/crt/math/amd64/tan.S
trunk/reactos/lib/sdk/crt/setjmp/amd64/setjmp.s
trunk/reactos/ntoskrnl/include/internal/amd64/mm.h
trunk/reactos/ntoskrnl/ke/amd64/thrdini.c
trunk/reactos/ntoskrnl/ke/amd64/trap.S
trunk/reactos/ntoskrnl/mm/amd64/init.c
trunk/reactos/tools/rsym/rsym64.h
Modified: trunk/reactos/include/ndk/amd64/ketypes.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/amd64/ketypes.…
==============================================================================
--- trunk/reactos/include/ndk/amd64/ketypes.h [iso-8859-1] (original)
+++ trunk/reactos/include/ndk/amd64/ketypes.h [iso-8859-1] Thu Feb 10 10:30:43 2011
@@ -81,6 +81,7 @@
#define CR4_PGE 0x80
#define CR4_FXSR 0x200
#define CR4_XMMEXCPT 0x400
+#define CR4_CHANNELS 0x800
//
// EFlags
@@ -98,6 +99,39 @@
#define EFLAGS_USER_SANITIZE 0x3F4DD7
#define EFLAG_SIGN 0x8000
#define EFLAG_ZERO 0x4000
+#define EFLAGS_TF_MASK 0x0100
+#define EFLAGS_TF_SHIFT 0x0008
+#define EFLAGS_ID_MASK 0x200000
+#define EFLAGS_IF_MASK 0x0200
+#define EFLAGS_IF_SHIFT 0x0009
+
+//
+// Machine Specific Registers
+//
+#define MSR_EFER 0xC0000080
+#define MSR_STAR 0xC0000081
+#define MSR_LSTAR 0xC0000082
+#define MSR_CSTAR 0xC0000083
+#define MSR_SYSCALL_MASK 0xC0000084
+#define MSR_FS_BASE 0xC0000100
+#define MSR_GS_BASE 0xC0000101
+#define MSR_GS_SWAP 0xC0000102
+#define MSR_MCG_STATUS 0x017A
+#define MSR_AMD_ACCESS 0x9C5A203A
+
+//
+// Flags in MSR_EFER
+//
+#define MSR_LMA 0x0400
+#define MSR_LME 0x0100
+#define MSR_SCE 0x0001
+#define MSR_NXE 0x0800
+#define MSR_PAT 0x0277
+#define MSR_DEGUG_CTL 0x01D9
+#define MSR_LAST_BRANCH_FROM 0x01DB
+#define MSR_LAST_BRANCH_TO 0x01DC
+#define MSR_LAST_EXCEPTION_FROM 0x01DD
+#define MSR_LAST_EXCEPTION_TO 0x01DE
//
// IPI Types
@@ -114,6 +148,15 @@
#define PRCB_MAJOR_VERSION 1
#define PRCB_BUILD_DEBUG 1
#define PRCB_BUILD_UNIPROCESSOR 2
+
+//
+// Service Table
+//
+#define NUMBER_SERVICE_TABLES 2
+#define SERVICE_NUMBER_MASK 0xFFF
+#define SERVICE_TABLE_SHIFT 7
+#define SERVICE_TABLE_MASK 0x20
+#define SERVICE_TABLE_TEST 0x20
//
// HAL Variables
@@ -143,6 +186,8 @@
#else
#define SYNCH_LEVEL (IPI_LEVEL - 2)
#endif
+
+#define NMI_STACK_SIZE 0x2000
//
// Trap Frame Definition
@@ -863,6 +908,56 @@
UINT64 Return;
} KEXCEPTION_FRAME, *PKEXCEPTION_FRAME;
+typedef struct _DISPATCHER_CONTEXT
+{
+ ULONG64 ControlPc;
+ PVOID ImageBase;
+ PVOID FunctionEntry;
+ PVOID EstablisherFrame;
+ ULONG64 TargetIp;
+ PVOID ContextRecord;
+ PVOID LanguageHandler;
+ PVOID HandlerData;
+ PVOID HistoryTable;
+ ULONG ScopeIndex;
+} DISPATCHER_CONTEXT, *PDISPATCHER_CONTEXT;
+
+
+typedef struct _KSTART_FRAME
+{
+ ULONG64 P1Home;
+ ULONG64 P2Home;
+ ULONG64 P3Home;
+ ULONG64 P4Home;
+ ULONG64 P5Home;
+ ULONG64 Return;
+} KSTART_FRAME, *PKSTART_FRAME;
+
+typedef struct _KSWITCH_FRAME
+{
+ ULONG64 P1Home;
+ ULONG64 P2Home;
+ ULONG64 P3Home;
+ ULONG64 P4Home;
+ ULONG64 P5Home;
+ ULONG64 ApcBypass;
+ ULONG64 Rbp;
+ ULONG64 Return;
+} KSWITCH_FRAME, *PKSWITCH_FRAME;
+
+typedef struct _KTIMER_TABLE_ENTRY
+{
+ ULONG_PTR Lock;
+ LIST_ENTRY Entry;
+ ULARGE_INTEGER Time;
+} KTIMER_TABLE_ENTRY, *PKTIMER_TABLE_ENTRY;
+
+typedef struct _KTIMER_TABLE
+{
+ KTIMER* TimerExpiry[64];
+ KTIMER_TABLE_ENTRY TimerEntries[256];
+} KTIMER_TABLE, *PKTIMER_TABLE;
+
//
// Inline function to get current KPRCB
//
Modified: trunk/reactos/include/xdk/amd64/ke.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/xdk/amd64/ke.h?rev…
==============================================================================
--- trunk/reactos/include/xdk/amd64/ke.h [iso-8859-1] (original)
+++ trunk/reactos/include/xdk/amd64/ke.h [iso-8859-1] Thu Feb 10 10:30:43 2011
@@ -67,7 +67,7 @@
{
KIRQL OldIrql;
- OldIrql = __readcr8();
+ OldIrql = (KIRQL)__readcr8();
//ASSERT(OldIrql <= NewIrql);
__writecr8(NewIrql);
return OldIrql;
Modified: trunk/reactos/lib/sdk/crt/except/amd64/chkstk_asm.s
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/except/amd64/c…
==============================================================================
--- trunk/reactos/lib/sdk/crt/except/amd64/chkstk_asm.s [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/except/amd64/chkstk_asm.s [iso-8859-1] Thu Feb 10 10:30:43
2011
@@ -10,21 +10,25 @@
#include <asm.inc>
+/* CODE **********************************************************************/
+.code64
PUBLIC MsgUnimplemented
MsgUnimplemented:
.asciz "WARNING: %s at %s:%d is UNIMPLEMENTED!\n"
-.proc _chkstk
+FUNC _chkstk
+ .endprolog
UNIMPLEMENTED chkstk
ret
-.endp
+ENDFUNC _chkstk
-.proc _alloca_probe
+FUNC _alloca_probe
+ .endprolog
UNIMPLEMENTED alloca_probe
ret
-.endp
+ENDFUNC _alloca_probe
END
/* EOF */
Modified: trunk/reactos/lib/sdk/crt/except/amd64/seh.s
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/except/amd64/s…
==============================================================================
--- trunk/reactos/lib/sdk/crt/except/amd64/seh.s [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/except/amd64/seh.s [iso-8859-1] Thu Feb 10 10:30:43 2011
@@ -17,42 +17,43 @@
/* GLOBALS *******************************************************************/
-.globl _global_unwind2
-.globl _local_unwind2
-.globl _abnormal_termination
-.globl _except_handler2
-.globl _except_handler3
+PUBLIC _global_unwind2
+PUBLIC _local_unwind2
+PUBLIC _abnormal_termination
+PUBLIC _except_handler2
+PUBLIC _except_handler3
-/* FUNCTIONS *****************************************************************/
+/* CODE **********************************************************************/
+.code64
-.func _unwind_handler
-_unwind_handler:
+FUNC _unwind_handler
+ .endprolog
ret
-.endfunc
+ENDFUNC _unwind_handler
-.func _global_unwind2
-_global_unwind2:
+FUNC _global_unwind2
+ .endprolog
ret
-.endfunc
+ENDFUNC _global_unwind2
-.func _abnormal_termination
-_abnormal_termination:
+FUNC _abnormal_termination
+ .endprolog
ret
-.endfunc
+ENDFUNC _abnormal_termination
-.func _local_unwind2
-_local_unwind2:
+FUNC _local_unwind2
+ .endprolog
ret
-.endfunc
+ENDFUNC _local_unwind2
-.func _except_handler2
-_except_handler2:
+FUNC _except_handler2
+ .endprolog
ret
-.endfunc
+ENDFUNC _except_handler2
-.func _except_handler3
-_except_handler3:
+FUNC _except_handler3
+ .endprolog
ret
-.endfunc
+ENDFUNC _except_handler3
END
Modified: trunk/reactos/lib/sdk/crt/math/amd64/alldiv.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/amd64/all…
==============================================================================
--- trunk/reactos/lib/sdk/crt/math/amd64/alldiv.S [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/math/amd64/alldiv.S [iso-8859-1] Thu Feb 10 10:30:43 2011
@@ -10,18 +10,21 @@
#include <asm.inc>
-/* DATA *********************************************************************/
+/* DATA **********************************************************************/
+.code64
PUBLIC _fltused
_fltused:
- .long 0x9875
+ .long HEX(9875)
-/* FUNCTIONS ****************************************************************/
-
+/* CODE **********************************************************************/
.code64
-.proc alldiv
+FUNC alldiv
+ .endprolog
UNIMPLEMENTED alldiv
ret
-.endp alldiv
+ENDFUNC alldiv
+
+END
Modified: trunk/reactos/lib/sdk/crt/math/amd64/atan.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/amd64/ata…
==============================================================================
--- trunk/reactos/lib/sdk/crt/math/amd64/atan.S [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/math/amd64/atan.S [iso-8859-1] Thu Feb 10 10:30:43 2011
@@ -11,11 +11,12 @@
#include <asm.inc>
#include <ksamd64.inc>
-/* FUNCTIONS ****************************************************************/
-
+/* CODE **********************************************************************/
.code64
PUBLIC atan
atan:
UNIMPLEMENTED atan
ret
+
+END
Modified: trunk/reactos/lib/sdk/crt/math/amd64/atan2.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/amd64/ata…
==============================================================================
--- trunk/reactos/lib/sdk/crt/math/amd64/atan2.S [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/math/amd64/atan2.S [iso-8859-1] Thu Feb 10 10:30:43 2011
@@ -11,11 +11,12 @@
#include <asm.inc>
#include <ksamd64.inc>
-/* FUNCTIONS ****************************************************************/
-
+/* CODE **********************************************************************/
.code64
PUBLIC atan2
atan2:
UNIMPLEMENTED atan2
ret
+
+END
Modified: trunk/reactos/lib/sdk/crt/math/amd64/ceil.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/amd64/cei…
==============================================================================
--- trunk/reactos/lib/sdk/crt/math/amd64/ceil.S [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/math/amd64/ceil.S [iso-8859-1] Thu Feb 10 10:30:43 2011
@@ -11,8 +11,7 @@
#include <asm.inc>
#include <ksamd64.inc>
-/* FUNCTIONS ****************************************************************/
-
+/* CODE **********************************************************************/
.code64
PUBLIC ceil
@@ -20,3 +19,4 @@
UNIMPLEMENTED ceil
ret
+END
Modified: trunk/reactos/lib/sdk/crt/math/amd64/ceilf.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/amd64/cei…
==============================================================================
--- trunk/reactos/lib/sdk/crt/math/amd64/ceilf.S [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/math/amd64/ceilf.S [iso-8859-1] Thu Feb 10 10:30:43 2011
@@ -11,8 +11,7 @@
#include <asm.inc>
#include <ksamd64.inc>
-/* FUNCTIONS ****************************************************************/
-
+/* CODE **********************************************************************/
.code64
PUBLIC ceilf
@@ -39,7 +38,7 @@
fstp dword ptr [rsp]
movss xmm0, [rsp]
-
+
add rsp, 16
ret
Modified: trunk/reactos/lib/sdk/crt/math/amd64/exp.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/amd64/exp…
==============================================================================
--- trunk/reactos/lib/sdk/crt/math/amd64/exp.S [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/math/amd64/exp.S [iso-8859-1] Thu Feb 10 10:30:43 2011
@@ -11,8 +11,7 @@
#include <asm.inc>
#include <ksamd64.inc>
-/* FUNCTIONS ****************************************************************/
-
+/* CODE **********************************************************************/
.code64
PUBLIC exp
Modified: trunk/reactos/lib/sdk/crt/math/amd64/fabs.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/amd64/fab…
==============================================================================
--- trunk/reactos/lib/sdk/crt/math/amd64/fabs.S [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/math/amd64/fabs.S [iso-8859-1] Thu Feb 10 10:30:43 2011
@@ -10,12 +10,12 @@
#include <asm.inc>
-/* FUNCTIONS ****************************************************************/
-
+/* CODE **********************************************************************/
.code64
-PUBLIC fabs
-fabs:
+PUBLIC _fabs
+_fabs:
UNIMPLEMENTED fabs
ret
+END
Modified: trunk/reactos/lib/sdk/crt/math/amd64/floor.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/amd64/flo…
==============================================================================
--- trunk/reactos/lib/sdk/crt/math/amd64/floor.S [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/math/amd64/floor.S [iso-8859-1] Thu Feb 10 10:30:43 2011
@@ -11,8 +11,7 @@
#include <asm.inc>
#include <ksamd64.inc>
-/* FUNCTIONS ****************************************************************/
-
+/* CODE **********************************************************************/
.code64
PUBLIC floor
Modified: trunk/reactos/lib/sdk/crt/math/amd64/floorf.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/amd64/flo…
==============================================================================
--- trunk/reactos/lib/sdk/crt/math/amd64/floorf.S [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/math/amd64/floorf.S [iso-8859-1] Thu Feb 10 10:30:43 2011
@@ -11,8 +11,7 @@
#include <asm.inc>
#include <ksamd64.inc>
-/* FUNCTIONS ****************************************************************/
-
+/* CODE **********************************************************************/
.code64
PUBLIC floorf
Modified: trunk/reactos/lib/sdk/crt/math/amd64/fmod.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/amd64/fmo…
==============================================================================
--- trunk/reactos/lib/sdk/crt/math/amd64/fmod.S [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/math/amd64/fmod.S [iso-8859-1] Thu Feb 10 10:30:43 2011
@@ -10,10 +10,11 @@
#include <asm.inc>
-/* DATA *********************************************************************/
+/* CODE **********************************************************************/
+.code64
-PUBLIC fmod
-fmod:
+PUBLIC _fmod
+_fmod:
UNIMPLEMENTED fmod
ret
Modified: trunk/reactos/lib/sdk/crt/math/amd64/fmodf.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/amd64/fmo…
==============================================================================
--- trunk/reactos/lib/sdk/crt/math/amd64/fmodf.S [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/math/amd64/fmodf.S [iso-8859-1] Thu Feb 10 10:30:43 2011
@@ -10,7 +10,8 @@
#include <asm.inc>
-/* DATA *********************************************************************/
+/* CODE **********************************************************************/
+.code64
PUBLIC fmodf
fmodf:
Modified: trunk/reactos/lib/sdk/crt/math/amd64/ldexp.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/amd64/lde…
==============================================================================
--- trunk/reactos/lib/sdk/crt/math/amd64/ldexp.S [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/math/amd64/ldexp.S [iso-8859-1] Thu Feb 10 10:30:43 2011
@@ -10,7 +10,8 @@
#include <asm.inc>
-/* DATA *********************************************************************/
+/* CODE **********************************************************************/
+.code64
PUBLIC ldexp
ldexp:
Modified: trunk/reactos/lib/sdk/crt/math/amd64/log.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/amd64/log…
==============================================================================
--- trunk/reactos/lib/sdk/crt/math/amd64/log.S [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/math/amd64/log.S [iso-8859-1] Thu Feb 10 10:30:43 2011
@@ -10,9 +10,12 @@
#include <asm.inc>
-/* DATA *********************************************************************/
+/* CODE **********************************************************************/
+.code64
PUBLIC log
log:
UNIMPLEMENTED log
ret
+
+END
Modified: trunk/reactos/lib/sdk/crt/math/amd64/log10.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/amd64/log…
==============================================================================
--- trunk/reactos/lib/sdk/crt/math/amd64/log10.S [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/math/amd64/log10.S [iso-8859-1] Thu Feb 10 10:30:43 2011
@@ -10,10 +10,12 @@
#include <asm.inc>
-/* DATA *********************************************************************/
+/* CODE **********************************************************************/
+.code64
PUBLIC log10
log10:
UNIMPLEMENTED log10
ret
+END
Modified: trunk/reactos/lib/sdk/crt/math/amd64/pow.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/amd64/pow…
==============================================================================
--- trunk/reactos/lib/sdk/crt/math/amd64/pow.S [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/math/amd64/pow.S [iso-8859-1] Thu Feb 10 10:30:43 2011
@@ -11,10 +11,12 @@
#include <asm.inc>
#include <ksamd64.inc>
-/* DATA *********************************************************************/
+/* CODE **********************************************************************/
+.code64
PUBLIC pow
pow:
UNIMPLEMENTED pow
ret
+END
Modified: trunk/reactos/lib/sdk/crt/math/amd64/sqrt.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/amd64/sqr…
==============================================================================
--- trunk/reactos/lib/sdk/crt/math/amd64/sqrt.S [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/math/amd64/sqrt.S [iso-8859-1] Thu Feb 10 10:30:43 2011
@@ -11,7 +11,8 @@
#include <asm.inc>
#include <ksamd64.inc>
-/* DATA *********************************************************************/
+/* CODE **********************************************************************/
+.code64
PUBLIC sqrt
sqrt:
Modified: trunk/reactos/lib/sdk/crt/math/amd64/sqrtf.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/amd64/sqr…
==============================================================================
--- trunk/reactos/lib/sdk/crt/math/amd64/sqrtf.S [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/math/amd64/sqrtf.S [iso-8859-1] Thu Feb 10 10:30:43 2011
@@ -11,7 +11,8 @@
#include <asm.inc>
#include <ksamd64.inc>
-/* DATA *********************************************************************/
+/* CODE **********************************************************************/
+.code64
PUBLIC sqrtf
sqrtf:
Modified: trunk/reactos/lib/sdk/crt/math/amd64/tan.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/amd64/tan…
==============================================================================
--- trunk/reactos/lib/sdk/crt/math/amd64/tan.S [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/math/amd64/tan.S [iso-8859-1] Thu Feb 10 10:30:43 2011
@@ -11,7 +11,8 @@
#include <asm.inc>
#include <ksamd64.inc>
-/* DATA *********************************************************************/
+/* CODE **********************************************************************/
+.code64
PUBLIC tan
tan:
Modified: trunk/reactos/lib/sdk/crt/setjmp/amd64/setjmp.s
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/setjmp/amd64/s…
==============================================================================
--- trunk/reactos/lib/sdk/crt/setjmp/amd64/setjmp.s [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/setjmp/amd64/setjmp.s [iso-8859-1] Thu Feb 10 10:30:43 2011
@@ -11,41 +11,45 @@
#include <asm.inc>
#include <ksamd64.inc>
-#define JUMP_BUFFER_Frame 0x00
-#define JUMP_BUFFER_Rbx 0x08
-#define JUMP_BUFFER_Rsp 0x10
-#define JUMP_BUFFER_Rbp 0x18
-#define JUMP_BUFFER_Rsi 0x20
-#define JUMP_BUFFER_Rdi 0x28
-#define JUMP_BUFFER_R12 0x30
-#define JUMP_BUFFER_R13 0x38
-#define JUMP_BUFFER_R14 0x40
-#define JUMP_BUFFER_R15 0x48
-#define JUMP_BUFFER_Rip 0x50
-#define JUMP_BUFFER_Spare 0x58
-#define JUMP_BUFFER_Xmm6 0x60
-#define JUMP_BUFFER_Xmm7 0x70
-#define JUMP_BUFFER_Xmm8 0x80
-#define JUMP_BUFFER_Xmm9 0x90
-#define JUMP_BUFFER_Xmm10 0xa0
-#define JUMP_BUFFER_Xmm11 0xb0
-#define JUMP_BUFFER_Xmm12 0xc0
-#define JUMP_BUFFER_Xmm13 0xd0
-#define JUMP_BUFFER_Xmm14 0xe0
-#define JUMP_BUFFER_Xmm15 0xf0
+#define JUMP_BUFFER_Frame 0 /* 0x00 */
+#define JUMP_BUFFER_Rbx 8 /* 0x08 */
+#define JUMP_BUFFER_Rsp 16 /* 0x10 */
+#define JUMP_BUFFER_Rbp 24 /* 0x18 */
+#define JUMP_BUFFER_Rsi 32 /* 0x20 */
+#define JUMP_BUFFER_Rdi 40 /* 0x28 */
+#define JUMP_BUFFER_R12 48 /* 0x30 */
+#define JUMP_BUFFER_R13 56 /* 0x38 */
+#define JUMP_BUFFER_R14 64 /* 0x40 */
+#define JUMP_BUFFER_R15 72 /* 0x48 */
+#define JUMP_BUFFER_Rip 80 /* 0x50 */
+#define JUMP_BUFFER_Spare 88 /* 0x58 */
+#define JUMP_BUFFER_Xmm6 96 /* 0x60 */
+#define JUMP_BUFFER_Xmm7 112 /* 0x70 */
+#define JUMP_BUFFER_Xmm8 128 /* 0x80 */
+#define JUMP_BUFFER_Xmm9 144 /* 0x90 */
+#define JUMP_BUFFER_Xmm10 160 /* 0xa0 */
+#define JUMP_BUFFER_Xmm11 176 /* 0xb0 */
+#define JUMP_BUFFER_Xmm12 192 /* 0xc0 */
+#define JUMP_BUFFER_Xmm13 208 /* 0xd0 */
+#define JUMP_BUFFER_Xmm14 224 /* 0xe0 */
+#define JUMP_BUFFER_Xmm15 240 /* 0xf0 */
/* FUNCTIONS ******************************************************************/
+.code64
-/*
+/*!
* int _setjmp(jmp_buf env);
*
- * Parameters: <rcx> - jmp_buf env
- * Returns: 0
- * Notes: Sets up the jmp_buf
+ * \param <rcx> - jmp_buf env
+ * \return 0
+ * \note Sets up the jmp_buf
*/
PUBLIC _setjmp
-.proc _setjmp
+FUNC _setjmp
+
+ .endprolog
+
/* Load rsp as it was before the call into rax */
lea rax, [rsp + 8]
/* Load return address into r8 */
@@ -73,18 +77,21 @@
movdqa [rcx + JUMP_BUFFER_Xmm15], xmm15
xor rax, rax
ret
-.endp setjmp
+ENDFUNC _setjmp
-/*
+/*!
* int _setjmpex(jmp_buf _Buf,void *_Ctx);
*
- * Parameters: <rcx> - jmp_buf env
- * <rdx> - frame
- * Returns: 0
- * Notes: Sets up the jmp_buf
+ * \param <rcx> - jmp_buf env
+ * \param <rdx> - frame
+ * \return 0
+ * \note Sets up the jmp_buf
*/
PUBLIC _setjmpex
-.proc _setjmpex
+FUNC _setjmpex
+
+ .endprolog
+
/* Load rsp as it was before the call into rax */
lea rax, [rsp + 8]
/* Load return address into r8 */
@@ -112,19 +119,21 @@
movdqa [rcx + JUMP_BUFFER_Xmm15], xmm15
xor rax, rax
ret
-.endp setjmpex
+ENDFUNC _setjmpex
-/*
+/*!
* void longjmp(jmp_buf env, int value);
*
- * Parameters: <rcx> - jmp_buf setup by _setjmp
- * <rdx> - int value to return
- * Returns: Doesn't return
- * Notes: Non-local goto
+ * \param <rcx> - jmp_buf setup by _setjmp
+ * \param <rdx> - int value to return
+ * \return Doesn't return
+ * \note Non-local goto
*/
PUBLIC longjmp
-.proc longjmp
+FUNC longjmp
+
+ .endprolog
// FIXME: handle frame
@@ -152,9 +161,9 @@
/* return param2 or 1 if it was 0 */
mov rax, rdx
test rax, rax
- jnz 2f
+ jnz l2
inc rax
-2: jmp r8
-.endp longjmp
+l2: jmp r8
+ENDFUNC longjmp
END
Modified: trunk/reactos/ntoskrnl/include/internal/amd64/mm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/amd64/mm.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/amd64/mm.h [iso-8859-1] Thu Feb 10 10:30:43
2011
@@ -131,6 +131,7 @@
Temp >>= 16;
return (PVOID)Temp;
}
+#define MiPdeToAddress MiPteToAddress
BOOLEAN
FORCEINLINE
@@ -157,8 +158,6 @@
MI_MAKE_PROTOTYPE_PTE(IN PMMPTE NewPte,
IN PMMPTE PointerPte)
{
- ULONG_PTR Offset;
-
/* Store the Address */
NewPte->u.Long = (ULONG64)PointerPte;
@@ -197,9 +196,11 @@
// FIXME, only copied from x86
#define MI_MAKE_LOCAL_PAGE(x) ((x)->u.Hard.Global = 0)
#define MI_MAKE_DIRTY_PAGE(x) ((x)->u.Hard.Dirty = 1)
+#define MI_MAKE_ACCESSED_PAGE(x) ((x)->u.Hard.Accessed = 1)
#define MI_PAGE_DISABLE_CACHE(x) ((x)->u.Hard.CacheDisable = 1)
#define MI_PAGE_WRITE_THROUGH(x) ((x)->u.Hard.WriteThrough = 1)
#define MI_PAGE_WRITE_COMBINED(x) ((x)->u.Hard.WriteThrough = 0)
+#define MI_IS_PAGE_LARGE(x) ((x)->u.Hard.LargePage == 1)
#if !defined(CONFIG_SMP)
#define MI_IS_PAGE_WRITEABLE(x) ((x)->u.Hard.Write == 1)
#else
@@ -231,8 +232,13 @@
#define MI_MAPPING_RANGE_START (ULONG)HYPER_SPACE
#define MI_MAPPING_RANGE_END (MI_MAPPING_RANGE_START + \
MI_HYPERSPACE_PTES * PAGE_SIZE)
-#define MI_ZERO_PTE (PMMPTE)(MI_MAPPING_RANGE_END + \
- PAGE_SIZE)
+#define MI_DUMMY_PTE (PMMPTE)(MI_MAPPING_RANGE_END + \
+ PAGE_SIZE)
+#define MI_VAD_BITMAP (PMMPTE)(MI_DUMMY_PTE + \
+ PAGE_SIZE)
+#define MI_WORKING_SET_LIST (PMMPTE)(MI_VAD_BITMAP + \
+ PAGE_SIZE)
+
/* On x86, these two are the same */
#define MMPDE MMPTE
Modified: trunk/reactos/ntoskrnl/ke/amd64/thrdini.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/amd64/thrdini.…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/amd64/thrdini.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/amd64/thrdini.c [iso-8859-1] Thu Feb 10 10:30:43 2011
@@ -12,24 +12,9 @@
#define NDEBUG
#include <debug.h>
-typedef struct _KSWITCHFRAME
-{
- PVOID ExceptionList;
- BOOLEAN ApcBypassDisable;
- PVOID RetAddr;
-} KSWITCHFRAME, *PKSWITCHFRAME;
-
-typedef struct _KSTART_FRAME
-{
- PKSYSTEM_ROUTINE SystemRoutine;
- PKSTART_ROUTINE StartRoutine;
- PVOID StartContext;
- BOOLEAN UserThread;
-} KSTART_FRAME, *PKSTART_FRAME;
-
typedef struct _KUINIT_FRAME
{
- KSWITCHFRAME CtxSwitchFrame;
+ KSWITCH_FRAME CtxSwitchFrame;
KSTART_FRAME StartFrame;
KTRAP_FRAME TrapFrame;
//FX_SAVE_AREA FxSaveArea;
@@ -37,7 +22,7 @@
typedef struct _KKINIT_FRAME
{
- KSWITCHFRAME CtxSwitchFrame;
+ KSWITCH_FRAME CtxSwitchFrame;
KSTART_FRAME StartFrame;
//FX_SAVE_AREA FxSaveArea;
} KKINIT_FRAME, *PKKINIT_FRAME;
@@ -55,7 +40,7 @@
//PFX_SAVE_AREA FxSaveArea;
//PFXSAVE_FORMAT FxSaveFormat;
PKSTART_FRAME StartFrame;
- PKSWITCHFRAME CtxSwitchFrame;
+ PKSWITCH_FRAME CtxSwitchFrame;
PKTRAP_FRAME TrapFrame;
CONTEXT LocalContext;
PCONTEXT Context = NULL;
@@ -140,7 +125,7 @@
Thread->PreviousMode = UserMode;
/* Tell KiThreadStartup of that too */
- StartFrame->UserThread = TRUE;
+// StartFrame->UserThread = TRUE;
}
else
{
@@ -170,18 +155,18 @@
Thread->PreviousMode = KernelMode;
/* Tell KiThreadStartup of that too */
- StartFrame->UserThread = FALSE;
+// StartFrame->UserThread = FALSE;
}
/* Now setup the remaining data for KiThreadStartup */
- StartFrame->StartContext = StartContext;
- StartFrame->StartRoutine = StartRoutine;
- StartFrame->SystemRoutine = SystemRoutine;
+// StartFrame->StartContext = StartContext;
+// StartFrame->StartRoutine = StartRoutine;
+// StartFrame->SystemRoutine = SystemRoutine;
/* And set up the Context Switch Frame */
- CtxSwitchFrame->RetAddr = KiThreadStartup;
- CtxSwitchFrame->ApcBypassDisable = TRUE;
- CtxSwitchFrame->ExceptionList = EXCEPTION_CHAIN_END;;
+// CtxSwitchFrame->RetAddr = KiThreadStartup;
+// CtxSwitchFrame->ApcBypassDisable = TRUE;
+// CtxSwitchFrame->ExceptionList = EXCEPTION_CHAIN_END;;
/* Save back the new value of the kernel stack. */
Thread->KernelStack = (PVOID)CtxSwitchFrame;
Modified: trunk/reactos/ntoskrnl/ke/amd64/trap.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/amd64/trap.S?r…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/amd64/trap.S [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/amd64/trap.S [iso-8859-1] Thu Feb 10 10:30:43 2011
@@ -76,7 +76,7 @@
#define TRAPFLAG_SYSTEMSERVICE (TRAPFLAG_VOLATILES|TRAPFLAG_DEBUG)
#define TRAPFLAG_ALL HEX(ff)
-/*
+/*
* Stack Layout:
* |-------------------|
* | KTRAP_FRAME |
@@ -89,7 +89,7 @@
*/
/*
- * ENTER_TRAP_FRAME - Allocate SIZE_KTRAP_FRAME and save registers to it
+ * ENTER_TRAP_FRAME - Allocate KTRAP_FRAME_LENGTH and save registers to it
*/
MACRO(ENTER_TRAP_FRAME, Flags)
LOCAL dont_swap
@@ -107,8 +107,8 @@
endif
/* Make room for a KTRAP_FRAME */
- sub rsp, (SIZE_KTRAP_FRAME - SIZE_INITIAL_FRAME)
- .allocstack (SIZE_KTRAP_FRAME - SIZE_INITIAL_FRAME)
+ sub rsp, (KTRAP_FRAME_LENGTH - SIZE_INITIAL_FRAME)
+ .allocstack (KTRAP_FRAME_LENGTH - SIZE_INITIAL_FRAME)
.endprolog
/* Save rbp */
@@ -278,12 +278,12 @@
.PROC InternalDispatchException
/* Allocate stack space for EXCEPTION_RECORD and KEXCEPTION_FRAME */
- sub rsp, SIZE_EXCEPTION_RECORD + SIZE_KEXCEPTION_FRAME
- .allocstack (SIZE_EXCEPTION_RECORD + SIZE_KEXCEPTION_FRAME)
+ sub rsp, EXCEPTION_RECORD_LENGTH + KEXCEPTION_FRAME_LENGTH
+ .allocstack (EXCEPTION_RECORD_LENGTH + KEXCEPTION_FRAME_LENGTH)
.endprolog
/* Set up EXCEPTION_RECORD */
- lea rcx, [rsp + SIZE_KEXCEPTION_FRAME]
+ lea rcx, [rsp + KEXCEPTION_FRAME_LENGTH]
mov [rcx + EXCEPTION_RECORD_ExceptionCode], eax
xor rax, rax
mov [rcx + EXCEPTION_RECORD_ExceptionFlags], eax
@@ -341,7 +341,7 @@
movdqa xmm14, [rsp + KEXCEPTION_FRAME_Xmm14]
movdqa xmm15, [rsp + KEXCEPTION_FRAME_Xmm15]
- add rsp, SIZE_EXCEPTION_RECORD + SIZE_KEXCEPTION_FRAME
+ add rsp, EXCEPTION_RECORD_LENGTH + KEXCEPTION_FRAME_LENGTH
ret
.ENDP InternalDispatchException
@@ -516,7 +516,7 @@
KiInvalidOpcodeKernel:
/* Kernel mode fault */
-
+
/* Dispatch the exception */
mov eax, STATUS_ILLEGAL_INSTRUCTION
mov edx, 3
@@ -837,7 +837,7 @@
mov r10, 0
mov r11, 0
call InternalDispatchException
-
+
LEAVE_TRAP_FRAME
iretq
.ENDP KiRaiseAssertion
Modified: trunk/reactos/ntoskrnl/mm/amd64/init.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/amd64/init.c?r…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/amd64/init.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/amd64/init.c [iso-8859-1] Thu Feb 10 10:30:43 2011
@@ -27,10 +27,16 @@
/* GLOBALS *****************************************************************/
/* Template PTE and PDE for a kernel page */
-MMPTE ValidKernelPde = {.u.Hard.Valid = 1, .u.Hard.Write = 1, .u.Hard.Dirty = 1,
.u.Hard.Accessed = 1};
-MMPTE ValidKernelPte = {.u.Hard.Valid = 1, .u.Hard.Write = 1, .u.Hard.Dirty = 1,
.u.Hard.Accessed = 1};
-MMPDE DemandZeroPde = {.u.Long = (MM_READWRITE <<
MM_PTE_SOFTWARE_PROTECTION_BITS)};
-MMPTE PrototypePte = {.u.Long = (MM_READWRITE << MM_PTE_SOFTWARE_PROTECTION_BITS) |
PTE_PROTOTYPE | 0xFFFFF000};
+MMPTE ValidKernelPde = {{PTE_VALID|PTE_READWRITE|PTE_DIRTY|PTE_ACCESSED}};
+MMPTE ValidKernelPte = {{PTE_VALID|PTE_READWRITE|PTE_DIRTY|PTE_ACCESSED}};
+
+/* Template PDE for a demand-zero page */
+MMPDE DemandZeroPde = {{MM_READWRITE << MM_PTE_SOFTWARE_PROTECTION_BITS}};
+MMPTE DemandZeroPte = {{MM_READWRITE << MM_PTE_SOFTWARE_PROTECTION_BITS}};
+
+/* Template PTE for prototype page */
+MMPTE PrototypePte = {{(MM_READWRITE << MM_PTE_SOFTWARE_PROTECTION_BITS) |
+ PTE_PROTOTYPE | (MI_PTE_LOOKUP_NEEDED << PAGE_SHIFT)}};
/* Sizes */
///SIZE_T MmSessionSize = MI_SESSION_SIZE;
@@ -413,7 +419,7 @@
TmplPte.u.Flush.Write = 1;
HyperTemplatePte = TmplPte;
- /* Create PDPTs (72 KB) for shared system address space,
+ /* Create PDPTs (72 KB) for shared system address space,
* skip page tables and hyperspace */
/* Loop the PXEs */
@@ -492,7 +498,7 @@
/* Page-align the nonpaged pool size */
MmSizeOfNonPagedPoolInBytes &= ~(PAGE_SIZE - 1);
-
+
/* Now, check if there was a registry size for the maximum size */
if (!MmMaximumNonPagedPoolInBytes)
{
@@ -501,7 +507,7 @@
MmMaximumNonPagedPoolInBytes += (MmNumberOfPhysicalPages - 1024) /
256 * MmMaxAdditionNonPagedPoolPerMb;
}
-
+
/* Don't let the maximum go too high */
if (MmMaximumNonPagedPoolInBytes > MI_MAX_NONPAGED_POOL_SIZE)
{
@@ -517,7 +523,7 @@
{
/* Put non paged pool after the PFN database */
MmNonPagedPoolStart = (PCHAR)MmPfnDatabase + MxPfnSizeInBytes;
- MmMaximumNonPagedPoolInBytes = (ULONG64)MmNonPagedPoolEnd -
+ MmMaximumNonPagedPoolInBytes = (ULONG64)MmNonPagedPoolEnd -
(ULONG64)MmNonPagedPoolStart;
}
@@ -688,7 +694,7 @@
PMMPTE Pte;
MMPTE TmplPte;
ULONG Size, BitMapSize;
-
+
/* Default size for paged pool is 4 times non paged pool */
MmSizeOfPagedPoolInBytes = 4 * MmMaximumNonPagedPoolInBytes;
@@ -767,7 +773,7 @@
// Allocate the allocation bitmap, which tells us which regions have not yet
// been mapped into memory
- MmPagedPoolInfo.PagedPoolAllocationMap =
+ MmPagedPoolInfo.PagedPoolAllocationMap =
ExAllocatePoolWithTag(NonPagedPool, Size, ' mM');
ASSERT(MmPagedPoolInfo.PagedPoolAllocationMap);
@@ -783,7 +789,7 @@
// Given the allocation bitmap and a base address, we can therefore figure
// out which page is the last page of that allocation, and thus how big the
// entire allocation is.
- MmPagedPoolInfo.EndOfPagedPoolBitmap =
+ MmPagedPoolInfo.EndOfPagedPoolBitmap =
ExAllocatePoolWithTag(NonPagedPool, Size, ' mM');
ASSERT(MmPagedPoolInfo.EndOfPagedPoolBitmap);
@@ -859,7 +865,7 @@
//MmPagedPoolSize = MM_PAGED_POOL_SIZE;
//ASSERT((PCHAR)MmPagedPoolBase + MmPagedPoolSize <
(PCHAR)MmNonPagedSystemStart);
-
+
HalInitializeBios(0, LoaderBlock);
}
@@ -871,7 +877,7 @@
MiSyncARM3WithROS(IN PVOID AddressStart,
IN PVOID AddressEnd)
{
-
+
}
NTSTATUS
Modified: trunk/reactos/tools/rsym/rsym64.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rsym/rsym64.h?rev=50…
==============================================================================
--- trunk/reactos/tools/rsym/rsym64.h [iso-8859-1] (original)
+++ trunk/reactos/tools/rsym/rsym64.h [iso-8859-1] Thu Feb 10 10:30:43 2011
@@ -10,6 +10,7 @@
#endif
+#define IMAGE_FILE_MACHINE_I386 0x14c
#define IMAGE_FILE_MACHINE_AMD64 0x8664
#define IMAGE_DIRECTORY_ENTRY_IMPORT 1
#define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3