Subject: Profiling for the 532
To: 532bsd Mailing List <port-pc532@sun-lamp.cs.berkeley.edu>
From: Matthias Pfaller <leo@marco.de>
List: port-pc532
Date: 07/08/1994 15:05:03
Hi,
At the moment profiling does not work in 532bsd.
Since only a few lines were missing, I made the necessary changes.
First of all the following line in sys/arch/pc532/include/asm.h has to
be changed (this was my fault anyway...):
Change
#define MC2 addr 1b(pc),tos; bsr mcount
to
#define MC2 addr 1b(pc),r0; bsr mcount
In sys/arch/pc532/pc532/trap.c the comments around the calls to addupc
have to be removed.
The functions appended to this mail should go into locore.s.
That's all.
Matthias
ENTRY(fusword)
enter [r2],0
movd _curpcb(pc), r2
addr fusufault(pc), PCB_ONFAULT(r2)
movzwd 0(B_ARG0), r0
br fusu_ret
ENTRY(susword)
enter [r2],0
movqd 2, tos
movd B_ARG0, tos
bsr _check_user_write
adjspb -8
cmpqd 0, r0
bne fusufault
movd _curpcb(pc), r2
addr fusufault(pc), PCB_ONFAULT(r2)
movqd 0, r0
movw B_ARG1,0(B_ARG0)
br fusu_ret
/*
* update profiling information for the user
* addupc(pc, &u.u_prof, ticks)
*/
ENTRY(addupc)
movd 8(sp),r2 # get &u.u_prof
movd 4(sp),r0 # get user pc
subd PR_OFF(r2),r0
bcs 1f # if ((pc -= pr->pr_off) >= 0) {
movqd 0,tos
movd r0,tos
meid PR_SCALE(r2),tos # pc = (pr->pr_scale * (long long)pc)
movd 2(sp),r0 # >> 16;
cmpd tos,tos
andb -2,r0 # pc &= ~1;
cmpd r0,PR_SIZE(r2)
bge 1f # if (pc < pr->pr_size) {
addd PR_BASE(r2),r0 # pc += pr->pr_base;
movd r0,tos
bsr _fusword # d = fusword(pc);
movd tos,r1
cmpd -1,r0
beq 0f # if (d != -1) {
addw 12(sp),r0 # d += ticks;
movd r0,tos
movd r1,tos
bsr _susword
cmpd tos,tos
cmpqd 0,r0 # if (susword(pc, d) == 0)
beq 1f # return;
# }
0: movqd 0,PR_SCALE(8(sp)) # pr->pr_scale = 0;
# }
1: ret 0 # }
------------------------------------------------------------------------------