void PIC::SLEEP(){ qDebug() << "SLEEP"; //system("pause"); PC(); }
void PIC::NOP(){ qDebug() << "NOP"; qDebug() << regModel->reg[bank][PCL]; PC(); qDebug() << regModel->reg[bank][PCL]; }
void PIC::CLRWDT(){ qDebug() << "CLRWDT"; //wdt = 0x0; PC(); }
Z K2(zsocksend){PC(x); TC(y,-KS); R kj(zsock_send(VSK(x), ys));}
int TFP_Bearing::update() { // opserr << "UPDATE: " << this->getTag() << endln; static Vector delU(4); static Vector delP(4); const Vector &v1 = theNodes[0]->getIncrDisp(); const Vector &v2 = theNodes[1]->getIncrDisp(); double vpi[8]; delU(0)=v1(0); delU(1)=v1(1); delU(2)=v2(0); delU(3)=v2(1); int contC = kt3Drma(vCommit, vpCommit, FrCommit, Ac, PCommit, vpi); // Vector vpiF (vpi,8); // opserr << "delU: " << delU; // opserr << "vpiF: " << vpiF; static Matrix stiffCommit(8,8); stiffCommit = ks; stiffCommit += ksrest; Vector PC(PCommit,4); Vector PT(PTrial, 4); // opserr << "PTrial 1:" << PTrial; delP = kthat*delU; PT = PC; PT += delP; for (int i=0; i<4; i++) UTrial[i] = UCommit[i] + delU(i); static Vector delU58(4); static Vector tmp1(4); tmp1.addMatrixVector(0.0, kei, delU, 1.0); delU58.addMatrixVector(0.0, kee, tmp1, -1.0); static double dvData[8]; static Vector dv(dvData,8); static Vector dFr(8); static Vector tmp2(8); for (int i=0; i<4; i++) { tmp2(i)=delU(i); tmp2(i+4)=delU58(i); } dv = Af * tmp2; // opserr << "dv: " << dv; // Vector vC(vCommit, 8); opserr << "vCommit: " << vC; for (int i=0; i<8; i++) { vTrial[i] = vCommit[i] + dvData[i]; FrTrial[i] = FrCommit[i] + dFr(i); } // Vector vT(vTrial, 8); opserr << "vTrial: " << vT; HTrial = H0 + dh; double vpit[8]; int contT = kt3Drma(vTrial, vpCommit, FrTrial, Ac, PTrial, vpit); // opserr << "vTrial: " << vT; // Vector FT(FrTrial, 8); opserr << "FrTrial: " << FT; // opserr << "Ptrial 2:" << PT; // opserr << "kthat: " << kthat; // Vector vpiO(vpi, 8); opserr << "VPI 0: " << vpiO; static Matrix stiffTrial(8,8); stiffTrial = ks; stiffTrial += ksrest; int subDiv = 0; for (int j=0; j<8; j++) { // j=1:8 int f=(stiffCommit(j,j)*2<stiffTrial(j,j) || stiffCommit(j,j)>2*stiffTrial(j,j)); if (f==1 || contT==1 || contC==1) subDiv=1; } // opserr << "subDIV: " << subDiv << " contT: " << contT << " contC: " << contC << endln; if (subDiv==1) { double dumax = 0.0001; //double dumax = 0.001; double maxDelU = 0.0; for (int i=0; i<4; i++) { double delUi = fabs(delU(i)); // opserr << "delUi: " << delUi << " maxDelU: " << maxDelU << endln; if (delUi > maxDelU) maxDelU = delUi; } int n=ceil(maxDelU/dumax); // opserr << "n: " << n << "maxDelU: " << maxDelU << " dumax: " << dumax << endln; static Vector delu(4); delu = delU; delu /= 1.0*n; // opserr << "delu: " << delu; static double padd[4]; static double uadd[4]; static double Ptemp[4]; static double vadd[8]; static double vpTemp[8]; static double FrTemp[8]; for (int i=0; i<4; i++) { padd[i] = 0.0; uadd[i]=0.0; } for (int i=0; i<8; i++) { vadd[i]=0.0; FrTemp[i]=FrCommit[i]; vpTemp[i] = vpCommit[i]; } for (int j=0; j<n; j++) { for (int i=0; i<4; i++) { vTrial[i] = vCommit[i] + vadd[i]; Ptemp[i] = PCommit[i] + padd[i]; } contT = kt3Drma(vTrial, vpTemp, FrTemp, Ac, Ptemp, vpi); // Vector vpiJ(vpi, 8); opserr << "vpiJ: " << vpiJ; static Vector delp(4); delp.addMatrixVector(0.0, kthat, delu, 1.0); // opserr << "delp: " << delp; for (int i=0; i<4; i++) { padd[i] += delp(i); uadd[i] += delu[i]; } // delu58=-kt(5:8,5:8)^-1*kt(5:8,1:4)*delu; tmp1.addMatrixVector(0.0, kei, delu, 1.0); delU58.addMatrixVector(0.0, kee, tmp1, -1.0); // opserr << "delU58: " << delU58; // dv=Af*[delu;delu58]; static Vector tmp2(8); for (int i=0; i<4; i++) { tmp2(i)=delu[i]; tmp2(i+4)=delU58(i); } dv.addMatrixVector(0.0, Af, tmp2, 1.0); /// opserr << "tmp2: " << tmp2; // opserr << "dv: " << dv; dFr.addMatrixVector(0.0, ksrest, dv, 1.0); for (int i=0; i<8; i++) { vadd[i] += dv(i); vpTemp[i]=vpi[i]; FrTemp[i] = FrTemp[i] + dFr(i); } } for (int i=0; i<8; i++) { FrTrial[i] = FrTemp[i]; vTrial[i] = vCommit[i] + vadd[i]; } for (int i=0; i<4; i++) { PTrial[i] = PCommit[i]+padd[i]; UTrial[i] = UCommit[i]+uadd[i]; vTrial[i] = vCommit[i]+vadd[i]; } } for (int i=0; i<8; i++) { vpTrial[i] = vpi[i]; } HTrial=H0+dh; theMatrix->Zero(); theVector->Zero(); int numD = numDOF/2; for (int i=0; i<2; i++) { (*theVector)(i) = PTrial[i]; (*theVector)(i+numD) = PTrial[i+2]; for (int j=0; j<2; j++) { (*theMatrix)(i,j) = kthat(i,j); (*theMatrix)(i+numD,j+numD) = kthat(i+2,j+2); (*theMatrix)(i+numD,j) = kthat(i+2,j); (*theMatrix)(i,j+numD) = kthat(i,j+2); } } const Vector &d1 = theNodes[0]->getTrialDisp(); const Vector &d2 = theNodes[1]->getTrialDisp(); double axialDefo = d1(2)-d2(2); if (axialDefo >= 0) { (*theMatrix)(2,2) = K; (*theMatrix)(2,2+numD) = -K; (*theMatrix)(2+numD,2) = -K; (*theMatrix)(2+numD,2+numD) = K; double force = axialDefo*K; (*theVector)(2) = force; (*theVector)(2+numD) = -force; Ap = force; } else { double Kmin = K*DBL_EPSILON; (*theMatrix)(2,2) = Kmin; // uisng Kmin to keep system stable (*theMatrix)(2,2+numD) = -Kmin; (*theMatrix)(2+numD,2) = -Kmin; (*theMatrix)(2+numD,2+numD) = Kmin; double force = 0.0; (*theVector)(2) = force; (*theVector)(2+numD) = -force; Ap = force; } return 0; }
Z K2(zsockunbind){PC(x); TC(y,-KS); R kj(zsock_unbind(VSK(x),ys));}
Z K3(zsockattach){PC(x); TC(y,-KS); R kj(zsock_attach(VSK(x),ys, z->g));}
static WRITE16_HANDLER( twrldc94_prot_reg_w ) { prot_reg[1] = prot_reg[0]; prot_reg[0] = data; if( ((prot_reg[1] & 2) == 2) && ((prot_reg[0] & 2) == 0) ) { switch( gametype ) { case 1: switch(mcu_data) { #define NULL_SUB 0x0000828E case 0x53: PC(0x0000a4c); break; // boot -> main loop /* 68 and 62 could be sprite or sound changes, or ? 68(),61() if( !carry ) { 68(),65() } else { 62(),72() } */ case 0x68: PC(NULL_SUB); break; // time up doesn't block long enough for pk shootout case 0x61: PC(0x0003AF4); break; // after time up, pk shootout??? case 0x65: PC(0x0003F26); break; // 62->72 case 0x62: PC(NULL_SUB); break; // after lose shootout, continue ??? case 0x72: PC(0x000409E); break; // game over /* Attract mode is pre programmed loop called from main that runs through top11->demoplay (NOTE: sprites for demo play are being drawn at 0x141000, this address is used in a few places, and there's some activity further up around 0x1410b0.) The loop begins with three prot calls: one always present (may be diversion to 0x0010DC8 unreachable code and prot cases 6a,79,6f) and two alternating calls. The loop is 6e -> [6b|69] -> top11 -> (4 segment)playdemo These are the likely suspects for attract mode: 0x0010E28 red tecmo on black 0x0010EEC bouncing ball and player with game title 0x00117A2 single segment demo play with player sprites at 0x140000 0x001120A sliding display of player photos 0x0010DC8 unreachable code at end of attract loop with cases 6a,79,6f */ case 0x6e: PC(0x0010E28); break; // loop case 0x6b: PC(0x0010EEC); break; // attract even case 0x69: PC(0x001120A); break; // attract odd // In "continue" screen // if( w@FFE078 & 80) 75 // *** after 75 beq case 0x75: PC(NULL_SUB); break; // unreachable code at end of attract loop 6a->79->6f case 0x6a: PC(NULL_SUB); break; case 0x79: PC(NULL_SUB); break; case 0x6f: PC(NULL_SUB); break; default: popmessage("Unknown MCU CMD %04x",mcu_data); PC(NULL_SUB); break; } break; case 2: switch(mcu_data) { case 0x53: PC(0x00000a5c); break; // POST default: popmessage("Unknown MCU CMD %04x",mcu_data); PC(NULL_SUB); break; } break; case 3: switch(mcu_data) { case 0x33: PC(0x00063416); break; // *after game over, is this right? case 0x3d: PC(0x0006275C); break; // after sprite ram init, team select case 0x42: PC(0x0006274E); break; // after press start, init sprite ram case 0x43: PC(0x0006a000); break; // POST case 0x50: PC(0x00001900); break; // enter main loop case 0x65: PC(0x0006532C); break; // results case 0x70: PC(0x00063416); break; // *attract loop ends, what should happen after "standings" display? case 0x74: PC(0x000650D8); break; // after time up, show scores and continue case 0x79: PC(0x0006072E); break; // after select, start match default: popmessage("Unknown MCU CMD %04x",mcu_data); PC(0x00000586); // rts break; } break; } } }
void kcc_drtp_set_value(ST_PACKHEAD *head, ST_PACK *pack,int ids,char *data) { long lv; double dv; #define PC(a) { \ SetParmBit(head,ids);\ kcc_strncpy((char *)pack->a,data,sizeof(pack->a)); \ pack->a[sizeof(pack->a)-1]=0;}//CHAR[] #define PI(a) {\ SetParmBit(head,ids);\ lv=atol(data);\ kcc_memcpy(&pack->a,&lv,sizeof(pack->a));}//INT #define PD(a) {\ SetParmBit(head,ids);\ dv=atof(data);\ kcc_memcpy(&pack->a,&dv,sizeof(pack->a));}//LONG switch(ids) { case F_SCUST_NO: PC(scust_no); break; case F_SCUST_NO2: PC(scust_no2); break; case F_SHOLDER_AC_NO: PC(sholder_ac_no); break; case F_SHOLDER_AC_NO2: PC(sholder_ac_no2); break; case F_SHOLDER_TYPE: PC(sholder_type); break; case F_SHOLDER_TYPE2: PC(sholder_type2); break; case F_SNAME: PC(sname); break; case F_SNAME2: PC(sname2); break; case F_SALL_NAME: PC(sall_name); break; case F_SMARKET_CODE: PC(smarket_code); break; case F_SMARKET_CODE2: PC(smarket_code2); break; case F_SDATE0: PC(sdate0); break; case F_SDATE1: PC(sdate1); break; case F_SDATE2: PC(sdate2); break; case F_SDATE3: PC(sdate3); break; case F_STIME0: PC(stime0); break; case F_STIME1: PC(stime1); break; case F_STIME2: PC(stime2); break; case F_STIME3: PC(stime3); break; case F_LVOL0: PI(lvol0); break; case F_LVOL1: PI(lvol1); break; case F_LVOL2: PI(lvol2); break; case F_LVOL3: PI(lvol3); break; case F_LVOL4: PI(lvol4); break; case F_LVOL5: PI(lvol5); break; case F_LVOL6: PI(lvol6); break; case F_LVOL7: PI(lvol7); break; case F_LVOL8: PI(lvol8); break; case F_LVOL9: PI(lvol9); break; case F_LVOL10: PI(lvol10); break; case F_LVOL11: PI(lvol11); break; case F_LVOL12: PI(lvol12); break; case F_DAMT0: PD(damt0); break; case F_DAMT1: PD(damt1); break; case F_DAMT2: PD(damt2); break; case F_DAMT3: PD(damt3); break; case F_DAMT4: PD(damt4); break; case F_DAMT5: PD(damt5); break; case F_DAMT6: PD(damt6); break; case F_DAMT7: PD(damt7); break; case F_DAMT8: PD(damt8); break; case F_DAMT9: PD(damt9); break; case F_DAMT10: PD(damt10); break; case F_DAMT11: PD(damt11); break; case F_DAMT12: PD(damt12); break; case F_DAMT13: PD(damt13); break; case F_DAMT14: PD(damt14); break; case F_DAMT15: PD(damt15); break; case F_DAMT16: PD(damt16); break; case F_DAMT17: PD(damt17); break; case F_DAMT18: PD(damt18); break; case F_DAMT19: PD(damt19); break; case F_DAMT20: PD(damt20); break; case F_DAMT21: PD(damt21); break; case F_DAMT22: PD(damt22); break; case F_DAMT23: PD(damt23); break; case F_DAMT24: PD(damt24); break; case F_DAMT25: PD(damt25); break; case F_DAMT26: PD(damt26); break; case F_DAMT27: PD(damt27); break; case F_DAMT28: PD(damt28); break; case F_DAMT29: PD(damt29); break; case F_DAMT30: PD(damt30); break; case F_DAMT31: PD(damt31); break; case F_DAMT32: PD(damt32); break; case F_DAMT33: PD(damt33); break; case F_SSTOCK_CODE: PC(sstock_code); break; case F_SSTOCK_CODE2: PC(sstock_code2); break; case F_SCUST_TYPE: PC(scust_type); break; case F_SCUST_TYPE2: PC(scust_type2); break; case F_SSTAT_TYPE: PC(sstat_type); break; case F_SSTAT_TYPE2: PC(sstat_type2); break; case F_SROOM_NO: PC(sroom_no); break; case F_SROOM_NO2: PC(sroom_no2); break; case F_SOPEN_EMP: PC(sopen_emp); break; case F_SCLOSE_EMP: PC(sclose_emp); break; case F_SCHANGE_EMP: PC(schange_emp); break; case F_SCHECK_EMP: PC(scheck_emp); break; case F_SEMP: PC(semp); break; case F_SNATION_CODE: PC(snation_code); break; case F_LCERT_CODE: PI(lcert_code); break; case F_STX_PWD: PC(stx_pwd); break; case F_STX_PWD2: PC(stx_pwd2); break; case F_SWITHDRAW_PWD: PC(swithdraw_pwd); break; case F_SWITHDRAW_PWD2: PC(swithdraw_pwd2); break; case F_SEMP_PWD: PC(semp_pwd); break; case F_SEMP_PWD2: PC(semp_pwd2); break; case F_SBANK_PWD: PC(sbank_pwd); break; case F_SBANK_PWD2: PC(sbank_pwd2); break; case F_SCUST_AUTH: PC(scust_auth); break; case F_SCUST_AUTH2: PC(scust_auth2); break; case F_SCUST_LIMIT: PC(scust_limit); break; case F_SCUST_LIMIT2: PC(scust_limit2); break; case F_LSAFE_LEVEL: PI(lsafe_level); break; case F_LSAFE_LEVEL2: PI(lsafe_level2); break; case F_SPOST_CODE: PC(spost_code); break; case F_SPOST_CODE2: PC(spost_code2); break; case F_SPHONE: PC(sphone); break; case F_SPHONE2: PC(sphone2); break; case F_SPHONE3: PC(sphone3); break; case F_SPAGER: PC(spager); break; case F_SEMAIL: PC(semail); break; case F_SEMAIL2: PC(semail2); break; case F_SNOTE: PC(snote); break; case F_SNOTE2: PC(snote2); break; case F_SCERT_NO: PC(scert_no); break; case F_SCERT_NO2: PC(scert_no2); break; case F_SCERT_ADDR: PC(scert_addr); break; case F_SSTATUS0: PC(sstatus0); break; case F_SSTATUS1: PC(sstatus1); break; case F_SSTATUS2: PC(sstatus2); break; case F_SSTATUS3: PC(sstatus3); break; case F_SSTATUS4: PC(sstatus4); break; case F_LWITHDRAW_FLAG: PI(lwithdraw_flag); break; case F_SADDR: PC(saddr); break; case F_SADDR2: PC(saddr2); break; case F_SSERIAL0: PC(sserial0); break; case F_SSERIAL1: PC(sserial1); break; case F_SSERIAL2: PC(sserial2); break; case F_SSERIAL3: PC(sserial3); break; case F_SSERIAL4: PC(sserial4); break; case F_SCURRENCY_TYPE: PC(scurrency_type); break; case F_SCURRENCY_TYPE2: PC(scurrency_type2); break; case F_SBRANCH_CODE0: PC(sbranch_code0); break; case F_SBRANCH_CODE1: PC(sbranch_code1); break; case F_SBRANCH_CODE2: PC(sbranch_code2); break; case F_USSET0: PC(usset0); break; case F_USSET1: PC(usset1); break; case F_USSET2: PC(usset2); break; case F_USSET3: PC(usset3); break; case F_USSET4: PC(usset4); break; case F_USSET5: PC(usset5); break; case F_USSET6: PC(usset6); break; case F_SSTATION0: PC(sstation0); break; case F_SSTATION1: PC(sstation1); break; case F_SBANK_ACC: PC(sbank_acc); break; case F_SBANK_ACC2: PC(sbank_acc2); break; case F_LBANK_ACC_TYPE: PI(lbank_acc_type); break; case F_LBANK_ACC_TYPE2: PI(lbank_acc_type2); break; case F_SMAIN_FLAG: PC(smain_flag); break; case F_SMAIN_FLAG2: PC(smain_flag2); break; case F_SBANK_CODE: PC(sbank_code); break; case F_SBANK_CODE2: PC(sbank_code2); break; case F_SEMP_NO: PC(semp_no); break; case F_SEMP_NO2: PC(semp_no2); break; case F_DRATE0: PD(drate0); break; case F_DRATE1: PD(drate1); break; case F_LSERIAL0: PI(lserial0); break; case F_LSERIAL1: PI(lserial1); break; case F_SBANKNAME: PC(sbankname); break; case F_SBANKNAME2: PC(sbankname2); break; case F_SCARD0: PC(scard0); break; case F_SCARD1: PC(scard1); break; case F_SORDER0: PC(sorder0); break; case F_SORDER1: PC(sorder1); break; case F_SORDER2: PC(sorder2); break; case F_VSMESS: PC(vsmess); break; case F_SCUSTTYPES: PC(scusttypes); break; case F_SSECTYPES: PC(ssectypes); break; case F_VSVARSTR0: PC(vsvarstr0); break; case F_VSVARSTR1: PC(vsvarstr1); break; case F_VSVARSTR2: PC(vsvarstr2); break; case F_VSVARSTR3: PC(vsvarstr3); break; default: printf("not existed parameter=%d....\n",ids); } }
VOID ARPReceive( PVOID Context, PIP_PACKET Packet) /* * FUNCTION: Receives an ARP packet * ARGUMENTS: * Context = Pointer to context information (IP_INTERFACE) * Packet = Pointer to packet */ { PARP_HEADER Header; IP_ADDRESS SrcAddress; IP_ADDRESS DstAddress; PCHAR SenderHWAddress, SenderProtoAddress, TargetProtoAddress; PNEIGHBOR_CACHE_ENTRY NCE; PNDIS_PACKET NdisPacket; PIP_INTERFACE Interface = (PIP_INTERFACE)Context; ULONG BytesCopied, DataSize; PCHAR DataBuffer; PAGED_CODE(); TI_DbgPrint(DEBUG_ARP, ("Called.\n")); Packet->Header = ExAllocatePoolWithTag(PagedPool, sizeof(ARP_HEADER), PACKET_BUFFER_TAG); if (!Packet->Header) { TI_DbgPrint(DEBUG_ARP, ("Unable to allocate header buffer\n")); Packet->Free(Packet); return; } Packet->MappedHeader = FALSE; BytesCopied = CopyPacketToBuffer((PCHAR)Packet->Header, Packet->NdisPacket, Packet->Position, sizeof(ARP_HEADER)); if (BytesCopied != sizeof(ARP_HEADER)) { TI_DbgPrint(DEBUG_ARP, ("Unable to copy in header buffer\n")); Packet->Free(Packet); return; } Header = (PARP_HEADER)Packet->Header; /* FIXME: Ethernet only */ if (WN2H(Header->HWType) != 1) { TI_DbgPrint(DEBUG_ARP, ("Unknown ARP hardware type (0x%X).\n", WN2H(Header->HWType))); Packet->Free(Packet); return; } /* Check protocol type */ if (Header->ProtoType != ETYPE_IPv4) { TI_DbgPrint(DEBUG_ARP, ("Unknown ARP protocol type (0x%X).\n", WN2H(Header->ProtoType))); Packet->Free(Packet); return; } DataSize = (2 * Header->HWAddrLen) + (2 * Header->ProtoAddrLen); DataBuffer = ExAllocatePool(PagedPool, DataSize); if (!DataBuffer) { TI_DbgPrint(DEBUG_ARP, ("Unable to allocate data buffer\n")); Packet->Free(Packet); return; } BytesCopied = CopyPacketToBuffer(DataBuffer, Packet->NdisPacket, Packet->Position + sizeof(ARP_HEADER), DataSize); if (BytesCopied != DataSize) { TI_DbgPrint(DEBUG_ARP, ("Unable to copy in data buffer\n")); ExFreePool(DataBuffer); Packet->Free(Packet); return; } SenderHWAddress = (PVOID)(DataBuffer); SenderProtoAddress = (PVOID)(SenderHWAddress + Header->HWAddrLen); TargetProtoAddress = (PVOID)(SenderProtoAddress + Header->ProtoAddrLen + Header->HWAddrLen); AddrInitIPv4(&DstAddress, *((PULONG)TargetProtoAddress)); if (!AddrIsEqual(&DstAddress, &Interface->Unicast)) { ExFreePool(DataBuffer); Packet->Free(Packet); return; } AddrInitIPv4(&SrcAddress, *((PULONG)SenderProtoAddress)); /* Check if we know the sender */ NCE = NBLocateNeighbor(&SrcAddress, Interface); if (NCE) { /* We know the sender. Update the hardware address and state in our neighbor address cache */ NBUpdateNeighbor(NCE, SenderHWAddress, 0); } else { /* The packet had our protocol address as target. The sender may want to communicate with us soon, so add his address to our address cache */ NBAddNeighbor(Interface, &SrcAddress, SenderHWAddress, Header->HWAddrLen, 0, ARP_COMPLETE_TIMEOUT); } if (Header->Opcode != ARP_OPCODE_REQUEST) { ExFreePool(DataBuffer); Packet->Free(Packet); return; } /* This is a request for our address. Swap the addresses and send an ARP reply back to the sender */ NdisPacket = PrepareARPPacket( Interface, Header->HWType, /* Hardware type */ Header->ProtoType, /* Protocol type */ (UCHAR)Interface->AddressLength, /* Hardware address length */ (UCHAR)Header->ProtoAddrLen, /* Protocol address length */ Interface->Address, /* Sender's (local) hardware address */ &Interface->Unicast.Address.IPv4Address,/* Sender's (local) protocol address */ SenderHWAddress, /* Target's (remote) hardware address */ SenderProtoAddress, /* Target's (remote) protocol address */ ARP_OPCODE_REPLY); /* ARP reply */ if (NdisPacket) { PC(NdisPacket)->DLComplete = ARPTransmitComplete; (*Interface->Transmit)(Interface->Context, NdisPacket, 0, SenderHWAddress, LAN_PROTO_ARP); } ExFreePool(DataBuffer); Packet->Free(Packet); }
std::vector<Point> DefenceArea::lineIntercepts(const Point& PA, const Point& PB) { std::vector<Point> intercepts; // Check stretch // https://en.wikipedia.org/wiki/Line%E2%80%93line_intersection float x1 = PA.x, y1 = PA.y; float x2 = PB.x, y2 = PB.y; float x3 = FIELD_LENGTH/2 - DEF_AREA_RADIUS - DEF_AREA_TOL, y3 = DEF_AREA_OFFSET; float x4 = FIELD_LENGTH/2 - DEF_AREA_RADIUS - DEF_AREA_TOL, y4 = -DEF_AREA_OFFSET; if (team == OUR_TEAM) { x3 *= -1; x4 *= -1; } float Px_num = (x1*y2 - y1*x2)*(x3 - x4) - (x1 - x2)*(x3*y4 - y3*x4); float Py_num = (x1*y2 - y1*x2)*(y3 - y4) - (y1 - y2)*(x3*y4 - y3*x4); float dem = (x1-x2)*(y3-y4) - (y1-y2)*(x3-x4); if(dem != 0) // Lines are not parallel { // Check if intersection is within stretch float Px = Px_num/dem; float Py = Py_num/dem; if(Py < DEF_AREA_OFFSET && Py > -DEF_AREA_OFFSET) intercepts.push_back(Point(Px, Py)); } // Check top sector // Line info float m = (PA.y - PB.y)/(PA.x - PB.x); float c = PB.y - m*PB.x; // http://math.stackexchange.com/questions/228841/how-do-i-calculate-the-intersections-of-a-straight-line-and-a-circle // Circle info float p = s1.c.x, q = s1.c.y, r = s1.r + DEF_AREA_TOL; // Intersection Equation Variables float A = m*m + 1; float B = 2*(m*c - m*q - p); float C = q*q - r*r + p*p - 2*c*q + c*c; float det = B*B - 4*A*C; if(det >= 0) { float x1 = (-B + sqrt(det))/(2*A); float y1 = m*x1 + c; float x2 = (-B - sqrt(det))/(2*A); float y2 = m*x2 + c; // Check if within correct sector if(team == OUR_TEAM) { Rectangle rec(-HALF_FIELD_LENGTH, DEF_AREA_OFFSET, -HALF_FIELD_LENGTH+DEF_AREA_RADIUS+DEF_AREA_TOL, DEF_AREA_OFFSET+DEF_AREA_RADIUS+DEF_AREA_TOL); // Check if within line segment Point PC(x1,y1); if(rec.contains(PC)) intercepts.push_back(PC); PC = Point(x2,y2); if(rec.contains(Point(x2,y2))) intercepts.push_back(Point(x2, y2)); } else { Rectangle rec(HALF_FIELD_LENGTH-DEF_AREA_RADIUS-DEF_AREA_TOL, DEF_AREA_OFFSET, HALF_FIELD_LENGTH, DEF_AREA_OFFSET+DEF_AREA_RADIUS+DEF_AREA_TOL); // Check if within line segment Point PC(x1,y1); if(rec.contains(PC)) intercepts.push_back(PC); PC = Point(x2,y2); if(rec.contains(PC)) intercepts.push_back(PC); } } // Check bottom sector // http://math.stackexchange.com/questions/228841/how-do-i-calculate-the-intersections-of-a-straight-line-and-a-circle // Circle info p = s2.c.x, q = s2.c.y, r = s2.r+DEF_AREA_TOL; // Intersection Equation Variables A = m*m + 1; B = 2*(m*c - m*q - p); C = q*q - r*r + p*p - 2*c*q + c*c; det = B*B - 4*A*C; if(det >= 0) { float x1 = (-B + sqrt(det))/(2*A); float y1 = m*x1 + c; float x2 = (-B - sqrt(det))/(2*A); float y2 = m*x2 + c; if(team == OUR_TEAM) { Rectangle rec(-HALF_FIELD_LENGTH, -DEF_AREA_OFFSET-DEF_AREA_RADIUS-DEF_AREA_TOL, -HALF_FIELD_LENGTH+DEF_AREA_RADIUS+DEF_AREA_TOL, -DEF_AREA_OFFSET); // Check if within line segment Point PC(x1,y1); if(rec.contains(PC)) intercepts.push_back(PC); PC = Point(x2,y2); if(rec.contains(PC)) intercepts.push_back(PC); } else { Rectangle rec(HALF_FIELD_LENGTH-DEF_AREA_RADIUS-DEF_AREA_TOL, -DEF_AREA_OFFSET-DEF_AREA_RADIUS-DEF_AREA_TOL, HALF_FIELD_LENGTH, -DEF_AREA_OFFSET); // Check if within line segment Point PC(x1,y1); if(rec.contains(PC)) intercepts.push_back(PC); PC = Point(x2,y2); if(rec.contains(PC)) intercepts.push_back(PC); } } return intercepts; }
BOOLEAN ARPTransmit(PIP_ADDRESS Address, PVOID LinkAddress, PIP_INTERFACE Interface) /* * FUNCTION: Creates an ARP request and transmits it on a network * ARGUMENTS: * Address = Pointer to IP address to resolve * RETURNS: * TRUE if the request was successfully sent, FALSE if not */ { PNDIS_PACKET NdisPacket; UCHAR ProtoAddrLen; USHORT ProtoType; TI_DbgPrint(DEBUG_ARP, ("Called.\n")); /* If Address is NULL then the caller wants an * gratuitous ARP packet sent */ if (!Address) Address = &Interface->Unicast; switch (Address->Type) { case IP_ADDRESS_V4: ProtoType = (USHORT)ETYPE_IPv4; /* IPv4 */ ProtoAddrLen = 4; /* Length of IPv4 address */ break; case IP_ADDRESS_V6: ProtoType = (USHORT)ETYPE_IPv6; /* IPv6 */ ProtoAddrLen = 16; /* Length of IPv6 address */ break; default: TI_DbgPrint(DEBUG_ARP,("Bad Address Type %x\n", Address->Type)); DbgBreakPoint(); /* Should not happen */ return FALSE; } NdisPacket = PrepareARPPacket( Interface, WN2H(0x0001), /* FIXME: Ethernet only */ ProtoType, /* Protocol type */ (UCHAR)Interface->AddressLength, /* Hardware address length */ (UCHAR)ProtoAddrLen, /* Protocol address length */ Interface->Address, /* Sender's (local) hardware address */ &Interface->Unicast.Address.IPv4Address,/* Sender's (local) protocol address */ LinkAddress, /* Target's (remote) hardware address */ &Address->Address.IPv4Address, /* Target's (remote) protocol address */ ARP_OPCODE_REQUEST); /* ARP request */ if( !NdisPacket ) return FALSE; ASSERT_KM_POINTER(NdisPacket); ASSERT_KM_POINTER(PC(NdisPacket)); PC(NdisPacket)->DLComplete = ARPTransmitComplete; TI_DbgPrint(DEBUG_ARP,("Sending ARP Packet\n")); (*Interface->Transmit)(Interface->Context, NdisPacket, 0, NULL, LAN_PROTO_ARP); return TRUE; }
ROM_END /****************************************************************************************** Simple protection check concept.The M68k writes a command and the MCU returns the PC at address 0xffc000. The problem is that only the concept is easy,beating this protection requires a good amount of time without a trojan... Misc Notes: -Protection routine is at 0x890 -An original feature of this game is that if you enter into service mode the game gives you the possibility to test various stuff on a pre-registered play such as the speed or the zooming.To use it,you should use Player 2 Start button to show the test screens or to advance into the tests. ******************************************************************************************/ #define PC(_num_)\ m_work_ram[0x000/2] = (_num_ & 0xffff0000) >> 16;\ m_work_ram[0x002/2] = (_num_ & 0x0000ffff) >> 0; WRITE8_MEMBER(gstriker_state::twcup94_prot_reg_w) { m_prot_reg[1] = m_prot_reg[0]; m_prot_reg[0] = data; // Command byte is also written to VS9209 port F, which is set for input only. // Does the MCU somehow strobe it out of there? uint8_t mcu_data = m_work_ram[0x00f/2] & 0x00ff; if( ((m_prot_reg[1] & 4) == 0) && ((m_prot_reg[0] & 4) == 4) ) { switch( m_gametype ) { case TECMO_WCUP94_MCU: switch (mcu_data) { #define NULL_SUB 0x0000828E case 0x53: PC(0x00000A4C); break; // boot -> main loop /* 68 and 62 could be sprite or sound changes, or ? 68(),61() if( !carry ) { 68(),65() } else { 62(),72() } */ case 0x68: PC(NULL_SUB); break; // time up doesn't block long enough for pk shootout case 0x61: PC(0x00003AF4); break; // after time up, pk shootout??? case 0x65: PC(0x00003F26); break; // 62->72 case 0x62: PC(NULL_SUB); break; // after lose shootout, continue ??? case 0x72: PC(0x0000409E); break; // game over /* Attract mode is pre programmed loop called from main that runs through top11->demoplay (NOTE: sprites for demo play are being drawn at 0x141000, this address is used in a few places, and there's some activity further up around 0x1410b0.) The loop begins with three prot calls: one always present (may be diversion to 0x0010DC8 unreachable code and prot cases 6a,79,6f) and two alternating calls. The loop is 6e -> [6b|69] -> top11 -> (4 segment)playdemo These are the likely suspects for attract mode: 0x0010E28 red tecmo on black 0x0010EEC bouncing ball and player with game title 0x00117A2 single segment demo play with player sprites at 0x140000 0x001120A sliding display of player photos 0x0010DC8 unreachable code at end of attract loop with cases 6a,79,6f */ case 0x6e: PC(0x00010E28); break; // loop case 0x6b: PC(0x00010EEC); break; // attract even case 0x69: PC(0x0001120A); break; // attract odd // In "continue" screen // if( w@FFE078 & 80) 75 // *** after 75 beq case 0x75: PC(0x005088); break; // match adder, and check if limit is reached for ending // unreachable code at end of attract loop 6a->79->6f case 0x6a: PC(NULL_SUB); break; case 0x79: PC(NULL_SUB); break; case 0x6f: PC(NULL_SUB); break; default: logerror("Unknown MCU CMD %04x\n",mcu_data); PC(NULL_SUB); break; #undef NULL_SUB } break; // same as above but with +0x10 displacement offsets case TECMO_WCUP94A_MCU: switch (mcu_data) { #define NULL_SUB 0x0000829E case 0x53: PC(0x00000A5C); break; // POST case 0x68: PC(NULL_SUB); break; // time up doesn't block long enough for pk shootout case 0x61: PC(0x00003B04); break; // after time up, pk shootout??? case 0x65: PC(0x00003F36); break; case 0x62: PC(NULL_SUB); break; // after lose shootout, continue ??? case 0x72: PC(0x000040AE); break; // game over case 0x75: PC(0x005098); break; // match adder, and check if limit is reached for ending // attract mode case 0x6e: PC(0x00010E38); break; // loop case 0x6b: PC(0x00010EFC); break; // attract even case 0x69: PC(0x0001121A); break; // attract odd default: logerror("Unknown MCU CMD %04x\n",mcu_data); PC(NULL_SUB); break; #undef NULL_SUB } break; // Variable displacements (newer set?) case TECMO_WCUP94B_MCU: switch (mcu_data) { #define NULL_SUB (0x00830A) case 0x53: PC(0x000a80); break; // POST case 0x68: PC(NULL_SUB); break; // time up doesn't block long enough for pk shootout case 0x61: PC(0x003B72); break; // after time up, pk shootout??? case 0x65: PC(0x003FA4); break; case 0x62: PC(NULL_SUB); break; // after lose shootout, continue ??? case 0x72: PC(0x411C); break; // game over case 0x75: PC(0x5106); break; // match adder, and check if limit is reached for ending // attract mode case 0x6e: PC(0x00010EF0); break; // loop case 0x6b: PC(0x00010FB4); break; // attract even case 0x69: PC(0x000112D2); break; // attract odd default: logerror("Unknown MCU CMD %04x\n",mcu_data); PC(NULL_SUB); break; #undef NULL_SUB } break; case VGOAL_SOCCER_MCU: switch (mcu_data) { case 0x33: PC(0x00063416); break; // *after game over, is this right? case 0x3d: PC(0x0006275C); break; // after sprite ram init, team select case 0x42: PC(0x0006274E); break; // after press start, init sprite ram case 0x43: PC(0x0006a000); break; // POST case 0x50: PC(0x00001900); break; // enter main loop case 0x65: PC(0x0006532C); break; // results case 0x70: PC(0x00063416); break; // *attract loop ends, what should happen after "standings" display? case 0x74: PC(0x000650D8); break; // after time up, show scores and continue case 0x79: PC(0x0006072E); break; // after select, start match default: logerror("Unknown MCU CMD %04x\n",mcu_data); PC(0x00000586); // rts break; } break; } } }
void PrintTickyInfo(void) { // XXX This is only used in commented out or #if FALSE'd out code currently: // unsigned long i; /* XXX These are used only in an #if FALSE block below */ #if FALSE unsigned long tot_allocs = /* total number of things allocated */ ALLOC_FUN_ctr + ALLOC_SE_THK_ctr + ALLOC_UP_THK_ctr + ALLOC_CON_ctr + ALLOC_TUP_ctr + + ALLOC_TSO_ctr + ALLOC_BH_ctr + ALLOC_PAP_ctr + ALLOC_PRIM_ctr ; unsigned long tot_adm_wds = /* total number of admin words allocated */ ALLOC_FUN_adm + ALLOC_THK_adm + ALLOC_CON_adm + ALLOC_TUP_adm + ALLOC_TSO_adm + ALLOC_BH_adm + ALLOC_PAP_adm + ALLOC_PRIM_adm ; unsigned long tot_gds_wds = /* total number of words of ``good stuff'' allocated */ ALLOC_FUN_gds + ALLOC_THK_gds + ALLOC_CON_gds + ALLOC_TUP_gds + ALLOC_TSO_gds + ALLOC_BH_gds + ALLOC_PAP_gds + ALLOC_PRIM_gds ; unsigned long tot_slp_wds = /* total number of ``slop'' words allocated */ ALLOC_FUN_slp + ALLOC_THK_slp + ALLOC_CON_slp + ALLOC_TUP_slp + ALLOC_TSO_slp + ALLOC_BH_slp + ALLOC_PAP_slp + ALLOC_PRIM_slp ; unsigned long tot_wds = /* total words */ tot_adm_wds + tot_gds_wds + tot_slp_wds; #endif unsigned long tot_thk_enters = ENT_STATIC_THK_MANY_ctr + ENT_DYN_THK_MANY_ctr + ENT_STATIC_THK_SINGLE_ctr + ENT_DYN_THK_SINGLE_ctr; unsigned long tot_con_enters = ENT_STATIC_CON_ctr + ENT_DYN_CON_ctr; unsigned long tot_fun_direct_enters = ENT_STATIC_FUN_DIRECT_ctr + ENT_DYN_FUN_DIRECT_ctr; unsigned long tot_ind_enters = ENT_STATIC_IND_ctr + ENT_DYN_IND_ctr; // This is the number of times we entered a function via some kind // of slow call. It amounts to all the slow applications, not // counting those that were to too few arguments. /* XXX This us unused - can we delete it? -- IGL 2008-04-25 unsigned long tot_fun_slow_enters = SLOW_CALL_ctr - SLOW_CALL_FUN_TOO_FEW_ctr - SLOW_CALL_PAP_TOO_FEW_ctr; */ unsigned long tot_known_calls = KNOWN_CALL_ctr + KNOWN_CALL_TOO_FEW_ARGS_ctr + + KNOWN_CALL_EXTRA_ARGS_ctr; unsigned long tot_tail_calls = UNKNOWN_CALL_ctr + tot_known_calls; unsigned long tot_enters = tot_con_enters + tot_fun_direct_enters + tot_ind_enters + ENT_PERM_IND_ctr + ENT_PAP_ctr + tot_thk_enters; unsigned long jump_direct_enters = tot_enters - ENT_VIA_NODE_ctr; unsigned long tot_returns = RET_NEW_ctr + RET_OLD_ctr + RET_UNBOXED_TUP_ctr; unsigned long tot_returns_of_new = RET_NEW_ctr; unsigned long con_updates = UPD_CON_IN_NEW_ctr + UPD_CON_IN_PLACE_ctr; unsigned long pap_updates = UPD_PAP_IN_NEW_ctr + UPD_PAP_IN_PLACE_ctr; unsigned long tot_updates = UPD_SQUEEZED_ctr + pap_updates + con_updates; unsigned long tot_new_updates = UPD_NEW_IND_ctr + UPD_NEW_PERM_IND_ctr; unsigned long tot_old_updates = UPD_OLD_IND_ctr + UPD_OLD_PERM_IND_ctr; unsigned long tot_gengc_updates = tot_new_updates + tot_old_updates; FILE *tf = RtsFlags.TickyFlags.tickyFile; /* If tf = NULL, that means the user passed in stderr for the ticky stats file. According to a comment in RtsFlags.c, this means to use debugBelch to print out messages. But this function prints out a lot of stuff so in order to avoid changing a lot of code, we just dump the same output to stderr (for now). */ if( tf == NULL ) tf = stderr; /* krc: avoid dealing with this just now */ #if FALSE fprintf(tf,"\n\nALLOCATIONS: %ld (%ld words total: %ld admin, %ld goods, %ld slop)\n", tot_allocs, tot_wds, tot_adm_wds, tot_gds_wds, tot_slp_wds); fprintf(tf,"\t\t\t\ttotal words:\t 2 3 4 5 6+\n"); #define ALLOC_HISTO_MAGIC(categ) \ (PC(INTAVG(ALLOC_##categ##_hst[0], ALLOC_##categ##_ctr))), \ (PC(INTAVG(ALLOC_##categ##_hst[1], ALLOC_##categ##_ctr))), \ (PC(INTAVG(ALLOC_##categ##_hst[2], ALLOC_##categ##_ctr))), \ (PC(INTAVG(ALLOC_##categ##_hst[3], ALLOC_##categ##_ctr))), \ (PC(INTAVG(ALLOC_##categ##_hst[4], ALLOC_##categ##_ctr))) fprintf(tf,"%11ld (%5.1f%%) function values", ALLOC_FUN_ctr, PC(INTAVG(ALLOC_FUN_ctr, tot_allocs))); if (ALLOC_FUN_ctr != 0) fprintf(tf,"\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(FUN)); fprintf(tf,"\n%11ld (%5.1f%%) thunks", ALLOC_SE_THK_ctr + ALLOC_UP_THK_ctr, PC(INTAVG(ALLOC_SE_THK_ctr + ALLOC_UP_THK_ctr, tot_allocs))); #define ALLOC_THK_ctr (ALLOC_UP_THK_ctr + ALLOC_SE_THK_ctr) /* hack to make ALLOC_HISTO_MAGIC still work for THK */ if ((ALLOC_SE_THK_ctr + ALLOC_UP_THK_ctr) != 0) fprintf(tf,"\t\t\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(THK)); #undef ALLOC_THK_ctr fprintf(tf,"\n%11ld (%5.1f%%) data values", ALLOC_CON_ctr, PC(INTAVG(ALLOC_CON_ctr, tot_allocs))); if (ALLOC_CON_ctr != 0) fprintf(tf,"\t\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(CON)); fprintf(tf,"\n%11ld (%5.1f%%) big tuples", ALLOC_TUP_ctr, PC(INTAVG(ALLOC_TUP_ctr, tot_allocs))); if (ALLOC_TUP_ctr != 0) fprintf(tf,"\t\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(TUP)); fprintf(tf,"\n%11ld (%5.1f%%) black holes", ALLOC_BH_ctr, PC(INTAVG(ALLOC_BH_ctr, tot_allocs))); if (ALLOC_BH_ctr != 0) fprintf(tf,"\t\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(BH)); fprintf(tf,"\n%11ld (%5.1f%%) prim things", ALLOC_PRIM_ctr, PC(INTAVG(ALLOC_PRIM_ctr, tot_allocs))); if (ALLOC_PRIM_ctr != 0) fprintf(tf,"\t\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(PRIM)); fprintf(tf,"\n%11ld (%5.1f%%) partial applications", ALLOC_PAP_ctr, PC(INTAVG(ALLOC_PAP_ctr, tot_allocs))); if (ALLOC_PAP_ctr != 0) fprintf(tf,"\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(PAP)); fprintf(tf,"\n%11ld (%5.1f%%) thread state objects", ALLOC_TSO_ctr, PC(INTAVG(ALLOC_TSO_ctr, tot_allocs))); if (ALLOC_TSO_ctr != 0) fprintf(tf,"\t\t%5.1f %5.1f %5.1f %5.1f %5.1f", ALLOC_HISTO_MAGIC(TSO)); fprintf(tf,"\n"); fprintf(tf,"\nTotal storage-manager allocations: %ld (%ld words)\n\t[%ld words lost to speculative heap-checks]\n", ALLOC_HEAP_ctr, ALLOC_HEAP_tot, ALLOC_HEAP_tot - tot_wds); #endif /* FALSE */ fprintf(tf,"\nSTACK USAGE:\n"); /* NB: some bits are direction sensitive */ fprintf(tf,"\nENTERS: %ld of which %ld (%.1f%%) direct to the entry code\n\t\t [the rest indirected via Node's info ptr]\n", tot_enters, jump_direct_enters, PC(INTAVG(jump_direct_enters,tot_enters))); fprintf(tf,"%11ld (%5.1f%%) thunks\n", tot_thk_enters, PC(INTAVG(tot_thk_enters,tot_enters))); fprintf(tf,"%11ld (%5.1f%%) data values\n", tot_con_enters, PC(INTAVG(tot_con_enters,tot_enters))); fprintf(tf,"%11ld (%5.1f%%) normal indirections\n", tot_ind_enters, PC(INTAVG(tot_ind_enters,tot_enters))); fprintf(tf,"%11" FMT_Int " (%5.1f%%) permanent indirections\n", ENT_PERM_IND_ctr, PC(INTAVG(ENT_PERM_IND_ctr,tot_enters))); fprintf(tf,"\nFUNCTION ENTRIES: %ld\n", tot_fun_direct_enters); fprintf(tf, "\nTAIL CALLS: %ld, of which %ld (%.lf%%) were to known functions\n", tot_tail_calls, tot_known_calls, PC(INTAVG(tot_known_calls,tot_tail_calls))); fprintf(tf, "\nSLOW APPLICATIONS: %" FMT_Int " evaluated, %" FMT_Int " unevaluated\n", SLOW_CALL_ctr, SLOW_CALL_UNEVALD_ctr); fprintf(tf, "\n"); fprintf(tf, " Too few args Correct args Too many args\n"); fprintf(tf, " FUN %8" FMT_Int " %8" FMT_Int " %8" FMT_Int "\n", SLOW_CALL_FUN_TOO_FEW_ctr, SLOW_CALL_FUN_CORRECT_ctr, SLOW_CALL_FUN_TOO_MANY_ctr); fprintf(tf, " PAP %8" FMT_Int " %8" FMT_Int " %8" FMT_Int "\n", SLOW_CALL_PAP_TOO_FEW_ctr, SLOW_CALL_PAP_CORRECT_ctr, SLOW_CALL_PAP_TOO_MANY_ctr); fprintf(tf, "\n"); fprintf(tf,"\nRETURNS: %ld\n", tot_returns); fprintf(tf,"%11ld (%5.1f%%) from entering a new constructor\n\t\t [the rest from entering an existing constructor]\n", tot_returns_of_new, PC(INTAVG(tot_returns_of_new,tot_returns))); /* krc: comment out some of this stuff temporarily */ /* fprintf(tf, "\nRET_NEW: %11ld: ", RET_NEW_ctr); for (i = 0; i < 9; i++) { fprintf(tf, "%5.1f%%", PC(INTAVG(RET_NEW_hst[i],RET_NEW_ctr))); } fprintf(tf, "\n"); fprintf(tf, "RET_OLD: %11ld: ", RET_OLD_ctr); for (i = 0; i < 9; i++) { fprintf(tf, "%5.1f%%", PC(INTAVG(RET_OLD_hst[i],RET_OLD_ctr))); } fprintf(tf, "\n"); fprintf(tf, "RET_UNBOXED_TUP: %11ld: ", RET_UNBOXED_TUP_ctr); for (i = 0; i < 9; i++) { fprintf(tf, "%5.1f%%", PC(INTAVG(RET_UNBOXED_TUP_hst[i], RET_UNBOXED_TUP_ctr))); } fprintf(tf, "\n"); */ fprintf(tf,"\nUPDATE FRAMES: %" FMT_Int " (%" FMT_Int " omitted from thunks)", UPDF_PUSHED_ctr, UPDF_OMITTED_ctr); fprintf(tf,"\nCATCH FRAMES: %" FMT_Int "", CATCHF_PUSHED_ctr); if (UPDF_RCC_PUSHED_ctr != 0) fprintf(tf,"%11" FMT_Int " restore cost centre frames (%" FMT_Int " omitted)\n", UPDF_RCC_PUSHED_ctr, UPDF_RCC_OMITTED_ctr); fprintf(tf,"\nUPDATES: %ld\n", tot_updates); fprintf(tf,"%11ld (%5.1f%%) data values\n\t\t [%" FMT_Int " in place, %" FMT_Int " allocated new space]\n", con_updates, PC(INTAVG(con_updates,tot_updates)), UPD_CON_IN_PLACE_ctr, UPD_CON_IN_NEW_ctr); fprintf(tf,"%11ld (%5.1f%%) partial applications\n\t\t [%" FMT_Int " in place, %" FMT_Int " allocated new space]\n", pap_updates, PC(INTAVG(pap_updates,tot_updates)), UPD_PAP_IN_PLACE_ctr, UPD_PAP_IN_NEW_ctr); fprintf(tf,"%11" FMT_Int " (%5.1f%%) updates by squeezing\n", UPD_SQUEEZED_ctr, PC(INTAVG(UPD_SQUEEZED_ctr, tot_updates))); /* krc: also avoid dealing with this for now */ #if FALSE fprintf(tf, "\nUPD_CON_IN_NEW: %11ld: ", UPD_CON_IN_NEW_ctr); for (i = 0; i < 9; i++) { fprintf(tf, "%11ld", UPD_CON_IN_NEW_hst[i]); } fprintf(tf, "\n"); fprintf(tf, "UPD_CON_IN_PLACE: %11ld: ", UPD_CON_IN_PLACE_ctr); for (i = 0; i < 9; i++) { fprintf(tf, "%11ld", UPD_CON_IN_PLACE_hst[i]); } fprintf(tf, "\n"); fprintf(tf, "UPD_PAP_IN_NEW: %11ld: ", UPD_PAP_IN_NEW_ctr); for (i = 0; i < 9; i++) { fprintf(tf, "%11ld", UPD_PAP_IN_NEW_hst[i]); } fprintf(tf, "\n"); #endif if (tot_gengc_updates != 0) { fprintf(tf,"\nNEW GEN UPDATES: %9ld (%5.1f%%)\n", tot_new_updates, PC(INTAVG(tot_new_updates,tot_gengc_updates))); fprintf(tf,"OLD GEN UPDATES: %9ld (%5.1f%%)\n", tot_old_updates, PC(INTAVG(tot_old_updates,tot_gengc_updates))); } printRegisteredCounterInfo(tf); fprintf(tf,"\n**************************************************\n"); /* here, we print out all the raw numbers; these are really more useful when we want to snag them for subsequent rdb-etc processing. WDP 95/11 */ #define PR_CTR(ctr) \ do { fprintf(tf,"%11" FMT_Int " " #ctr "\n", ctr); } while(0) /* COND_PR_CTR takes a boolean; if false then msg is the printname rather than ctr */ #define COND_PR_CTR(ctr,b,msg) \ if (b) { fprintf(tf,"%11" FMT_Int " " #ctr "\n", ctr); } else { fprintf(tf,"%11" FMT_Int " " msg "\n", ctr); } #define PR_HST(hst,i) \ do { fprintf(tf,"%11ld " #hst "_" #i "\n", hst[i]); } while(0) ALLOC_HEAP_ctr = (StgInt)ALLOC_HEAP_ctr + (StgInt)ALLOC_RTS_ctr; ALLOC_HEAP_tot = (StgInt)ALLOC_HEAP_tot + (StgInt)ALLOC_RTS_tot; PR_CTR(ALLOC_HEAP_ctr); PR_CTR(ALLOC_HEAP_tot); PR_CTR(HEAP_CHK_ctr); PR_CTR(STK_CHK_ctr); PR_CTR(ALLOC_RTS_ctr); PR_CTR(ALLOC_RTS_tot); PR_CTR(ALLOC_FUN_ctr); PR_CTR(ALLOC_FUN_gds); PR_CTR(ALLOC_PAP_ctr); PR_CTR(ALLOC_PAP_adm); PR_CTR(ALLOC_PAP_gds); PR_CTR(ALLOC_UP_THK_ctr); PR_CTR(ALLOC_SE_THK_ctr); PR_CTR(ALLOC_THK_gds); PR_CTR(ALLOC_CON_ctr); PR_CTR(ALLOC_CON_gds); PR_CTR(ALLOC_PRIM_ctr); PR_CTR(ALLOC_PRIM_gds); PR_CTR(ALLOC_PRIM_slp); /* krc: comment out some of this stuff temporarily PR_HST(ALLOC_FUN_hst,0); PR_HST(ALLOC_FUN_hst,1); PR_HST(ALLOC_FUN_hst,2); PR_HST(ALLOC_FUN_hst,3); PR_HST(ALLOC_FUN_hst,4); PR_CTR(ALLOC_UP_THK_ctr); PR_CTR(ALLOC_SE_THK_ctr); PR_CTR(ALLOC_THK_adm); PR_CTR(ALLOC_THK_gds); PR_CTR(ALLOC_THK_slp); PR_HST(ALLOC_THK_hst,0); PR_HST(ALLOC_THK_hst,1); PR_HST(ALLOC_THK_hst,2); PR_HST(ALLOC_THK_hst,3); PR_HST(ALLOC_THK_hst,4); PR_CTR(ALLOC_CON_ctr); PR_CTR(ALLOC_CON_adm); PR_CTR(ALLOC_CON_gds); PR_CTR(ALLOC_CON_slp); PR_HST(ALLOC_CON_hst,0); PR_HST(ALLOC_CON_hst,1); PR_HST(ALLOC_CON_hst,2); PR_HST(ALLOC_CON_hst,3); PR_HST(ALLOC_CON_hst,4); PR_CTR(ALLOC_TUP_ctr); PR_CTR(ALLOC_TUP_adm); PR_CTR(ALLOC_TUP_gds); PR_CTR(ALLOC_TUP_slp); PR_HST(ALLOC_TUP_hst,0); PR_HST(ALLOC_TUP_hst,1); PR_HST(ALLOC_TUP_hst,2); PR_HST(ALLOC_TUP_hst,3); PR_HST(ALLOC_TUP_hst,4); PR_CTR(ALLOC_BH_ctr); PR_CTR(ALLOC_BH_adm); PR_CTR(ALLOC_BH_gds); PR_CTR(ALLOC_BH_slp); PR_HST(ALLOC_BH_hst,0); PR_HST(ALLOC_BH_hst,1); PR_HST(ALLOC_BH_hst,2); PR_HST(ALLOC_BH_hst,3); PR_HST(ALLOC_BH_hst,4); PR_CTR(ALLOC_PRIM_ctr); PR_CTR(ALLOC_PRIM_adm); PR_CTR(ALLOC_PRIM_gds); PR_CTR(ALLOC_PRIM_slp); PR_HST(ALLOC_PRIM_hst,0); PR_HST(ALLOC_PRIM_hst,1); PR_HST(ALLOC_PRIM_hst,2); PR_HST(ALLOC_PRIM_hst,3); PR_HST(ALLOC_PRIM_hst,4); PR_CTR(ALLOC_PAP_slp); PR_HST(ALLOC_PAP_hst,0); PR_HST(ALLOC_PAP_hst,1); PR_HST(ALLOC_PAP_hst,2); PR_HST(ALLOC_PAP_hst,3); PR_HST(ALLOC_PAP_hst,4); PR_CTR(ALLOC_TSO_ctr); PR_CTR(ALLOC_TSO_adm); PR_CTR(ALLOC_TSO_gds); PR_CTR(ALLOC_TSO_slp); PR_HST(ALLOC_TSO_hst,0); PR_HST(ALLOC_TSO_hst,1); PR_HST(ALLOC_TSO_hst,2); PR_HST(ALLOC_TSO_hst,3); PR_HST(ALLOC_TSO_hst,4); */ PR_CTR(ENT_VIA_NODE_ctr); PR_CTR(ENT_STATIC_CON_ctr); PR_CTR(ENT_DYN_CON_ctr); PR_CTR(ENT_STATIC_FUN_DIRECT_ctr); PR_CTR(ENT_DYN_FUN_DIRECT_ctr); PR_CTR(ENT_LNE_ctr); PR_CTR(ENT_STATIC_IND_ctr); PR_CTR(ENT_DYN_IND_ctr); /* The counters ENT_PERM_IND and UPD_{NEW,OLD}_PERM_IND are not dumped * at the end of execution unless update squeezing is turned off (+RTS * -Z =RtsFlags.GcFlags.squeezeUpdFrames), as they will be wrong * otherwise. Why? Because for each update frame squeezed out, we * count an UPD_NEW_PERM_IND *at GC time* (i.e., too early). And * further, when we enter the closure that has been updated, we count * the ENT_PERM_IND, but we then enter the PERM_IND that was built for * the next update frame below, and so on down the chain until we * finally reach the value. Thus we count many new ENT_PERM_INDs too * early. * * This of course refers to the -ticky version that uses PERM_INDs to * determine the number of closures entered 0/1/>1. KSW 1999-04. */ COND_PR_CTR(ENT_PERM_IND_ctr,RtsFlags.GcFlags.squeezeUpdFrames == rtsFalse,"E!NT_PERM_IND_ctr requires +RTS -Z"); PR_CTR(ENT_AP_ctr); PR_CTR(ENT_PAP_ctr); PR_CTR(ENT_AP_STACK_ctr); PR_CTR(ENT_BH_ctr); PR_CTR(ENT_STATIC_THK_SINGLE_ctr); PR_CTR(ENT_STATIC_THK_MANY_ctr); PR_CTR(ENT_DYN_THK_SINGLE_ctr); PR_CTR(ENT_DYN_THK_MANY_ctr); PR_CTR(UPD_CAF_BH_UPDATABLE_ctr); PR_CTR(UPD_CAF_BH_SINGLE_ENTRY_ctr); PR_CTR(SLOW_CALL_fast_v16_ctr); PR_CTR(SLOW_CALL_fast_v_ctr); PR_CTR(SLOW_CALL_fast_f_ctr); PR_CTR(SLOW_CALL_fast_d_ctr); PR_CTR(SLOW_CALL_fast_l_ctr); PR_CTR(SLOW_CALL_fast_n_ctr); PR_CTR(SLOW_CALL_fast_p_ctr); PR_CTR(SLOW_CALL_fast_pv_ctr); PR_CTR(SLOW_CALL_fast_pp_ctr); PR_CTR(SLOW_CALL_fast_ppv_ctr); PR_CTR(SLOW_CALL_fast_ppp_ctr); PR_CTR(SLOW_CALL_fast_pppv_ctr); PR_CTR(SLOW_CALL_fast_pppp_ctr); PR_CTR(SLOW_CALL_fast_ppppp_ctr); PR_CTR(SLOW_CALL_fast_pppppp_ctr); PR_CTR(VERY_SLOW_CALL_ctr); PR_CTR(UNKNOWN_CALL_ctr); PR_CTR(KNOWN_CALL_ctr); PR_CTR(KNOWN_CALL_TOO_FEW_ARGS_ctr); PR_CTR(KNOWN_CALL_EXTRA_ARGS_ctr); PR_CTR(MULTI_CHUNK_SLOW_CALL_ctr); PR_CTR(MULTI_CHUNK_SLOW_CALL_CHUNKS_ctr); PR_CTR(SLOW_CALL_ctr); PR_CTR(SLOW_CALL_FUN_TOO_FEW_ctr); PR_CTR(SLOW_CALL_FUN_CORRECT_ctr); PR_CTR(SLOW_CALL_FUN_TOO_MANY_ctr); PR_CTR(SLOW_CALL_PAP_TOO_FEW_ctr); PR_CTR(SLOW_CALL_PAP_CORRECT_ctr); PR_CTR(SLOW_CALL_PAP_TOO_MANY_ctr); PR_CTR(SLOW_CALL_UNEVALD_ctr); /* krc: put off till later... */ #if FALSE PR_HST(SLOW_CALL_hst,0); PR_HST(SLOW_CALL_hst,1); PR_HST(SLOW_CALL_hst,2); PR_HST(SLOW_CALL_hst,3); PR_HST(SLOW_CALL_hst,4); PR_HST(SLOW_CALL_hst,5); PR_HST(SLOW_CALL_hst,6); PR_HST(SLOW_CALL_hst,7); #endif PR_CTR(RET_NEW_ctr); PR_CTR(RET_OLD_ctr); PR_CTR(RET_UNBOXED_TUP_ctr); /* krc: put off till later... */ #if FALSE PR_HST(RET_NEW_hst,0); PR_HST(RET_NEW_hst,1); PR_HST(RET_NEW_hst,2); PR_HST(RET_NEW_hst,3); PR_HST(RET_NEW_hst,4); PR_HST(RET_NEW_hst,5); PR_HST(RET_NEW_hst,6); PR_HST(RET_NEW_hst,7); PR_HST(RET_NEW_hst,8); PR_HST(RET_OLD_hst,0); PR_HST(RET_OLD_hst,1); PR_HST(RET_OLD_hst,2); PR_HST(RET_OLD_hst,3); PR_HST(RET_OLD_hst,4); PR_HST(RET_OLD_hst,5); PR_HST(RET_OLD_hst,6); PR_HST(RET_OLD_hst,7); PR_HST(RET_OLD_hst,8); PR_HST(RET_UNBOXED_TUP_hst,0); PR_HST(RET_UNBOXED_TUP_hst,1); PR_HST(RET_UNBOXED_TUP_hst,2); PR_HST(RET_UNBOXED_TUP_hst,3); PR_HST(RET_UNBOXED_TUP_hst,4); PR_HST(RET_UNBOXED_TUP_hst,5); PR_HST(RET_UNBOXED_TUP_hst,6); PR_HST(RET_UNBOXED_TUP_hst,7); PR_HST(RET_UNBOXED_TUP_hst,8); #endif /* FALSE */ PR_CTR(UPDF_OMITTED_ctr); PR_CTR(UPDF_PUSHED_ctr); PR_CTR(CATCHF_PUSHED_ctr); PR_CTR(UPDF_RCC_PUSHED_ctr); PR_CTR(UPDF_RCC_OMITTED_ctr); PR_CTR(UPD_SQUEEZED_ctr); PR_CTR(UPD_CON_IN_NEW_ctr); PR_CTR(UPD_CON_IN_PLACE_ctr); PR_CTR(UPD_PAP_IN_NEW_ctr); PR_CTR(UPD_PAP_IN_PLACE_ctr); /* krc: put off till later...*/ #if FALSE PR_HST(UPD_CON_IN_NEW_hst,0); PR_HST(UPD_CON_IN_NEW_hst,1); PR_HST(UPD_CON_IN_NEW_hst,2); PR_HST(UPD_CON_IN_NEW_hst,3); PR_HST(UPD_CON_IN_NEW_hst,4); PR_HST(UPD_CON_IN_NEW_hst,5); PR_HST(UPD_CON_IN_NEW_hst,6); PR_HST(UPD_CON_IN_NEW_hst,7); PR_HST(UPD_CON_IN_NEW_hst,8); PR_HST(UPD_PAP_IN_NEW_hst,0); PR_HST(UPD_PAP_IN_NEW_hst,1); PR_HST(UPD_PAP_IN_NEW_hst,2); PR_HST(UPD_PAP_IN_NEW_hst,3); PR_HST(UPD_PAP_IN_NEW_hst,4); PR_HST(UPD_PAP_IN_NEW_hst,5); PR_HST(UPD_PAP_IN_NEW_hst,6); PR_HST(UPD_PAP_IN_NEW_hst,7); PR_HST(UPD_PAP_IN_NEW_hst,8); #endif /* FALSE */ PR_CTR(UPD_NEW_IND_ctr); /* see comment on ENT_PERM_IND_ctr */ COND_PR_CTR(UPD_NEW_PERM_IND_ctr,RtsFlags.GcFlags.squeezeUpdFrames == rtsFalse,"U!PD_NEW_PERM_IND_ctr requires +RTS -Z"); PR_CTR(UPD_OLD_IND_ctr); /* see comment on ENT_PERM_IND_ctr */ COND_PR_CTR(UPD_OLD_PERM_IND_ctr,RtsFlags.GcFlags.squeezeUpdFrames == rtsFalse,"U!PD_OLD_PERM_IND_ctr requires +RTS -Z"); PR_CTR(GC_SEL_ABANDONED_ctr); PR_CTR(GC_SEL_MINOR_ctr); PR_CTR(GC_SEL_MAJOR_ctr); PR_CTR(GC_FAILED_PROMOTION_ctr); }
Z K1(zsockdestroy){PC(x); ZTK(zsock_t,s); zsock_destroy(&s); RZ;}
static int print_insn_rl78_common (bfd_vma addr, disassemble_info * dis, RL78_Dis_Isa isa) { int rv; RL78_Data rl78_data; RL78_Opcode_Decoded opcode; const char * s; #if DEBUG_SEMANTICS static char buf[200]; #endif rl78_data.pc = addr; rl78_data.dis = dis; rv = rl78_decode_opcode (addr, &opcode, rl78_get_byte, &rl78_data, isa); dis->bytes_per_line = 10; #define PR (dis->fprintf_func) #define PS (dis->stream) #define PC(c) PR (PS, "%c", c) s = opcode.syntax; #if DEBUG_SEMANTICS switch (opcode.id) { case RLO_unknown: s = "uknown"; break; case RLO_add: s = "add: %e0%0 += %e1%1"; break; case RLO_addc: s = "addc: %e0%0 += %e1%1 + CY"; break; case RLO_and: s = "and: %e0%0 &= %e1%1"; break; case RLO_branch: s = "branch: pc = %e0%0"; break; case RLO_branch_cond: s = "branch_cond: pc = %e0%0 if %c1 / %e1%1"; break; case RLO_branch_cond_clear: s = "branch_cond_clear: pc = %e0%0 if %c1 / %e1%1, %e1%1 = 0"; break; case RLO_call: s = "call: pc = %e1%0"; break; case RLO_cmp: s = "cmp: %e0%0 - %e1%1"; break; case RLO_mov: s = "mov: %e0%0 = %e1%1"; break; case RLO_or: s = "or: %e0%0 |= %e1%1"; break; case RLO_rol: s = "rol: %e0%0 <<= %e1%1"; break; case RLO_rolc: s = "rol: %e0%0 <<= %e1%1,CY"; break; case RLO_ror: s = "ror: %e0%0 >>= %e1%1"; break; case RLO_rorc: s = "ror: %e0%0 >>= %e1%1,CY"; break; case RLO_sar: s = "sar: %e0%0 >>= %e1%1 signed"; break; case RLO_sel: s = "sel: rb = %1"; break; case RLO_shr: s = "shr: %e0%0 >>= %e1%1 unsigned"; break; case RLO_shl: s = "shl: %e0%0 <<= %e1%1"; break; case RLO_skip: s = "skip: if %c1"; break; case RLO_sub: s = "sub: %e0%0 -= %e1%1"; break; case RLO_subc: s = "subc: %e0%0 -= %e1%1 - CY"; break; case RLO_xch: s = "xch: %e0%0 <-> %e1%1"; break; case RLO_xor: s = "xor: %e0%0 ^= %e1%1"; break; } sprintf(buf, "%s%%W%%f\t\033[32m%s\033[0m", s, opcode.syntax); s = buf; #endif for (; *s; s++) { if (*s != '%') { PC (*s); } else { RL78_Opcode_Operand * oper; int do_hex = 0; int do_addr = 0; int do_es = 0; int do_sfr = 0; int do_cond = 0; int do_bang = 0; while (1) { s ++; switch (*s) { case 'x': do_hex = 1; break; case '!': do_bang = 1; break; case 'e': do_es = 1; break; case 'a': do_addr = 1; break; case 's': do_sfr = 1; break; case 'c': do_cond = 1; break; default: goto no_more_modifiers; } } no_more_modifiers:; switch (*s) { case '%': PC ('%'); break; #if DEBUG_SEMANTICS case 'W': if (opcode.size == RL78_Word) PR (PS, " \033[33mW\033[0m"); break; case 'f': if (opcode.flags) { char *comma = ""; PR (PS, " \033[35m"); if (opcode.flags & RL78_PSW_Z) { PR (PS, "Z"); comma = ","; } if (opcode.flags & RL78_PSW_AC) { PR (PS, "%sAC", comma); comma = ","; } if (opcode.flags & RL78_PSW_CY) { PR (PS, "%sCY", comma); comma = ","; } PR (PS, "\033[0m"); } break; #endif case '0': case '1': oper = *s == '0' ? &opcode.op[0] : &opcode.op[1]; if (do_es) { if (oper->use_es && indirect_type (oper->type)) PR (PS, "es:"); } if (do_bang) PC ('!'); if (do_cond) { PR (PS, "%s", condition_names[oper->condition]); break; } switch (oper->type) { case RL78_Operand_Immediate: if (do_addr) dis->print_address_func (oper->addend, dis); else if (do_hex || oper->addend > 999 || oper->addend < -999) PR (PS, "%#x", oper->addend); else PR (PS, "%d", oper->addend); break; case RL78_Operand_Register: PR (PS, "%s", register_names[oper->reg]); break; case RL78_Operand_Bit: PR (PS, "%s.%d", register_names[oper->reg], oper->bit_number); break; case RL78_Operand_Indirect: case RL78_Operand_BitIndirect: switch (oper->reg) { case RL78_Reg_None: if (oper->addend == 0xffffa && do_sfr && opcode.size == RL78_Byte) PR (PS, "psw"); else if (oper->addend == 0xffff8 && do_sfr && opcode.size == RL78_Word) PR (PS, "sp"); else if (oper->addend >= 0xffe20) PR (PS, "%#x", oper->addend); else { int faddr = oper->addend; if (do_es && ! oper->use_es) faddr += 0xf0000; dis->print_address_func (faddr, dis); } break; case RL78_Reg_B: case RL78_Reg_C: case RL78_Reg_BC: PR (PS, "%d[%s]", oper->addend, register_names[oper->reg]); break; default: PR (PS, "[%s", register_names[oper->reg]); if (oper->reg2 != RL78_Reg_None) PR (PS, "+%s", register_names[oper->reg2]); if (oper->addend || do_addr) PR (PS, "+%d", oper->addend); PC (']'); break; } if (oper->type == RL78_Operand_BitIndirect) PR (PS, ".%d", oper->bit_number); break; #if DEBUG_SEMANTICS /* Shouldn't happen - push and pop don't print [SP] directly. But we *do* use them for semantic debugging. */ case RL78_Operand_PostInc: PR (PS, "[%s++]", register_names[oper->reg]); break; case RL78_Operand_PreDec: PR (PS, "[--%s]", register_names[oper->reg]); break; #endif default: /* If we ever print this, that means the programmer tried to print an operand with a type we don't expect. Print the line and operand number from rl78-decode.opc for them. */ PR (PS, "???%d.%d", opcode.lineno, *s - '0'); break; } } } } #if DEBUG_SEMANTICS PR (PS, "\t\033[34m(line %d)\033[0m", opcode.lineno); #endif return rv; }
Z K1(zsockendpoint){PC(x); R ks((const S)zsock_endpoint(VSK(x)));}
int print_insn_rx (bfd_vma addr, disassemble_info * dis) { int rv; RX_Data rx_data; RX_Opcode_Decoded opcode; const char * s; rx_data.pc = addr; rx_data.dis = dis; rv = rx_decode_opcode (addr, &opcode, rx_get_byte, &rx_data); dis->bytes_per_line = 10; #define PR (dis->fprintf_func) #define PS (dis->stream) #define PC(c) PR (PS, "%c", c) /* Detect illegal instructions. */ if (opcode.op[0].size == RX_Bad_Size || register_names [opcode.op[0].reg] == NULL || register_names [opcode.op[1].reg] == NULL || register_names [opcode.op[2].reg] == NULL) { bfd_byte buf[10]; int i; PR (PS, ".byte "); rx_data.dis->read_memory_func (rx_data.pc - rv, buf, rv, rx_data.dis); for (i = 0 ; i < rv; i++) PR (PS, "0x%02x ", buf[i]); return rv; } for (s = opcode.syntax; *s; s++) { if (*s != '%') { PC (*s); } else { RX_Opcode_Operand * oper; int do_size = 0; int do_hex = 0; int do_addr = 0; s ++; if (*s == 'S') { do_size = 1; s++; } if (*s == 'x') { do_hex = 1; s++; } if (*s == 'a') { do_addr = 1; s++; } switch (*s) { case '%': PC ('%'); break; case 's': PR (PS, "%s", opsize_names[opcode.size]); break; case '0': case '1': case '2': oper = opcode.op + *s - '0'; if (do_size) { if (oper->type == RX_Operand_Indirect || oper->type == RX_Operand_Zero_Indirect) PR (PS, "%s", size_names[oper->size]); } else switch (oper->type) { case RX_Operand_Immediate: if (do_addr) dis->print_address_func (oper->addend, dis); else if (do_hex || oper->addend > 999 || oper->addend < -999) PR (PS, "%#x", oper->addend); else PR (PS, "%d", oper->addend); break; case RX_Operand_Register: case RX_Operand_TwoReg: PR (PS, "%s", register_names[oper->reg]); break; case RX_Operand_Indirect: PR (PS, "%d[%s]", oper->addend, register_names[oper->reg]); break; case RX_Operand_Zero_Indirect: PR (PS, "[%s]", register_names[oper->reg]); break; case RX_Operand_Postinc: PR (PS, "[%s+]", register_names[oper->reg]); break; case RX_Operand_Predec: PR (PS, "[-%s]", register_names[oper->reg]); break; case RX_Operand_Condition: PR (PS, "%s", condition_names[oper->reg]); break; case RX_Operand_Flag: PR (PS, "%s", flag_names[oper->reg]); break; default: PR (PS, "[???]"); break; } } } } return rv; }
Z K2(zsockdisconnect){PC(x); TC(y,-KS); R kj(zsock_disconnect(VSK(x),ys));}
struct platform_device *__init at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data, unsigned long fbmem_start, unsigned long fbmem_len) { struct platform_device *pdev; struct atmel_lcdfb_info *info; struct fb_monspecs *monspecs; struct fb_videomode *modedb; unsigned int modedb_size; /* * Do a deep copy of the fb data, monspecs and modedb. Make * sure all allocations are done before setting up the * portmux. */ monspecs = kmemdup(data->default_monspecs, sizeof(struct fb_monspecs), GFP_KERNEL); if (!monspecs) return NULL; modedb_size = sizeof(struct fb_videomode) * monspecs->modedb_len; modedb = kmemdup(monspecs->modedb, modedb_size, GFP_KERNEL); if (!modedb) goto err_dup_modedb; monspecs->modedb = modedb; switch (id) { case 0: pdev = &atmel_lcdfb0_device; select_peripheral(PC(19), PERIPH_A, 0); /* CC */ select_peripheral(PC(20), PERIPH_A, 0); /* HSYNC */ select_peripheral(PC(21), PERIPH_A, 0); /* PCLK */ select_peripheral(PC(22), PERIPH_A, 0); /* VSYNC */ select_peripheral(PC(23), PERIPH_A, 0); /* DVAL */ select_peripheral(PC(24), PERIPH_A, 0); /* MODE */ select_peripheral(PC(25), PERIPH_A, 0); /* PWR */ select_peripheral(PC(26), PERIPH_A, 0); /* DATA0 */ select_peripheral(PC(27), PERIPH_A, 0); /* DATA1 */ select_peripheral(PC(28), PERIPH_A, 0); /* DATA2 */ select_peripheral(PC(29), PERIPH_A, 0); /* DATA3 */ select_peripheral(PC(30), PERIPH_A, 0); /* DATA4 */ select_peripheral(PC(31), PERIPH_A, 0); /* DATA5 */ select_peripheral(PD(0), PERIPH_A, 0); /* DATA6 */ select_peripheral(PD(1), PERIPH_A, 0); /* DATA7 */ select_peripheral(PD(2), PERIPH_A, 0); /* DATA8 */ select_peripheral(PD(3), PERIPH_A, 0); /* DATA9 */ select_peripheral(PD(4), PERIPH_A, 0); /* DATA10 */ select_peripheral(PD(5), PERIPH_A, 0); /* DATA11 */ select_peripheral(PD(6), PERIPH_A, 0); /* DATA12 */ select_peripheral(PD(7), PERIPH_A, 0); /* DATA13 */ select_peripheral(PD(8), PERIPH_A, 0); /* DATA14 */ select_peripheral(PD(9), PERIPH_A, 0); /* DATA15 */ select_peripheral(PD(10), PERIPH_A, 0); /* DATA16 */ select_peripheral(PD(11), PERIPH_A, 0); /* DATA17 */ select_peripheral(PD(12), PERIPH_A, 0); /* DATA18 */ select_peripheral(PD(13), PERIPH_A, 0); /* DATA19 */ select_peripheral(PD(14), PERIPH_A, 0); /* DATA20 */ select_peripheral(PD(15), PERIPH_A, 0); /* DATA21 */ select_peripheral(PD(16), PERIPH_A, 0); /* DATA22 */ select_peripheral(PD(17), PERIPH_A, 0); /* DATA23 */ clk_set_parent(&atmel_lcdfb0_pixclk, &pll0); clk_set_rate(&atmel_lcdfb0_pixclk, clk_get_rate(&pll0)); break; default: goto err_invalid_id; } if (fbmem_len) { pdev->resource[2].start = fbmem_start; pdev->resource[2].end = fbmem_start + fbmem_len - 1; pdev->resource[2].flags = IORESOURCE_MEM; } info = pdev->dev.platform_data; memcpy(info, data, sizeof(struct atmel_lcdfb_info)); info->default_monspecs = monspecs; platform_device_register(pdev); return pdev; err_invalid_id: kfree(modedb); err_dup_modedb: kfree(monspecs); return NULL; }
Z K1(zsocktypestr){PC(x); R ks((const S)zsock_type_str(VSK(x)));}
struct platform_device *__init at32_add_device_eth(unsigned int id, struct eth_platform_data *data) { struct platform_device *pdev; switch (id) { case 0: pdev = &macb0_device; select_peripheral(PC(3), PERIPH_A, 0); /* TXD0 */ select_peripheral(PC(4), PERIPH_A, 0); /* TXD1 */ select_peripheral(PC(7), PERIPH_A, 0); /* TXEN */ select_peripheral(PC(8), PERIPH_A, 0); /* TXCK */ select_peripheral(PC(9), PERIPH_A, 0); /* RXD0 */ select_peripheral(PC(10), PERIPH_A, 0); /* RXD1 */ select_peripheral(PC(13), PERIPH_A, 0); /* RXER */ select_peripheral(PC(15), PERIPH_A, 0); /* RXDV */ select_peripheral(PC(16), PERIPH_A, 0); /* MDC */ select_peripheral(PC(17), PERIPH_A, 0); /* MDIO */ if (!data->is_rmii) { select_peripheral(PC(0), PERIPH_A, 0); /* COL */ select_peripheral(PC(1), PERIPH_A, 0); /* CRS */ select_peripheral(PC(2), PERIPH_A, 0); /* TXER */ select_peripheral(PC(5), PERIPH_A, 0); /* TXD2 */ select_peripheral(PC(6), PERIPH_A, 0); /* TXD3 */ select_peripheral(PC(11), PERIPH_A, 0); /* RXD2 */ select_peripheral(PC(12), PERIPH_A, 0); /* RXD3 */ select_peripheral(PC(14), PERIPH_A, 0); /* RXCK */ select_peripheral(PC(18), PERIPH_A, 0); /* SPD */ } break; case 1: pdev = &macb1_device; select_peripheral(PD(13), PERIPH_B, 0); /* TXD0 */ select_peripheral(PD(14), PERIPH_B, 0); /* TXD1 */ select_peripheral(PD(11), PERIPH_B, 0); /* TXEN */ select_peripheral(PD(12), PERIPH_B, 0); /* TXCK */ select_peripheral(PD(10), PERIPH_B, 0); /* RXD0 */ select_peripheral(PD(6), PERIPH_B, 0); /* RXD1 */ select_peripheral(PD(5), PERIPH_B, 0); /* RXER */ select_peripheral(PD(4), PERIPH_B, 0); /* RXDV */ select_peripheral(PD(3), PERIPH_B, 0); /* MDC */ select_peripheral(PD(2), PERIPH_B, 0); /* MDIO */ if (!data->is_rmii) { select_peripheral(PC(19), PERIPH_B, 0); /* COL */ select_peripheral(PC(23), PERIPH_B, 0); /* CRS */ select_peripheral(PC(26), PERIPH_B, 0); /* TXER */ select_peripheral(PC(27), PERIPH_B, 0); /* TXD2 */ select_peripheral(PC(28), PERIPH_B, 0); /* TXD3 */ select_peripheral(PC(29), PERIPH_B, 0); /* RXD2 */ select_peripheral(PC(30), PERIPH_B, 0); /* RXD3 */ select_peripheral(PC(24), PERIPH_B, 0); /* RXCK */ select_peripheral(PD(15), PERIPH_B, 0); /* SPD */ } break; default: return NULL; } memcpy(pdev->dev.platform_data, data, sizeof(struct eth_platform_data)); platform_device_register(pdev); return pdev; }
Z K2(zsockrecv){PC(x); TC(y,-KS); R kj(zsock_recv(VSK(x), ys));}
void ProcessSegmentLoadEvent( DEBUG_EVENT64 * pde, HTHDX hthdx ) /*++ Routine Description: This function takes care of dealing with segment load events from the wow system. These come in as exceptions and are translated to segment load events in ProcessDebugEvent. Arguments: pde - Supplies a pointer to the modified debug event hthdx - Supplies the handle to the thread of the debug event Return Value: None. --*/ { #if defined(i386) && !defined(WIN32S) PDWORDLONG lpdw = &pde->u.Exception.ExceptionRecord.ExceptionInformation[0]; int mode = LOWORD( (DWORD)lpdw[0] ); int cb; int cbRead; int b; char * lpb; WORD packetType = tlfDebugPacket; HEMI hemi; HPRCX hprcx = hthdx->hprc; int idx; SEGMENT_NOTE sn; ADDR addr; EXPECTED_EVENT * pee; DWORD eventCode; DWORD subClass; LDT_ENTRY ldt; BREAKPOINT *bp; DeWow = *pde; if ( !FVDMInitDone ) { HANDLE hmodVDM; hmodVDM = LoadLibrary("VDMDBG.DLL"); if ( hmodVDM != (HANDLE)NULL ) { FVDMActive = TRUE; pfnVDMProcessException = (VDMPROCESSEXCEPTIONPROC) GetProcAddress( hmodVDM, "VDMProcessException" ); pfnVDMGetPointer = (VDMGETPOINTERPROC) GetProcAddress( hmodVDM, "VDMGetPointer" ); pfnVDMGetThreadSelectorEntry = (VDMGETTHREADSELECTORENTRYPROC) GetProcAddress( hmodVDM, "VDMGetThreadSelectorEntry" ); pfnVDMGetThreadContext = (VDMGETCONTEXTPROC) GetProcAddress( hmodVDM, "VDMGetContext" ); pfnVDMSetThreadContext = (VDMSETCONTEXTPROC) GetProcAddress( hmodVDM, "VDMSetContext" ); pfnVDMGetSelectorModule = (VDMGETSELECTORMODULEPROC) GetProcAddress( hmodVDM, "VDMGetSelectorModule" ); pfnVDMEnumProcessWOW = (VDMENUMPROCESSWOWPROC) GetProcAddress( hmodVDM, "VDMEnumProcessWOW" ); } else { DMPrintShellMsg( _T("LoadLibrary(VDMDBG.DLL) failed\n")); } FVDMInitDone = TRUE; } if ( !FVDMActive ) { return; } else { DebugEvent64To32(pde, &DeWow32); (*pfnVDMProcessException)((LPDEBUG_EVENT)&DeWow32); DebugEvent32To64(&DeWow32, pde); } hthdx->fWowEvent = TRUE; switch ( mode ) { /* * SEG LOAD: * * LOWORD(lpdw[0]) --- DBG_SEGLOAD * HIWORD(lpdw[0]) --- Unused * LOWORD(lpdw[1]) --- Unused * HIWORD(lpdw[1]) --- Unused * lpdw[2] --- pointer to SEGMENT_NOTE structure * lpdw[3] --- Reserved */ case DBG_SEGLOAD: lpb = (char *) lpdw[2]; b = DbgReadMemory(hprcx, (UINT_PTR)lpb, &sn, sizeof(sn), &cbRead); if ((b == 0) || (cbRead != sizeof(sn))) { b = GetLastError(); AddQueue( QT_CONTINUE_DEBUG_EVENT, hthdx->hprc->pid, hthdx->tid, DBG_CONTINUE, 0); //hthdx->tstate &= ~(ts_stopped|ts_first|ts_second); //hthdx->tstate |= ts_running; hthdx->tstate = (TSTATEX)((DWORD)hthdx->tstate & ~(ts_stopped|ts_first|ts_second)); hthdx->tstate = (TSTATEX)((DWORD)hthdx->tstate | (ts_running)); return; } if (sn.FileName[0] == 0) { AddQueue( QT_CONTINUE_DEBUG_EVENT, hthdx->hprc->pid, hthdx->tid, DBG_CONTINUE, 0); //hthdx->tstate &= ~(ts_stopped|ts_first|ts_second); //hthdx->tstate |= ts_running; hthdx->tstate = (TSTATEX)((DWORD)hthdx->tstate & ~(ts_stopped|ts_first|ts_second)); hthdx->tstate = (TSTATEX)((DWORD)hthdx->tstate | (ts_running)); return; } cb = _tcslen(sn.FileName)+1; idx = LookupDllName(hprcx, sn.FileName); if ( idx != -1 ) { if (hprcx->rgDllList[idx].fReal) { // // Changing from real to protected mode. We don't // support this, so we'll throw away what we have // and start from scratch. // WORD w = (WORD)idx; DMSendDebugPacket(dbceModFree16, hprcx->hpid, hthdx->htid, sizeof(WORD), &w ); RemoveDllName( hprcx, idx ); idx = -1; } } if (idx == -1) { LPMODULELOAD lpmdl; cb = cb + sizeof(MODULELOAD) + (sn.Segment+1)*sizeof(OBJD); lpmdl = (LPMODULELOAD) MHAlloc(cb); lpmdl->cobj = sn.Segment+1; lpmdl->rgobjd[sn.Segment].wSel = sn.Selector1; lpmdl->rgobjd[sn.Segment].cb = (DWORD) -1; lpmdl->rgobjd[sn.Segment].wPad = 1; lpmdl->mte = InsertDllName(hprcx, sn.FileName); _tcscpy((char *) &lpmdl->rgobjd[lpmdl->cobj], sn.FileName); lpmdl->fRealMode = FALSE; lpmdl->fFlatMode = FALSE; lpmdl->fOffset32 = FALSE; DMSendRequestReply(dbcModLoad, hprcx->hpid, hthdx->htid, cb, lpmdl, sizeof(HEMI), &hemi ); hemi = *((HEMI *) abEMReplyBuf); MHFree(lpmdl); AddQueue( QT_CONTINUE_DEBUG_EVENT, hthdx->hprc->pid, hthdx->tid, DBG_CONTINUE, 0); //hthdx->tstate &= ~(ts_stopped|ts_first|ts_second); //hthdx->tstate |= ts_running; hthdx->tstate = (TSTATEX)((DWORD)hthdx->tstate & ~(ts_stopped|ts_first|ts_second)); hthdx->tstate = (TSTATEX)((DWORD)hthdx->tstate | (ts_running)); } else { SLI sli; sli.wSelector = sn.Selector1; sli.wSegNo = sn.Segment; sli.mte = idx; DMSendDebugPacket(dbceSegLoad, hprcx->hpid, hthdx->htid, sizeof(SLI), &sli ); } break; /* * SEGMOVE: * * This event will be triggered if a selector number * is to be changed. * * LOWORD( lpdw[0] ) - SEGMOVE * LOWORD( lpdw[1] ) - old selector number * HIWORD( lpdw[1] ) - new selector number */ case DBG_SEGMOVE: lpb = (char *) lpdw[2]; b = DbgReadMemory(hprcx, (UINT_PTR)lpb, &sn, sizeof(sn), &cbRead); if ((b == 0) || (cbRead != sizeof(sn))) { b = GetLastError(); AddQueue( QT_CONTINUE_DEBUG_EVENT, hthdx->hprc->pid, hthdx->tid, DBG_CONTINUE, 0); //hthdx->tstate &= ~(ts_stopped|ts_first|ts_second); //hthdx->tstate |= ts_running; hthdx->tstate = (TSTATEX)((DWORD)hthdx->tstate & ~(ts_stopped|ts_first|ts_second)); hthdx->tstate = (TSTATEX)((DWORD)hthdx->tstate | (ts_running)); return; } if (sn.FileName[0] == 0) { AddQueue( QT_CONTINUE_DEBUG_EVENT, hthdx->hprc->pid, hthdx->tid, DBG_CONTINUE, 0); //hthdx->tstate &= ~(ts_stopped|ts_first|ts_second); //hthdx->tstate |= ts_running; hthdx->tstate = (TSTATEX)((DWORD)hthdx->tstate & ~(ts_stopped|ts_first|ts_second)); hthdx->tstate = (TSTATEX)((DWORD)hthdx->tstate | (ts_running)); return; } cb = _tcslen(sn.FileName)+1; idx = LookupDllName(hprcx, sn.FileName); if ( idx != -1 ) { SLI sli; assert( sn.Selector1 == 0 ); sli.wSelector = sn.Selector2; sli.wSegNo = sn.Segment; sli.mte = idx; DMSendDebugPacket(dbceSegMove, hprcx->hpid, hthdx->htid, sizeof(SLI), &sli ); } AddQueue( QT_CONTINUE_DEBUG_EVENT, hthdx->hprc->pid, hthdx->tid, DBG_CONTINUE, 0); //hthdx->tstate &= ~(ts_stopped|ts_first|ts_second); //hthdx->tstate |= ts_running; hthdx->tstate = (TSTATEX)((DWORD)hthdx->tstate & ~(ts_stopped|ts_first|ts_second)); hthdx->tstate = (TSTATEX)((DWORD)hthdx->tstate | (ts_running)); break; /* * SEGFREE: * * This event is triggered if a selector is freed * * LOWORD( lpdw[0] ) - SEGFREE * HIWORD( lpdw[0] ) - fBPRelease * LOWORD( lpdw[1] ) - selector to be freed */ case DBG_SEGFREE: AddQueue( QT_CONTINUE_DEBUG_EVENT, hthdx->hprc->pid, hthdx->tid, DBG_CONTINUE, 0); //hthdx->tstate &= ~(ts_stopped|ts_first|ts_second); //hthdx->tstate |= ts_running; hthdx->tstate = (TSTATEX)((DWORD)hthdx->tstate & ~(ts_stopped|ts_first|ts_second)); hthdx->tstate = (TSTATEX)((DWORD)hthdx->tstate | (ts_running)); break; /* * MODLOAD: * * This event is triggered when a new DLL is loaded * * LOWORD( lpdw[0] ) - MODLOAD * HIWORD( lpdw[0] ) - length of module name * HIWORD( lpdw[1] ) - selector * lpdw[2] - address of module name * lpdw[3] - image length * */ case DBG_MODLOAD: lpb = (char *) lpdw[2]; b = DbgReadMemory(hprcx, (UINT_PTR)lpb, &sn, sizeof(sn), &cbRead); if ((b == 0) || (cbRead != sizeof(sn))) { b = GetLastError(); AddQueue( QT_CONTINUE_DEBUG_EVENT, hthdx->hprc->pid, hthdx->tid, DBG_CONTINUE, 0); //hthdx->tstate &= ~(ts_stopped|ts_first|ts_second); //hthdx->tstate |= ts_running; hthdx->tstate = (TSTATEX)((DWORD)hthdx->tstate & ~(ts_stopped|ts_first|ts_second)); hthdx->tstate = (TSTATEX)((DWORD)hthdx->tstate | (ts_running)); return; } if (sn.FileName[0] == 0) { AddQueue( QT_CONTINUE_DEBUG_EVENT, hthdx->hprc->pid, hthdx->tid, DBG_CONTINUE, 0); //hthdx->tstate &= ~(ts_stopped|ts_first|ts_second); //hthdx->tstate |= ts_running; hthdx->tstate = (TSTATEX)((DWORD)hthdx->tstate & ~(ts_stopped|ts_first|ts_second)); hthdx->tstate = (TSTATEX)((DWORD)hthdx->tstate | (ts_running)); return; } cb = _tcslen(sn.FileName)+1; idx = LookupDllName(hprcx, sn.FileName); if (idx == -1) { LPMODULELOAD lpmdl; cb = cb + sizeof(MODULELOAD); lpmdl = (LPMODULELOAD) MHAlloc(cb); lpmdl->cobj = 0; lpmdl->mte = InsertDllName(hprcx, sn.FileName); idx = LookupDllName(hprcx, sn.FileName); if ( idx != -1 ) { hprcx->rgDllList[idx].fReal = TRUE; } _tcscpy((char *) &lpmdl->rgobjd[lpmdl->cobj], sn.FileName); lpmdl->StartingSegment = sn.Segment; lpmdl->fRealMode = TRUE; lpmdl->fFlatMode = FALSE; lpmdl->fOffset32 = FALSE; DMSendRequestReply(dbcModLoad, hprcx->hpid, hthdx->htid, cb, lpmdl, sizeof(HEMI), &hemi ); MHFree(lpmdl); } AddQueue( QT_CONTINUE_DEBUG_EVENT, hthdx->hprc->pid, hthdx->tid, DBG_CONTINUE, 0); //hthdx->tstate &= ~(ts_stopped|ts_first|ts_second); //hthdx->tstate |= ts_running; hthdx->tstate = (TSTATEX)((DWORD)hthdx->tstate & ~(ts_stopped|ts_first|ts_second)); hthdx->tstate = (TSTATEX)((DWORD)hthdx->tstate | (ts_running)); break; /* * MODFREE: * * This event is triggered when a DLL is unloaded * * LOWORD( lpdw[0] ) - MODFREE */ case DBG_MODFREE: lpb = (char *) lpdw[2]; b = DbgReadMemory(hprcx, (UINT_PTR)lpb, &sn, sizeof(sn), &cbRead); if ((b == 0) || (cbRead != sizeof(sn))) { b = GetLastError(); AddQueue( QT_CONTINUE_DEBUG_EVENT, hthdx->hprc->pid, hthdx->tid, DBG_CONTINUE, 0); //hthdx->tstate &= ~(ts_stopped|ts_first|ts_second); //hthdx->tstate |= ts_running; hthdx->tstate = (TSTATEX)((DWORD)hthdx->tstate & ~(ts_stopped|ts_first|ts_second)); hthdx->tstate = (TSTATEX)((DWORD)hthdx->tstate | (ts_running)); return; } if (sn.FileName[0] == 0) { AddQueue( QT_CONTINUE_DEBUG_EVENT, hthdx->hprc->pid, hthdx->tid, DBG_CONTINUE, 0); //hthdx->tstate &= ~(ts_stopped|ts_first|ts_second); //hthdx->tstate |= ts_running; hthdx->tstate = (TSTATEX)((DWORD)hthdx->tstate & ~(ts_stopped|ts_first|ts_second)); hthdx->tstate = (TSTATEX)((DWORD)hthdx->tstate | (ts_running)); return; } cb = _tcslen(sn.FileName)+1; idx = LookupDllName(hprcx, sn.FileName); if (idx != -1) { WORD w = (WORD)idx; DMSendDebugPacket(dbceModFree16, hprcx->hpid, hthdx->htid, sizeof(WORD), &w ); RemoveDllName( hprcx, idx ); } AddQueue( QT_CONTINUE_DEBUG_EVENT, hthdx->hprc->pid, hthdx->tid, DBG_CONTINUE, 0); //hthdx->tstate &= ~(ts_stopped|ts_first|ts_second); //hthdx->tstate |= ts_running; hthdx->tstate = (TSTATEX)((DWORD)hthdx->tstate & ~(ts_stopped|ts_first|ts_second)); hthdx->tstate = (TSTATEX)((DWORD)hthdx->tstate | (ts_running)); break; /* * Int 01h break; */ case DBG_SINGLESTEP: hthdx->context.ContextFlags = VDMCONTEXT_FULL; (*pfnVDMGetThreadContext)(hthdx->hprc->rwHand, hthdx->rwHand, &hthdx->context); eventCode = EXCEPTION_DEBUG_EVENT; pde->dwDebugEventCode = EXCEPTION_DEBUG_EVENT; pde->u.Exception.ExceptionRecord.ExceptionCode = subClass = (DWORD)EXCEPTION_SINGLE_STEP; /* * They are not clearing the trace bit */ hthdx->context.EFlags &= ~TF_BIT_MASK; hthdx->fContextDirty = TRUE; AddrInit(&addr, 0, (SEGMENT) hthdx->context.SegCs, SE32To64( hthdx->context.Eip ), FALSE, FALSE, FALSE, FALSE ); bp = FindBP(hthdx->hprc, hthdx, bptpExec, (BPNS)-1, &addr, FALSE); if ( bp ) { SetBPFlag( hthdx, bp ); } goto dispatch; case DBG_TASKSTART: hthdx->context.ContextFlags = VDMCONTEXT_FULL; (*pfnVDMGetThreadContext)(hthdx->hprc->rwHand, hthdx->rwHand, &hthdx->context); eventCode = pde->dwDebugEventCode = ENTRYPOINT_DEBUG_EVENT; goto dispatch; case DBG_TASKSTOP: case DBG_DLLSTART: case DBG_DLLSTOP: case DBG_ATTACH: AddQueue( QT_CONTINUE_DEBUG_EVENT, hthdx->hprc->pid, hthdx->tid, DBG_CONTINUE, 0); hthdx->tstate &= ~(ts_stopped|ts_first|ts_second); hthdx->tstate |= ts_running; break; /* * Int 03h break * * LOWORD(lpdw[0]) --- BREAKPOINT * HIWORD(lpdw[0]) --- Protect Mode */ case DBG_BREAK: hthdx->context.ContextFlags = VDMCONTEXT_FULL; (*pfnVDMGetThreadContext)(hthdx->hprc->rwHand, hthdx->rwHand, &hthdx->context); Set_PC(hthdx, PC(hthdx) - 1); hthdx->fContextDirty = TRUE; eventCode = pde->dwDebugEventCode = BREAKPOINT_DEBUG_EVENT; // NOTENOTE --- jimsch -- assuming only 0xcc not 0xcd 0x3 breakpoints AddrInit(&addr, 0, (SEGMENT) hthdx->context.SegCs, SE32To64( hthdx->context.Eip ), FALSE, FALSE, FALSE, FALSE ); bp = FindBP(hthdx->hprc, hthdx, bptpExec, (BPNS)-1, &addr, FALSE); if ( bp && bp->isStep ) { eventCode = EXCEPTION_DEBUG_EVENT; pde->dwDebugEventCode = EXCEPTION_DEBUG_EVENT; pde->u.Exception.ExceptionRecord.ExceptionCode = subClass = (DWORD)EXCEPTION_SINGLE_STEP; RemoveBP(bp); } else { if ( bp ) { SetBPFlag( hthdx, bp ); } pde->u.Exception.ExceptionRecord.ExceptionCode = subClass = (DWORD)bp; } pde->u.Exception.ExceptionRecord.ExceptionAddress = PC(hthdx); dispatch: hthdx->fAddrIsReal = FALSE; hthdx->fAddrIsFlat = FALSE; DebugEvent64To32(pde, &DeWow32); if ((*pfnVDMGetThreadSelectorEntry)(&DeWow32, hthdx->rwHand, (WORD) hthdx->context.SegCs, &ldt)) { if (ldt.HighWord.Bits.Default_Big) { hthdx->fAddrOff32 = TRUE; } else { hthdx->fAddrOff32 = FALSE; } } else { hthdx->fAddrOff32 = FALSE; } /* * Check if this debug event was expected */ pee = PeeIsEventExpected(hthdx, eventCode, subClass, TRUE); /* * If it wasn't, run the standard handler with * notifications going to the execution model */ assert((0 < eventCode) && (eventCode < MAX_EVENT_CODE)); if (pee == NULL) { if ((hthdx != NULL) && (hthdx->tstate & ts_funceval)) { RgfnFuncEventDispatch[eventCode-EXCEPTION_DEBUG_EVENT](pde, hthdx); } else { DebugDispatchTable[eventCode-EXCEPTION_DEBUG_EVENT](pde,hthdx); } return; } /* * If it was expected then call the action * function if one was specified */ if (pee->action) { (pee->action)(pde, hthdx, 0, pee->lparam); } /* * And call the notifier if one was specified */ if (pee->notifier) { METHOD *nm = pee->notifier; (nm->notifyFunction)(pde, hthdx, 0, nm->lparam); } free(pee); break; #if 0 // why is this here?? case DBG_DIVOVERFLOW: pde->dwDebugEventCode = 3; goto fault_occured; case DBG_INSTRFAULT: pde->dwDebugEventCode = 1; goto fault_occured; #endif case DBG_DIVOVERFLOW: case DBG_INSTRFAULT: case DBG_GPFAULT: pde->dwDebugEventCode = EXCEPTION_DEBUG_EVENT; #if 0 // why is this here?? fault_occured: #endif hthdx->context.ContextFlags = VDMCONTEXT_FULL; (*pfnVDMGetThreadContext)(hthdx->hprc->rwHand, hthdx->rwHand, &hthdx->context); pde->u.Exception.ExceptionRecord.ExceptionCode = 13; hthdx->fAddrIsReal = FALSE; hthdx->fAddrIsFlat = FALSE; DebugEvent64To32(pde, &DeWow32); if ((*pfnVDMGetThreadSelectorEntry)(&DeWow32, hthdx->rwHand, (WORD) hthdx->context.SegCs, &ldt)) { if (ldt.HighWord.Bits.Default_Big) { hthdx->fAddrOff32 = TRUE; } else { hthdx->fAddrOff32 = FALSE; } } else { hthdx->fAddrOff32 = FALSE; } ProcessExceptionEvent(pde, hthdx); break; default: AddQueue( QT_CONTINUE_DEBUG_EVENT, hthdx->hprc->pid, hthdx->tid, DBG_CONTINUE, 0); hthdx->tstate &= ~(ts_stopped|ts_first|ts_second); hthdx->tstate |= ts_running; break; } #endif // i386 && !Win32S return; } /* ProcessSegmentLoadEvent() */