[00:19] not using jit for mono makes compiler hit bad C code ...bails out [00:19] bah === persia` is now known as persia [02:03] howdy, where can I obtain binaries of 9.04 for a sheevaplug? Googling is giving me all sorts of goofy pages [02:12] ports.ubuntu.com ought have individual packages. No idea where to get images. [02:12] Note that upgrading to 9.10 will break your system on a sheevaplug, and require reinstall. [02:14] persia, yes thank you… I just read the 9.10 warning and was wondering if there is enough community to support maintaining a non VFP version of ubuntu [02:14] just now starting to research [02:18] sevenseeker: There's a bunch of people, but not enough infrastructure. [02:20] persia: what does launchpad currently (if any) support? I am new to embedded ubuntu, but have used launchpad to make packages for my ppa before [02:21] This isn't the best place to talk about embedded ubuntu, because we don't do anything to make it more embedded friendly: we just do Ubuntu on armel. [02:21] Mind you, many "embedded" systems are now powerful enough that this doesn't matter. [02:21] But I wouldn't try to install Ubuntu on a network interface, for example :) [02:21] Anyway, that aside ... [02:22] launchpad PPAs don't suppprt armel at all right now. [02:22] aha, good to know [02:22] (same as powerpc, sparc, ia64) [02:22] sad I am, but still good to know, lol [02:22] But Ubuntu is available for armel. [02:23] So any software in Ubuntu can be used. Adding new software to Ubuntu isn't particularly hard, but there are several ways to do it, which can be a bit confusing. [02:23] But since there are already something like 20,000 software packages, most of what one needs is already there. [02:23] I also build Alix based systems but use openwrt for that [02:24] Ubuntu 9.04 was ARMv5t+ compatible. [02:24] 9.10 was ARMv6+vfp+ compatible [02:24] 10.04 seems to be ARMv7/Thumb2 [02:24] (but it's not out yet, so no promises) [02:24] Rumour has it that this escalation will be stopping soon. [02:25] So one hopes that in the not-too-distant future, one can safely upgrade on common consumer devices. [02:26] that would be nice [02:26] persia, ARM hasn't announced anything past ARMv7... So any cortex-aX device is safe... [02:27] then maybe more embedded friendly sub-distros could be worked on… who knows? [02:27] rcn-ee: So rumour has it, but I'm not privy to all conversations between all counterparties everywhere :) [02:28] sevenseeker: Well, why do you need embedded? Ubuntu 9.10 runs on devices with 2G storage and 256MB RAM. [02:28] lol, you could be my 'insider' for info [02:28] You could probably make it even smaller if you just did a single-purpose server. [02:29] well its like this… I love that 'embedded' class systems are getting faster/more ram/better/etc… but it seems like much software is just banking on this and being lazy (I know I did that previously… ok, now) [02:29] persia, if you factor in the time between ARM announcing ARMv7 devices, product availably from silicon manufactures and gcc support.. It'll be couple years before the next ARMv+ would be out.. [02:30] but the more tight it is the better it can use whatever system its on basically [02:30] rcn-ee: That's my opinion as well. I just tend to be careful when I don't have any formal statements. [02:30] note: I have been optimizing for 2 weeks and probably am stuck mentally in that mode now [02:30] sevenseeker: The main difference in "embedded" is usually stuff like not shipping documentation, etc. [02:31] The code should be made as efficient as possible regardless of the target, for performance reasons. [02:31] I agree [02:32] I use EC2 for some 'stuff' and my optimization sure does save me money :) :) :) [02:32] The other common "embedded" choice is monolithic static binaries. That gets hard to maintain in a modular fashion. [02:32] wow, yes it is [02:32] you mean like jffs? [02:33] No, like compiling your app linked statically against glibc so that you don't have to ship as many files (because you didn't ship glibc) [02:33] We (kinda) support jffs2, and I know of at least one consumer device being sold with Ubuntu on ubifs. [02:33] aha [02:35] But anyway, there's lots of optimisations. [02:35] So the "bloat" is mostly docs, overhead from having lots of files, overhead from having a full package management system, etc. [02:35] But flash is cheap :) [02:36] I see, yeah that makes sense [02:37] So anyway, for your sheevaplug, just stick with 9.04. ports.ubuntu.com has lots of packages you can use. [02:37] sweet, that sounds great [02:37] And when you have a chance to get newer hardware, ask for something that is known to work with Ubuntu :) [02:37] lol, yeah [02:37] And if rcn-ee and my speculations are correct, you should be able to upgrade that to the latest version and keep up for a while. [02:38] well, I am considering this summer prototyping a series of Alix boards based on full ubuntu, granted they are x86 and thus OT here [02:39] sevenseeker, one note thou too, even with an unoptimzed debian dist, the sheevaplug is still pretty quick: http://global.phoronix-test-suite.com/?k=profile&u=robertcnelson-8971-28884-22100 [02:39] is there a similar system to sheevas that is cheap and readily available that uses > ARM v5? [02:43] I haven't heard of anything in that form factor. [02:43] Most people around seem to use development boards (beagle, babbage, etc.) [02:44] The Sharp Netwalker is also available, but I don't know of anyone who hosts a kernel for it that can boot 9.10 ot lucid [02:47] hmmm [02:47] thanks for the info… and the reminder, I need to try a beagleboard just for kicks [02:48] since it won't do HD it really would not be useful for me now, but a year ago … woah nellie! [02:52] sevenseeker, with the dsp, HD'ish is possible.. "1280x720" i have just not spent enought time getting the ubuntu side to work.. It does play video with the DSP in Angstrom... [02:53] hmm, now THAT sounds very enticing [02:53] thank you [02:54] sevenseeker, this was done at FOSDEM this year, 6 beagles each connected it's own display.. we are still waiting from the ffmpeg guys on how they did it.. http://hardwarebug.org/2010/02/10/1080p-video-on-beagle/ [02:58] WOAH [02:58] yeah, they need to reveal that :) [08:12] davidm [08:32] saeed, i guess thats a bad time to catch him (2am at his place) [08:41] hi ogra [08:41] hey saeed [08:42] hey saeed! [08:42] I need some help with the power button on Dove DB [08:42] Hi Michael [08:42] ericm_, ^^^ [08:42] saeed: whats the issue with the power button? [08:43] saeed: long time no see [08:43] I want to make it trigger user space suspend and power off [08:43] ?? [08:43] Hi bryan [08:43] hey saeed, how u doing dude [08:44] currenty that button implemented as input device [08:44] and it reports EV_SUSPEND when pressed/unpressed [08:47] hi eric [08:51] Saeed, maybe you want your Xorg.log.0 pasted? [08:52] here? [08:52] paste.ubuntu.com [08:53] http [08:56] saeed: Try xev under Xorg; do you see any event? [08:57] saeed: AFAIK, we expect all buttons to trigger Xorg key press events, then gnome-power-manager listens to them [09:00] saeed: To quickly paste stuff to paste.ubuntu.com, you might find http://people.canonical.com/~cjwatson/ubuntu-paste useful [09:00] Or install the pastebinit package [09:01] check http://paste.ubuntu.com/373788/ [09:02] You have evdev at least [09:02] saeed: Could you try running xev in a terminal and checking whether the power button triggers a Xorg keypress event? [09:02] xev doesn't show anything when pressing on the button [09:03] (II) UnloadModule: "evdev" [09:03] that's odd [09:03] also lsof /dev/input/event0 is empty [09:03] Ah the unload is for another device [09:03] that it configures the kbd as a mouse looks wrong too [09:04] saeed: Your xorg.log doesn't show any setup for event0 [09:04] yes [09:04] saeed: So probably Xorg doesn't think your event0 is an interesting device [09:05] yes, I added some file to hal/fdi/policy [09:06] I think we're trying not to use hal anymore, but straight udev [09:06] In the xorg-server source package, patch debian/patches/12-Add-libudev-input-hotplug-backend.diff adds this stuff [09:06] and xinput [09:06] udev rules would look something like: [09:06] SUBSYSTEM=="input", KERNEL=="event*", ENV{x11_driver}="evdev" [09:06] SUBSYSTEM=="input", KERNEL=="event*", ENV{ID_CLASS}=="kbd", ENV{xkb.layout}="fr", ENV{xkb.options}="terminate:ctrl_alt_bksp,compose:lwin" [09:07] i think we're supposed to use the xinput tool [09:07] saeed: Check /lib/udev/rules.d/64-xorg-xkb.rules, does it match your device? [09:07] but at least here i cant make it use any device [09:07] (instead of xev) [09:08] we should ask tseliot, he cares for the whole xinput stack [09:08] That's just xkb actually [09:08] saeed: I would add a ENV{x11_driver}="evdev" property to your device [09:09] where should I add that? [09:10] saeed: For now, add it manually to your local udev rules [09:11] saeed: Something like /etc/udev/rules.d/90-power-button.rules [09:11] at /etc/udev/rules.d/ ? [09:11] ok [09:11] with SUBSYSTEM=="input", KERNEL=="event0", ENV{x11_driver}="evdev" [09:11] But I'm not an udev expert [09:12] saeed: You can raise the verbosity of udev to debug this [09:13] /etc/udev/udev.conf use info [09:14] saeed: Ah I found some good examples [09:15] saeed: /lib/udev/rules.d/66-xorg-synaptics.rules [09:15] That sets ENV{x11_driver}="synaptics" and some additional options for some devices [09:15] the generic rule is /lib/udev/rules.d/65-xorg-evdev.rules [09:16] saeed: So your problem is that /lib/udev/rules.d/65-xorg-evdev.rules doesn't map your device to evdev [09:16] saeed: It only maps devices of type keyboard, mouse, touchscreen or touchpad [09:16] saeed: What intput type are you using? [09:22] keyboard [09:22] saeed: Odd, so the generic rule should have mapped it to the evdev xorg driver [09:22] saeed: You probably want some udev debug to see if that gets properly assigned [09:23] saeed: Basically make sure that x11_driver gets set to evdev, then it becomes a xorg-server issue if it didn't load an evdev xorg driver for this device [09:25] (**) "Power Button": always reports core events [09:25] (**) "Power Button": Device: "/dev/input/event0" [09:25] (II) "Power Button": Found keys [09:25] (II) "Power Button": Configuring as keyboard [09:25] (II) XINPUT: Adding extended input device ""Power Button"" (type: KEYBOARD) [09:25] thats what i have on my laptop [09:25] so the keyboard driver should be fine for it [09:26] s/keyboard driver/evdev driver in keyboard mode/ [09:26] here is the lshal part for the button http://paste.ubuntu.com/373798/ [09:28] hmm, you shouldnt be having hal installed if you run lucid [09:28] * ogra wonders if that gets in the way somehow [09:29] (it shouldnt though) [09:29] saeed: udevadm info --query=all --path=/sys/class/input/event0 [09:30] this is my power button http://paste.ubuntu.com/373800/ [09:30] You can see x11_driver=evdev [09:31] * lool had a great idea before sleeping in last night [09:31] the info.capabilities is just input, maybe is should be input.keyboard? [09:32] saeed: Yes, that's likely why the generic rule doesn't match [09:32] saeed: On my power buttong I have E: ID_INPUT_KEY=1 [09:32] saeed: Do you have it? [09:36] no [09:36] saeed: Ok, that's your issue then [09:37] saeed: Actually there seem to be two types [09:37] One for keyboard and one for key [09:37] /lib/udev/rules.d/60-persistent-input.rules references ID_INPUT_KEYBOARD [09:37] saeed: But you basically want to set your kernel driver evdev props to key or keyboard [09:39] are we actually sure we want gpoi mapped to Xorg at all ? [09:39] We're sure we want the power button mapped [09:39] right, but that doesnt necessarily need to happen with evdev [09:40] ogra: What do you propose? [09:40] especially for gpio ... i.e. look at lirc which uses gpio buttons [09:41] it doesnt have much useful stuff, but definately doesnt use evdev ... all we need is to capture the gpio even somehow and make g-p-m aware through devkit-power [09:42] saeed: I checked the ACPI power button implementation, and it does: input->evbit[0] = BIT_MASK(EV_KEY); [09:43] set_bit(KEY_POWER, input->keybit); [09:43] though the devkit-power rules dont seem to have anything useful in them regarding buttons [09:43] saeed: drivers/acpi/button.c:395 [09:43] ok, I'll try that [09:44] ogra: Can use your lirc device to power off? [09:47] cooloney: WRT LP #516352, did you also cherry-pick the commit removing the file on package removal? [09:47] Launchpad bug 516352 in linux-fsl-imx51 (Ubuntu) "fsl-imx51: need backport module.builtin to .31 kernel for lucid userspace compatibility (affects: 1)" [Medium,Fix released] https://launchpad.net/bugs/516352 [09:48] cooloney: 69f2227cdca42c4bbaa6fc931e64385f7fdee38f [09:48] grrr [09:48] * ogra hates reconnects [09:48] lool, /lib/udev/rules.d/95-keymap.rules has what we want [09:48] for example ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Extensa*", ATTR{[dmi/id]product_name}=="*5210*|*5220*|*5610*|*5620*|*5720*", RUN+="keymap $name 0xEE screenlock" [09:48] (see the RUN part) [09:48] saeed, do you see any events in dmesg if you press the button ? preferably with a keycode ? [09:49] lool: oh, i just cherry picked 2 .32 patches to .31 kernel as we discussed before [09:49] cooloney: You might want the above SHA too [09:50] ogra: What you're pointing at is for extra keys on laptop keyboards [09:51] lool, yes [09:51] well, keymapping for buttons not used by X [09:51] ogra: The mvl-dove driver doesn't need any specific rule IMO [09:51] you want a low level power key event [09:51] We just need to have the power key device using the proper class [09:51] which isnt mapped atm [09:51] I don't think that's needed, no [09:52] well, as i understood it already emits an event [09:52] its just not mapped to power [09:52] ogra: As you can see in the Xorg log, the device is not seen by Xorg at all [09:52] why should it be seen by Xorg at all ? [09:52] While on your system and mine it is [09:52] you want a power event from the kernel [09:52] No [09:53] You want a keypress event [09:53] which you likely already get [09:53] currenty that button implemented as input device [09:53] and it reports EV_SUSPEND when pressed/unpressed [09:54] if there is a keycode emitted too a rule will just map it properly [09:54] ogra: Try it out [09:54] lool: do you mean this "UBUNTU: [Config] armel -- cleanup to-be builtin modules", right? [09:55] cooloney: No, I mean UBUNTU: Add modules.builtin.bin to prerm rm list [09:55] cooloney: Try installing and removing a fsl-im51 kernel package, you will see that a file is left behind [09:56] cooloney: (modules.builtin.bin) [09:57] now xinput show the gpio device [09:57] saeed: Wee [09:57] xev shows nothing when pressing on the button [09:57] thanks lool [09:57] lool, * include modules.builtin in the binary debs ?? that one ? [09:58] ogra: I don't understand what you're commenting on [09:58] your discussion with cooloney [09:58] brb [09:58] ogra: Your comment doesn't make any sense in the discussion [09:58] lool: ok, got you, i just recall that this patch is from you, right? [09:58] saeed: You need to have the proper flags when sending the event too [09:59] saeed: Specifically, it needs to be a key event [09:59] cooloney: It is from me indeed, which is why I recall it [09:59] cooloney: It should go together with the modules.builtin backport/cherry-pick you're doing [10:00] yeah, i noticed that, thanks for reminding me [10:00] but the SHA on my side is 48d7349bbc9e47a27c74cdb3e56bbcc92d9bab29 [10:01] roc@roc-desktop:/opt/git/Ubuntu/lucid$ git show 48d7349bbc9e47a27c74cdb3e56bbcc92d9bab29 [10:01] cooloney: You're right, it's 48d7349bbc9e47a27c74cdb3e56bbcc92d9bab29 [10:01] commit 48d7349bbc9e47a27c74cdb3e56bbcc92d9bab29 [10:01] Author: Loïc Minier [10:01] Date: Wed Feb 3 05:32:45 2010 +0000 [10:01] UBUNTU: Add modules.builtin.bin to prerm rm list [10:01] BugLink: http://bugs.launchpad.net/bugs/516584 [10:01] Launchpad bug 516584 in linux (Ubuntu) "modules.builtin.bin not removed on package removal (affects: 3) (dups: 1)" [Undecided,Fix released] [10:01] cooloney: Must be a copy-paste error, sorry [10:01] lool: ok, cool. I will cherry pick that to my branch [10:01] which was included already [10:01] lool: no problem, thanks a lot [10:01] * ogra really wonders what you guys are discussing here [10:02] ogra: oh, really? [10:02] look at the imx changelog, apw usually includes the package fixes frim the linux package [10:02] *from [10:03] ogra: It's certainly not in the git log of the fsl-imx51 branch [10:04] Besides, it needs to be adapted to apply on debian.fsl-imx51/ anyway [10:05] cooloney: I checked the fsl-imx51 and it still needs fixing [10:05] ogra: lool is right. [10:05] cooloney: debian.fsl-imx51/control-scripts/prerm, @files_to_remove [10:05] lool, because there was never a modules.builtin.bin until recntly in imx51 [10:05] yep i missed that one when i pulled fsl-imx51 togther [10:05] ogra: And there is one now, because it was cherry-picked [10:05] i need to cherry pick that patch with others [10:05] lool, right, since the very last upload [10:05] which i pointed to before [10:05] I wonder how many people it takes to convince ogra that I'm right [10:06] oh, guys, no problem, [10:06] i will fix that soon, [10:06] its in mvl-dove as part of the rebase [10:06] cooloney: thanks; not a big deal anyway [10:06] Just a leftover file, but it causes a warning on package removal [10:06] not in fsl-imx51 cause its a franken kernel [10:06] apw: right, because mvl-dove is .32 based anyway [10:06] apw: Do you have some script to adapt the debian.foo/ pathname when doing these rebases? [10:06] yep, cooloney get it to me soon :) [10:07] lool, nope, just use vi on the patch [10:07] hehe ok [10:07] apw: Would it be much work to turn on udebs for versatile? [10:08] I'm sure that's something you'd be excited about :-) [10:08] what the heck would we want those for [10:08] i am sure the aa's would love a heap of more binary debs to wave though [10:08] apw: I don't know for mobile team, but I'd love to point people at debian-installer images to install Ubuntu in qemu [10:09] apw: That would allow providing just vmlinux on ports.ubuntu.com [10:09] and a d-i initrd [10:09] the work is not normally in eanbling them but in getting the result to pass the d-i pass afterwards [10:09] if you don't have all modules built [10:09] apw: something like http://ports.ubuntu.com/ubuntu-ports/dists/lucid/main/installer-armel/current/images/dove/ but for versatile [10:10] apw: Ack; the work would probably involve adding some Provides to the binary package [10:10] * cooloney is vi on the patch file as apw said. heh [10:10] apw: Because a lot of modules are builtin in the versatile config [10:11] loads of ?'s to be added and you have to build it to find out which ones [10:11] apw: The d-i side of things is just commented out for versatile BTW; it's well supported in d-i [10:11] apw: Right [10:11] something like that [10:12] apw: Currently, if we want to pull the official kernel for versatile from lucid, we have to download a .deb and unpack it to get to the vmlinuz file which allows running qemu [10:13] i have no objection to udebs or not, they arn't a big bit of the build [10:13] So having d-i images would allow people to use them for install, and would also make it easier for e.g. rootstock to pull a kernel [10:13] apw: I'd love that [10:13] apw: Do you want me to check formally whether there are objections/interest in that from the mobile team? [10:13] sure [10:14] Ok, mailing ubuntu-mobile@ [10:19] apw: i found lool's patch can not apply to debian.fsl-imx51 directory, [10:20] apw: FYI I just tested the in archive linux-image-2.6.32-13-versatile_2.6.32-13.18_armel.deb and it boots fine with lucid and karmic userspace [10:20] apw: it does not have the whole line 'modules.alias.bin modules.dep.bin modules.symbols.bin' at all [10:21] cooloney: You don't have .bin files with your fsl-imx51 kernel? [10:21] apw: (I mailed ubuntu-mobile@) [10:23] * cooloney wants to punch his head to the wall, messed up his board. [10:23] i need to reinstall my lucid on my board now [10:31] cooloney, then have a look at the debian.master version of that file [10:31] there is another patch which pulls the other two in you need as well [10:33] cooloney, ironically it was your first patch i think [10:33] commit 8b453930465c15f490ea44c2987b0a1bfe71ed66 [10:33] Author: Bryan Wu [10:33] Date: Wed Mar 25 17:31:26 2009 +0800 [10:33] UBUNTU: Add 3 missing files to prerm remove file list [10:35] cooloney, so you need that commit copied over first, then lool's one [10:41] apw: that is a good memory for me [10:41] apw: will do it soon [10:41] whenever man [10:54] I changed the button to send EV_KEY instead on EV_PWR [10:55] now I see message "Failed to suspend" (hibernate) [10:55] I'll change the code to KEY_SLEEP instead of KEY_SUSPEND [10:57] saeed: Great [10:57] saeed: Where do you see the message? [10:57] saeed: Are you running gnome-power-manager? [10:58] yes, [10:58] I think it failed to hibernate because the resume param was wrong [10:58] saeed: drivers/acpi/button.c uses KEY_POWER for ACPI_BUTTON_TYPE_POWER, so that seems correct [10:59] saeed: Ack [11:00] saeed: And it uses KEY_SLEEP for ACPI_BUTTON_TYPE_SLEEP; it doesn't use KEY_SUSPEND [11:00] oh, hibernation is disabled [11:01] saeed: Yeah, you certainly don't want KEY_SUSPEND [11:02] ok [11:02] look, we are looking for the folowing behavior [11:02] if button pressed for less that 3 seconds , the system enters standby mode [11:03] othewise we want the system to shutdown [11:03] saeed: Ok; so you would send KEY_SLEEP for < 3 secs and KEY_POWER otherwise [11:03] that means driver change, right? [11:03] saeed: Oh you would like to implement the 3 secs in userspace? [11:04] yes [11:05] btw, lucid keeps showing the "failed to suspend" again and again [11:19] lool, bug 520028 ... what was the reason for dropping ubuntu-minimal ? [11:19] Launchpad bug 520028 in project-rootstock "ubuntu-minimal doesn't build correctly for karmic (affects: 1)" [Undecided,New] https://launchpad.net/bugs/520028 [11:20] iirc a patch from you dropped it [11:20] (though if its really upstart being at fault, there should be a hard dep) [11:42] guys, the suspend works fine now [11:43] however I wish ubuntu show message that the system going to suspend to ram [11:43] \o/ [11:43] the rules file not needed of course [11:45] saeed, /var/log/pm-suspend.log should have something [11:51] ogra: here it is root@lucid-dove:~# cat /var/log/pm-suspend.log Initial commandline parameters: Tue Jan 11 21:19:32 CST 2011: Running hooks for suspend. /usr/lib/pm-utils/sleep.d/000kernel-change suspend suspend:success. /usr/lib/pm-utils/sleep.d/00logging suspend suspend:Linux lucid-dove 2.6.32.3-dove-5.0.0-rc3-00671-g43c704e-dirty #200 Thu Feb 11 13:34:59 IST 2010 armv7l GNx Module Size Used by [11:51] sorry [11:51] here it is http://paste.ubuntu.com/373887/ [11:52] ue Jan 11 21:19:33 CST 2011: performing suspend [11:52] thats the actual suspend [11:52] /usr/lib/pm-utils/sleep.d/000kernel-change resume suspend:success. [11:52] Tue Jan 11 21:19:48 CST 2011: Finished. [11:52] is the final wakeup [11:53] ogra: I was expecting gui message telling that the system going to suspend [11:53] ah [11:53] because it takce few seconds to do that [11:53] usually the screen fades out immediately [11:54] lool, eric, I see this kernel message when pressing on the button: [11:54] keyboard.c: can't emulate rawmode for keycode 142 === jiteshs is now known as jitesh_afk [12:34] http://people.canonical.com/~ogra/babbage2-lucid-20100211-3.png [12:34] netbook-launcher is on the screen after 35 sec :) [12:34] Nice! [12:35] That's getting close to boot speeds I find acceptable in my laptop. [12:35] What's the suspend/resume delay? [12:35] i think if jockey wouldnt run all the time in the background we'd get another 5 sec speedup [12:35] suspend takes a while to process the scripts, resume is instant [12:35] Don't we need jockey? [12:36] we will need it once we have 3D drivers [12:36] the prob is that its *scanning* permanently due to a bug [12:36] That's extra nice. On my netwalker, I get about 2 seconds suspend and 3 seconds to resume (which Sharp advertises as a "3-second boot") [12:36] heh [12:37] i think suspend takes rather five here [12:37] Well, I mean, really. How often to people actually boot. Even my laptop only gets booted for kernel updates. [12:37] but resume is just up after pressing the button [12:37] probably 1sec [12:37] That's nice. [12:38] saeed: I'm glad it works :) [12:38] saeed: Did you try emulating the power key as well? [12:39] saeed: Will you do this in kernel? [12:39] saeed: Concerning the feedback on suspend: a) some devices blink the power led in the kernel, and b) the suspend is supposed to be so quick that you don't need feedback, right? :-) [12:39] I didn't try the power key [12:41] in karmic the system enters standby immediately [12:41] using echo mem > .. [12:42] regarding the power key, it's easier for me to do it kernel, but I'm not sure if this is the right way [12:59] saeed: I would think that an userspace hack wouldn't get upstream either [13:00] saeed: IMO it's a device design problem [13:00] saeed: This is going to be in a physical device for which the user experience is going to be "this button can do multiple things"; the button is going to be labelled with or more icons depending on what it does [13:01] In another design you would have two buttons [13:01] So I don't know whether you're trying to do a generic device design or whether you're trying to demonstrate shutdown and suspend with a single button on a particular design [13:01] It's hack either way, but it's really related to your hardware layout [13:02] What's the goal again? [13:03] The kernel can send events for either a power or a suspend button press [13:04] saeed would like a shutdown to happen if pressed more than 3 seconds and a suspend otherwise [13:04] But on what does that depend, in terms of user experience. [13:04] Ah, yeah, that needs to be a kernel thing. [13:04] I'd hope additionally for a hardware shutdown if the key is held longer. At least I use that on my Netwalker. [13:04] (because sometimes software hangs) [13:05] So HW differentiation for whether hold > 10s, and kernel differentiation for whether hold > 3s. [13:06] But again, why bother shutting down with a button? Is it that frequent a use-case to turn a device off? [13:07] saeed: Or alternatively, call your key "User button 1", send your own event and keycode and write a tool to handle it ;-) [13:10] Um, in that case, just use the power button. [13:11] We already have software that can take a power button event and perform various actions, which could be extended to meet the timing case. [13:11] It might be simpler to have another software handle a timed key press and call into gpm rather than patching gpm [13:11] (and easier to maintain/less intrusive) [13:12] I guess. I just don't like to have too many special HW hacks. [13:12] Which is why I'd prefer having it separate [13:12] instead of running the hack in gpm [13:12] I'd rather enable a use case for a broad spectrum of HW, and have the HW produce something that works with existing software, to preserve user choice. [13:13] You can always remap the key in software if you want [13:13] Right, that would be the special HW hack: "If you have this board, you need to remap your keys like this: ..." [13:14] Well you're proposing to patch GPM to have a mode "If this hardware is detected and button is pressed more than n seconds, do something else" [13:14] Adding a fork function for timing in g-p-m would enable this class of behaviour for arbitrary HW which didn't expose a sleep button (and there's lots of that) [13:14] I'm proposing to have a separate software which doesn't have the "if you have this hardware" and if people want to replace the software to use gpm, they can either patch gpm or remap thier keys [13:14] No. I'm proposing that g-p-m be patched to be able to have different actions happen for different timing delays in power button presses. [13:14] No special HW detection. [13:15] I don't think that'd fly [13:15] Why not? [13:15] I have hardware for three different architectures that doesn't have sleep keys. [13:15] We'd have to run and maintain the patch for everybody instead of maintaining a single isolated trampoline [13:16] Why wouldn't the patch go upstream? [13:16] dmart, i remember you filed a bug once on building the kernel with thumb2 but i cant find it on LP, do you happen to remember the bug number ? [13:16] Well that's my opinion that's it's too specific [13:16] Upstream mught have a different opinion [13:17] lool: How specific. Like I said, I have HW for three different architectures with no sleep button, and none of it is saeed's HW. [13:17] persia: For instance, why do it for the power button and not the sleep button? [13:18] lool: No reason at all. Generalisation is good. [13:18] Then you also need some GUI, more GUI == more confusion [13:18] ogra: can you remember what it was about? I don't remeber filing a bug on Thumb-2 kernels yet. [13:18] Users with both power and sleep would be able to get to all of shutdown, hibernate, suspend, and screen-lock. [13:19] dmart, well, that the kernel should be built with thumb2 (not the config option but the kernel binary being a thumb2 binary) [13:19] i know we reviwed that in dallas and i thought it resulted in a bug you filed [13:19] lool: My basic point being that the utility you describe would simply not work for any of my hardware without a sleep button. To me, this is HW-specific. [13:20] ogra: I don't think I filed a bug. It's not required that we build the kernel in Thumb-2, but we can try it if you think we're ready. [13:20] ogra: I think it is a config option actually [13:20] dmart, well, apw seems to just research that [13:21] yep ... 'we' have a sprint in a half hour on this stuff right? [13:21] having smaller kernels surely helps speed up the boot [13:21] apw, thats more about porting packages :) [13:21] not sure kernel packages were meant there :) [13:21] linux was listed, i noticed when i read the announcements [13:22] ogra: Bear in mind that there may be platform-specific drivers with assembler code, so it might not all work out of the box. I would hope that there's not much of that however. [13:22] ah [13:22] Most of the assembler is in the general arch/arm code though, and that should be OK in the lucid kernel versions. [13:25] persia: Technically you could make the utility I describe listen to power button instead and disable GPM [13:28] lool: That would address all of my concerns :) [13:59] I filed lp #520465 on the qemu/linux/eglibc/glib2.0 issue [14:00] Launchpad bug 520465 in ubuntu "armel/versatile: glibc detected double-free or corruption (!prev) (affects: 1)" [Undecided,New] https://launchpad.net/bugs/520465 [14:00] * asac waves [14:00] It's not a priority for me, but it would be nice to fix it for lucid [14:01] * ogra is here [14:01] lool, its a priority for me to be able to use the archive kernels though [14:01] * ogra subscribes [14:02] * JamieBen1ett waves back [14:02] ah, armel is subbed already, good [14:02] dmart: dyfet: StevenK: persia: ping ;) [14:02] Hi there [14:02] pong [14:02] * persia will be about 10 minutes late [14:03] persia: ok. please read the backlog then ;) [14:03] anyone else here for the porting sprint? [14:03] Always :) [14:03] dealing also with replacing a furnace this morning :( [14:03] what is a furnace? [14:03] * asac goes for dictionary [14:04] big firey thing [14:04] dyfet: so you cannot attend? [14:04] http://en.wikipedia.org/wiki/Furnace :) [14:04] oven :) [14:04] No I can... [14:04] good [14:04] Just annoying distraction ;) [14:04] ok [14:04] and a bit cold this morning ;) [14:04] While we're waiting for persia, people might want to pull up https://wiki.ubuntu.com/ARM/Thumb2PortingHowto [14:05] that should be fine ... our excersizes will make you feel hot i am sure ;) [14:05] NO reason to wait: I'm loosely about, just distracted for another 5 minutes or so. [14:05] erm [14:05] did anyone notify any MOTUs ? [14:05] we announced it on mobile [14:05] given the univers list is HUGE [14:06] i doubt many MOTUs read mobile [14:06] and on internal list [14:06] ogra: may not be an issue for the first pass [14:06] ogra: we can spread the news to wider forum for the next time [14:06] Partly I want to know what else needs to be documented [14:06] dmart: The first pass is not enough to fix all bugs? ;-) [14:06] we have https://wiki.ubuntu.com/ARM/Thumb2PackageReviewList [14:06] lool: well, obviously, if you're feeling energetic ;) [14:06] asac, definately should be announced on ubuntu-motu@ next time [14:06] which should give us a decent amount of work [14:07] ogra: well. i usually dont hunt in random territory ... we could also have it announced on -devel [14:07] which most motus are subscribed to too [14:07] yeah [14:07] What's the best way to do this? [14:07] I suggest we pick one package from the list and all take a look, and discuss. [14:07] right [14:07] i suggest that dmart takes the lead ;) [14:07] either way i dont expect that our litle crew manages all these universe issues [14:07] so boost stuff is already done [14:08] dmart: maybe we can go by topic? [14:08] e.g. today focus on "mov" issues? [14:08] That was going to be my suggestion [14:08] any ideas about which one? === lool changed the topic of #ubuntu-arm to: Thumb2 bug squashing party | https://wiki.ubuntu.com/ARM/Thumb2PackageReviewList [14:08] ok lets pick a first mov one [14:08] * asac checks list [14:09] mono ! :) [14:09] first in list is djvulibre [14:09] maybe start with something simple? [14:09] djvulibre looks like it was a simple one [14:09] yeah [14:09] * ogra wasnt serious with mono :) [14:09] ok everony get the source ;) [14:10] so how do we find the right places? [14:10] grep ? [14:10] mono comes later :) [14:11] *shudder* [14:11] djvulibre-3.5.22$ grep -r mov * | pastebinit [14:11] http://pastebin.com/f55740dea [14:11] and mono jit? :) [14:11] guess that grep can be tweaked [14:12] so is this a mov only problem or does that include mov's such as movq? [14:12] grep -R " mov " * ? [14:12] grep -R "mov " * [14:13] yeah [14:13] 7 occurances [14:13] So we're just looking at ZPCodec.cpp and MMX.cpp [14:13] And GThreads.cpp? [14:13] Can we ignore MMX.cpp, under the assumption that we're not going to take that codepath for HW that doesn't declare MMX? [14:13] * persia doesn't see GThreads.cpp from ogra's grep. [14:13] so no mov's that use the sp [14:14] sorry pc [14:14] grep -r mov.*pc * [14:14] libdjvu/GThreads.cpp: "mov%?\t%|pc, %1" // branch to address %1 [14:14] * dmart was distracted, back now === lool changed the topic of #ubuntu-arm to: Thumb2 bug squashing party | https://wiki.ubuntu.com/ARM/Thumb2PackageReviewList | https://wiki.ubuntu.com/ARM/Thumb2PortingHowto [14:15] so the GThreads.cpp seems to be right match? [14:15] dmart: ? [14:16] To find the occurrences, it's probably a good idea to look at the original grep list [14:16] https://wiki.ubuntu.com/ARM/Thumb2PackageReviewList?action=AttachFile&do=get&target=search-arm-mov.filt.gz [14:16] (linked from https://wiki.ubuntu.com/ARM/Thumb2PackageReviewList) [14:17] GThreads.cpp is indeed the location of the hit we got. [14:17] So GThreads is the only issue, and we can ignore ZPCodec.cpp as well? [14:17] asac: it's a mov pc, someregister op...a candidate for bx? [14:17] grep djvulibre * [14:17] /var/cache/debmirror/pool/main/d/djvulibre/djvulibre_3.5.22-1ubuntu2.dsc [14:17] ./djvulibre-3.5.22/libdjvu/GThreads.cpp: "mov%?\t%|pc, %1" // branch to address %1 [14:17] persia: only stuff that messes with "pc" is relevant from what i understood [14:17] dyfet: would you like to suggest a fix? ;) [14:18] Well, it may not expand to a simple fix because the actual mov might be a movl, etc... [14:18] movl? [14:19] The closest relevant fix might be using a string constant, and maybe #ifdef (___ARM_ARCH_4T__) || defined (__ARM_ARCH_4__) [14:19] #define ARM_MOVPC "mov%?\t%|pc, %1" [14:19] #else [14:20] #define ARM_MOVPC "bx%? , %1" ??? well, its hard to say how this expands exactly [14:21] What did you mean by movl? This doesn't mean anything to me (at least for arm) [14:21] Sorry, I meant the mov may not be for pc since it seems like some conditional substitution....thats why I am uncertain [14:22] oooh, that's a new one on me. What does %? do in gcc asm? [14:23] Yea that is what I was wondering... [14:23] A good first step could be a stick a #error in there and build (since the code depends on -DCOTHREAD_UNTESTED, which might not be defined in our build?) [14:24] http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html [14:24] AT&T Code ... heh [14:24] i dont see anything about %? [14:25] can't find it; maybe it adds the right AT&T operand size suffix. That wouldn't apply to ARM, but then %? is only present in the ARM version. [14:25] weird [14:26] yeah. lets ignore that [14:26] Then I think the simplest case is we want effectively a "bx %1"... [14:27] thats the obvious idea [14:27] what does the |pc mean? [14:27] yeah [14:28] Dunno! I'll see if I can find out from anyone here. [14:28] its probably %| [14:29] asac: I read the original as effectively reducing to "mov pc, %1" but yea, I wondered about that too [14:29] right [14:29] It might be the case that GCC can substitute condition codes for %? [14:29] but it's no documented if so [14:29] But is it even a valid code path? Its tied to COTHREAD_UNTESTED being defined... [14:29] indeed [14:29] I think the best thing iintially is [14:29] #ifdef __thumb__ [14:30] #error "Needs porting to Thumb-2" [14:30] #endif [14:30] Yes, lets see if it even builds that path first :) [14:30] If this doesn't ftbfs, then someone can worry about it later :) [14:30] dmart: agreed [14:30] dyfet: ok want to create the diff for the file ... and i just upload ;)? [14:31] well, we have the other mov's to look at too :) [14:31] we will see if it fails then in a bit [14:31] OK [14:31] dyfet: that was the only mov [14:31] hold on [14:31] sure [14:31] * asac waits [14:31] dyfet, only "mov, pc" [14:31] mov.*pc [14:32] true....but then if its not explored, there must be another reason for the ftbfs :) [14:33] http://pastebin.ubuntu.com/373995/ [14:33] dyfet: it currently ftbfs? [14:33] hmmm, guess we should look at the log [14:33] And since the end of it reaches a #error if none of the paths are explored, it has to be here...but yes, let's look at the log [14:33] dyfet: I don't see it at http://qa.ubuntuwire.com/ftbfs/ [14:34] dmart: right. i wanted dyfet to produce that ... but ok ;) ... let me upload [14:34] Um, should we not try a local build first to make sure that fixes it? [14:35] persia, queue is empty [14:35] persia: its not a fix, its just a warning in case that code path is taken [14:35] doing one, but it may take some minutes [14:35] I am going to try a local build quickly... [14:35] (or so I understand) [14:35] we can play with the buildds unless they are busy === JamieBen1ett is now known as JamieBennett [14:35] JamieBennett: Right: it's that I don't tend to like to generate lots of archive churn when it might fail :) [14:36] Our first priority is to get everything building and working in lucid. Fixing code paths which are not built is nice to have, but putting a #error bomb is a reasonable way of helping ensure it gets fixed at the appropriate time [14:36] dmart: I think that code path has to be built, otherwise it would fall into a default #error after that section [14:37] ...unless the package is built with -DTHREADMODEL=NOTHREADS [14:37] ok can we use a pastebin != ubuntu? [14:37] Hmm...we could also do that :) [14:38] asac: Why? [14:38] thats just annoying. you cant wget the plain text because of openid [14:38] any suggestions? [14:38] just pastebin.com [14:38] * persia thought that was fixed, but tends to have trouble parsing other pastebins [14:38] dmart: debian's work [14:38] alias debian-paste='pastebinit -b http://paste.debian.net' [14:38] every pastebin works ... just paste.ubuntu.com is broken [14:38] \o/ :) [14:38] i already kicked #is for that ... seems they didnt listen [14:38] * asac does that again [14:38] persia: It got fixed and borken a couple of days later sadly [14:39] asac: It was fixed for a day or two [14:39] I don't know the answer to thathttp://paste.debian.net/59542/ [14:39] oops [14:39] http://paste.debian.net/59542/ [14:39] That's one I can parse cleanly :) [14:40] dmart: thanks. i did it manually now [14:40] uploaded [14:41] /bin/bash ../libtool --mode=compile g++ -DHAVE_CONFIG_H -I.. -I. -Wall -g -O2 -pthread -DTHREADMODEL=POSIXTHREADS -c GThreads.cpp [14:41] g++ -DHAVE_CONFIG_H -I.. -I. -Wall -g -O2 -pthread -DTHREADMODEL=POSIXTHREADS -c GThreads.cpp -fPIC -DPIC -o .libs/GThreads.o [14:41] In file included from DjVuMessageLite.h:74, [14:41] from GThreads.cpp:76: [14:41] GString.h:745: note: the mangling of 'va_list' has changed in GCC 4.4 [14:41] g++ -DHAVE_CONFIG_H -I.. -I. -Wall -g -O2 -pthread -DTHREADMODEL=POSIXTHREADS -c GThreads.cpp -o GThreads.o >/dev/null 2>&1 [14:41] File seemed to build OK [14:42] So we conclude that this code path is never exercised, and just leave the comment as a note? [14:42] i uploaded the patch that would catch it for __thumb__ [14:42] thats ok imo [14:43] As it turns out, yes :) [14:43] If it's considered OK to add #error (provided it's for a case we know definitely won't work) [14:43] we should upstream that or suggest the right way ... e.g. bx [14:43] yes, it might be a good idea to make the comment clearer [14:43] dmart: i think for cases where we cant try the code path its ok to use #error ... otherwise we should obviously fix it [14:44] next package ? [14:44] I'm perfectly happy to use #error as a base of test builds, and if we don't hit the code path, replace with a useful comment. [14:44] gmp seems small [14:44] Probably worth discussing this one a bit further first [14:45] persia: Why is a comment (which will go unnoticed) better than #error (which won't) [14:45] well, what if we hit it and have no solution ? [14:45] i think #error is fine. we should upstream that so they know [14:45] hope for upstream ? [14:45] #error potentially saves someone a lot of debugging [14:45] ogra: we would have a solution. but we cant test it because the code is not used [14:45] dmart: I want *both* the comment and the #error : the #error to force it not working if the codepath is hit, and the comment to tell someone why we added that patch. [14:45] so should we add something untested? or just ad an error [14:46] Oh, OK. Yes adding extra explanation in a comment is of course a very good idea :) [14:46] persia: right. thats what we did [14:46] we can improve the comment on next one though [14:46] +#ifdef __thumb__ [14:46] +#error "This code needs some porting to work correctly in Thumb." [14:46] +#endif [14:46] maybe point to the porting page [14:46] good idea [14:46] anyway. lets move on [14:46] gmp ;) [14:46] Since djvulibre is a simple example, I think it's worth discussing how we would fix it (if we needed to) [14:47] Someone suggested bx [14:47] dmart: yes :) [14:47] dyfet, did [14:47] #define ARM_MOVPC "bx%? , %1" [14:47] ... so far so good, but it's worth taking a step back and looking at the context of this code so we are sure we're doing the right thing [14:48] Well, I was not sure what the %? was about....but essentially something like that... [14:48] "mov%?\t%|pc, %1" // branch to address %1 [14:48] so it uses that to branch to %1 ... which is .... hmm [14:48] I _think_ we could pretend the %? is not there. I can't think of anything vital that it would do. [14:49] but best not to alter that aspect of the code in the fix in case it matters [14:49] scrolling up a bit [14:49] static void [14:49] mach_start(mach_state *st1, void *pc, char *stacklo, char *stackhi) [14:50] Scrolling up a bit more, mach_state contains a jmp_buf [14:50] So this looks like a long jump / thread starting function if some sort. [14:51] Yes, a funny kind of procedure call to start a thread.... [14:51] %1 is the argument pc, which is just a pointer [14:52] But it's not a function pointer which is slightly suspicious [14:52] ...because it could be passed a pointer to some data (containing run-time generated code) [14:52] dmart: its a func pointer [14:53] just not declared explicitly [14:53] mach_start(&st1, (void*)th2relay, stack, stack+sizeof(stack)); [14:53] void th2relay() { [14:53] certainly that's the likely case --- I was just going to suggest seeing how it's called, but you beat me to it :) [14:53] and pc is the second argument [14:54] ok lets grep for mor mach_start ;) [14:54] the other is startone [14:54] line 950 [14:54] which is also a func [14:54] persia: right. thats the function where the asm code is in [14:54] we are looking for callers now to see if its always a func [14:55] so ... based on that is bx %1 still the right thing? [14:55] After a couple of examples, we can be reasonably confident, since passing a function is certainly how we would expect a thread start func to be used. [14:56] right [14:56] but I just wanted to highlight the issue [14:56] Oh, btw: [14:56] %? - condition code used only in conditional execution. [14:56] %| - some kind of register prefix and legacy assemblers. Largely irrelevant today. [14:56] it was a good educational example :) [14:56] dmart: where did you find that? [14:57] Um, our tools guys here ;) I'll try and get it merged in the docs if it's not upstream [14:57] ok good. so are we confident enough to replace the error with bx %1? or want to keep the error as its not used? [14:58] I think we should keep the error, but maybe add a comment suggesting bx %1 : we can't test the codepath, so we have no way of knowing if our solution works. [14:58] before that, I was going to talk about what would happen if we were passed a data pointer here [14:58] Given that it's already uploaded, I think we should leave it alone. [14:58] Maybe someone wants to guess? [14:58] ok [14:59] dmart: bad things [14:59] dmart: trying to call in data memory [14:59] :) [14:59] exploitable [14:59] But what if the data is code? Maybe the caller created a trampoline sequence. (GCC does this internally for some things) [15:00] then it just runs that code? [15:00] or is there some protection stuff going on? [15:00] well, you need to synchronise and data and instruction caches and flush the pipeline, so that the code executed is what you wrote. [15:01] This is what the GCC builtin __clear_cache is for (look at the docs) [15:01] ...however, this is not a Thumb-2 specific issue, so we would not expect to need to fix that if it already worked in ARM. [15:01] oh cool. so i assume those steps are generated at each "real" function started by gcc? [15:02] Well, the kernel always does this when paging in an executable page [15:02] So for the text sections of programs and libraries, you never need to worry. [15:03] Only self-modifying code or programs which generate code at runtime need to be concerned about this. [15:03] ok good info. thanks [15:03] ok move on to gmp? [15:03] There certainly were some packages like that in the list... [15:03] still wanted to make one more point: [15:03] erlang was marked as "potentially creating code" [15:03] sure go ahea [15:03] d [15:04] JITs, VMs, interpreters etc. should be treated with extra care for these reasons. [15:04] ... [15:04] anyway, a non-Thumb aware program which generates code an runtime probably generates ARM instruction encodings (not Thumb) [15:05] right [15:06] Such packages may need extra attention. Especially if the generated code may be called by other random (probably Thumb-2) code, or calls out to other functions (also probably Thumb-2) ... it's unlikely to work out of the box [15:06] Anyway, enough on that for now, until we find a real instance ;) [15:06] maybe mono ;) [15:06] *shudder* [15:07] ok so gmp? [15:07] Going back to the suggestion of how to fix djvulibre [15:07] ;) [15:07] hehe [15:07] endles story it seems [15:07] (I know, nearly finished!) [15:07] (but good to have all details first) [15:07] ... we're just trying to jump to a passed function pointer [15:07] * persia likes the long explanation, having not much prior understanding [15:08] ack [15:08] * ogra too [15:08] I thought this would be a good idea --- the wiki page has lots of details, but may not be so easy to understand as an example [15:09] Anyway, BX is definitely the right way to do jump to a function pointer where we don't expect to return. [15:09] So adding a comment to this effect would be a good idea, something like [15:10] /* instead of "mov pc, ", "bx " should be used on ARMv5 and above */ [15:11] ok let me add that too and upload ... next time i will wait longer ;) [15:11] sorry! [15:11] dmart: No need to apologies. asac is just impatient :) [15:11] I'm sure I can think of something else to add when you're done ;) [15:12] We could add the wiki link for completeness [15:12] #ifdef __thumb__ [15:12] /* instead of "mov pc, ", "bx " should be used on ARMv5 and above */ [15:12] #error "This code needs some porting to work correctly in Thumb: https://wiki.ubuntu.com/ARM/Thumb2PortingHowto" [15:12] #endif [15:12] thats what i have now ;) [15:12] are we happy with that? [15:12] cool, looks good [15:12] Seems sufficiently complete. [15:12] Of course, it might have been quicker just to fix it :P but it helps to educate more people this way. [15:13] itsw really good ... especially since i know that at least persia is eager to work on these things ;) [15:14] dmart: The risk with fixing it is that we can't test the code path, so we have no way to know if the "fix" worked. [15:14] * dmart spies a volunteer [15:14] * persia doesn't really know assembler, and will be slow, but willing [15:14] agreed, it's better not to commit anything we can't test [15:14] only joking [15:14] dyfet is definitly a senior volunteer ... [15:14] * asac goes with persia [15:14] anyway [15:15] so thanks. do we want to look at a second package now? [15:15] Generally best to stay out of assembler as much as possible (it would certainly make this porting job easier) [15:15] Yes, if people want to grab that I'll just fetch a quick cuppa [15:15] well, in gmp, we have a function return in mpn/arm/copyi/d.asm, and in udiv.asm we find mov pc, lr also...at least to start with :) [15:17] mov's in copyd, udiv and copyi [15:17] * JamieBennett goes to get a coffee [15:18] copyd.asm looks like a copy paste job from the wiki :) [15:18] and copyi.asm... [15:18] yeah, its the same [15:19] all three actually [15:19] so who wants to prepare a patch suggestion? [15:19] feels like its exactly as on the wiki ;) [15:20] L(return): [15:20] #ifdef __thumb__ [15:20] bx lr [15:20] #else [15:20] mov pc, lr [15:20] #endif [15:20] dyfet: on the wiki it uses something else for ifdef [15:20] Hmmm [15:20] #ifdef (___ARM_ARCH_4T__) || defined (__ARM_ARCH_4__) [15:20] ... [15:20] #else [15:20] These are not C files [15:20] "bx lr" [15:20] oh right ;) [15:21] Separate assembler files are a bit of a different animal [15:21] how annoying [15:21] Yes, that's right... [15:21] yeah, no ifdef i guess ? [15:21] whats the best way to do this if we dont want to do a full copy? [15:22] well, unless you want to use cpp in front of it, ogra :) [15:22] For assembler files which are preprocessed by the C preprocessor (.S) you can use ifdef in the normal way [15:22] But it looks like these are processed by m4 [15:22] So we probably need to get a configure argument passed in somehow [15:23] nice [15:24] lovely [15:24] And then use a .ifdef, .else,.endif [15:24] * dmart knows nothing about m4 [15:24] * asac_ had to clone himself [15:25] Assembler macros could work as you suggest [15:25] L(return): [15:25] .ifdef thumb2_config_from_config.m4... [15:25] bx lr [15:25] .else [15:25] mov pc, lr [15:25] .endif [15:25] as a starting point.... [15:25] But there are no magic predefined macros in the assembler to tell you what your build target it. [15:26] yep, something like that [15:26] Yes, so we have to feed it into one of the included files which are generated.... [15:26] Or maybe you could have a common macro somewhere else [15:26] .macro return register:req [15:26] .ifdef [15:26] bx \reg [15:26] .else [15:26] mov pc, \reg [15:26] .fi [15:26] .endm [15:27] Anyway, that should work [15:27] that too would be a good idea.... [15:27] Exactly how to create the configure argument, I'm not sure [15:28] You could preprocess some C with #ifdefs to check the architecture version and look at the output, e.g. [15:28] we have to see how config.m4 is created since it includes it... [15:28] #if defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__) [15:28] use_mov [15:28] #else [15:28] use_bx [15:28] #endif [15:29] acinclude.m4 [15:29] has GMP_INIT [15:30] i think there are various options ... not sure we should discuss them here [15:31] Agreed, I think everyone understands what's needed. [15:31] Once we've done this once, we can reuse the solution if it's needed again. [15:31] lets ask this, is there any other porting issue in gmp other than the mov instructions? [15:31] good question --- we should always take a careful look at any assembler which pops up [15:32] "uses mov; also "add" assumes arm" [15:32] thats the comment we had from review [15:32] yes....thats why I asked :) [15:32] what does add assumes arm mean? dmart ? [15:32] I meant "assumes it's running as ARM instructions and not as Thumb instructions" [15:33] yeah [15:33] There's a bit more info on this on the wiki page at PC and "." arithmetic and position-independent addressing [15:34] But in brief, when you read pc in Thumb, the result is not that same as you'd get if you were executing in ARM. [15:35] ok so we are looking for add.*pc here? [15:35] mpn/arm/invert_limb.asm: add r2, pc, #invtab-.-8 [15:35] That's the one. [15:35] In ARM, when you read PC, you (usually) get the address of the current instruction + 8 [15:35] So this trick gives you the address invtab in r2 [15:36] right [15:36] whats the right way to find a good offset? [15:36] But in Thumb, pc is different. You get
+ 2 or 4 (depending on the alignment of the instruction in memory) [15:37] It is possible to work out the correct offset, but ugly [15:37] ...and you need #ifdefs or other special cases hacks for ARM versus Thumb [15:37] ... [15:37] Fortunately, the assmbler can do it for you [15:38] There's a special pseudo-op to get the address of a nearby label in the text section: [15:38] adr ,