From: anon Date: Sat, 21 Jun 2008 05:55:19 +0000 (+0800) Subject: nagra-0101: update INT map39/3a/3e X-Git-Tag: 0.9.1~57 X-Git-Url: http://www.vanbest.org/gitweb/?a=commitdiff_plain;h=90b619ae482a37b259eaef143c6fa88dba0b22fd;p=sasc-ng.git nagra-0101: update INT map39/3a/3e --- diff --git a/systems/nagra/nagra2-0101.c b/systems/nagra/nagra2-0101.c index 8eb2d26..1d450eb 100644 --- a/systems/nagra/nagra2-0101.c +++ b/systems/nagra/nagra2-0101.c @@ -170,7 +170,7 @@ bool cMap0101::Map(int f, unsigned char *data, int l) BN_clear(C); WS_END(); cycles=898; - break; + break; case 0x22: if(BN_is_zero(D)) { cycles=639-6; break; } l&=0x1fff; @@ -244,7 +244,17 @@ bool cMap0101::Map(int f, unsigned char *data, int l) BN_one(A); } else { - MonInit(); + MakeJ0(J,D); + if(!BN_is_zero(D)) { + BN_zero(I); + BN_set_bit(I,68*wordsize); + BN_mod(B,I,D,ctx); + } + MonMul0(B,B,B,C,D,J,wordsize); + AddMapCycles(2350); + MonFin(B,D); + for(int i=1; i<4; i++) MonMul(B,B,B); +// MonInit(); MonMul(B,A,B); MonExp(scalar); } @@ -841,7 +851,7 @@ void cN2Prov0101::TimerHandler(unsigned int num) if(mask&1) { DisableTimers(11); if(t==2) { - PRINTF(L_SYS_EMU,"Timer interrupt %u @ %04x",t,GetPc()); + PRINTF(L_SYS_EMU,"0101: Timer interrupt %u @ %04x",t,GetPc()); RaiseException(9); if(Interruptible()) throw(t); } diff --git a/systems/nagra/nagra2.c b/systems/nagra/nagra2.c index cc5a424..d6c6ce8 100644 --- a/systems/nagra/nagra2.c +++ b/systems/nagra/nagra2.c @@ -53,6 +53,7 @@ bool cN2Timer::AddCycles(unsigned int count) while(cycles<0) cycles+=latch+1; } else if(stop) { + PRINTF(L_SYS_EMU,"n2timer %d: timer stop (cycles=%d remainder=%d)",nr,cycles,remainder); cycles=0; Stop(); } @@ -678,7 +679,11 @@ void cMapCore::DoMap(int f, unsigned char *data, int l) unsigned int elapsed=CpuCycles()-startcycles; if(cycles>elapsed) AddMapCycles(cycles-elapsed); } - } catch(int) { interrupted=true; } + } + catch(int) { + interrupted=true; + PRINTF(L_SYS_MAP,"%04x: call %02x interrupted (%d cycles)",mapid,f,CpuCycles()-startcycles); + } interruptible=false; cycles=CpuCycles()-startcycles; } @@ -771,23 +776,34 @@ bool cMapCore::MapGeneric(int f, unsigned char *data, int l) last=3; C.Set(D,l1); cycles=462+(8*l1+3)/5*5-6; break; case 0x39: - case 0x3a: - AddMapCycles(512); WS_START(1); - MakeJ0(J,D); - AddMapCycles(256); + MakeJ0(J,D,C); + AddMapCycles(860); + BN_zero(C); WS_END(); - AddMapCycles(340); if(!BN_is_zero(D)) { BN_zero(I); BN_set_bit(I,68*wordsize); BN_mod(B,I,D,ctx); } - AddMapCycles(320); + AddMapCycles(940); for(int i=0; i<4; i++) MonMul(B,B,B); - - if(f==0x39) I.GetLE(data,wordsize<<3); - MonMul(B,(f==0x39?I:A),B); +// MonInit(); + I.GetLE(data,wordsize<<3); + MonMul(B,I,B); + MonMul(B,A,B); + break; + case 0x3a: + MakeJ0(J,D); + if(!BN_is_zero(D)) { + BN_zero(I); + BN_set_bit(I,68*wordsize); + BN_mod(B,I,D,ctx); + } + AddMapCycles(2000); + for(int i=0; i<4; i++) MonMul(B,B,B); +// MonInit(); + MonMul(B,A,B); MonMul(B,A,B); break; case 0x43: // init SHA1