[tlinux-users:08144] Re: New release of omnibook module soon: testing welcome
Holger Nelson <[email protected]>
| Newsgroups | gmane.linux.hardware.toshiba |
|---|---|
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tue, 12 Sep 2006, Mathieu Bérard wrote: > Holger Nelson a écrit : > > Just another typo-fix: > > > > > > > One word: Thanks > One more fix like that an you have SVN commit access. > > Could you please try this and check it doesn't introduce > any regression: It works, but I doubt it does what you really want: The disassembly of your code shows: intel_do_smi_call(): /home/crius/download/xx/xxxx/trunk/nbsmi.c:153 3c2: 89 f0 mov %esi,%eax 3c4: 9c pushf 3c5: 60 pusha 3c6: 66 e7 b2 out %ax,$0xb2 3c9: 66 83 f8 00 cmp $0x0,%ax 3cd: 74 08 je 3d7 <nbsmi_smi_command+0xad> 3cf: c7 44 24 0c fb ff ff movl $0xfffffffb,0xc(%esp) 3d6: ff 3d7: 61 popa 3d8: 9d popf Looking at the stack at 3cf will show something like (I dont know the stack-layout of pusha/popa nor exactly which registers get saved so I just guess as I am to lazy to look it up. ;-) ) esp+0x2c:retval esp+0x28:??? esp:0x24:??? - ---- Flags by pushf: esp+0x20:Flags - ---- Registers by pusha: esp+0x1c:eax esp+0x18:ebx esp+0x14:ecx esp+0x10:edx esp+0x0c:esi esp+0x08:edi esp+0x04:ebp esp+0x02:es esp+0x00:ds So the assembly-Instruction at 3cf will change some register instead if retval. As retval is just a pointer to *retval, you also need to dereference it by something like: lea 0x2c(%esp),%bx mov $0xfffffffb,(%bx) As little proof I modified u32 retval=0; to u32 retval=255; in nbsmi_smi_command and got the expected errors in dmesg: [4350356.495000] omnibook: smi_command failed with error 255. While I am at it another simple fix against R166: As the structs are put on stack we cannot know that they are initialized with 0 so we need to initialize the used fields ourself. - --- orig/nbsmi.c 2006-09-12 03:10:00.000000000 +0200 +++ trunk/nbsmi.c 2006-09-12 12:31:55.000000000 +0200 @@ -428,6 +428,7 @@ static int omnibook_nbsmi_get_wireless(c u8 data; aerial_op.read_addr = SMI_GET_KILL_SWITCH; + aerial_op.read_mask = 0; if((retval = nbsmi_smi_read_command(&aerial_op, &data))) goto out; @@ -475,6 +476,7 @@ static int omnibook_nbmsi_hotkeys_get(co struct omnibook_operation hotkeys_op; hotkeys_op.read_addr = SMI_GET_FN_INTERFACE; + hotkeys_op.read_mask = 0; retval = nbsmi_smi_read_command(&hotkeys_op, &data); if(retval < 0) @@ -529,6 +531,7 @@ static int omnibook_nbmsi_display_get(c struct omnibook_operation display_op; display_op.read_addr = SMI_GET_DISPLAY_STATE; + display_op.read_mask = 0; retval = nbsmi_smi_read_command(&display_op, &data); if(retval < 0) Holger -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) Comment: Made with pgp4pine 1.76 iD8DBQFFBo65V71P2fDJM84RAn0XAKDnJti09pCGdua3OHX5gru/yjZUhACgjDah Jlx5O9tYxDcCIunJ4zq7r54= =8IaS -----END PGP SIGNATURE-----