* shared.cc (offsets): Define as offsets relative to cygwin_hmodule
instead of addresses. (off_addr): New macro. (open_shared): Use offsets array accordingly. Remove unused code. * shared_info.h (cygwin_shared_address): Remove.
This commit is contained in:
parent
5faa48850f
commit
a0bb355ffe
@ -1,3 +1,11 @@
|
|||||||
|
2006-07-26 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* shared.cc (offsets): Define as offsets relative to cygwin_hmodule
|
||||||
|
instead of addresses.
|
||||||
|
(off_addr): New macro.
|
||||||
|
(open_shared): Use offsets array accordingly. Remove unused code.
|
||||||
|
* shared_info.h (cygwin_shared_address): Remove.
|
||||||
|
|
||||||
2006-07-26 Corinna Vinschen <corinna@vinschen.de>
|
2006-07-26 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* cygheap.h (struct init_cygheap): Remove shared_h and mt_h members.
|
* cygheap.h (struct init_cygheap): Remove shared_h and mt_h members.
|
||||||
|
@ -49,20 +49,19 @@ shared_name (char *ret_buf, const char *str, int num)
|
|||||||
#define page_const (65535)
|
#define page_const (65535)
|
||||||
#define pround(n) (((size_t) (n) + page_const) & ~page_const)
|
#define pround(n) (((size_t) (n) + page_const) & ~page_const)
|
||||||
|
|
||||||
static char *offsets[] =
|
static ptrdiff_t offsets[] =
|
||||||
{
|
{
|
||||||
(char *) cygwin_shared_address
|
|
||||||
- pround (sizeof (user_info))
|
- pround (sizeof (user_info))
|
||||||
- pround (sizeof (console_state))
|
- pround (sizeof (console_state))
|
||||||
- pround (sizeof (_pinfo)),
|
- pround (sizeof (_pinfo)),
|
||||||
(char *) cygwin_shared_address
|
|
||||||
- pround (sizeof (console_state))
|
- pround (sizeof (console_state))
|
||||||
- pround (sizeof (_pinfo)),
|
- pround (sizeof (_pinfo)),
|
||||||
(char *) cygwin_shared_address
|
|
||||||
- pround (sizeof (_pinfo)),
|
- pround (sizeof (_pinfo)),
|
||||||
(char *) cygwin_shared_address
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define off_addr(x) ((void *)((caddr_t) cygwin_hmodule + offsets[x]))
|
||||||
|
|
||||||
void * __stdcall
|
void * __stdcall
|
||||||
open_shared (const char *name, int n, HANDLE& shared_h, DWORD size,
|
open_shared (const char *name, int n, HANDLE& shared_h, DWORD size,
|
||||||
shared_locations& m, PSECURITY_ATTRIBUTES psa, DWORD access)
|
shared_locations& m, PSECURITY_ATTRIBUTES psa, DWORD access)
|
||||||
@ -75,7 +74,7 @@ open_shared (const char *name, int n, HANDLE& shared_h, DWORD size,
|
|||||||
addr = NULL;
|
addr = NULL;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
addr = offsets[m];
|
addr = off_addr (m);
|
||||||
VirtualFree (addr, 0, MEM_RELEASE);
|
VirtualFree (addr, 0, MEM_RELEASE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,7 +117,7 @@ open_shared (const char *name, int n, HANDLE& shared_h, DWORD size,
|
|||||||
if (wincap.is_winnt ())
|
if (wincap.is_winnt ())
|
||||||
system_printf ("relocating shared object %s(%d) from %p to %p on Windows NT", name, n, addr, shared);
|
system_printf ("relocating shared object %s(%d) from %p to %p on Windows NT", name, n, addr, shared);
|
||||||
#endif
|
#endif
|
||||||
offsets[0] = NULL;
|
offsets[0] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!shared)
|
if (!shared)
|
||||||
@ -126,22 +125,16 @@ open_shared (const char *name, int n, HANDLE& shared_h, DWORD size,
|
|||||||
|
|
||||||
if (m == SH_USER_SHARED && offsets[0] && wincap.needs_memory_protection ())
|
if (m == SH_USER_SHARED && offsets[0] && wincap.needs_memory_protection ())
|
||||||
{
|
{
|
||||||
unsigned delta = (char *) shared - offsets[0];
|
ptrdiff_t delta = (caddr_t) shared - (caddr_t) off_addr (0);
|
||||||
offsets[0] = (char *) shared;
|
offsets[0] = (caddr_t) shared - (caddr_t) cygwin_hmodule;
|
||||||
for (int i = SH_USER_SHARED + 1; i < SH_TOTAL_SIZE; i++)
|
for (int i = SH_USER_SHARED + 1; i < SH_TOTAL_SIZE; i++)
|
||||||
{
|
{
|
||||||
unsigned size = offsets[i + 1] - offsets[i];
|
unsigned size = offsets[i + 1] - offsets[i];
|
||||||
offsets[i] += delta;
|
offsets[i] += delta;
|
||||||
if (!VirtualAlloc (offsets[i], size, MEM_RESERVE, PAGE_NOACCESS))
|
if (!VirtualAlloc (off_addr (i), size, MEM_RESERVE, PAGE_NOACCESS))
|
||||||
continue; /* oh well */
|
continue; /* oh well */
|
||||||
}
|
}
|
||||||
offsets[SH_TOTAL_SIZE] += delta;
|
offsets[SH_TOTAL_SIZE] += delta;
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (!child_proc_info && wincap.needs_memory_protection ())
|
|
||||||
for (DWORD s = 0x950000; s <= 0xa40000; s += 0x1000)
|
|
||||||
VirtualAlloc ((void *) s, 4, MEM_RESERVE, PAGE_NOACCESS);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
debug_printf ("name %s, n %d, shared %p (wanted %p), h %p", mapname, n, shared, addr, shared_h);
|
debug_printf ("name %s, n %d, shared %p (wanted %p), h %p", mapname, n, shared, addr, shared_h);
|
||||||
|
@ -184,8 +184,6 @@ void __stdcall memory_init ();
|
|||||||
(((DWORD) ((p) + 1) + system_info.dwAllocationGranularity - 1) / \
|
(((DWORD) ((p) + 1) + system_info.dwAllocationGranularity - 1) / \
|
||||||
system_info.dwAllocationGranularity)))
|
system_info.dwAllocationGranularity)))
|
||||||
|
|
||||||
#define cygwin_shared_address ((void *) 0x61000000)
|
|
||||||
|
|
||||||
#ifdef _FHANDLER_H_
|
#ifdef _FHANDLER_H_
|
||||||
struct console_state
|
struct console_state
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user