Date: Mon, 1 Jun 92 09:01:42 EDT From: DJ Delorie To: djgpp AT sun DOT soe DOT clarkson DOT edu Subject: patches to 1.06 Status: O Attached are a number of bugfix patches for 1.06. These will be official in 1.07, but I thought they would be needed for a lot of folks right away. Binaries will not be distributed until 1.07 is released. DJ dj AT ctron DOT com Problem: go32 doesn't accept the long command line convention of the GNUish utilities. This makes in incompatible with GNUish make. Solution: Change go32 so that it will use _argc, _argv* iff there are no command line parameters. This will fix all djgpp compiled programs at once. diff -c2 1.06/control.c 1.07/control.c *** 1.06/control.c Mon Jun 1 11:12:24 1992 --- 1.07/control.c Mon Jun 1 11:12:20 1992 *************** *** 200,203 **** --- 200,229 ---- } + static getlongargs(int *ac, char ***av) + { + char *_argcs = getenv("_argc"); + int _argc, i; + char tmp[10]; + char **_argv; + + if (_argcs == 0) + return; + if (*ac > 1) + return; + + _argc = atoi(_argcs); + _argv = (char **)malloc((_argc+1)*sizeof(char*)); + for (i = 1; i<_argc; i++) + { + sprintf(tmp, "_argv%d", i); + _argv[i] = getenv(tmp); + } + _argv[0] = (*av)[0]; + _argv[i] = 0; + *av = _argv; + *ac = _argc; + putenv("_argc="); + } + main(int argc, char **argv, char **envp) { *************** *** 238,241 **** --- 264,269 ---- } } + + getlongargs(&argc, &argv); ems_handle = emm_present(); Problem: Using -pg to profile applications causes hangs or exceptions Solution: The timer interrupt was modified in 1.06, and the profiling handler was not modified to suit. diff -c2 1.06/gcrt0.s 1.07/gcrt0.s *** 1.06/gcrt0.s Sat May 30 22:40:48 1992 --- 1.07/gcrt0.s Sat May 30 22:56:42 1992 *************** *** 78,81 **** --- 78,82 ---- popl %eax ljmp mc_chain /* chain to the next timer vector */ + iret .data Problem: Destructors of global objects were not being called (and thus cout was not being flushed) Solution: The linked list of onexit/atexit routines was not being managed correctly. diff -c2 1.06/onexit.c 1.07/onexit.c *** 1.06/onexit.c Sat May 30 22:30:56 1992 --- 1.07/onexit.c Sat May 30 22:31:06 1992 *************** *** 24,27 **** --- 24,28 ---- a->function = func; a->arg = arg; + __atexit = a; } Problem: There is no way of accessing memory mapped devices that exist above 1M. Solution: Accesses between 0xe0000000 and 0xefffffff will automatically cause that address to be mapped to the physical address (addr-0xe0000000). diff -c2 1.06/paging.c 1.07/paging.c *** 1.06/paging.c Mon Jun 1 11:19:48 1992 --- 1.07/paging.c Mon Jun 1 11:21:12 1992 *************** *** 436,439 **** --- 436,462 ---- goto got_area; + if (vaddr >= 0xf0000000L) + { + pdi = (vaddr >> 22) & 0x3ff; + if (!(pd[pdi] & PT_P)) /* put in a mapped page table */ + { + pn = valloc(VA_640); + pt = (word32 far *)((word32)pn << 24); + pd[pdi] = ((word32)pn<<12) | PT_P | PT_W | PT_I; + vaddr &= 0x0fffffffL; + for (pti=0; pti<1024; pti++) + { + pt[pti] = PT_W | PT_P | PT_I | vaddr; + vaddr += 4096; + } + return 0; + } + pt = (word32 far *)((pd[pdi]&~0xFFF) << 12); + vaddr &= 0x0ffff000L; + pti = (vaddr>>12) & 0x3ff; + pt[pti] = vaddr | PT_P | PT_W | PT_I; + return 0; + } + printf("Segmentation violation in pointer 0x%08lx at %x:%lx\n", tss_ptr->tss_cr2-ARENA, tss_ptr->tss_cs, tss_ptr->tss_eip);