[haiku-development] Re: RFC PCI config access API change

  • From: Jérôme Duval <jerome.duval@xxxxxxxxx>
  • To: haiku-development <haiku-development@xxxxxxxxxxxxx>
  • Date: Mon, 24 Jun 2013 00:15:01 +0200

2013/6/23 Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>:
> On 06/21/2013 09:18 PM, Jérôme Duval wrote:
>>
>> For compatibility, we could also introduce a new bus_managers/pci/v2
>> interface, or extend the current with new functions.
>> A function find_pci_extended_capability would be added anyway.
>
>
> I may be mistaken, but AFAIR this change should not hurt compatibility, as
> the arguments are usually 4 bytes large in any case. It might hurt as there
> is no requirement that the upper bits are cleared, but I don't know how GCC2
> handles this case.

Here is what happens on a call in GCC2:

   3582a:       6a 02                   push   $0x2
   3582c:       6a 06                   push   $0x6
   3582e:       31 c0                   xor    %eax,%eax
   35830:       8a 46 06                mov    0x6(%esi),%al
   35833:       50                      push   %eax
   35834:       31 c0                   xor    %eax,%eax
   35836:       8a 46 05                mov    0x5(%esi),%al
   35839:       50                      push   %eax
   3583a:       31 c0                   xor    %eax,%eax
   3583c:       8a 46 04                mov    0x4(%esi),%al
   3583f:       50                      push   %eax
   35840:       e8 f3 b0 ff ff          call   30938 <pci_read_config>

then

00030938 <pci_read_config>:
   30938:       55                      push   %ebp
   30939:       89 e5                   mov    %esp,%ebp
   3093b:       83 ec 14                sub    $0x14,%esp
   3093e:       53                      push   %ebx
   3093f:       e8 00 00 00 00          call   30944 <pci_read_config+0xc>
   30944:       5b                      pop    %ebx
   30945:       81 c3 f8 e4 08 00       add    $0x8e4f8,%ebx
   3094b:       8a 45 0c                mov    0xc(%ebp),%al
   3094e:       88 45 f7                mov    %al,-0x9(%ebp)
   30951:       8a 45 10                mov    0x10(%ebp),%al
   30954:       88 45 f6                mov    %al,-0xa(%ebp)
   30957:       8a 45 14                mov    0x14(%ebp),%al
   3095a:       88 45 f5                mov    %al,-0xb(%ebp)
   3095d:       8a 45 18                mov    0x18(%ebp),%al
   30960:       88 45 f4                mov    %al,-0xc(%ebp)

Arguments are in fact 4 bytes large anyway, the question is as you
evoke how many bytes are written by a push byte operation. From the
IA32 doc, it would be at least 2 (a word or a double word).

>
> Other than that, I wouldn't mind either way you outlined above :-)

OK

Bye,
Jérôme

Other related posts: