cwr@pnet01.cts.com (Will Rose) (03/11/91)
I've been looking at the profil() call stuff recently posted by Kai-Uwe Bloom for the ST, and trying to port it to the PC. (His revised scheduler, posted at the same time, is a trivial change and an enormous improvement in performance). At the moment, the test command is running to completion, but producing an error message "profile failed" and a gprof file that contains only zero bytes. The first place to look is in the mrtso.s (mcrtso.s) file, where I've tried to translate from 68000 assembler to PCIX assembler with very little information to go on. Nor can I find out how the compiler is calling the _procentry and _procexit routines; here there is no information. Below I've added Kai-Uwe's original (working) 68000 code, and my tentative translation to PCIX. Given the PC compiler sources, and some PCIX documentation, it would be ten minutes work to check if the stack is being set up correctly for the calls. Could some expert have a shot at it? Once this file is know to be correct, any remaining problems must lie in the monitor() or profil() code, presumably caused by the 68000->8086 change. 68000 version: ======================================================================== ! This is the C run-time start-off routine. It's job is to take the ! arguments as put on the stack by EXEC, and to parse them and set them up the ! way _main expects them. ! public labels .define __start .define _environ #ifdef ACK .define EXIT .define .trpim .define .trppc #endif ACK #ifdef _MCRTSO .define _monstartup .define _moncontrol .define __mcleanup #endif #ifdef ACK .sect .text .sect .rom .sect .data .sect .bss #endif ACK ! external references .extern _main .extern _exit .extern _etext .extern _edata .extern _end .sect .text __start: #ifdef _MCRTSO pea _etext ! start profile monitor pea __start jsr _monstartup add #8,sp #endif move.l sp,a0 move.l (a0)+,d0 ! long due to lib/exec.c and mm/exec.c move.l d0,d1 add.l #1,d1 asl.l #2,d1 ! pointers are four bytes on 68000 move.l a0,a1 add.l d1,a1 move.l a1,_environ ! save envp in environ move.l a1,-(sp) ! push environ move.l a0,-(sp) ! push argv move.w d0,-(sp) ! push argc jsr _main add.l #10,sp #ifdef _MCRTSO ! This should normally be in __exit ?? clr.l -(sp) ! stop profile monitor jsr _moncontrol add #4,sp jsr __mcleanup ! write mon.out file #endif #ifdef ACK EXIT: #endif ACK move.w d0,-(sp) ! push exit status jsr _exit L0: bra L0 #ifdef _MCRTSO .extern _mcount #ifdef ACK .define _procentry .define _procexit _procentry: move.l 4(a6),a1 ! callers address move.l (sp),a0 ! callees address move.l 4(sp),-(sp) move.l a0,-(sp) move.l a1,-(sp) jsr _mcount ! mcount(from_pc, to_pc, arc_ptr) add #12,sp _procexit: rts #else .define mcount mcount: move.l (sp),a1 move.l a0,-(sp) ! UNIX has arc_ptr in a0 (at least for GNU C) move.l a1,-(sp) ! callees address move.l 4(a6),-(sp) ! callers address jsr _mcount ! mcount(from_pc, to_pc, arc_ptr) add #12,sp rts #endif #endif .sect .data _environ: .data4 0 #ifdef ACK .trpim: .data2 0 .trppc: .data4 0 #endif ACK ======================================================================== PCIX version: ======================================================================== | This is the C run-time start-off routine. It's job is to take the | arguments as put on the stack by EXEC, and to parse them and set them up the | way _main expects them. .globl _main, _exit, crtso, _environ, __start #ifdef _MCRTSO .globl _monstartup, _moncontrol, __mcleanup #endif _MCRTSO .globl begtext, begdata, begbss, endtext, enddata, endbss .text __start: | expected by monitor() begtext: crtso: #ifdef _MCRTSO | start profile monitor push endtext push begtext call _monstartup add sp,*4 #endif _MCRTSO mov bx,sp mov cx,(bx) add bx,*2 mov ax,cx inc ax shl ax,#1 | shift logical left add ax,bx mov _environ,ax | save envp in environ push ax | push environ push bx | push argv push cx | push argc call _main add sp,*6 #ifdef _MCRTSO | This should normally be in __exit ?? | mov (sp),#0 | dec sp | dec sp mov bx,#0 push bx call _moncontrol add sp,*2 call __mcleanup #endif _MCRTSO push ax | push exit status call _exit _lbl: j _lbl #ifdef _MCRTSO .globl _mcount, _procentry, _procexit _procentry: mov bx,sp | move.l 4(sp),-(sp) mov ax,2(bx) pop bx | move.l (sp),a0 | callees address push bx mov cx,2(bp) | move.l 4(a6),a1 | callers address push ax push bx | move.l a0,-(sp) push cx | move.l a1,-(sp) call _mcount | mcount(from_pc, to_pc, arc_ptr) add sp,*6 _procexit: ret #endif _MCRTSO .data begdata: _environ: .word 0 .bss begbss: ======================================================================== Many thanks - Will ----------------------------------------------------------------------- "You think that your career | Will Rose will suffer if Dr. Kenworthy | learns you have the poisoned | UUCP:{nosc ucsd hplabs!hp-sdd}!crash!pnet01!c corpse of our fiancee in the | ARPA:crash!pnet01!cwr@nosc.mil ice box?" | INET:cwr@pnet01.cts.com Evelyn Waugh, "The Loved One" | UUCP: {nosc ucsd hplabs!hp-sdd}!crash!pnet01!cwr ARPA: crash!pnet01!cwr@nosc.mil INET: cwr@pnet01.cts.com
tgcpwd@rwc.urc.tue.nl (Wim van Dorst) (03/12/91)
In article <7934@crash.cts.com> cwr@pnet01.cts.com (Will Rose) writes: >I've been looking at the profil() call stuff recently posted by Kai-Uwe Bloom >for the ST, and trying to port it to the PC. (His revised scheduler, posted >at the same time, is a trivial change and an enormous improvement in >performance). I am interested in a good performance increase, but not in the whole package of profil() and others, good as it probably is. Could anyone (Kai-Uwe, Will) please post the trivial change mentioned above, e.g., in a cdiff file for Minix 1.5.10 PC, so that I won't have to study the whole posting by Kai-Uwe to find it? A textual description of "change that line in kernel/duck.[cx] to 'foo=bar;'" will do fine too. Many thanks in advance, met vriendelijke groeten, Wim 'Blue Baron' van Dorst -- --------------------------------------------------------------------- Blue Baron = Wim van Dorst, Voice (+31) 074-443937, (+31) 02152-42319 (-: baron@wiesje.hobby.nl tgcpwd@urc.tue.nl :-) ---------------------------------------------------------------------
vickde@vicstoy.UUCP (Vick De Giorgio) (03/14/91)
In article <475@rc6.urc.tue.nl> baron@wiesje.hobby.nl writes: > >I am interested in a good performance increase, but not in the whole >package of profil() and others, good as it probably is. Could anyone >(Kai-Uwe, Will) please post the trivial change mentioned above, e.g., >in a cdiff file for Minix 1.5.10 PC, so that I won't have to study >the whole posting by Kai-Uwe to find it? A textual description of >"change that line in kernel/duck.[cx] to 'foo=bar;'" will do fine too. > I am _also_ interested in only installing the scheduler changes into PC 1.5.10 Minix. If it's possible to easily break it out, would some- one please do so and post it? Thanks! =V= -- Vick De Giorgio - vickde@vicstoy.UUCP UUCP - uunet!tarpit!bilver!vicstoy!vickde - The Philosopher's Stone Unix BBS, Orlando FL - (407) 299-3661 1200/2400 24 hours 8N1