Subject:
|
Re: RCX "locking up" when trying to use dll
|
Newsgroups:
|
lugnet.robotics.rcx.legos
|
Date:
|
Tue, 11 Jan 2000 20:16:33 GMT
|
Viewed:
|
1386 times
|
| |
| |
In lugnet.robotics.rcx.legos, Markus L. Noga writes:
> Sounds like a problem with saving and restoring registers in
> lnp_logical_handler. Could you verify in the disassembly if all
> registers are being saved and restored?
It's actually in the library. I just found it. Here is a disassembly of a
correct memcpy.o, as built by egcs-1.1.2:
00000000 <_memcpy>:
0: 0d 13 mov.w r1,r3
2: 09 23 add.w r2,r3
4: 1d 13 cmp.w r1,r3
6: 47 00 beq .0 (8)
8: 6c 1a mov.b @r1+,r2l
a: 68 8a mov.b r2l,@e0
c: 0b 00 adds #0x1,er0
e: 40 00 bra .0 (10)
10: 54 70 rts
Here is the bad memcpy.o, from gcc-2.95.2:
00000000 <_memcpy>:
0: 0d 13 mov.w r1,r3
2: 09 23 add.w r2,r3
4: 1d 13 cmp.w r1,r3
6: 47 00 beq .0 (8)
8: 6c 19 mov.b @r1+,r1l
a: 68 89 mov.b r1l,@e0
c: 0b 00 adds #0x1,er0
e: 40 00 bra .0 (10)
10: 54 70 rts
Notice offset 8, which is 'src = *src++', so on the first loop iteration it
clobbers the src pointer. In the correct version it uses a temporary register
(r2) to hold that.
If you browse a more complete disassembly you can see that the global register
allocator has been changed, but this appears to be the only case where it
breaks. If you build and entire kernel with gcc-2.95.2, then replace memcpy.o
with one built by egcs-1.1.2 you get a working kernel.
I'll work on the gcc bug report.
--Ben
|
|
Message has 2 Replies: | | RE: RCX "locking up" when trying to use dll
|
| (...) <Snipped disassembly showing exactly what the bug is...> WOW! Good catch Ben! I have recently been looking through some disassembly on a totally unrelated topic and have found a bug in an unnamed commercial compiler. But of course I had a (...) (25 years ago, 11-Jan-00, to lugnet.robotics.rcx.legos)
| | | Re: RCX "locking up" when trying to use dll
|
| (...) Actually I won't, since I just read memcpy.c and I see it's an __asm__ macro. I don't know if that's a valid __asm__ or not. In this case, if it's causing legOS pain, memcpy.c should just be replaced by memcpy.s with the correct assembly (...) (25 years ago, 11-Jan-00, to lugnet.robotics.rcx.legos)
|
Message is in Reply To:
| | Re: RCX "locking up" when trying to use dll
|
| Ben Jackson schrieb: (...) Some parts of legOS, especially the interrupt handlers, are less portable than they should be - they use some assembly, or my attribute((rcx_interrupt)) which I haven't verified with 2.95.2. (...) Sounds like a problem (...) (25 years ago, 11-Jan-00, to lugnet.robotics.rcx.legos)
|
11 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|