Дескскриптор прерывания

Тема в разделе "WASM.OS.DEVEL", создана пользователем Toxasoft, 22 сен 2010.

  1. Toxasoft

    Toxasoft New Member

    Публикаций:
    0
    Теперь понятно.
     
  2. Toxasoft

    Toxasoft New Member

    Публикаций:
    0
    Phantom напиши плиз сам макрос
     
  3. baldr

    baldr New Member

    Публикаций:
    0
    Есть вот такой вариант.
    Код (Text):
    1. struc descriptor [def] {
    2. common
    3.   local .base,.limit,.type
    4.   .base = 0
    5.   .type = 0x0010; defaults: byte-granularity 16-bit not-present DPL0 read-only not-accessed data
    6. forward
    7.   match =base==v, def \{ .base = v \}
    8.   match =limit==v, def \{
    9.     \local matched
    10.     matched equ 0
    11.     match vv*=4k,v \\{
    12.       .limit = vv
    13.       .type = .type or 0x8000
    14.       restore matched
    15.       matched equ 1
    16.     \\}
    17.     match =0, matched \\{
    18.       .limit = v
    19.     \\}
    20.     restore matched
    21.   \}
    22.   match =a, def \{ .type = .type or 1 \}
    23.   match =w, def \{ .type = .type or 2 \}
    24.   match =e, def \{ .type = .type or 4 \}
    25.   match =code, def \{ .type = .type or 8 \}
    26.   match =r, def \{ .type = .type or 2 \}
    27.   match =c, def \{ .type = .type or 4 \}
    28.   match =dpl==.dpl, def \{ .type = .type and not 0x0060 or ((.dpl) and 3) shl 5 \}
    29.   match =p, def \{ .type = .type or 0x80 \}
    30.   match =avl==.avl, def \{ .type = .type and not 0x0100 or ((.avl) and 1) shl 12 \}
    31.   match =64bit, def \{ .type = .type or 0x2000 \}
    32.   match =32bit, def \{ .type = .type or 0x4000 \}
    33. common
    34.   if .type and 0x6008 = 0x6008
    35.     display "Reserved combination of L and D bits in code segment descriptor", 13, 10
    36.     err
    37.   end if
    38.   dw    .limit and 0xFFFF
    39.   dw    .base and 0xFFFF
    40.   db    .base shr 16 and 0xFF
    41.   db    .type and 0xFF
    42.   db    (.type shr 8 and 0xF0) or (.limit shr 16 and 0x0F)
    43.   db    .base shr 24 and 0xFF
    44. }
    45.  
    46. macro descriptor [def] {
    47. common
    48.   local .
    49.   . descriptor def
    50. }
    Использовать примерно так:
    Код (Text):
    1. code0   descriptor code, 32bit, base=0, limit=0xFFFFFF*4k, p, r
    2. code3   descriptor code, dpl=3, 32bit, base=0, limit=0xFFFFFF*4k, p, r
    3. data3   descriptor data, dpl=3, 32bit, base=0, limit=0xFFFFFF*4k, p, w
    Не совсем про прерывания, но общая идея должна быть ясна.
     
  4. Toxasoft

    Toxasoft New Member

    Публикаций:
    0
  5. Phantom_84

    Phantom_84 New Member

    Публикаций:
    0
    У меня все просто, но не менее эффективно. Первые два параметра могут быть либо селектором и смещением, либо базой и лимитом. Это зависит от типа дескриптора, определяемого флагами. DF_USE32 и DF_PAGED определяются по-особому, поэтому я их тоже покажу.
    Код (Text):
    1. ...
    2.  
    3. DF_PRESENT      equ     80h
    4.  
    5. DF_USE16        equ     0
    6. DF_USE32        equ     400000h
    7.  
    8. DF_BYTED        equ     0
    9. DF_PAGED        equ     800000h
    10.  
    11. DF_DATA32       equ     (DF_DATA or DF_DUALACTION or DF_USE32 or DF_PAGED)
    12. DF_CODE32       equ     (DF_CODE or DF_DUALACTION or DF_USE32 or DF_PAGED)
    13.  
    14. macro desc p1, p2, p3
    15. {
    16. dw (p2) and 0FFFFh
    17. dw (p1) and 0FFFFh
    18. db (p1) shr 16 and 0FFh
    19. db (p3) and 0FFh or DF_PRESENT
    20. db ((p2) or (p3)) shr 16 and 0FFh
    21. db ((p1) or (p2)) shr 24
    22. }