change fillmeup syscall to use an int32 field to indicate the position within the...
[akaros.git] / kern / arch / i686 / rl8168.c
index d24506c..ecafb14 100644 (file)
@@ -519,12 +519,18 @@ void rl8168_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);