cancel
Showing results for 
Search instead for 
Did you mean: 

a question about kill_stub32

SOLVED
Go to solution
kaijile
Frequent Advisor

a question about kill_stub32

Dump of assembler code for function kill_stub32:
0x8b433c : ldw 4(%r26),%ret0
0x8b4340 : extrw,s %ret0,0,1,%ret0
0x8b4344 : stw %ret0,0(%r26)
0x8b4348 : ldw 0xc(%r26),%ret0
0x8b434c : extrw,s %ret0,0,1,%ret0
0x8b4350 : ldil L'0x1d1000,%r31
0x8b4354 : be 0x688(%sr4,%r31)
0x8b4358 : stw %ret0,8(%r26)

why kill_stub32 have such code before call kill function?
14 REPLIES
Dennis Handly
Acclaimed Contributor
Solution

Re: a question about kill_stub32

It looks like it is obviously sign extending the values at offset 4 and 12, to 64 bit.
Laurent Menase
Honored Contributor

Re: a question about kill_stub32

you are in the kernel.
That stub get long argument of kill and change them to int.

f(x)
struct {
union { int v1; int v2 } i ;
union { long v1; long v2 } l ;
}*x;
{
x->i.v1=x->l.v1;
x->i.v2=x->l.v2;
kill(x);
}
Laurent Menase
Honored Contributor

Re: a question about kill_stub32

oops,
in fact it extends the sign of the lower 32 bits to the 64 bits.



Laurent Menase
Honored Contributor

Re: a question about kill_stub32

f(x)
struct {
union { int i[2]; long l } v1,v2 ;
}*x;
{
x->vl.l=x->v1.i[1];
x->v2.l=x->v2.i[1];
kill(x);
}
Dennis Handly
Acclaimed Contributor

Re: a question about kill_stub32

>Laurent: in fact it extends the sign of the lower 32 bits to the 64 bits.

Didn't I say that? :-)
Laurent Menase
Honored Contributor

Re: a question about kill_stub32

Yes you said it. I just rectified MY error.
kaijile
Frequent Advisor

Re: a question about kill_stub32

what's the means assembler code
extrw,s %ret0,0,1,%ret0?
Laurent Menase
Honored Contributor

Re: a question about kill_stub32

what's the means assembler code
extrw,s %ret0,0,1,%ret0?

It is an signed extract word on the left most bit (pos 0 len 1)of ret0 to ret0 so if it is a 1 it set the all word to 1 because it is signed
and if it is a 0 it reset ret0 to 0.
so it propagate the sign of ret0 to ret0



kaijile
Frequent Advisor

Re: a question about kill_stub32

kill_stub32() function have two parameters.

is kill() function one parameter?
Laurent Menase
Honored Contributor

Re: a question about kill_stub32

kill_stub32() and kill() as 1 parameter.

a pointer to 2 long , for kill_stub32, only the 32 bit lower part is initialized.

else the dynamic parameter facility of sysent_* API is made for that.

kaijile
Frequent Advisor

Re: a question about kill_stub32

Are all system call functions (such as open_stub32, bind_stub32)in sysent array as 1 parameter?
Laurent Menase
Honored Contributor

Re: a question about kill_stub32

yes, a pointer to the uarea where the calling params are stored.
kaijile
Frequent Advisor

Re: a question about kill_stub32

thanks Laurent Menase
kaijile
Frequent Advisor

Re: a question about kill_stub32

Close thread