Date: Fri, 8 Jan 93 10:38:36 JST From: Makoto Kobayashi To: djgpp AT sun DOT soe DOT clarkson DOT edu Subject: paging mechanism trouble in go32 I find a trouble in go32. I show you a sample program for the trouble. Please compile it with djgpp, and run with go32 (not debug32). /* this is file go32chk.c */ #include char a[24576]={1}; void main() { printf ("1: a[12288]= %d\n",a[12288]); a[12288]=-1; printf ("2: a[12288]= %d\n",a[12288]); system("echo child process"); printf (" a[8192]= %d\n",a[8192]); printf ("3: a[12288]= %d\n",a[12288]); } /* end of file */ > gcc go32chk.c > go32 a.out Of cource the expected result is: 1: a[12288]= 0 2: a[12288]= -1 child process a[8192]= 0 3: a[12288]= -1 but some results may be: 1: a[12288]= 0 2: a[12288]= -1 child process a[8192]= 0 3: a[12288]= 0 I think that this is due to a bug in the paging mechanism. This bug is rare but I feel it is very dangerous... Patch for go32 1.09 to fix this trouble follows. Please try and test it. *** paging.c0 Sun Nov 1 07:54:38 1992 --- paging.c Fri Jan 8 09:27:46 1993 *************** *** 110,116 **** word32 far *vcpi_pt = 0; extern word32 graphics_pt_lin; char paging_buffer[4096*MAX_PAGING_NUM]; - static int paged_out_something = 0; word32 screen_primary, screen_secondary; --- 110,115 ---- *************** *** 567,573 **** return 0; } count = MAX_PAGING_NUM; ! if ((count > mem_avail/4) || (paged_out_something)) count = 1; if (pti + count > 1024) count = 1024 - pti; --- 566,572 ---- return 0; } count = MAX_PAGING_NUM; ! if (count > mem_avail/4) count = 1; if (pti + count > 1024) count = 1024 - pti; *************** *** 582,587 **** --- 581,588 ---- { if (pt[pti] & PT_P) break; + if (eaddr != -1 && (pt[pti] & PT_I) != 0) + break; /* EastWind 1993 */ dblock = pt[pti] >> 12; pn = valloc(VA_1M); pt[pti] &= 0xfffL & ~(word32)(PT_A | PT_D); *************** *** 629,635 **** } pt[pti] |= PT_I; } - if (paged_out_something) break; } if (eaddr != -1) --- 630,635 ---- *************** *** 680,687 **** #if TOPLINEINFO old_status = update_status('>' | 0x0a00, 79); #endif - if (!fInPageOutEverything) - paged_out_something = 1; start_pdi = last_po_pdi; start_pti = last_po_pti; if (where == VA_640) --- 680,685 ---- The variable "paged_out_something" seemed to be expected to fix the paging problem, but it was imperfect. I took away it. At last, I want to hear DJ's view. Do you think multi-page-loading mechanism is effective? (Should MAX_PAGING_NUM be 4 ?) Thank you very much. Faculty of Eng., Mi'e Univ., Tsu, Japan. na70103 AT mips DOT cc DOT mie-u DOT ac DOT jp Makoto Kobayashi