Annotation of driverkit/notes/msg_send_problems, revision 1.1.1.1

1.1       root        1:                        driverkit msg_send notes
                      2:                        
                      3: thread.ipc_kernel TRUE ==> "body of message is in kernel pmap" (avoids copyin
                      4:        and copyout)
                      5: task.kernel_ipc_space TRUE ==> ports are kernel objects, i.e., they are 
                      6:        ptrs to struct kern_port_t instread of ints.
                      7:        
                      8: difference between msg_send() and msg_send_from_kernel():
                      9:        -- msg_send() does copyin() of entire msg body (instead of bcopy())
                     10:        -- msg_send_from_kernel() forces both ipc_kernel and kernel_ipc_space
                     11:           TRUE
                     12:           
                     13: Must do msg_send_from_kernel() if it's possible that current_task() is a user task. For example, the exported methods in SCSIController call enqueueCmd, which will do a msg_send to cmdPort. No good - the msg_send() will do a copyin() to get a local copy of the message body; the copyin() willget garbage from the user task. Thus SCSIController has to keep a kern_port_t version of cmdPort; enqueueCmd will do a msg_send_from_kernel to that.
                     14: 
                     15: Other msg_send()s in kernel drivers which need to be msg_send_from_kernel:
                     16: 
                     17:     adbDriver:
                     18:        threadOpCommon in adbDriver.m - same fix (cmdPort)
                     19:        fake_hw_intr_msg() in adbArch.m - same fix (interruptPort)
                     20:     SCSIController:
                     21:        enqueueCmd in SCSIControllerPrivate (cmdPort)
                     22:        FAKE_HARDWARE version of enableInterrupt in SCSIDevice.m 
                     23:                (interruptPort) <<<probably can skip....>>
                     24:     Ethernet:
                     25:        enetNotifyThread in Ethernet.m (IOPort)
                     26:        enetSyncCmd in Ethernet.m (IOPort)
                     27:        
                     28: msg_send()s which are OK as is:
                     29:     SCSIController:
                     30:        SCSITimerFcn (timerPort) - called via IOTimeout
                     31:     libIO:
                     32:        iotaskTest() - this is an IOTask thread.
                     33:        

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.