DEV9ghzdrk: Either be thread safe in the whole plugin or don't try to at all.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5597 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
ramapcsx2.code 2013-03-19 23:08:29 +00:00
parent 6ac678d34f
commit 2e6917c409
3 changed files with 16 additions and 42 deletions

View File

@ -61,11 +61,6 @@
<Filter>Source Files\ethernet i/o\pcap</Filter> <Filter>Source Files\ethernet i/o\pcap</Filter>
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="DEV9ghzdrk.def">
<Filter>Source Files</Filter>
</None>
</ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="mtfifo.h"> <ClInclude Include="mtfifo.h">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
@ -94,4 +89,9 @@
<Filter>Resource Files</Filter> <Filter>Resource Files</Filter>
</ResourceCompile> </ResourceCompile>
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="DEV9ghzdrk.def">
<Filter>Resource Files</Filter>
</None>
</ItemGroup>
</Project> </Project>

View File

@ -101,19 +101,7 @@ void rx_process(NetPacket* pk)
pbd->ctrl_stat&= ~SMAP_BD_RX_EMPTY; pbd->ctrl_stat&= ~SMAP_BD_RX_EMPTY;
//increase frame count //increase frame count
u8* cntptr=&dev9Ru8(SMAP_R_RXFIFO_FRAME_CNT); dev9Ru8(SMAP_R_RXFIFO_FRAME_CNT)++;
#ifdef WIN_X64
*cntptr++; //no asm inline in x64
#else
__asm
{
//this is silly
mov eax,[cntptr];
lock inc byte ptr [eax]
}
#endif
//spams// emu_printf("Got packet, %d bytes (%d fifo)\n", pk->size,bytes); //spams// emu_printf("Got packet, %d bytes (%d fifo)\n", pk->size,bytes);
_DEV9irq(SMAP_INTR_RXEND,0);//now ? or when the fifo is full ? i guess now atm _DEV9irq(SMAP_INTR_RXEND,0);//now ? or when the fifo is full ? i guess now atm
//note that this _is_ wrong since the IOP interrupt system is not thread safe.. but nothing i can do about that //note that this _is_ wrong since the IOP interrupt system is not thread safe.. but nothing i can do about that
@ -131,15 +119,15 @@ void tx_process()
//spams// printf("tx_process : %d cnt frames !\n",cnt); //spams// printf("tx_process : %d cnt frames !\n",cnt);
// this hack worsens OPL performance. Is it really needed? OPL works fine without. (rama) // this hack worsens OPL performance. Is it really needed? OPL works fine without. (rama)
if (!tx_p_first) //if (!tx_p_first)
{ //{
dev9Ru8(SMAP_R_TXFIFO_FRAME_CNT)=0; // dev9Ru8(SMAP_R_TXFIFO_FRAME_CNT)=0;
tx_p_first=true; // tx_p_first=true;
//THIS IS A HACK.without that the stack wont init, i guess its missing e3/emac emulation .. // //THIS IS A HACK.without that the stack wont init, i guess its missing e3/emac emulation ..
emu_printf("WARN : First packet interrupt hack ..\n"); // emu_printf("WARN : First packet interrupt hack ..\n");
_DEV9irq(SMAP_INTR_RXEND|SMAP_INTR_TXEND|SMAP_INTR_TXDNV,100); // _DEV9irq(SMAP_INTR_RXEND|SMAP_INTR_TXEND|SMAP_INTR_TXDNV,100);
return; // return;
} //}
NetPacket pk; NetPacket pk;
int fc=0; int fc=0;
@ -554,17 +542,7 @@ void CALLBACK smap_write8(u32 addr, u8 value)
DEV9_LOG("SMAP_R_RXFIFO_FRAME_DEC 8bit write %x\n", value); DEV9_LOG("SMAP_R_RXFIFO_FRAME_DEC 8bit write %x\n", value);
dev9Ru8(addr) = value; dev9Ru8(addr) = value;
{ {
u8* cntptr=&dev9Ru8(SMAP_R_RXFIFO_FRAME_CNT); dev9Ru8(SMAP_R_RXFIFO_FRAME_CNT)--;
#ifdef WIN_X64
*cntptr--; //no asm inline in x64
#else
__asm
{
//this is silly
mov eax,[cntptr];
lock dec byte ptr [eax]
}
#endif
} }
return; return;

View File

@ -64,11 +64,7 @@
#define USERMODEDEVICEDIR "\\\\.\\Global\\" #define USERMODEDEVICEDIR "\\\\.\\Global\\"
#define TAPSUFFIX ".tap" #define TAPSUFFIX ".tap"
#ifdef WIN_X64
#define TAP_COMPONENT_ID "tap0901"
#else
#define TAP_COMPONENT_ID "tap0801" #define TAP_COMPONENT_ID "tap0801"
#endif
vector<string>* get_tap_reg () vector<string>* get_tap_reg ()
{ {