change fillmeup syscall to use an int32 field to indicate the position within the...
authorDavid Zhu <yuzhu@cs.berkeley.edu>
Tue, 27 Apr 2010 23:09:43 +0000 (16:09 -0700)
committerKevin Klues <klueska@cs.berkeley.edu>
Thu, 3 Nov 2011 00:35:45 +0000 (17:35 -0700)
kern/arch/i686/ne2k.c
kern/arch/i686/nic_common.h
kern/arch/i686/rl8168.c
kern/src/syscall.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);
 
index 4ee4a21..d96c0fa 100644 (file)
@@ -51,7 +51,7 @@ struct fillmeup {
        struct proc *proc;
        uint8_t *bufs;
        uint16_t num_bufs;
-       int16_t *last_written;
+       int32_t *last_written;
 };
 extern struct fillmeup fillmeup_data;
 #endif
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);
 
index 0749a54..90d875e 100644 (file)
@@ -1053,7 +1053,7 @@ intreg_t sys_tcsetattr(struct proc* p, int fd, int optional_actions, const void*
 }
 
 intreg_t sys_fillmeup(struct proc *p, uint8_t *bufs, 
-                      uint16_t num_bufs, int16_t *last_written)
+                      uint16_t num_bufs, int32_t *last_written)
 {
 #if defined(__CONFIG_OSDI__) && defined(__CONFIG_NETWORKING__)
        extern struct fillmeup fillmeup_data;