New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] The ultimate ros amd64 bringup #361
Changes from 1 commit
91c8699
ff1eaad
15a08e8
cce3d16
286b2fb
12002d4
546c05b
1bc15af
1f6d61b
9e097de
aedb9f6
d139743
25064d0
75e11df
13ef07a
03920b1
235566d
1e326fb
c4fbc15
29db059
c24203c
c9d1f6a
e503f53
9335f8f
4b4a334
945d807
a26ae1d
bd078ab
7749bdc
177b3e7
52721c2
fbec870
d5bdd7e
4351118
5b1588c
1dc22b6
8366b2c
29d20df
10e086b
3252ac3
66eb02c
c93d924
c3380ef
c249c15
8b48097
e7e7e40
a9fc91d
6e0a3be
f062e2d
21177bb
ebe9bc4
c8bd63f
4c80d83
96f3020
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,13 +15,13 @@ | |
#include <debug.h> | ||
|
||
#include <mm/ARM3/miarm.h> | ||
#include <fltkernel.h> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It contains a few nice macros like Add2Ptr, PtrOffset, ROUND_TO_SIZE, IS_ALIGNED, We should probably put those somewhere separate and include them from fltkernel.h and ntoskrnl.h, so we don't need the whole clusterfuck, but still have those macros available. |
||
|
||
#ifdef _WINKD_ | ||
extern PMMPTE MmDebugPte; | ||
#endif | ||
|
||
/* Helper macros */ | ||
#define IS_ALIGNED(addr, align) (((ULONG64)(addr) & (align - 1)) == 0) | ||
#define IS_PAGE_ALIGNED(addr) IS_ALIGNED(addr, PAGE_SIZE) | ||
|
||
/* GLOBALS *****************************************************************/ | ||
|
@@ -64,41 +64,55 @@ NTAPI | |
INIT_FUNCTION | ||
MiInitializeSessionSpaceLayout(VOID) | ||
{ | ||
/* This is the entire size */ | ||
MmSessionSize = MI_SESSION_SIZE; | ||
MmSessionViewSize = MI_SESSION_VIEW_SIZE; | ||
MmSessionPoolSize = MI_SESSION_POOL_SIZE; | ||
MmSessionImageSize = MI_SESSION_IMAGE_SIZE; | ||
MmSystemViewSize = MI_SYSTEM_VIEW_SIZE; | ||
|
||
/* Set up session space */ | ||
/* Start with session space end */ | ||
MiSessionSpaceEnd = (PVOID)MI_SESSION_SPACE_END; | ||
|
||
/* This is where we will load Win32k.sys and the video driver */ | ||
/* The highest range is the session image range */ | ||
MmSessionImageSize = MI_SESSION_IMAGE_SIZE; | ||
MiSessionImageEnd = MiSessionSpaceEnd; | ||
MiSessionImageStart = (PCHAR)MiSessionImageEnd - MmSessionImageSize; | ||
MiSessionImageStart = (PUCHAR)MiSessionImageEnd - MmSessionImageSize; | ||
ASSERT(IS_PAGE_ALIGNED(MiSessionImageStart)); | ||
|
||
/* Session working set is below the session image range */ | ||
MiSessionSpaceWs = (PUCHAR)MiSessionImageStart - MI_SESSION_WORKING_SET_SIZE; | ||
|
||
/* The view starts right below the session working set (itself below | ||
* the image area) */ | ||
MiSessionViewEnd = (PVOID)MI_SESSION_VIEW_END; | ||
MiSessionViewStart = (PCHAR)MiSessionViewEnd - MmSessionViewSize; | ||
/* Session view is below the session working set */ | ||
MmSessionViewSize = MI_SESSION_VIEW_SIZE; | ||
MiSessionViewEnd = (PUCHAR)MiSessionImageStart - MI_SESSION_WORKING_SET_SIZE; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not to self: use MiSessionSpaceWs here. |
||
MiSessionViewStart = (PUCHAR)MiSessionViewEnd - MmSessionViewSize; | ||
ASSERT(IS_PAGE_ALIGNED(MiSessionViewStart)); | ||
|
||
/* Session pool follows */ | ||
/* Session pool is below session view */ | ||
MmSessionPoolSize = MI_SESSION_POOL_SIZE; | ||
MiSessionPoolEnd = MiSessionViewStart; | ||
MiSessionPoolStart = (PCHAR)MiSessionPoolEnd - MmSessionPoolSize; | ||
MiSessionPoolStart = (PUCHAR)MiSessionPoolEnd - MmSessionPoolSize; | ||
ASSERT(IS_PAGE_ALIGNED(MiSessionPoolStart)); | ||
|
||
/* And it all begins here */ | ||
MmSessionBase = MiSessionPoolStart; | ||
|
||
/* System view space ends at session space, so now that we know where | ||
* this is, we can compute the base address of system view space itself. */ | ||
MiSystemViewStart = (PCHAR)MmSessionBase - MmSystemViewSize; | ||
MmSystemViewSize = MI_SYSTEM_VIEW_SIZE; | ||
MiSystemViewStart = (PUCHAR)MmSessionBase - MmSystemViewSize; | ||
ASSERT(IS_PAGE_ALIGNED(MiSystemViewStart)); | ||
|
||
/* Sanity checks */ | ||
ASSERT(Add2Ptr(MmSessionBase, MmSessionSize) == MiSessionSpaceEnd); | ||
ASSERT(MiSessionViewEnd <= MiSessionImageStart); | ||
ASSERT(MmSessionBase <= MiSessionPoolStart); | ||
|
||
/* Compute the PTE addresses for all the addresses we carved out */ | ||
MiSessionImagePteStart = MiAddressToPte(MiSessionImageStart); | ||
MiSessionImagePteEnd = MiAddressToPte(MiSessionImageEnd); | ||
MiSessionBasePte = MiAddressToPte(MmSessionBase); | ||
MiSessionLastPte = MiAddressToPte(MiSessionSpaceEnd); | ||
|
||
/* Initialize the pointer to the session space structure */ | ||
MmSessionSpace = (PMM_SESSION_SPACE)Add2Ptr(MiSessionImageStart, 0x10000); | ||
} | ||
|
||
VOID | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh. An old WC of mine says:
Same thing I suppose
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should technically be the same. If there is a reason for your variant, I can change it.