ddi_mmap_get_model(9f) 맨 페이지 - 윈디하나의 솔라나라

개요

섹션
맨 페이지 이름
검색(S)

ddi_mmap_get_model(9f)

ddi_mmap_get_model(9F)         Kernel Functions         ddi_mmap_get_model(9F)



NAME
       ddi_mmap_get_model - return data model type of current thread

SYNOPSIS
       #include <sys/ddi.h>
       #include <sys/sunddi.h>

       uint_t ddi_mmap_get_model(void);

INTERFACE LEVEL
       Solaris DDI specific (Solaris DDI).

DESCRIPTION
       ddi_mmap_get_model()  returns  the C Language Type Model which the cur‐
       rent thread expects. ddi_mmap_get_model() is used in  combination  with
       ddi_model_convert_from(9F) in the mmap(9E) driver entry point to deter‐
       mine whether there is a data model mismatch between the current  thread
       and the device driver. The device driver might have to adjust the shape
       of data structures before exporting them to a user  thread  which  sup‐
       ports a different data model.

RETURN VALUES
       DDI_MODEL_ILP32     Current thread expects 32-bit (ILP32) semantics.


       DDI_MODEL_LP64     Current thread expects 64-bit (LP64) semantics.


       DDI_FAILURE        The  ddi_mmap_get_model()  function  was  not called
                          from the mmap(9E) entry point.


CONTEXT
       The ddi_mmap_get_model() function can only be called from the  mmap(9E)
       driver entry point.

EXAMPLES
       Example 1 : Using ddi_mmap_get_model()



       The following is an example of the mmap(9E) entry point and how to sup‐
       port 32-bit and 64-bit applications with the same device driver.




         struct data32 {
                 int len;
                 caddr32_t addr;
         };

         struct data {
                 int len;
                 caddr_t addr;
         };
         xxmmap(dev_t dev, off_t off, int prot) {
                 struct data dtc; /* a local copy for clash resolution */
                 struct data *dp = (struct data *)shared_area;

                 switch (ddi_model_convert_from(ddi_mmap_get_model())) {
                 case DDI_MODEL_ILP32:
                 {
                         struct data32 *da32p;

                         da32p = (struct data32 *)shared_area;
                         dp = &dtc;
                         dp->len = da32p->len;
                         dp->address = da32->address;
                         break;
                 }
                 case DDI_MODEL_NONE:
                         break;
                 }
                 /* continues along using dp */
                ...
         }


SEE ALSO
       mmap(9E), ddi_model_convert_from(9F)


       Writing Device Drivers in Oracle Solaris 11.4



Oracle Solaris 11.4               8 Feb 2001            ddi_mmap_get_model(9F)
맨 페이지 내용의 저작권은 맨 페이지 작성자에게 있습니다.
RSS ATOM XHTML 5 CSS3