<lekernel> how clean/dirty is it to define special pointer values in C?
<lekernel> i.e. #define FOO ((void *)1)
<lekernel> afaik on all MMU-enabled systems, the first page is never mapped, which means we should have at least ~2k such possible values
<Fallenou> what would be the use of such a pointer lekernel ?
<lekernel> marking LLHDL nodes as being consumed by a custom mapper (arithmetic, RAM, ...) with information about the generated netlist elements stored in the parent LLHDL node
<lekernel> each LLHDL node has a pointer, which could either point to the netlist information structure or take that special value
<lekernel> or NULL if they aren't mapped yet
<Fallenou> what would it mean for the node to point to this special value ?
<Fallenou> instead of pointing to the netlist
<Fallenou> or NULL
<lekernel> this way of functioning enables extra logic to be stuffed into particular macros to optimize the mapping efficiency
<lekernel> for example, an adder using the carry chain only uses 2 inputs (out of 6) of the LUT in the slice
<Fallenou> yes
<lekernel> the other inputs of the LUT could be used to implement logic with up to 4 variables that feeds the operands
<Fallenou> ok but this LUT output is already used, to carry to the next operand, right ?
<Fallenou> so how can you use it to do other things ?
<Fallenou> (i don't remember how many outputs there are in a LUT :xx)
<lekernel> so, in LLHDL the arithmetic mapper would look at what logic is connected to the operands, and if it has less than 4 variables, stuff that into the same LUT that generates one bit of the addition/subtraction result
<lekernel> and mark the LLHDL nodes implementing said logic as "consumed"
<Fallenou> ok I understand the optimization
<lekernel> i.e. they do not instantiate anything in the netlist, but this is handled by the parent
<wpwrak> lekernel: how would you use these "special" pointers ? just check if it's special_A or special_B, etc. ? or would you treat them as a class, i.e., have a test if it's anything special ?
<wpwrak> lekernel: in the former case, i'd suggest to just allocate an otherwise unused memory object
<wpwrak> lekernel: the (void *) 1 hack would almost certainly work, but you never know when something comes along that breaks it
<lekernel> if(p == NULL) foo(); else if(p == SPECIAL_X) bar(); else process_stuff_pointed_by_p(p);
<lekernel> the (void *)1 hack also has the advantage that it would segfault if it gets deferenced due to some bug
<lekernel> dereferenced
<lekernel> instead of corrupting stuff and mysteriously crashing later on
<wpwrak> looks like just allocating a different memory object would be the portable way to go. you can still #ifdef the (void *) 1 hack for catching dereferencing
<lekernel> or can we use mmap()?
<lekernel> and reserve a "no access" range for those special values
<wpwrak> don't create complex dependencies ;-)
<lekernel> oh it's not complex
<lekernel> wasn't it you who said that MMU and mmap() was like a multiplier those days? :)
<wpwrak> you'd be competing with malloc. yes, you can do that, but ...
<lekernel> malloc() handles mmap'd regions nicely
<wpwrak> sure. but it's this sort of things that get you in trouble when on "unusual" systems
<wpwrak> there doesn't seem to be much of a need to go to extremes here, so why bother ?
<lekernel> well, of course, this stifles the runnability of the LLHDL tools on MMU-less LM32 for self-reconfiguration ;)
<wpwrak> see :)
<lekernel> but i'm not even sure this would be usable anyway... maybe slow, and we need libgmp
<lekernel> seems I just have to use PROT_NONE (no access) and MAP_ANONYMOUS (no backing file descriptor).... and I get a nice range of guaranteed-immediate-segfault addresses
<lekernel> in a POSIX-compliant way
<Fallenou> ahah the famous PROT_NONE used by go ? :p
<wpwrak> lekernel: posix doesn't guarantee segfaults :)
<lekernel> "PROT_NONE  Pages may not be accessed." so what happens if you do?
<lekernel> you get sig11, no?
<lekernel> at least on all systems I know of
<wpwrak> lekernel: "if the Memory Protection  option  is  supported, the implementation shall not permit a write to succeed where PROT_WRITE has not been set or shall not permit any access where PROT_NONE  alone had been set." so far, so good. but ...
<wpwrak> lekernel: "If the Memory Protection option is not supported, the result of any  access  that  conflicts  with  the specified  protection  is  undefined."
<lekernel> well, said protection is only really useful when debugging pointer bugs, right?
<wpwrak> lekernel: yes, unless you start getting other ideas, such as your code depending on a signal handler to be called ;-)
<lekernel> it's a simple command line tools that has little to do with signals...
<wpwrak> lekernel: that would be the ultimate optimization - handle the special cases with the mmu ;-)
<lekernel> and it would be pretty stupid to catch signal 11 anyway
<wpwrak> but yes, the mmap approach is more portable than (void *) 1, at least in the sense that if it won't work at all on a given platform, you'll find out quickly
<wpwrak> (as in mmap not existing/returning an error)
<kristianpaul> Fallenou: Are you awake/around?
<Fallenou> yes !
<kristianpaul> I'm taking a look the the flicernoise code, and i noticed this
<kristianpaul> sysettings.c:139:             "e_login = new Entry()",
<kristianpaul> sysettings.c:141:             "e_password = new Entry(-blind yes)",
<Fallenou> kristianpaul: have you tried forcing your ethernet card to work at 10 Mbps ?
<kristianpaul> Fallenou: hmm not
<Fallenou> to see if it prevents the rx fifo from becoming full ?
<kristianpaul> hmm
<Fallenou> it would be worth a try :)
<kristianpaul> good point
<kristianpaul> sure i will
<Fallenou> ok thanks!
<Fallenou> I tested ttcp
<Fallenou> without any bug, as it seams i cannot reproduce the bug with qemu :/
<Fallenou> i will have to try to fix it blindly
<kristianpaul> as soon i got te way to add a ftp user to flicernoise by commad
<kristianpaul> ah you dont have a mm one..
<Fallenou> root does not work ?
<Fallenou> no i don't :/
<kristianpaul> root got login but said 550 Acess denied as soon i try a ls
<Fallenou> oh
<Fallenou> strange
<Fallenou> did you try ls /dev
<Fallenou> ?
<kristianpaul> no no
<Fallenou> using the shell I can do such a ls
<kristianpaul> i mean ftp !
<Fallenou> yes via the ftp
<Fallenou> tu list the /dev
<kristianpaul> root password rtems?
<kristianpaul> or no password?
<Fallenou> no password
<Fallenou> if it is like the shell
<kristianpaul> same thing...
<kristianpaul> last time i tested after add a user using GUI but i'm going to do that again
<kristianpaul> so i was digging how flickernoise added a ftp user
<Fallenou> wow
<Fallenou> using flickernoise in qemu, i got weird mouse movements
<Fallenou> i just cannot use the GUI
<Fallenou> the mouse is doing crazy stuff
<kristianpaul> :\
<Fallenou> it is moving randomly everywhere while i move it
<Fallenou> mwalle do you have such a behaviour ?
<kristianpaul> can you TAB ?
<Fallenou> no
<Fallenou> does no do anything
<kristianpaul> :-(
<Fallenou> oh, now that i clicked on a button
<Fallenou> i can tab
<kristianpaul> phew
<Fallenou> click works, if I happen to be on a button :)
<Fallenou> but it is totally random where I move
<kristianpaul> weird i remenber whe i was using qemu i dont have that behavior
<kristianpaul> let me try
<kristianpaul> Fallenou: i dint get GUI to boot, actually i just got flooded with "milkymist_memcard: read more cmd bytes than available. Clipping."..
<Fallenou> yes
<Fallenou> I have been told that you have to create a file
<Fallenou> empty file should do
<Fallenou> like dd if=/dev/zero of=sdcard bs=1M count=30
<Fallenou> and then append -sd sdcard to qemu command line
<Fallenou> it made my flickernoise boot :)
<kristianpaul> my mouse cursor is okay here
<Fallenou> oh !
<Fallenou> well let me restart my VM then :o
<kristianpaul> VM is cheating !
<kristianpaul> ;-)
<kristianpaul> poor qemu
<kristianpaul> ;-)
<Fallenou> =)
<Fallenou> well I still have the problem
<Fallenou> it's a really clean ubuntu VM
<Fallenou> just installed to do RTEMS dev
<Fallenou> I am using the touchpad :o
<Fallenou> maybe it's the problem
<Fallenou> but I don't have any mouse
<Fallenou> and it used to work well with a touchpad before
<kristianpaul> mtk is really simple :-)
<kristianpaul> Is that a Mac?
<Fallenou> anyway I still have 2 "read more cmd bytes" ...
<Fallenou> yes
<kristianpaul> do you understand what is for the lines of code i pointed before?
<kristianpaul> I still not get how it change ftp in rtems to make that user and pass to login
<kristianpaul> ah !, sysconfig_get_credentials(login, password);
<Fallenou> :)
<Fallenou> no i don't understand sorry
<Fallenou> I have almost no knowledge of how flickernoise works
<Fallenou> i mean MTK
<kristianpaul> no no you dont
<kristianpaul> need
<kristianpaul> I think i found my answer
<Fallenou> ok great !
<Fallenou> so root / nothing didn't work ?
<kristianpaul> Fallenou: nope
<Fallenou> oh, but the thing you just pasted indicate the use of the system login and pass , right ?
<Fallenou> so it should be root / nothing :o
<kristianpaul> no no, thats code is called when you set Remote Acess in System Settings (flickernoise gui)
<kristianpaul> dunno why root is not allowed
<Fallenou> oh ok
<kristianpaul> actually i did log in my a foo user and is same behavior..
<kristianpaul> Fallenou: http://paste.debian.net/108130/
<Fallenou> watches a battelstar galactica
<kristianpaul> hehe
<Fallenou> or my head is gnna explose
<kristianpaul> ok good
<Fallenou> week has been hard