* Re: System call select on R4600
@ 2004-08-25 2:18 Macleod
2004-08-25 8:00 ` Ralf Baechle
0 siblings, 1 reply; 4+ messages in thread
From: Macleod @ 2004-08-25 2:18 UTC (permalink / raw)
To: linux-mips
After trace system, found this problem is from scall_o32.S
line 161 in 2.4.26 kernel.
bltz t0, bad_stack # -> sp is bad
If stack address larger than 0x7fffffff, branch will take,
and that's why I got "-4142" errno on select system call
even parameters in stack are correct. I tried to remove this
line and seems "select" works fine.
-----Original message-----
From:Ralf Baechle <ralf@linux-mips.org>
To:Macleod <macleod@mail2000.com.tw>
Cc:linux-mips@linux-mips.org
Date:Sun, 22 Aug 2004 14:14:36 +0200
Subject:Re: System call select on R4600
On Sun, Aug 22, 2004 at 11:54:10AM +0800, Macleod wrote:
> My problem is "select" system call always return -1
> and errno is -4142, but sys_select has never been called.
> Think, it has some problem on handling system call.
> Because if I change SYS(sys_select, 5) to 4 arguments,
> sys_select will be executed.
> Thanks!
This is a bug which was fixed a while ago. I assume your application
is picking up a bad definition from an old kernel header package or so.
Still doing syscalls directly is a fragily; better avoid and use your
libc's select(3).
Ralf
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: System call select on R4600
2004-08-25 2:18 System call select on R4600 Macleod
@ 2004-08-25 8:00 ` Ralf Baechle
0 siblings, 0 replies; 4+ messages in thread
From: Ralf Baechle @ 2004-08-25 8:00 UTC (permalink / raw)
To: Macleod; +Cc: linux-mips
On Wed, Aug 25, 2004 at 10:18:04AM +0800, Macleod wrote:
> After trace system, found this problem is from scall_o32.S
> line 161 in 2.4.26 kernel.
>
> bltz t0, bad_stack # -> sp is bad
>
> If stack address larger than 0x7fffffff, branch will take,
> and that's why I got "-4142" errno on select system call
> even parameters in stack are correct. I tried to remove this
> line and seems "select" works fine.
Oh yes, I forgot on this one :-) It's intentional; making all syscalls
work from kernel mode would add some overhead. Possible solutions:
- move to 64-bit kernels; the 64-bit syscall interface happens to support
upto 8 arguments for syscalls from kernel mode.
- move your module or parts of it to userspace. Something that's using
select suspiciously looks like something that shouldn't be in the kernel.
- use the proper kernel APIs. Kernel programming isn't user space
programming.
Ralf
^ permalink raw reply [flat|nested] 4+ messages in thread
* System call select on R4600
@ 2004-08-22 3:54 Macleod
2004-08-22 12:14 ` Ralf Baechle
0 siblings, 1 reply; 4+ messages in thread
From: Macleod @ 2004-08-22 3:54 UTC (permalink / raw)
To: linux-mips
My problem is "select" system call always return -1
and errno is -4142, but sys_select has never been called.
Think, it has some problem on handling system call.
Because if I change SYS(sys_select, 5) to 4 arguments,
sys_select will be executed.
Thanks!
Compiler: gcc-3.3.3
Kernel: mips-linux-2.4.25/mips-linux-2.4.26
Compile parameter:
-Wno-inline \
-Werror-implicit-function-declarations \
-fno-PIC \
-fno-common \
-mno-abicalls \
-mlong-calls \
-march=r4600 \
-mtune=r4600 \
-G 0 \
-Wa,--trap
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: System call select on R4600
2004-08-22 3:54 Macleod
@ 2004-08-22 12:14 ` Ralf Baechle
0 siblings, 0 replies; 4+ messages in thread
From: Ralf Baechle @ 2004-08-22 12:14 UTC (permalink / raw)
To: Macleod; +Cc: linux-mips
On Sun, Aug 22, 2004 at 11:54:10AM +0800, Macleod wrote:
> My problem is "select" system call always return -1
> and errno is -4142, but sys_select has never been called.
> Think, it has some problem on handling system call.
> Because if I change SYS(sys_select, 5) to 4 arguments,
> sys_select will be executed.
> Thanks!
This is a bug which was fixed a while ago. I assume your application
is picking up a bad definition from an old kernel header package or so.
Still doing syscalls directly is a fragily; better avoid and use your
libc's select(3).
Ralf
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-08-25 8:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-25 2:18 System call select on R4600 Macleod
2004-08-25 8:00 ` Ralf Baechle
-- strict thread matches above, loose matches on Subject: below --
2004-08-22 3:54 Macleod
2004-08-22 12:14 ` Ralf Baechle
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.