<GitHub31> [extras-m1] yizhangsh pushed 2 new commits to master: https://github.com/milkymist/extras-m1/compare/59e8a82...6fcaa21
<GitHub31> [extras-m1/master] removed distrabutors list. added Notes block - Yi Zhang
<GitHub31> [extras-m1/master] adjust manufacturer position - Yi Zhang
<Alarm> Compiling the program using the VGA output (Elektor) me miseries:
<Alarm> ;)
<GitHub176> [extras-m1] shiyele pushed 1 new commit to master: https://github.com/milkymist/extras-m1/commit/e16377e0c57ea3ef5795b60859187d45bae7fa96
<GitHub176> [extras-m1/master] added engraved logo file - Wolfgang Spraul
<GitHub13> [extras-m1] shiyele pushed 1 new commit to master: https://github.com/milkymist/extras-m1/commit/d90414bb91a64dac9bf572e842e8cc58acedbcfe
<GitHub13> [extras-m1/master] updated assembly manual from roh - Wolfgang Spraul
<Alarm> lekernel: made progress but I still have an error in the compilation of the program Elektor
<kristianpaul> lekernel: in verilog can i declare a module twice in differnt part of the code?, but not the same signal of course
<kristianpaul> my point is that i want to debug some signal that are not directly wired to the top module
<kristianpaul> so i wanted to avoid that, if posible..
<kristianpaul> sorry if in mind you with my  silly question, but this si due your great expertice in the field :-)
<kristianpaul> and yes, i'm aware of bitscope, i wanted to avoid, learn to use and the posible mess later implementing it..
<Alarm> I am reassured I am not alone to ask silly questions;)
<kristianpaul> sure go ahed Alarm !
<kristianpaul> lekernel is a bit rude (in the good sense)
<kristianpaul> but is okay, he is busy working hard on improvement the Milkymist SoC
<kristianpaul> so that is important :)
<kristianpaul> read about package signal
<GitHub99> [extras-m1] yizhangsh pushed 2 new commits to master: https://github.com/milkymist/extras-m1/compare/d90414b...f54abb6
<GitHub99> [extras-m1/master] removed some unnecessary punctuations - Yi Zhang
<GitHub99> [extras-m1/master] added some punctuations - Yi Zhang
<GitHub154> [extras-m1] yizhangsh pushed 1 new commit to master: https://github.com/milkymist/extras-m1/commit/a6581d04d7d14e217f66ee554fdbb2f7642b3c96
<GitHub154> [extras-m1/master] changed Save as PDF -> Viewer setting to single page - Yi Zhang
<mwalle> argh...
<mwalle> mmap2 syscall is broken
<mwalle> for some reason my gcc optimizes the syscall number away..
<mwalle> larsc: is openwrt with the latest kernel working for you?
<larsc> yes
<mwalle> larsc: could you please post an objdump of libc/sysdeps/linux/common/mmap.o
<mwalle> from uclibc
<mwalle> mh gcc --version?
<larsc> hm, for some reason that is sys_mmap and not sys_mmap2...
<mwalle> ahh :)
<mwalle> ok i guess after you are using mmap2 theres no mvi r8, <syscall no>
<larsc> yes, gone
<larsc> the shift seems to confuse gcc
<larsc> uninlining __syscall_mmap2 would solve the issue teporary
<kristianpaul> nothing more permanent than a temporary solution? :)
<larsc> a proper solution is to fix gcc
<larsc> moving LOAD_ARGS at the top of the function also seems to fix it
<mwalle> the dead code elimination pass removes the assignment
<larsc> i think doing the same as what arm does should do the trick
<larsc> first evaluate all parameters, then load them into the right registers
<mwalle> larsc: mh? where?
<larsc> something like this: http://pastebin.com/5idtavLE
<larsc> seems to work
<mwalle> with LOAD_ARGS behind _scno?
<larsc> before
<mwalle> "larsc | moving LOAD_ARGS at the top of the function also seems to fix it" << wasnt that already a workaround?
<larsc> yes, that works for mmap
<mwalle> what happens if you put your version of LOAD_ARGS behind _scno, like it was before?
<larsc> yes
<mwalle> yes, it is working?
<larsc> it's like before
<larsc> the assigment of r8 is dropped
<mwalle> so, then whats does http://pastebin.com/5idtavLE fix? :)
<larsc> if for example offset was not the last parameter to the systemcall we would loose the assigments of the registers which come after it as well
<mwalle> but thats only a workaround isn't it?
<larsc> maybe
<larsc> and it works
<mwalle> i dont see what should be wrong with the original code
<larsc> the problem here apparently is that if we do a function call after assigning the register the contents of that register is lost
<mwalle> where are we doing a function call?
<larsc> shift is a function call
<mwalle> are we still talking about the mmap syscall function? :)
<larsc> yes
<larsc> offset >> 12 evaluates to __shri(offset, 12) or whatever that function is called
<larsc> because we compile without barrel shifters enabled
<mwalle> but thats outside the __syscall_mmap2 function
<larsc> one would think so
<mwalle> so gcc forgets about the input variables after its inlining the functions?!
<larsc> it's probably some strange optimisation side effect
<mwalle> both -fno-dce or -fkeep-inline-functions are working (with the original code), so i would consider this another lm32 gcc bug
<larsc> it's probably not even lm32 specific
<mwalle> i bet it is :)
<mwalle> arm keeps it
<larsc> x86 too
<larsc> stuff get's properly reordered, so that the register is loaded after the function call
<mwalle> larsc: ok so the bug is that the soft shift is not called before the actual function
<mwalle> and of course the r8 assignment is optimized away, because its a caller saved register
<mwalle> i bet if that function call would be a 'normal' one (that is not a replacement for an opcode) it works as expected
<larsc> i think the bug is that gcc somehow forgets that _sco is in the asm instructions operand list
<mwalle> no if you look at the assemebler output
<mwalle>         addi     r8, r0, 222
<mwalle>         or       r1, r6, r0
<mwalle>         addi     r2, r0, 12
<mwalle>         calli    __ashrsi3
<mwalle> r8 may not be valid anymore after calli
<larsc> i know
<larsc> but gcc should restore it
<larsc> put it on the stack or whatever during the function call
<mwalle>         addi     r2, r0, 12
<mwalle>         calli    __ashrsi3
<mwalle>         addi     r8, r0, 222
<mwalle>         or       r6, r1, r0
<mwalle>         or       r5, r15, r0
<mwalle> if you use return __syscall_mmap2(addr, len, prot, flags, fd, __ashrsi3(offset, 12));
<larsc> hehe
<mwalle> so it must somewhere in the arch code that translate >> to sri or that function call
<larsc> so it probably assumes during the optimization phase that >> is a instruction
<mwalle> lets have a look at the wonderful gcc code :)
<mwalle> who understands that machine description language? :)
<mwalle> antgreen: ? :)
<larsc> i wonder if the same thing would happen if _sco would be used as a parameter for a normal function call
<mwalle> mh, my microblaze toolchain fails too..
<larsc> with the same problem?
<mwalle> yes
<mwalle> so either this is a general problem with libgcc calls or both implementations are crap :)
<larsc> hm, i wonder what keywords to search for in the gcc bugtracker
<mwalle> dunno, i dont even know how that mechanism works.. when is a call to libgcc emitted..
<larsc> i would assume it is the default
<mwalle> there are three methods to replace a shift, call to libgcc helper, barrelshifter or multiple shift by one
<larsc> hm, the documenation doesn't look to bad: gcc/doc/gccint.info
<mwalle> wonders if we are violating some internal gcc assumptions
<mumptai> moin
<mwalle> larsc: ok avr has the same problem
<mwalle> i'm not sure if we are violating some constraints ..
<mwalle> n 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 assignment
<mwalle> to p2. If you have to use such a register, use temporary variables for expressions between the register assignment and use
<larsc> so the fix is the right thing to do
<mwalle> larsc: yes, but i think we have to evaluate all arguments and then assign them to the register variables
<mwalle> ah arm does that :)
<mwalle> oh and your proposed fix too, i missed the fact, that LOAD_ARGS is in the middle
<mwalle> larsc: so do you commit a patch?
<GitHub171> [uclibc-lm32] larsclausen pushed 1 new commit to master: https://github.com/milkymist/uclibc-lm32/commit/df1075d1adc5dbc53e7746b0d80ade0b78b4deeb
<GitHub171> [uclibc-lm32/master] lm32: Evaluate syscall all arguments before loading them into registers - Lars-Peter Clausen
<larsc> btw. should we add memory and cc to the syscall clobber list?
<mwalle> cc?
<mwalle> condition codes?
<mwalle> lm32 doesnt have condition flags, but memory should be ok
<GitHub125> [uclibc-lm32] mwalle pushed 1 new commit to master: https://github.com/milkymist/uclibc-lm32/commit/defb191aab7711218035a506ec5cd8bb87c05c55
<GitHub125> [uclibc-lm32/master] lm32: update defconfig - Michael Walle
<mwalle> lol, next problem.. (sometimes?!) there are writes to the lowest page, after init is started
<mwalle> gn8 :)