Beispiel #1
0
        public void Scanner_EvenOdd()
        {
            var scan     = CreateScanner(0x1000, 0x2000);
            var platform = new DefaultPlatform(null, program.Architecture);

            program.Platform = platform;
            fakeArch.Test_AddTraces(RtlEvenOdd.Create(fakeArch));

            var proc = scan.ScanProcedure(
                Address.Ptr32(0x1000),
                "fn1000",
                arch.CreateProcessorState());
            var sExp = @"// fn1000
// Return size: 4
void fn1000()
fn1000_entry:
l00001000:
	r63 = fp
	r1 = 0x00000003
	r63 = r63 - 0x00000004
	Mem0[r63:word32] = r1
	call fn00001200 (retsize: 4;)
	r63 = r63 + 0x00000008
	r1 = 0x00000003
	r63 = r63 - 0x00000004
	Mem0[r63:word32] = r1
	call fn00001100 (retsize: 4;)
	r63 = r63 + 0x00000008
	return
fn1000_exit:

// fn00001100
// Return size: 0
void fn00001100()
fn00001100_entry:
l00001100:
	r63 = fp
	r1 = Mem0[r63 + 0x00000004:word32]
	branch r1 == 0x00000000 l00001120
	goto l00001108
l00001100:
l00001108:
	r1 = Mem0[r63 + 0x00000004:word32]
	r1 = r1 - 0x00000001
	Mem0[r63 + 0x00000004:word32] = r1
l00001114_thunk_fn00001200:
	call fn00001200 (retsize: 0;)
	return
l00001120:
	r1 = 0x00000000
	return
fn00001100_exit:

// fn00001200
// Return size: 0
void fn00001200()
fn00001200_entry:
l00001200:
	r63 = fp
	r1 = Mem0[r63 + 0x00000004:word32]
	branch r1 == 0x00000000 l00001220
l00001208:
	r1 = Mem0[r63 + 0x00000004:word32]
	r1 = r1 - 0x00000001
	Mem0[r63 + 0x00000004:word32] = r1
l00001214_thunk_fn00001100:
	call fn00001100 (retsize: 0;)
	return
l00001220:
	r1 = 0x00000001
	return
fn00001200_exit:

";

            AssertProgram(sExp, program);
        }
Beispiel #2
0
        public void Scanner_EvenOdd()
        {
            var scan     = CreateScanner(0x1000, 0x2000);
            var platform = new DefaultPlatform(null, program.Architecture);

            program.Platform = platform;
            fakeArch.Test_AddTraces(RtlEvenOdd.Create(fakeArch));

            scan.ScanProcedure(
                program.Architecture,
                Address.Ptr32(0x1000),
                "fn1000",
                arch.CreateProcessorState());
            var sExp = @"// fn1000
// Return size: 4
define fn1000
fn1000_entry:
	r63 = fp
l00001000:
	r1 = 3<32>
	r63 = r63 - 4<32>
	Mem0[r63:word32] = r1
	call fn00001200 (retsize: 4;)
	r63 = r63 + 8<32>
	r1 = 3<32>
	r63 = r63 - 4<32>
	Mem0[r63:word32] = r1
	call fn00001100 (retsize: 4;)
	r63 = r63 + 8<32>
	return
fn1000_exit:

// fn00001100
// Return size: 0
define fn00001100
fn00001100_entry:
	r63 = fp
l00001100:
	r1 = Mem0[r63 + 4<32>:word32]
	branch r1 == 0<32> l00001120
	goto l00001108
l00001100:
l00001108:
	r1 = Mem0[r63 + 4<32>:word32]
	r1 = r1 - 1<32>
	Mem0[r63 + 4<32>:word32] = r1
	goto 0x00001200<p32>
l00001114_thunk_fn00001200:
	call fn00001200 (retsize: 0;)
	return
l00001120:
	r1 = 0<32>
	return
fn00001100_exit:

// fn00001200
// Return size: 0
define fn00001200
fn00001200_entry:
	r63 = fp
l00001200:
	r1 = Mem0[r63 + 4<32>:word32]
	branch r1 == 0<32> l00001220
l00001208:
	r1 = Mem0[r63 + 4<32>:word32]
	r1 = r1 - 1<32>
	Mem0[r63 + 4<32>:word32] = r1
	goto 0x00001100<p32>
l00001214_thunk_fn00001100:
	call fn00001100 (retsize: 0;)
	return
l00001220:
	r1 = 1<32>
	return
fn00001200_exit:

";

            AssertProgram(sExp, program);
        }