[m-dev.] for review: use Win32 exceptions in the runtime
Fergus Henderson
fjh at cs.mu.OZ.AU
Thu Jun 29 10:41:14 AEST 2000
On 28-Jun-2000, Peter Ross <petdr at cs.mu.OZ.AU> wrote:
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/runtime/mercury_memory_handlers.c,v
> retrieving revision 1.11
> diff -u -r1.11 mercury_memory_handlers.c
> --- runtime/mercury_memory_handlers.c 2000/06/08 07:59:04 1.11
> +++ runtime/mercury_memory_handlers.c 2000/06/28 12:58:37
> @@ -132,7 +132,7 @@
> static bool
> try_munprotect(void *addr, void *context)
> {
> -#ifndef HAVE_SIGINFO
> +#if !(defined(HAVE_SIGINFO) || defined(MR_WIN32))
> return FALSE;
Could/should you use MR_WIN32_VIRTUAL_ALLOC there rather than MR_WIN32?
> +int
> +MR_protect_pages(void *addr, size_t size, int prot_flags)
> +{
> + int rc;
> + DWORD Flags, OldFlags;
> +
> + if (prot_flags & PROT_WRITE) {
> + Flags = PAGE_READWRITE;
> + } else if (prot_flags & PROT_READ) {
> + Flags = PAGE_READONLY;
> + } else {
> + Flags = PAGE_NOACCESS;
> + }
> +
> + if (rc < 0) {
> + fprintf(stderr,
> + "Error in VirtualProtect(addr=0x%08lx, size=0x%08lx):"
> + " 0x%08lx\n", (unsigned long) addr,
Here `rc' is an uninitialized variable;
I think somehow you deleted the call to VirtualProtect().
Apart from that, this change looks good now.
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list