Pointers
GDT_Buffers locates the GDT descriptor for the BUFSEG segment.
BUFSEG
┌────────────────┬──────┬──────┬────┬────────────────────────────────────────┐│Field Name │Offset│Length│Type│Description │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │bs_MRUHead │+0 │2 │W │Head of MRU buffer list (LRU tail) │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │bs_MRUTail │+2 │2 │W │Tail of MRU buffer list (LRU head) │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │bs_FreeHead │+4 │2 │W │Head of Free buffer list │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │bs_Handle │+6 │2 │W │Handle for virtual memory manager │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │bs_nBuffers │+8 │2 │W │Number of buffers in segment │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │bs_buffsize │+a │2 │W │Size of buffer+header, in bytes. │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │bs_seglimit │+c │2 │W │Limit for entire buffer segment. │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │bs_pStats │+e │2 │W │Offset of statistics block (for PROFILE)│ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │bs_offRemMed │+10 │2 │W │Minimum "legal" offset of buffer for │ │ │ │ │ │removable media │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │bs_MaxSec │+12 │2 │W │Maximum sector size for block device │ │ │ │ │ │drivers │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │bs_BigBufBase │+14 │2 │W │Base of big buffers pool │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │bs_BigBufMap │+16 │2 │W │Big buffers usage bit map (bit0 - Buf0) │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │bs_physBufSeg │+18 │4 │D │Buffer segment Physical Address │ └────────────────┴──────┴──────┴────┴────────────────────────────────────────┘
BUFFINFO
┌────────────────┬──────┬──────┬────┬────────────────────────────────────────┐ │Field Name │Offset│Length│Type│Description │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │buf_next │+0 │2 │W │Pointer to next buffer in list (-1 = │ │ │ │ │ │end) │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │buf_prev │+2 │2 │W │Pointer to previous buffer in list (-1 =│ │ │ │ │ │end) │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │buf_freeLink │+4 │2 │W │Pointer to next free buffer (-1 = end) │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │buf_hVPB │+6 │1 │W │serial number of volume │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │buf_sector │+8 │4 │D │Sector number of buffer │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │buf_wrtcnt │+c │1 │B │For FAT sectors, # times sector written │ │ │ │ │ │out │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │buf_wrtcntinc │+d │2 │W │For FAT sectors, # sectors between each │ │ │ │ │ │write │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │buf_flags │+f │1 │B │Flags │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │buf_tid │+10 │2 │W │thread ID of buffer owner │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │buf_refcnt │+12 │2 │W │number of threads using buffer for read │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │buf_fill │+14 │2 │W │random debugging information │ ├────────────────┼──────┼──────┼────┼────────────────────────────────────────┤ │buf_pad │+16 │2 │W │Force dword alignment. │ └────────────────┴──────┴──────┴────┴────────────────────────────────────────┘
buf_falgs flag definitions:
┌────────────────────┬────────┬────────────────────────────────────────┐ │Name │Bit Mask│Description │ ├────────────────────┼────────┼────────────────────────────────────────┤ │BUF_DIRTY │0x80 │Bit 7 = 1 if buffer dirty │ ├────────────────────┼────────┼────────────────────────────────────────┤ │BUF_VISIT │0x40 │Bit 6 = 1 if buffer seen in search │ ├────────────────────┼────────┼────────────────────────────────────────┤ │BUF_WANT │0x20 │Bit 5 = 1 if process waiting for buffer │ ├────────────────────┼────────┼────────────────────────────────────────┤ │BUF_BUSY │0x10 │Bit 4 = 1 if in use by process │ ├────────────────────┼────────┼────────────────────────────────────────┤ │BUF_ISDATA │0x08 │Bit 3 = 1 if buffer is DATA │ ├────────────────────┼────────┼────────────────────────────────────────┤ │BUF_ISDIR │0x04 │Bit 2 = 1 if buffer is DIR │ ├────────────────────┼────────┼────────────────────────────────────────┤ │BUF_ISFAT │0x02 │Bit 1 = 1 if buffer is FAT │ ├────────────────────┼────────┼────────────────────────────────────────┤ │BUF_ATTEMPTING_READ │0x01 │Bit 0 = 1 if buffer is in swapper pool │ └────────────────────┴────────┴────────────────────────────────────────┘