From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <13426df10712180938i72e63d86qcedfa551261ce09c@mail.gmail.com> Date: Tue, 18 Dec 2007 09:38:43 -0800 From: "ron minnich" To: "Fans of the OS Plan 9 from Bell Labs" <9fans@cse.psu.edu> Subject: Re: [9fans] a question on APE In-Reply-To: <47677CAF.4080009@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <13426df10712171736i60f181aax4fdf2cf57594fa87@mail.gmail.com> <47677773.30607@gmx.de> <47677CAF.4080009@gmx.de> Topicbox-Message-UUID: 1c50e81a-ead3-11e9-9d60-3106f5b1d025 On Dec 17, 2007 11:54 PM, Kernel Panic wrote: > Ahh... just looked at the code... > Ok, as i expected... recv() calls a different read() from > /sys/src/libc/9sys/read.c. It will all work if > recv() would call the thing from this one: > /sys/src/ape/lib/ap/plan9/read.c. I'm not seeing that. I would be happy if you are right but I can't confirm it. I run acid on the binary: recv 0x000cd7b6 SUBL $0x10,SP recv+0x3 0x000cd7b9 MOVL flags+0xc(FP),AX recv+0x7 0x000cd7bd ANDL $0x1,AX recv+0xa 0x000cd7c0 CMPL AX,$0x0 recv+0xd 0x000cd7c3 JEQ recv+0x22(SB) recv+0xf 0x000cd7c5 MOVL $0x29,errno(SB) recv+0x19 0x000cd7cf MOVL $0xffffffff,AX recv+0x1e 0x000cd7d4 ADDL $0x10,SP recv+0x21 0x000cd7d7 RET recv+0x22 0x000cd7d8 MOVL fd+0x0(FP),CX recv+0x26 0x000cd7dc MOVL CX,0x0(SP) recv+0x29 0x000cd7df MOVL a+0x4(FP),CX recv+0x2d 0x000cd7e3 MOVL CX,0x4(SP) recv+0x31 0x000cd7e7 MOVL n+0x8(FP),CX recv+0x35 0x000cd7eb MOVL CX,0x8(SP) recv+0x39 0x000cd7ef CALL read(SB) recv+0x3e 0x000cd7f4 ADDL $0x10,SP recv+0x41 0x000cd7f7 RET so it calls read. Read is this: read 0x000c3834 SUBL $0x28,SP read+0x3 0x000c3837 MOVL nbytes+0x8(FP),DI read+0x7 0x000c383b MOVL buf+0x4(FP),SI read+0xb 0x000c383f MOVL d+0x0(FP),BX read+0xf 0x000c3843 CMPL BX,$0x0 read+0x12 0x000c3846 JLT read+0x19(SB) read+0x14 0x000c3848 CMPL BX,$0x60 read+0x17 0x000c384b JLT read+0x2c(SB) read+0x19 0x000c384d MOVL $0x4,errno(SB) read+0x23 0x000c3857 MOVL $0xffffffff,AX read+0x28 0x000c385c ADDL $0x28,SP read+0x2b 0x000c385f RET read+0x2c 0x000c3860 LEAL 0x0(BX)(BX*4),CX read+0x2f 0x000c3863 SHLL $0x2,CX read+0x32 0x000c3866 LEAL _fdinfo(SB)(CX*1),AX read+0x39 0x000c386d MOVL 0x0(AX),AX read+0x3b 0x000c386f ANDL $0x2,AX read+0x3e 0x000c3872 CMPL AX,$0x0 read+0x41 0x000c3875 JEQ read+0x19(SB) read+0x43 0x000c3877 CMPL DI,$0x0 read+0x46 0x000c387a JHI read+0x4e(SB) read+0x48 0x000c387c XORL AX,AX read+0x4a 0x000c387e ADDL $0x28,SP read+0x4d 0x000c3881 RET read+0x4e 0x000c3882 CMPL SI,$0x0 read+0x51 0x000c3885 JNE read+0x66(SB) read+0x53 0x000c3887 MOVL $0x9,errno(SB) read+0x5d 0x000c3891 MOVL $0xffffffff,AX read+0x62 0x000c3896 ADDL $0x28,SP read+0x65 0x000c3899 RET which is the ape version. There is only one read symbol in the binary, and it's a T. So I am not convinced the recv is calling the wrong thing. That said, I'm still going to change it in source to see what happens :-) ron