--- Log opened Wed Aug 06 00:00:52 2014 | ||
poke53282 | Ok, it is mentioned in the discussions. | 00:13 |
---|---|---|
poke53282 | Hmm, not sure if all points mentioned are valid. | 00:19 |
poke53282 | or fixable | 00:20 |
mor1kx | [mor1kx] skristiansson pushed 1 new commit to master: https://github.com/openrisc/mor1kx/commit/3699dfb26c25d830fb3e55a299ab29cb2e36fbc3 | 05:32 |
mor1kx | mor1kx/master 3699dfb Stefan Kristiansson: cappuccino: move reading of rf port A to decode... | 05:32 |
poke53282 | stekern: I start to like musl | 05:33 |
poke53282 | But the number one distribution "sabotage" for musl is a little bit crazy. | 05:37 |
poke53282 | every program has its own /opt/ folder and everything else is symlinked | 05:38 |
poke53282 | "/usr" is symlinked to "." | 05:38 |
stekern | I haven't looked closer at sabotage, and not alpine linux neither, which is another distro that use musl | 05:41 |
poke53282 | It's just funny that it works this way | 05:43 |
poke53282 | sabotage supports cross compiling with musl-cross | 05:44 |
poke53282 | unfortunately it uses 2 year old packages. | 05:45 |
stekern | yeah, looking at them both, sabotage is probably more suited for us/your purposes | 05:45 |
poke53282 | not sure, most packages are outdated and fail in one or the other way with the toolchain. | 06:03 |
poke53282 | But he uses a lot of nice tricks which will help me. | 06:04 |
stekern | ok, I mostly meant between alpine and sabotage. adapting musl to your existing build setup is of course viable too | 06:06 |
poke53282 | My built system is also bad. Would be nicer to use a existing one sabotage-linux seems to be nice in principle but requires some work. | 06:10 |
stekern | darn... looks like I broke something with that last mor1kx commit... | 07:30 |
Hesham | Hi, can I use immediate constraint from inline assembly? | 08:31 |
LoneTech | I'd imagine you could, for the relevant instructions. openrisc does not use the same mnemonic for add and add immediate, for instance | 08:32 |
Hesham | "i", "I" "n" constraints are now allowed | 08:32 |
Hesham | not | 08:33 |
Hesham | LoneTech: I mean from inline assembly, I want to use C variable value in an instruction like mfpsr from inline assembly | 08:59 |
ysionnea1 | your instruction uses immediate or register ? | 08:59 |
Hesham | lets say I want to use l.mfspr %0, r0, %1 | 09:01 |
LoneTech | Hesham: variables for immediates are a no-go; they must be constants | 09:01 |
Hesham | %0 is the C variable - destination | 09:02 |
LoneTech | compile time constants, even | 09:02 |
Hesham | %1 is a another variable passed by value to the callee function, I want to use this value as immediate | 09:02 |
LoneTech | the thing is, immediates are encoded in the instruction itself, which is in the code section, which is read only | 09:04 |
ysionnea1 | asm volatile("l.mfspr %0, r0, %1" : "=r" (C_dest_var) : "r"(C_source_var) : ); | 09:04 |
ysionnea1 | ah, %1 is an immediate | 09:04 |
LoneTech | self modifying code is possible if your code memory is writable, but causes further complications with things like instruction cache and pipeline | 09:04 |
ysionnea1 | then what I said is wrong | 09:04 |
ysionnea1 | it can be done I think I remember someone talking to me about this kind of situation | 09:05 |
LoneTech | so for mtspr/mfspr, use the base register if you want to select spr by variable | 09:05 |
ysionnea1 | you can write your function like f(int i) {} but you will have to call it with constants like f(4) and not f(var) | 09:06 |
ysionnea1 | and gcc will just create as many "f" functions as calls with different values | 09:06 |
Hesham | LoneTech: using the base register as constant right? | 09:06 |
ysionnea1 | I think it works if the function is inlined | 09:06 |
LoneTech | yes, inlining could make compile time constants visible across a function call | 09:07 |
Hesham | LoneTech: But what's the immediate constraints for OR1K case? I always got " error: impossible constraint in 'asm'" when trying using "i" or "I" | 09:08 |
Hesham | ysionnea1: It will be still passed by value in case of function calls, your method is right while using macros | 09:09 |
LoneTech | Hesham: specific instructions have immediates as specific operands, for instance l.mfspr rD, rS, imm copies spr rS|imm into rD | 09:09 |
ysionnea1 | it can work for functions as well, not just macro | 09:09 |
Hesham | But I do not wanna use macros, I need to use inline assembly | 09:10 |
LoneTech | Hesham: inline functions work similarly to macros, but allow full type declarations. | 09:10 |
Hesham | LoneTech: Yes I know that, I want to get the value of 0xffffff for example, and place it in the immediate part from inline assembly | 09:11 |
Hesham | http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html#ss5.2 | 09:11 |
LoneTech | huh? openrisc doesn't have that large immediates except for jump. | 09:12 |
Hesham | I know that's just an example | 09:13 |
Hesham | ysionnea1: inline functions will pass this variable by value and allocate a work on the stack for it right? | 09:13 |
Hesham | word* | 09:14 |
LoneTech | Hesham: no, inline functions are expanded in the calling function, and do not have their own stack frame, only compile time variable scope | 09:14 |
ysionnea1 | please try something like that http://pastebin.com/nja46ggi | 09:15 |
ysionnea1 | and call f(4) | 09:15 |
Hesham | And is it guaranteed that the compiler will always inline it? | 09:15 |
Hesham | OK I will check it | 09:15 |
ysionnea1 | well, not "r" but "I" or "i" | 09:15 |
ysionnea1 | I used the wrong constraint :) | 09:15 |
ysionnea1 | maybe better like that: http://pastebin.com/YN5FnphA | 09:17 |
LoneTech | Hesham: not exactly. inline hints the compiler to do it inline, and with static inline there's no reason to add a non-inline version. whether it actually does inline may depend on the compiler and its settings | 09:17 |
Hesham | ysionnea1: That's exactly what I am doing | 09:17 |
Hesham | When using "i" I got the error of : "error: impossible constraint in 'asm'" | 09:18 |
LoneTech | try chapter 6.39 of the gcc manual; GCC for instance does have an always_inline attribute | 09:18 |
Hesham | ysionnea1: I think that's something relates to binutils/gcc port ? | 09:18 |
ysionnea1 | I honestly didn't compile the code I just pasted | 09:19 |
ysionnea1 | but I'm sure what you want to do is possible, and with a function, I saw this kind of code used in the Linux port of OpenRISC | 09:19 |
Hesham | LoneTech: It's not advised to use compiler specific attributes in my project | 09:20 |
ysionnea1 | I think stekern was showing me that code | 09:20 |
Hesham | OK, thanks guys, I will have to try other methods and they how I can get it working. | 09:21 |
LoneTech | Hesham: then I have bad news - the entire constraint thing for asm is compiler specific (6.41, Extended Asm) | 09:21 |
Hesham | LoneTech: Yes, that's my guess. That's why I asked here hoping that someone would give a little hint about possible constraints for or1k (hoping there is immediate one) | 09:23 |
Hesham | I only use "=r" and "r" for now | 09:23 |
LoneTech | while I don't recall verifying what constraint tag GCC uses for the immediates, as I told you openrisc defines operand type in every instruction. it's fully contrained when you choose instruction | 09:24 |
LoneTech | and the compiler cannot move information from calls at runtime into immediates which are written at compile time | 09:25 |
LoneTech | I'd suggest looking at how other pieces of code (linux, ecos, newlib) handle the task | 09:26 |
Hesham | For newlib, I believe macros are used, and not inline assembly. | 09:27 |
ysionnea1 | http://lxr.free-electrons.com/source/arch/openrisc/include/asm/spr.h | 09:27 |
ysionnea1 | for spr they use macro and "K" | 09:27 |
ysionnea1 | but look at the function ... | 09:27 |
ysionnea1 | static inline, + "K" | 09:27 |
LoneTech | ysionnea1: thanks :) | 09:28 |
Hesham | ysionnea1: Thanks, that's should be the answer :) | 09:34 |
Hesham | However I still got the same error when using "K" -> impossible constraint in 'asm' | 09:37 |
stekern | Hesham: then you are probably not calling the function with a constant | 09:38 |
Hesham | stekern: Called with a constant | 09:41 |
Hesham | static inline uint32_t _OR1K_mfspr(uint32_t reg) | 09:41 |
Hesham | { | 09:41 |
Hesham | uint32_t spr_value; | 09:41 |
Hesham | 09:41 | |
Hesham | __asm__ __volatile__ ( | 09:41 |
Hesham | "l.mfspr %0, r0, %1" | 09:41 |
Hesham | : "=r" (spr_value) : "K" (reg) : "memory"); | 09:41 |
Hesham | 09:41 | |
Hesham | return spr_value; | 09:41 |
Hesham | } | 09:41 |
stekern | can you paste the code for the function and the code where you call it? | 09:41 |
stekern | ...in some paste service | 09:41 |
stekern | that looks correct, but how do you call it? | 09:43 |
blueCmd | that paste looked quite neat. usually someone writes something in the middle of the paste | 09:44 |
blueCmd | almost modern art | 09:44 |
Hesham | I think it will be clearer if I pushed the code to github and provide a link here, one sec.. | 09:47 |
Hesham | Here is the definition https://github.com/heshamelmatary/rtems-gsoc2014/blob/master/cpukit/score/cpu/or1k/rtems/score/or1k-utility.h | 09:53 |
Hesham | The error is not produced when calling it... | 09:53 |
Hesham | stekern: And here is where it's called https://github.com/heshamelmatary/rtems-gsoc2014/blob/master/cpukit/score/cpu/or1k/rtems/score/cpu.h | 09:54 |
Hesham | In the or1k_interrupt_disable function | 09:54 |
Hesham | An earlier warning at line 86 is: warning: asm operand 1 probably doesn't match constraints | 09:56 |
Hesham | in or1k-utility.h file | 09:56 |
stekern | yes, but isn't it about the mtspr it complains, not the mfspr? | 09:59 |
stekern | you have the args the wrong way around | 10:00 |
stekern | reg should be constant and value in a register | 10:00 |
stekern | and you there's no output from mtspr, so you don't need to use the =r constraint | 10:01 |
Hesham | stekern: Fixed, It's for _OR1K_mfspr where I got the error | 10:02 |
Hesham | Please refresh | 10:02 |
Hesham | "rtems/score/or1k-utility.h:86:4: error: impossible constraint in 'asm" | 10:05 |
stekern | not that I think it's related, but why do you have a memory constraint in them? | 10:07 |
Hesham | I got the error from the _OR1K_mfspr, when I replace "K" and put a "17" constant value instead of %1, the error goes away | 10:08 |
Hesham | the "memory" constraint is not the problem | 10:10 |
Hesham | I think inline assembly does not recognize the "K" constraints | 10:11 |
stekern | yeah, I didn't think it was. | 10:11 |
stekern | well, it does.... | 10:11 |
stekern | and the code in Linux works | 10:12 |
stekern | are you compiling it without optimisations or something? | 10:13 |
Hesham | I tried a bare-metal application and compiled it with "K" constraint with or1k-elf-gcc and it works | 10:16 |
stekern | you can of course use the register instead of the immediate too | 10:17 |
Hesham | The value of the register ? | 10:17 |
Hesham | How? | 10:18 |
stekern | __asm__ __volatile__ ("l.mfspr %0,%1,0" : "=r" (value) : "r" (reg)); | 10:19 |
Hesham | stekern: Feeling dump :) I miss that | 10:22 |
Hesham | It now compiles fine | 10:22 |
stekern | but I still wonder why it didn't work for you with the "K" constraint | 10:24 |
Hesham1 | Thanks stekern | 10:26 |
-!- Hesham1 is now known as Hesham | 10:27 | |
juliusb | Hi all! | 11:52 |
juliusb | 2 things | 11:52 |
blueCmd | juliusb: hello | 11:53 |
juliusb | 1: it looks like there's another open source Verilog simulator now available, although not quite your usual open source project, but apparently it's pretty capable! http://www.tachyon-da.com/ | 11:53 |
juliusb | I read this article: https://www.semiwiki.com/forum/content/3737-open-source-verilog.html which I think the author doesn't quite understand why you would open source something | 11:53 |
juliusb | and second thing | 11:53 |
juliusb | http://lowrisc.org | 11:54 |
juliusb | Basically a team at Cambridge are going to build a full on proper open source SoC | 11:54 |
juliusb | based on the RISC-V processor designs coming out of Berkeley | 11:54 |
blueCmd | juliusb: yes, you were on hackernews yesterday with that lowrisc thing | 11:54 |
juliusb | They've asked me to give them advice on various things | 11:54 |
juliusb | which is fun, although basically so far all I've done is drink beer with them :) | 11:55 |
juliusb | But I think there might be room for an mor1kx in there, possibly | 11:55 |
juliusb | we'll see | 11:55 |
blueCmd | ooh. | 11:55 |
dalias | stekern, the reason hesham's code didn't work with "K" is that the expression is not a constant | 12:04 |
dalias | it may fold to a constant as an optimization. but it's not a constant expression. | 12:04 |
dalias | the way i usually handle this kind of constraint in inline asm is to give multiple options. e.g. for the syscall number on mips, i used "ir"(n) (immediate or register) and an instruction which would accept either. however this is hard to make work in the case at hand because the way they need to be used in the instruction mnemonic differs :/ | 12:07 |
stekern | dalias: yeah, I know. but I expect that the 'may fold' should happen in the code hesham pasted as long as optimization is turned on. | 12:11 |
stekern | that's why I asked if he's compiling with optimizations turned off | 12:11 |
stekern | ...if it's wise to rely on it, that's of course another question ;) | 12:11 |
dalias | my view is that any code that breaks under differences in optimization is a major bug | 12:12 |
dalias | (another big example is code that relies on tail call optimization in order not to overflow the stack) | 12:12 |
dalias | it's possible that the inlining doesn't happen at some -O levels other than 0, perhaps due to gcc mis-estimating the size cost of the asm block ? | 12:14 |
dalias | i have a ridiculous example on x86.... | 12:14 |
dalias | the function is: | 12:14 |
dalias | return c ? x>>24 | x>>8&0xff00 | x<<8&0xff0000 | x<<24 : x; | 12:14 |
dalias | (it's a conditional-bswap) | 12:15 |
dalias | gcc inlines the conditional branch, but instead of putting an inline bswap in the caller, it puts a call instruction in the caller, calling a two-instruction function that's just bswap and ret... | 12:16 |
dalias | and the call instruction is 5 bytes whereas the bswap is 2 bytes... | 12:16 |
dalias | obviously something went wrong in gcc's representation of size cost (this is at -Os) | 12:16 |
Stman | I have an urgent need for an orbd2a-ep4ce22 development kit, and OpenCores websites says it is no longer available ? Where can I buy this item quickly please ? | 12:18 |
Stman | Any help would be really welcome. | 12:18 |
Stman | Anyone with a reference from an equivalent development board ? | 12:18 |
stekern | gcc's cost representation is a mystery to me, Peter Gavin was playing around with them a while back to make them represent mor1kx better. But he got worse performance out of it when he did that. | 12:18 |
stekern | Stman: there's a chinese guy that has made a similar board: http://opencores.org/forum,OpenRISC,0,5354 | 12:20 |
stekern | juliusb: cool, I saw your name on that lowrisc page ;) | 12:21 |
Stman | thank a lot stekern , I gonna have a look at it straigh away. | 12:24 |
mor1kx | [mor1kx] skristiansson pushed 2 new commits to master: https://github.com/openrisc/mor1kx/compare/3699dfb26c25...94d1a0bb1786 | 14:24 |
mor1kx | mor1kx/master 7ce6584 Stefan Kristiansson: cappuccino/decode: fix PIPELINED multiplier interlocks... | 14:24 |
mor1kx | mor1kx/master 94d1a0b Stefan Kristiansson: cappuccino/fetch: latch rf address on bus_access_done... | 14:24 |
ysionnea1 | :) | 14:26 |
-!- ysionnea1 is now known as ysionneau | 14:26 | |
poke53282 | stekern: With your patches to correct the linking error I get an error during compiling of musl: http://pastie.org/9450851 | 16:22 |
poke53282 | Do you know anything about it? Otherwise I check my configure options. They are a little bit different to the musl-cross is using. | 16:23 |
stekern | poke53282: oh, crap... | 16:37 |
stekern | does it work in musl-cross though? | 16:37 |
poke53282 | Good question. I don't know. But I can check. | 16:38 |
poke53282 | first check: BFD (GNU Binutils) 2.24.51.20140804 | 16:38 |
poke53282 | the only real difference is, that I use the --sysroot option. | 16:39 |
poke53282 | Wait, I will try. HAve to change build.sh for this I suppose | 16:40 |
poke53282 | in 5 minutes I know. | 16:46 |
stekern | I'll test here too | 16:48 |
stekern | yeah, I get that assert here too... | 16:51 |
poke53282 | Ok, but then the binutils version has changed? | 16:52 |
stekern | no, I don't think I recompiled musl | 16:53 |
poke53282 | Ok | 16:54 |
stekern | I mean, it's not related to the version. It's related to my patch | 16:54 |
stekern | which is why I haven't committed it anywhere yet, I'm not confident it doesn't brake other stuff | 16:54 |
stekern | ...which it obviously do :/ | 16:55 |
poke53282 | this whole relocation and shared libs stuff is really complicated. That was a nice time during DOS. Even .com files ran without changes at different locations, thanks to the segment:offset addresses ;) | 17:00 |
stekern | poke53282: try this: http://pastie.org/9450955 | 17:18 |
stekern | http://pastie.org/9450955#44-49 is the part that has changed from the previous patch | 17:19 |
stekern | if you could test this change too, it'd be great: http://pastie.org/9450963#35-38 | 17:22 |
poke53282 | Compiling | 17:25 |
poke53282 | I use only one core so it will take a few minutes. | 17:25 |
stekern | I'm in no hurry ;) | 17:27 |
poke53282 | At least, musl compiles now | 17:36 |
poke53282 | But as long as I don't see Guybrush Threepwood on my screen nothing is settled. | 17:37 |
stekern | heh | 17:46 |
stekern | skip that second addition to the patch | 17:46 |
poke53282 | /ld: BFD (GNU Binutils) 2.24.51.20140804 assertion fail ../../../src/binutils/bfd/elf32-or1k.c:1054 | 17:47 |
poke53282 | collect2: error: ld returned 1 exit status | 17:47 |
poke53282 | because of this? | 17:47 |
stekern | I couldn't recompile gcc with that, I need to take a second look at that | 17:47 |
poke53282 | got it one minute ago | 17:47 |
stekern | yes, 1054 is in the that 'if' | 17:47 |
poke53282 | compiling | 17:49 |
poke53282 | the toolchain compiles. | 18:35 |
poke53282 | the compilation went well. The error in scummvm is gone. But nothing happens when I start scummvm. not even "scummvm --help" works. | 19:03 |
poke53282 | I can still stop with CTRL+c | 19:03 |
poke53282 | the same is true for gcc. But here I it loads at least gcc --help works | 19:06 |
poke53282 | stekern: do you have a trivial example to check? | 19:08 |
poke53282 | C code I mean | 19:08 |
poke53282 | I don't implement l.swa correctly. So, maybe I should try qemu instead of jor1k. | 19:09 |
poke53282 | The native binutils were compiled with the old toolchain. Trying again if gcc works | 19:20 |
poke53282 | gcc works now | 19:23 |
poke53282 | but scummvm still doesn't work | 20:38 |
olofk | Has anyone tried to get a copy of Tachyon-da? Would be fun to try it out | 20:49 |
olofk | I asked for a copy now. Let's see what happens now | 21:00 |
olofk | blueCmd: About to pull your bus converter stuff. Any changes lined up? | 21:07 |
blueCmd | olofk: nope | 21:07 |
blueCmd | olofk: thanks for merging | 21:07 |
olofk | They call me the lightning merger for my extreme swiftness in handling pull requests :) | 21:11 |
blueCmd | olofk: Yes, that's a much deserved nickname! ;-) | 21:14 |
* rah emailed the lowrisc.org people to apply for a position :-) | 21:41 | |
rah | I think it's (very highly) unlikely that they'll be interested but you never know.. | 21:42 |
rah | juliusb: put in a good word for me? ;-) | 21:42 |
rah | "that rah, he's a real code wizard, you should get him on board" | 21:43 |
--- Log closed Thu Aug 07 00:00:53 2014 |
Generated by irclog2html.py 2.15.2 by Marius Gedminas - find it at mg.pov.lt!