Diff for /np2/i386c/ia32/segments.h between versions 1.6 and 1.10

version 1.6, 2004/02/05 16:43:44 version 1.10, 2005/03/12 12:32:54
Line 12 Line 12
  * 2. Redistributions in binary form must reproduce the above copyright   * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the   *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.   *    documentation and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products  
  *    derived from this software without specific prior written permission.  
  *   *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR   * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES   * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
Line 40  extern "C" { Line 38  extern "C" {
 typedef struct {  typedef struct {
         union {          union {
                 struct {                  struct {
                         DWORD   segbase;                          UINT32  segbase;
                         DWORD   segend;                          UINT32  segend;
                         DWORD   limit;                          UINT32  limit;
   
                         BYTE    c;      /* 0 = data, 1 = code */                          UINT8   c;      /* 0 = data, 1 = code */
                         BYTE    g;      /* 4k base */                          UINT8   g;      /* 4k base */
                         BYTE    wr;     /* readable/writable */                          UINT8   wr;     /* readable/writable */
                         BYTE    ec;     /* expand down/conforming */                          UINT8   ec;     /* expand down/conforming */
                 } seg;                  } seg;
   
                 struct {                  struct {
                         WORD    selector;                          UINT16  selector;
                         WORD    w_pad;                          UINT16  w_pad;
                         DWORD   offset;                          UINT32  offset;
   
                         BYTE    count;          /* parameter count:call gate */                          UINT8   count;          /* parameter count:call gate */
   
                         BYTE    b_pad[7];                          UINT8   b_pad[7];
                 } gate;                  } gate;
         } u;          } u;
   
         BYTE    valid;  /* descriptor valid flag */          UINT8   valid;  /* descriptor valid flag */
         BYTE    p;      /* avail flag */          UINT8   p;      /* avail flag */
   
         BYTE    type;   /* descriptor type */          UINT8   type;   /* descriptor type */
         BYTE    dpl;    /* DPL */          UINT8   dpl;    /* DPL */
         BYTE    rpl;    /* RPL */          UINT8   rpl;    /* RPL */
         BYTE    s;      /* 0 = system, 1 = code/data */          UINT8   s;      /* 0 = system, 1 = code/data */
         BYTE    d;      /* 0 = 16bit, 1 = 32bit */          UINT8   d;      /* 0 = 16bit, 1 = 32bit */
   
         BYTE    flag;          UINT8   flag;
 #define CPU_DESC_FLAG_READABLE  (1 << 0)  #define CPU_DESC_FLAG_READABLE  (1 << 0)
 #define CPU_DESC_FLAG_WRITABLE  (1 << 1)  #define CPU_DESC_FLAG_WRITABLE  (1 << 1)
 } descriptor_t;  } descriptor_t;
Line 140  typedef struct { Line 138  typedef struct {
   
 #define CPU_SET_SEGDESC_DEFAULT(dscp, idx, selector) \  #define CPU_SET_SEGDESC_DEFAULT(dscp, idx, selector) \
 do { \  do { \
         (dscp)->u.seg.segbase = (DWORD)(selector) << 4; \          (dscp)->u.seg.segbase = (UINT32)(selector) << 4; \
         (dscp)->u.seg.segend = (dscp)->u.seg.segbase + (dscp)->u.seg.limit; \          (dscp)->u.seg.segend = (dscp)->u.seg.segbase + (dscp)->u.seg.limit; \
         (dscp)->u.seg.c = ((idx) == CPU_CS_INDEX) ? 1 : 0; \          (dscp)->u.seg.c = ((idx) == CPU_CS_INDEX) ? 1 : 0; \
         (dscp)->u.seg.g = 0; \          (dscp)->u.seg.g = 0; \
           (dscp)->u.seg.wr = 1; \
         (dscp)->valid = 1; \          (dscp)->valid = 1; \
         (dscp)->p = 1; \          (dscp)->p = 1; \
         (dscp)->type = 0x02; /* writable */ \          (dscp)->type = 0x02; /* writable */ \
Line 155  do { \ Line 154  do { \
   
 #define CPU_SET_TASK_BUSY(selector, dscp) \  #define CPU_SET_TASK_BUSY(selector, dscp) \
 do { \  do { \
         DWORD addr; \          UINT32 addr; \
         DWORD h; \          UINT32 h; \
         addr = CPU_GDTR_BASE + ((selector) & CPU_SEGMENT_SELECTOR_INDEX_MASK); \          addr = CPU_GDTR_BASE + ((selector) & CPU_SEGMENT_SELECTOR_INDEX_MASK); \
         h = cpu_kmemoryread_d(addr + 4); \          h = cpu_kmemoryread_d(addr + 4); \
         if (!(h & CPU_TSS_H_BUSY)) { \          if (!(h & CPU_TSS_H_BUSY)) { \
Line 170  do { \ Line 169  do { \
   
 #define CPU_SET_TASK_FREE(selector, dscp) \  #define CPU_SET_TASK_FREE(selector, dscp) \
 do { \  do { \
         DWORD addr; \          UINT32 addr; \
         DWORD h; \          UINT32 h; \
         addr = CPU_GDTR_BASE + ((selector) & CPU_SEGMENT_SELECTOR_INDEX_MASK); \          addr = CPU_GDTR_BASE + ((selector) & CPU_SEGMENT_SELECTOR_INDEX_MASK); \
         h = cpu_kmemoryread_d(addr + 4); \          h = cpu_kmemoryread_d(addr + 4); \
         if (h & CPU_TSS_H_BUSY) { \          if (h & CPU_TSS_H_BUSY) { \
Line 183  do { \ Line 182  do { \
         } \          } \
 } while (/*CONSTCOND*/ 0)  } while (/*CONSTCOND*/ 0)
   
 void load_descriptor(descriptor_t *descp, DWORD addr);  void load_descriptor(descriptor_t *descp, UINT32 addr);
   
 #define CPU_SET_SEGREG(idx, selector)   load_segreg(idx, selector, GP_EXCEPTION)  #define CPU_SET_SEGREG(idx, selector)   load_segreg(idx, selector, GP_EXCEPTION)
 void load_segreg(int idx, WORD selector, int exc);  void load_segreg(int idx, UINT16 selector, int exc);
 void load_ss(WORD selector, descriptor_t* sdp, DWORD cpl);  void load_ss(UINT16 selector, const descriptor_t *sd, UINT cpl);
 void load_cs(WORD selector, descriptor_t* sdp, DWORD cpl);  void load_cs(UINT16 selector, const descriptor_t *sd, UINT cpl);
 void load_ldtr(WORD selector, int exc);  void load_ldtr(UINT16 selector, int exc);
   
   
 /*  /*
Line 200  void load_ldtr(WORD selector, int exc); Line 199  void load_ldtr(WORD selector, int exc);
 #define CPU_SEGMENT_TABLE_IND           (1 << 2)        /* 0 = GDT, 1 = LDT */  #define CPU_SEGMENT_TABLE_IND           (1 << 2)        /* 0 = GDT, 1 = LDT */
   
 typedef struct {  typedef struct {
         WORD            selector;          UINT16          selector;
         WORD            idx;          UINT16          idx;
         WORD            rpl;          UINT16          rpl;
         BYTE            ldt;          UINT8           ldt;
         BYTE            pad;          UINT8           pad;
   
         DWORD           addr;           /* descriptor linear address */          UINT32          addr;           /* descriptor linear address */
   
         descriptor_t    desc;          descriptor_t    desc;
 } selector_t;  } selector_t;
   
 int parse_selector(selector_t *ssp, WORD selector);  int parse_selector(selector_t *ssp, UINT16 selector);
 int selector_is_not_present(selector_t *ssp);  int selector_is_not_present(const selector_t *ssp);
   
 #ifdef __cplusplus  #ifdef __cplusplus
 }  }

Removed from v.1.6  
changed lines
  Added in v.1.10


RetroPC.NET-CVS <cvs@retropc.net>