Re: Xbox Linux kernel for 2.6.21-rc2 working too
"Ronald C.F. Antony" <[email protected]> Sun, 4 Mar 2007 07:25:45 -0500
| Newsgroups | gmane.linux.ports.xbox.devel |
|---|---|
| Message-ID | <[email protected]> |
--===============0372283901== Content-Type: multipart/signed; micalg=sha1; boundary=Apple-Mail-73--717058751; protocol="application/pkcs7-signature" --Apple-Mail-73--717058751 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed On 3 Mar 2007, at 13:21, Ronald C.F. Antony wrote: > So if Linux automatically uses a math processor, if present, unless > told to do so otherwise, then why on the one hand does the arch/ > i386/Makefile specify in the standard kernel the -msoft-float > compiler flag, and why do we bother removing it for the xbox if the > standard kernel decides it's important to have that option? > > I mean, either the kernel does the right thing, even with this > option, and uses the coprocessor if present, or it doesn't. > Somehow, this seems somewhat contradictory to me. > > I then googled on the subject, and found this here: > > http://uwsg.iu.edu/hypermail/linux/kernel/0409.1/2266.html > >> On Wed, Sep 15, 2004 at 02:14:18AM +0600, Denis Zaitsev wrote: >>> Why this kernel is always compiled with the FP emulation for x86? >>> This is the line from the beginning of arch/i386/Makefile: >>> >>> CFLAGS += -pipe -msoft-float >>> >>> And it's hardcoded, it does not depend on CONFIG_MATH_EMULATION. >>> So, >>> is this just a typo or not? >> >> It catches bogus attempts to use floating point in the kernel by >> making them error at link-time. > > So does this mean the kernel is not supposed to use floating point > at all, and the -msoft-float forces the compiled to create > references to libraries, which then aren't linked and hence cause a > link error to catch this problem? > > If so, shouldn't we stop patching this, and leave the -msoft-float > compiler flag where it is and reduce the size of the xbox-linux > kernel patch a bit? To answer my own question: a) the kernel isn't supposed to use floating point calculations => http://uwsg.iu.edu/hypermail/linux/kernel/0409.1/2534.html To quote: > The problem is that the kernel can't use the FPU. I think this is > because its context is not saved on context switch (userland -> > kernel), so we'd end up messing up the FPU state, and userland > applications would get silly results for calculations with context > switches in between. > > Thus we force gcc to use the library functions for floating point > arith, and since we don't link against gcc's lib, FPU users get a > fancy linker error. > > If you want to use floating point arith inside the kernel, you're > probably wrong wanting it. If you really need it, you can > > a) emulate it using fixed-point math on unsigned long or > b) manually save the FPU state, load your operations into it, operate, > get the results and restore the FPU state. > > I have yet to see someone who really needs to do floating point maths > inside the kernel. b) we DO use floating point in drivers/video/xbox/conexant.c Now if all the other screen drivers can figure out the parameters w/o floating point calcuations, why does the XBOX chip need such tricks? First, all screen dimensions are integer in the first place. Second, even things like clock rates, etc. can be made integer by getting the proper unit e.g. 0.3 seconds are 300ms. If the code were a bit more readable/documented, then I'd take it upon myself to convert that into integer math, but given the potential to fry screens and graphic chips with the wrong data in the registers, that's not something I want to debug without having a clear understanding of what is supposed to be going on. :) The amount and kind of math done in floating point seems trivial, but it's not clear to me what precision is required and what some of these parameters mean, because fields in some structs are not documented, etc. Any takers for either explaining me the details or converting this to integer math? It seems odd that for one such module we run afoul of the rules. Ronald --Apple-Mail-73--717058751 Content-Transfer-Encoding: base64 Content-Type: application/pkcs7-signature; name=smime.p7s Content-Disposition: attachment; filename=smime.p7s MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGSTCCAwIw ggJroAMCAQICEF3Jp0yEGdv1n319+krhAD8wDQYJKoZIhvcNAQEFBQAwYjELMAkGA1UEBhMCWkEx JTAjBgNVBAoTHFRoYXd0ZSBDb25zdWx0aW5nIChQdHkpIEx0ZC4xLDAqBgNVBAMTI1RoYXd0ZSBQ ZXJzb25hbCBGcmVlbWFpbCBJc3N1aW5nIENBMB4XDTA3MDExNTEwNDYyMloXDTA4MDExNTEwNDYy MlowRDEfMB0GA1UEAxMWVGhhd3RlIEZyZWVtYWlsIE1lbWJlcjEhMB8GCSqGSIb3DQEJARYScmNm YUBjdWJpY3VsdW0uY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxtjBtHMQjA4v PSE6LrmTUVjE2WD5BP9cvJ/fMgRcxas4A0Lh569iAxK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N1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNv bmFsIEZyZWVtYWlsIElzc3VpbmcgQ0ECEF3Jp0yEGdv1n319+krhAD8wgYcGCyqGSIb3DQEJEAIL MXigdjBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRk LjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVtYWlsIElzc3VpbmcgQ0ECEF3Jp0yEGdv1 n319+krhAD8wDQYJKoZIhvcNAQEBBQAEggEAOs6LqlDVanSQVRtdq3ynWOv7r/nfMK/6Uw8tFNbU Uj9JLiCgEsBE7Kuy+yFhz+pVzLEqSQwopN/ucOjWzYe7kfTmH8KMbujOzEMGo5U5zo6w1ZIEuw3p rg8EnSyJ7ZGUR9+4JLsTDbXEtS2FZwbqitvBSRT105fCyAjtEsXjtBFpIJ9N7/Wai6H1dEGTV6Y/ 4ztkjolEcOZKNOVH94/AtPyHz/CwiPdNv06+GIJfXpAzZLw/f9LXjF/F7PWRyi1o6ZF3tFTaC63N uHQFZj97b7orIqSC65bdskv64E0XSs/+qfNO7IVA9G9B1rRJGFeb6PeAR0Y4GAFibOSb56FozAAA AAAAAA== --Apple-Mail-73--717058751-- --===============0372283901== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV --===============0372283901== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xbox-linux-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/xbox-linux-devel --===============0372283901==--