ntdll: Make the page_size variable global.
This commit is contained in:
parent
e2761ab075
commit
90e90e3b6a
|
@ -1980,9 +1980,9 @@ static NTSTATUS CDROM_ScsiGetCaps(int fd, PIO_SCSI_CAPABILITIES caps)
|
|||
#ifdef SG_SCATTER_SZ
|
||||
caps->Length = sizeof(*caps);
|
||||
caps->MaximumTransferLength = SG_SCATTER_SZ; /* FIXME */
|
||||
caps->MaximumPhysicalPages = SG_SCATTER_SZ / getpagesize();
|
||||
caps->MaximumPhysicalPages = SG_SCATTER_SZ / page_size;
|
||||
caps->SupportedAsynchronousEvents = TRUE;
|
||||
caps->AlignmentMask = getpagesize();
|
||||
caps->AlignmentMask = page_size;
|
||||
caps->TaggedQueuing = FALSE; /* we could check that it works and answer TRUE */
|
||||
caps->AdapterScansDown = FALSE; /* FIXME ? */
|
||||
caps->AdapterUsesPio = FALSE; /* FIXME ? */
|
||||
|
@ -1997,7 +1997,7 @@ static NTSTATUS CDROM_ScsiGetCaps(int fd, PIO_SCSI_CAPABILITIES caps)
|
|||
if (io != 0) return CDROM_GetStatusCode(io);
|
||||
caps->Length = sizeof(*caps);
|
||||
caps->MaximumTransferLength = bytesr < bytesw ? bytesr : bytesw;
|
||||
caps->MaximumPhysicalPages = caps->MaximumTransferLength / getpagesize();
|
||||
caps->MaximumPhysicalPages = caps->MaximumTransferLength / page_size;
|
||||
caps->SupportedAsynchronousEvents = TRUE;
|
||||
caps->AlignmentMask = align-1;
|
||||
caps->TaggedQueuing = FALSE; /* we could check that it works and answer TRUE */
|
||||
|
|
|
@ -1384,7 +1384,6 @@ static KERNEL_DIRENT *start_vfat_ioctl( int fd )
|
|||
|
||||
if (!de)
|
||||
{
|
||||
const size_t page_size = getpagesize();
|
||||
SIZE_T size = 2 * sizeof(*de) + page_size;
|
||||
void *addr = NULL;
|
||||
|
||||
|
|
|
@ -765,7 +765,6 @@ NTSTATUS WINAPI NtReadFileScatter( HANDLE file, HANDLE event, PIO_APC_ROUTINE ap
|
|||
PIO_STATUS_BLOCK io_status, FILE_SEGMENT_ELEMENT *segments,
|
||||
ULONG length, PLARGE_INTEGER offset, PULONG key )
|
||||
{
|
||||
size_t page_size = getpagesize();
|
||||
int result, unix_handle, needs_close;
|
||||
unsigned int options;
|
||||
NTSTATUS status;
|
||||
|
@ -1097,7 +1096,6 @@ NTSTATUS WINAPI NtWriteFileGather( HANDLE file, HANDLE event, PIO_APC_ROUTINE ap
|
|||
PIO_STATUS_BLOCK io_status, FILE_SEGMENT_ELEMENT *segments,
|
||||
ULONG length, PLARGE_INTEGER offset, PULONG key )
|
||||
{
|
||||
size_t page_size = getpagesize();
|
||||
int result, unix_handle, needs_close;
|
||||
unsigned int options;
|
||||
NTSTATUS status;
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "windef.h"
|
||||
#include "winnt.h"
|
||||
#include "winternl.h"
|
||||
#include "ntdll_misc.h"
|
||||
#include "wine/list.h"
|
||||
#include "wine/debug.h"
|
||||
#include "wine/server.h"
|
||||
|
@ -806,7 +807,7 @@ static BOOL validate_large_arena( HEAP *heap, const ARENA_LARGE *arena, BOOL qui
|
|||
{
|
||||
DWORD flags = heap->flags;
|
||||
|
||||
if ((ULONG_PTR)arena % getpagesize())
|
||||
if ((ULONG_PTR)arena % page_size)
|
||||
{
|
||||
if (quiet == NOISY)
|
||||
{
|
||||
|
|
|
@ -773,7 +773,7 @@ static BOOL is_dll_native_subsystem( HMODULE module, const IMAGE_NT_HEADERS *nt,
|
|||
WCHAR buffer[16];
|
||||
|
||||
if (nt->OptionalHeader.Subsystem != IMAGE_SUBSYSTEM_NATIVE) return FALSE;
|
||||
if (nt->OptionalHeader.SectionAlignment < getpagesize()) return TRUE;
|
||||
if (nt->OptionalHeader.SectionAlignment < page_size) return TRUE;
|
||||
|
||||
if ((imports = RtlImageDirectoryEntryToData( module, TRUE,
|
||||
IMAGE_DIRECTORY_ENTRY_IMPORT, &size )))
|
||||
|
|
|
@ -33,6 +33,12 @@
|
|||
|
||||
#define MAX_DOS_DRIVES 26
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
static const UINT_PTR page_size = 0x1000;
|
||||
#else
|
||||
extern UINT_PTR page_size DECLSPEC_HIDDEN;
|
||||
#endif
|
||||
|
||||
struct drive_info
|
||||
{
|
||||
dev_t dev;
|
||||
|
|
|
@ -798,7 +798,7 @@ NTSTATUS signal_alloc_thread( TEB **teb )
|
|||
|
||||
if (!sigstack_zero_bits)
|
||||
{
|
||||
size_t min_size = getpagesize(); /* this is just for the TEB, we don't use a signal stack yet */
|
||||
size_t min_size = page_size;
|
||||
/* find the first power of two not smaller than min_size */
|
||||
while ((1u << sigstack_zero_bits) < min_size) sigstack_zero_bits++;
|
||||
assert( sizeof(TEB) <= min_size );
|
||||
|
|
|
@ -963,7 +963,7 @@ NTSTATUS signal_alloc_thread( TEB **teb )
|
|||
|
||||
if (!sigstack_zero_bits)
|
||||
{
|
||||
size_t min_size = getpagesize(); /* this is just for the TEB, we don't use a signal stack yet */
|
||||
size_t min_size = page_size; /* this is just for the TEB, we don't use a signal stack yet */
|
||||
/* find the first power of two not smaller than min_size */
|
||||
while ((1u << sigstack_zero_bits) < min_size) sigstack_zero_bits++;
|
||||
assert( sizeof(TEB) <= min_size );
|
||||
|
|
|
@ -725,7 +725,7 @@ NTSTATUS signal_alloc_thread( TEB **teb )
|
|||
|
||||
if (!sigstack_zero_bits)
|
||||
{
|
||||
size_t min_size = getpagesize(); /* this is just for the TEB, we don't use a signal stack yet */
|
||||
size_t min_size = page_size;
|
||||
/* find the first power of two not smaller than min_size */
|
||||
while ((1u << sigstack_zero_bits) < min_size) sigstack_zero_bits++;
|
||||
assert( sizeof(TEB) <= min_size );
|
||||
|
|
|
@ -112,26 +112,23 @@ static RTL_CRITICAL_SECTION_DEBUG critsect_debug =
|
|||
static RTL_CRITICAL_SECTION csVirtual = { &critsect_debug, -1, 0, 0, 0, 0 };
|
||||
|
||||
#ifdef __i386__
|
||||
/* These are always the same on an i386, and it will be faster this way */
|
||||
# define page_mask 0xfff
|
||||
# define page_shift 12
|
||||
# define page_size 0x1000
|
||||
static const UINT page_shift = 12;
|
||||
static const UINT_PTR page_mask = 0xfff;
|
||||
/* Note: these are Windows limits, you cannot change them. */
|
||||
static void *address_space_limit = (void *)0xc0000000; /* top of the total available address space */
|
||||
static void *user_space_limit = (void *)0x7fff0000; /* top of the user address space */
|
||||
static void *working_set_limit = (void *)0x7fff0000; /* top of the current working set */
|
||||
static void *address_space_start = (void *)0x110000; /* keep DOS area clear */
|
||||
#elif defined(__x86_64__)
|
||||
# define page_mask 0xfff
|
||||
# define page_shift 12
|
||||
# define page_size 0x1000
|
||||
static const UINT page_shift = 12;
|
||||
static const UINT_PTR page_mask = 0xfff;
|
||||
static void *address_space_limit = (void *)0x7fffffff0000;
|
||||
static void *user_space_limit = (void *)0x7fffffff0000;
|
||||
static void *working_set_limit = (void *)0x7fffffff0000;
|
||||
static void *address_space_start = (void *)0x10000;
|
||||
#else
|
||||
UINT_PTR page_size = 0;
|
||||
static UINT page_shift;
|
||||
static UINT_PTR page_size;
|
||||
static UINT_PTR page_mask;
|
||||
static void *address_space_limit;
|
||||
static void *user_space_limit;
|
||||
|
@ -1416,8 +1413,8 @@ void virtual_init(void)
|
|||
size_t size;
|
||||
struct file_view *heap_view;
|
||||
|
||||
#ifndef page_mask
|
||||
page_size = getpagesize();
|
||||
#if !defined(__i386__) && !defined(__x86_64__)
|
||||
page_size = sysconf( _SC_PAGESIZE );
|
||||
page_mask = page_size - 1;
|
||||
/* Make sure we have a power of 2 */
|
||||
assert( !(page_size & page_mask) );
|
||||
|
|
Loading…
Reference in New Issue