change fillmeup syscall to use an int32 field to indicate the position within the...
[akaros.git] / kern / arch / i686 / ne2k.c
index 5d8dd8f..f59e836 100644 (file)
@@ -398,12 +398,17 @@ void ne2k_handle_rx_packet() {
                assert(fillmeup_data.bufs != NULL);
                struct proc *proc = fillmeup_data.proc;
 
-               int16_t lw;
+               int32_t lw;
+               uint32_t backupcr3;
                memcpy_from_user(proc, &lw, fillmeup_data.last_written, sizeof(lw));
                lw = (lw + 1) % (fillmeup_data.num_bufs);
-               memcpy_to_user(proc, fillmeup_data.last_written, &lw, sizeof(lw));
                memcpy_to_user(proc, &fillmeup_data.bufs[PACKETIZER_MAX_PAYLOAD * lw], 
                               p->payload, ntohl(p->payload_size));
+               // memcpy_to_user(proc, fillmeup_data.last_written, &lw, sizeof(lw));
+               backupcr3 = rcr3();
+               lcr3(proc->env_cr3);
+               *(fillmeup_data.last_written) = lw;
+               lcr3(backupcr3);
                //print_packetizer_packet(p);
                proc_notify(fillmeup_data.proc, NE_ETC_ETC_ETC, 0);