[m-dev.] for review: use Win32 exceptions in the runtime
Peter Ross
petdr at cs.mu.OZ.AU
Thu Jun 29 19:18:23 AEST 2000
On Thu, Jun 29, 2000 at 10:41:14AM +1000, Fergus Henderson wrote:
> 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?
>
Yes I could, will change.
> > +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().
>
I have no idea what happened there, but there definately should be a
call to VirtualProtect().
Pete
--------------------------------------------------------------------------
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