Пример #1
0
        private void IrqWorkerMain()
        {
            DebugPrint(
                "Intel {0} Ethernet Driver irq worker thread started.\n",
                DebugStub.ArgList(this.cardName)
                );
            uint rcnt   = 0;
            uint missed = 0;
            uint nobuf  = 0;

            while (irqWorkerStop == false)
            {
                Thread.Yield(); //TODO: irq.WaitForInterrupt();
                uint icr = Read32(Register.ICR);
                HandleInterrupts(icr);

                rcnt   += Read32(Register.TOTAL_RECV_PACKETS);
                missed += Read32(0x4010);
                nobuf  += Read32(0x40a0);
                INucleusCalls.DebugPrintHex(10, rcnt - nobuf);
                INucleusCalls.DebugPrintHex(20, rcnt);
                INucleusCalls.DebugPrintHex(30, missed);

                //TODO: irq.AckInterrupt();
            }

            DisableInterrupts();
            DebugPrint(
                "Intel {0} Ethernet Driver irq worker thread stopped.\n",
                DebugStub.ArgList(this.cardName)
                );
        }
        private Packet MakePacketFromDescriptor(DmaMemory mem, ulong controlBits)
        {
            PacketFifo inDevPkts = rxPacketsInDevice.Acquire();
            Packet     packet    = inDevPkts.Pop();
            int        length    = (int)((controlBits & RxDescriptor.LENGTH_MASK)
                                         >> RxDescriptor.LENGTH_SHIFT);
            uint stat_err = (uint)((controlBits & RxDescriptor.ERR_STAT_MASK)
                                   >> RxDescriptor.ERR_STAT_SHIFT);

            // can't deal with fragments yet
            if ((stat_err & RxErrStatFields.END_OF_PACKET) == 0)
            {
                INucleusCalls.DebugPrintHex(40, 0xd0);
                DebugStub.Print("FRAGMENT\n");
                throw new Exception();
            }

            //DebugStub.Assert((stat_err & RxErrStatFields.END_OF_PACKET) != 0);
            //DebugStub.Assert(packet.GetFragmentVirtualAddress(0) == fragmentVirtAddr);
            packet.FromDeviceFlags = GetRecvPktFlags(stat_err);
            packet.SetFragment(0, mem.BytesRef(0, length));
            rxPacketsInDevice.Release(inDevPkts);

            return(packet);
        }
Пример #3
0
    public override void Run()
    {
        int nIter = 1048576;

        if (me == 0)
        {
            kernel.NewThread(other);
            Semaphore s0 = mySemaphore;
            Semaphore s1 = other.mySemaphore;
            kernel.Yield();
            INucleusCalls.DebugPrintHex(50, 0);
            long t1 = INucleusCalls.Rdtsc();
            for (int i = 0; i < nIter; i++)
            {
                s1.Signal();
                s0.Wait();
            }
            long t2   = INucleusCalls.Rdtsc();
            uint diff = (uint)((t2 - t1) >> 20);
            INucleusCalls.DebugPrintHex(50, diff);
            doneSemaphore.Signal();
        }
        else
        {
            Semaphore s1 = mySemaphore;
            Semaphore s0 = other.mySemaphore;
            kernel.Yield();
            for (int i = 0; i < nIter; i++)
            {
                s1.Wait();
                s0.Signal();
            }
        }
    }
Пример #4
0
    public override void Run()
    {
        int nIter = 1048576;

        INucleusCalls.DebugPrintHex(50, 0);
        long t1 = INucleusCalls.Rdtsc();
        {
            new BinaryTree(0);
        }
        long t2   = INucleusCalls.Rdtsc();
        uint diff = (uint)((t2 - t1) >> 20);

        INucleusCalls.DebugPrintHex(50, diff);
        doneSemaphore.Signal();
    }
Пример #5
0
    public override void Run()
    {
        int nIter = 65536;

        INucleusCalls.DebugPrintHex(50, 0);
        long t1 = INucleusCalls.Rdtsc();

        for (int i = 0; i < nIter; i++)
        {
            (new byte[1000])[0]++;
        }
        long t2   = INucleusCalls.Rdtsc();
        uint diff = (uint)((t2 - t1) >> 16);

        INucleusCalls.DebugPrintHex(50, diff);
        doneSemaphore.Signal();
    }
Пример #6
0
    public override void Run()
    {
        //int nIter = 1048576;
        int nIter = 65536;

        INucleusCalls.DebugPrintHex(50, 0);
        long t1 = INucleusCalls.Rdtsc();

        /* int array
         * int[] a = new int[9];
         * for (int i = 0; i < nIter; i++)
         * {
         *  if (i < 9) a[i] = i;
         *  new BinaryTree(0);
         * }
         * for (int i = 0; i < 9; i++) {
         *  System.Console.WriteLine(" i => " + a[i]);
         * }*/

        // cast/instance of/array store

        /*B[] a = new C[10];
         * for (int i = 0; i < 10; i++) {
         *  if (i < 2) a[i] = new C();
         *  else if (i < 4) a[i] = new D();
         *  else a[i] = new E();
         * }
         *
         * // instance of
         * for (int i = 0; i < 10; i++) {
         *  if (a[i] is D) {
         *      INucleusCalls.DebugPrintHex(20, (uint)i);
         *  }
         * }
         *
         * // cast
         * for (int i = 0; i < 10; i++) {
         *  if (i > 4) {
         *      E e = (E)a[i];
         *      INucleusCalls.DebugPrintHex(20, (uint)i);
         *  }
         * }
         *
         * // box/unboxing
         * System.Object[] a = new System.Object[9];
         * for (int i = 0; i < 9; i++) {
         *  a[i] = i;
         * }
         * for (int i = 0; i < 9; i++) {
         *  int j = (int)a[i];
         *  INucleusCalls.DebugPrintHex(20, (uint)j);
         * }
         *
         * // interface lookup
         * C1 c1 = new C1();
         * C2 c2 = new C2(1);
         * I i = null;
         * if (foo == 2) i = c1;
         * else i = c2;
         * foo = i.m(3);
         * INucleusCalls.DebugPrintHex(20, (uint)foo);
         *
         * System.Object o = null;
         * if (foo == 2) o = c1;
         * else o = c2;
         * J oj = (J)o;
         * int result = oj.mj(3);
         * INucleusCalls.DebugPrintHex(20, (uint)result);
         *
         * // int[][]
         * int[][] board = new int[8][];
         *
         * for (int i = 0; i < 8; i++) {
         *  board[i] = new int[8] { 0, 1, 2, 3, 4, 5, 6, 7 };
         * }
         * for (int i=0; i<8; i++) {
         *  for (int j=0; j<8; j++) {
         *      INucleusCalls.DebugPrintHex(20, (uint)i);
         *      INucleusCalls.DebugPrintHex(30, (uint)j);
         *      INucleusCalls.DebugPrintHex(40, (uint)board[i][j]);
         *  }
         * }*/


        //impact.othello.othello.Main(new System.String[1] { "-d" });
        //Crafty.Net.OO.Crafty.Main(new System.String[0]);
        //SharpSAT.SATSolver.Main(new System.String[1]{"input"});
        //impact.li_130.xlisp.Main(new System.String[0]);

        long t2   = INucleusCalls.Rdtsc();
        uint diff = (uint)((t2 - t1) >> 16);

        INucleusCalls.DebugPrintHex(50, diff);
        doneSemaphore.Signal();
    }