#milkymist IRC log for Sunday, 2011-07-31

GitHub31[extras-m1] yizhangsh pushed 2 new commits to master: https://github.com/milkymist/extras-m1/compare/59e8a82...6fcaa2109:17
GitHub31[extras-m1/master] removed distrabutors list. added Notes block - Yi Zhang09:17
GitHub31[extras-m1/master] adjust manufacturer position - Yi Zhang09:17
AlarmCompiling the program using the VGA output (Elektor) me miseries:10:07
GitHub176[extras-m1] shiyele pushed 1 new commit to master: https://github.com/milkymist/extras-m1/commit/e16377e0c57ea3ef5795b60859187d45bae7fa9612:18
GitHub176[extras-m1/master] added engraved logo file - Wolfgang Spraul12:18
GitHub13[extras-m1] shiyele pushed 1 new commit to master: https://github.com/milkymist/extras-m1/commit/d90414bb91a64dac9bf572e842e8cc58acedbcfe12:56
GitHub13[extras-m1/master] updated assembly manual from roh - Wolfgang Spraul12:56
Alarmlekernel: made progress but I still have an error in the compilation of the program Elektor13:57
kristianpaullekernel: in verilog can i declare a module twice in differnt part of the code?, but not the same signal of course14:29
kristianpaulmy point is that i want to debug some signal that are not directly wired to the top module14:29
kristianpaulso i wanted to avoid that, if posible..14:29
kristianpaulsorry if in mind you with my  silly question, but this si due your great expertice in the field :-)14:30
kristianpauland yes, i'm aware of bitscope, i wanted to avoid, learn to use and the posible mess later implementing it..14:31
AlarmI am reassured I am not alone to ask silly questions;)14:34
kristianpaulsure go ahed Alarm !14:39
kristianpaullekernel is a bit rude (in the good sense)14:40
kristianpaulbut is okay, he is busy working hard on improvement the Milkymist SoC14:40
kristianpaulso that is important :)14:40
Action: kristianpaul read about package signal14:41
GitHub99[extras-m1] yizhangsh pushed 2 new commits to master: https://github.com/milkymist/extras-m1/compare/d90414b...f54abb615:11
GitHub99[extras-m1/master] removed some unnecessary punctuations - Yi Zhang15:11
GitHub99[extras-m1/master] added some punctuations - Yi Zhang15:11
GitHub154[extras-m1] yizhangsh pushed 1 new commit to master: https://github.com/milkymist/extras-m1/commit/a6581d04d7d14e217f66ee554fdbb2f7642b3c9615:15
GitHub154[extras-m1/master] changed Save as PDF -> Viewer setting to single page - Yi Zhang15:15
mwallemmap2 syscall is broken16:19
mwallefor some reason my gcc optimizes the syscall number away..16:21
mwallelarsc: is openwrt with the latest kernel working for you?16:25
mwallelarsc: could you please post an objdump of libc/sysdeps/linux/common/mmap.o16:36
mwallefrom uclibc16:36
mwallemh gcc --version?16:39
larschm, for some reason that is sys_mmap and not sys_mmap2...16:40
mwalleahh :)16:41
mwalleok i guess after you are using mmap2 theres no mvi r8, <syscall no>16:42
larscyes, gone16:46
larscthe shift seems to confuse gcc17:06
larscuninlining __syscall_mmap2 would solve the issue teporary17:10
kristianpaulnothing more permanent than a temporary solution? :)17:16
larsca proper solution is to fix gcc17:17
larscmoving LOAD_ARGS at the top of the function also seems to fix it17:23
mwallethe dead code elimination pass removes the assignment17:46
larsci think doing the same as what arm does should do the trick17:48
larscfirst evaluate all parameters, then load them into the right registers17:49
mwallelarsc: mh? where?17:51
larscsomething like this: http://pastebin.com/5idtavLE17:53
larscseems to work17:55
mwallewith LOAD_ARGS behind _scno?17:55
mwalle"larsc | moving LOAD_ARGS at the top of the function also seems to fix it" << wasnt that already a workaround?17:56
larscyes, that works for mmap17:57
mwallewhat happens if you put your version of LOAD_ARGS behind _scno, like it was before?17:58
mwalleyes, it is working?17:58
larscit's like before17:58
larscthe assigment of r8 is dropped17:59
mwalleso, then whats does http://pastebin.com/5idtavLE fix? :)18:00
larscif for example offset was not the last parameter to the systemcall we would loose the assigments of the registers which come after it as well18:01
mwallebut thats only a workaround isn't it?18:03
larscand it works18:03
mwallei dont see what should be wrong with the original code18:03
larscthe problem here apparently is that if we do a function call after assigning the register the contents of that register is lost18:04
mwallewhere are we doing a function call?18:05
larscshift is a function call18:05
mwalleare we still talking about the mmap syscall function? :)18:06
larscoffset >> 12 evaluates to __shri(offset, 12) or whatever that function is called18:06
larscbecause we compile without barrel shifters enabled18:07
mwallebut thats outside the __syscall_mmap2 function18:08
larscone would think so18:09
mwalleso gcc forgets about the input variables after its inlining the functions?!18:12
larscit's probably some strange optimisation side effect18:15
mwalleboth -fno-dce or -fkeep-inline-functions are working (with the original code), so i would consider this another lm32 gcc bug18:15
larscit's probably not even lm32 specific18:16
mwallei bet it is :)18:18
mwallearm keeps it18:30
larscx86 too18:31
larscstuff get's properly reordered, so that the register is loaded after the function call18:34
mwallelarsc: ok so the bug is that the soft shift is not called before the actual function20:12
mwalleand of course the r8 assignment is optimized away, because its a caller saved register20:13
mwallei bet if that function call would be a 'normal' one (that is not a replacement for an opcode) it works as expected20:14
larsci think the bug is that gcc somehow forgets that _sco is in the asm instructions operand list20:15
mwalleno if you look at the assemebler output20:15
mwalle        addi     r8, r0, 22220:15
mwalle        or       r1, r6, r020:15
mwalle        addi     r2, r0, 1220:15
mwalle        calli    __ashrsi320:15
mwaller8 may not be valid anymore after calli20:16
larsci know20:16
larscbut gcc should restore it20:16
larscput it on the stack or whatever during the function call20:16
mwalle        addi     r2, r0, 1220:17
mwalle        calli    __ashrsi320:17
mwalle        addi     r8, r0, 22220:17
mwalle        or       r6, r1, r020:17
mwalle        or       r5, r15, r020:17
mwalleif you use return __syscall_mmap2(addr, len, prot, flags, fd, __ashrsi3(offset, 12));20:17
mwalleso it must somewhere in the arch code that translate >> to sri or that function call20:18
larscso it probably assumes during the optimization phase that >> is a instruction20:18
mwallelets have a look at the wonderful gcc code :)20:19
mwallewho understands that machine description language? :)20:20
mwalleantgreen: ? :)20:20
larsci wonder if the same thing would happen if _sco would be used as a parameter for a normal function call20:21
mwallemh, my microblaze toolchain fails too..20:39
larscwith the same problem?20:48
mwalleso either this is a general problem with libgcc calls or both implementations are crap :)20:53
larschm, i wonder what keywords to search for in the gcc bugtracker20:55
mwalledunno, i dont even know how that mechanism works.. when is a call to libgcc emitted..21:01
larsci would assume it is the default21:03
mwallethere are three methods to replace a shift, call to libgcc helper, barrelshifter or multiple shift by one21:04
larschm, the documenation doesn't look to bad: gcc/doc/gccint.info21:08
Action: mwalle wonders if we are violating some internal gcc assumptions21:09
mwallelarsc: ok avr has the same problem21:50
mwallei'm not sure if we are violating some constraints ..21:50
mwallen the above example, beware that a register that is call-clobbered by the target ABI will be overwritten by any function call in the assignment, including library calls for arithmetic operators. Also a register may be clobbered when generating some operations, like variable shift, memory copy or memory move on x86. Assuming it is a call-clobbered register, this may happen to r0 above by the assignment22:04
mwalleto p2. If you have to use such a register, use temporary variables for expressions between the register assignment and use22:04
larscso the fix is the right thing to do22:07
mwallelarsc: yes, but i think we have to evaluate all arguments and then assign them to the register variables22:09
mwalleah arm does that :)22:10
mwalleoh and your proposed fix too, i missed the fact, that LOAD_ARGS is in the middle22:11
mwallelarsc: so do you commit a patch?22:11
GitHub171[uclibc-lm32] larsclausen pushed 1 new commit to master: https://github.com/milkymist/uclibc-lm32/commit/df1075d1adc5dbc53e7746b0d80ade0b78b4deeb22:21
GitHub171[uclibc-lm32/master] lm32: Evaluate syscall all arguments before loading them into registers - Lars-Peter Clausen22:21
larscbtw. should we add memory and cc to the syscall clobber list?22:24
mwallecondition codes?22:26
mwallelm32 doesnt have condition flags, but memory should be ok22:27
GitHub125[uclibc-lm32] mwalle pushed 1 new commit to master: https://github.com/milkymist/uclibc-lm32/commit/defb191aab7711218035a506ec5cd8bb87c05c5522:32
GitHub125[uclibc-lm32/master] lm32: update defconfig - Michael Walle22:32
mwallelol, next problem.. (sometimes?!) there are writes to the lowest page, after init is started22:43
mwallegn8 :)22:58
--- Mon Aug 1 201100:00

Generated by irclog2html.py 2.9.2 by Marius Gedminas - find it at mg.pov.lt!