[comp.os.minix] Patch to MacMINIX kernel/console.c

drew@everexn.com (Drew Rogge) (01/05/91)

Here's a patch for MacMINIX kernel/console.c. It fixes the bug which
causes the Address Error trap vector to get trashed. Basicly the outer-
most call to GetNextEvent gets passed an invalid pointer.

I'm not real sure if this is the correct fix to the problem. Joseph Pickert
should probably take a look at it. The outer most GetNextEvent might want to
be a call to some other function.

*** console.c	Sun Dec 30 15:00:01 1990
--- console.c~	Sun Dec 30 14:55:14 1990
***************
*** 115,121 ****
    if (scrollrgn == 0)
       scrollrgn = NewRgn();
    vdusetparams(line, 1, monaco, 9, line == 0 ? 1 : 0, 1, 0L, 1, 0, 0);
!   GetNextEvent(0, &e);
  }
  
  
--- 115,121 ----
    if (scrollrgn == 0)
       scrollrgn = NewRgn();
    vdusetparams(line, 1, monaco, 9, line == 0 ? 1 : 0, 1, 0L, 1, 0, 0);
!   GetNextEvent(GetNextEvent(0, &e));
  }
  
I was hoping that fixing this bug would allow MacMINIX to run with
Virtual '030 and maybe be more reliable under Multifinder, but the
fix doesn't seem to help either problem. The crash under Virtual
happens some point during the kernel boot process while the crash
under Multifinder usually happens at some indeterminate point in the
future. I don't remember if I tried Multifinder without any INITs
but I'll give that a try tonight.

While tracking down the GetNextEvent() bug I noticed that register
A5 is used just like any other address register by the code generated
with ACK. I was wondering if this could be a problem in the Mac
environment. Normally A5 pointer to the current tasks data space.
Even though the MINIX glue functions to the Mac toolboxes seem
to load A5 and A7 with the values which were obtained from the
"Macboot" application, I was wondering if asynchronous events like
INITs and BUS errors caused by the use of Virtual require a valid value
in A5? If they do then some of the crashes could be caused by A5
sometimes being invalid.

Anyone have any suggestions?

By the way, did anyone see the article I posted about the patch to
memory.c? I haven't seen any response to it so I was wondering
if it really made it to the net.

Drew Rogge
..!uunet!drew@everexn.com