Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2006-07-27 01:02:01 +0400
committerCorinna Vinschen <corinna@vinschen.de>2006-07-27 01:02:01 +0400
commita0bb355ffe06fb21c7db9a47bfb120c126247e2f (patch)
treea7a3ba4c76a392b2a4dfa95aea999e46656b4fb1 /winsup
parent5faa48850f4e40c09fa9353b4e4cfbef43c7d9e0 (diff)
* 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.
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog8
-rw-r--r--winsup/cygwin/shared.cc37
-rw-r--r--winsup/cygwin/shared_info.h2
3 files changed, 23 insertions, 24 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index d66bf8694..3b8ad6102 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,13 @@
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>
+
* cygheap.h (struct init_cygheap): Remove shared_h and mt_h members.
* fhandler_tape.cc (mt): Define as DLL shared area in
.cygwin_dll_common instead of as dynamically allocated area.
diff --git a/winsup/cygwin/shared.cc b/winsup/cygwin/shared.cc
index c88706a12..65965b58b 100644
--- a/winsup/cygwin/shared.cc
+++ b/winsup/cygwin/shared.cc
@@ -49,20 +49,19 @@ shared_name (char *ret_buf, const char *str, int num)
#define page_const (65535)
#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 (console_state))
- - pround (sizeof (_pinfo)),
- (char *) cygwin_shared_address
- - pround (sizeof (console_state))
- - pround (sizeof (_pinfo)),
- (char *) cygwin_shared_address
- - pround (sizeof (_pinfo)),
- (char *) cygwin_shared_address
+ - pround (sizeof (user_info))
+ - pround (sizeof (console_state))
+ - pround (sizeof (_pinfo)),
+ - pround (sizeof (console_state))
+ - pround (sizeof (_pinfo)),
+ - pround (sizeof (_pinfo)),
+ 0
};
+#define off_addr(x) ((void *)((caddr_t) cygwin_hmodule + offsets[x]))
+
void * __stdcall
open_shared (const char *name, int n, HANDLE& shared_h, DWORD size,
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;
else
{
- addr = offsets[m];
+ addr = off_addr (m);
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 ())
system_printf ("relocating shared object %s(%d) from %p to %p on Windows NT", name, n, addr, shared);
#endif
- offsets[0] = NULL;
+ offsets[0] = 0;
}
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 ())
{
- unsigned delta = (char *) shared - offsets[0];
- offsets[0] = (char *) shared;
+ ptrdiff_t delta = (caddr_t) shared - (caddr_t) off_addr (0);
+ offsets[0] = (caddr_t) shared - (caddr_t) cygwin_hmodule;
for (int i = SH_USER_SHARED + 1; i < SH_TOTAL_SIZE; i++)
{
unsigned size = offsets[i + 1] - offsets[i];
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 */
}
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);
diff --git a/winsup/cygwin/shared_info.h b/winsup/cygwin/shared_info.h
index ae80309cb..17a21b4cc 100644
--- a/winsup/cygwin/shared_info.h
+++ b/winsup/cygwin/shared_info.h
@@ -184,8 +184,6 @@ void __stdcall memory_init ();
(((DWORD) ((p) + 1) + system_info.dwAllocationGranularity - 1) / \
system_info.dwAllocationGranularity)))
-#define cygwin_shared_address ((void *) 0x61000000)
-
#ifdef _FHANDLER_H_
struct console_state
{