- Timestamp:
- 2010-11-14T17:25:55Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 481b212
- Parents:
- 982e3d8 (diff), a9db9b8 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- kernel
- Files:
-
- 5 edited
-
arch/amd64/include/pm.h (modified) (1 diff)
-
arch/amd64/src/ddi/ddi.c (modified) (1 diff)
-
arch/ia32/include/pm.h (modified) (1 diff)
-
arch/ia32/src/ddi/ddi.c (modified) (1 diff)
-
generic/src/adt/bitmap.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/amd64/include/pm.h
r982e3d8 r8e189ef 83 83 84 84 #define TSS_BASIC_SIZE 104 85 #define TSS_IOMAP_SIZE ( 16 * 1024 + 1) /* 16K for bitmap + 1 terminating byte for convenience */85 #define TSS_IOMAP_SIZE (8 * 1024 + 1) /* 8K for bitmap + 1 terminating byte for convenience */ 86 86 87 87 #define IO_PORTS (64 * 1024) -
kernel/arch/amd64/src/ddi/ddi.c
r982e3d8 r8e189ef 126 126 bitmap_initialize(&iomap, CPU->arch.tss->iomap, 127 127 TSS_IOMAP_SIZE * 8); 128 bitmap_copy(&iomap, &TASK->arch.iomap, TASK->arch.iomap.bits);128 bitmap_copy(&iomap, &TASK->arch.iomap, bits); 129 129 130 /* 131 * Set the trailing bits in the last byte of the map to disable 132 * I/O access. 133 */ 134 bitmap_set_range(&iomap, bits, ALIGN_UP(bits, 8) - bits); 130 135 /* 131 136 * It is safe to set the trailing eight bits because of the 132 137 * extra convenience byte in TSS_IOMAP_SIZE. 133 138 */ 134 bitmap_set_range(&iomap, ALIGN_UP( TASK->arch.iomap.bits, 8), 8);139 bitmap_set_range(&iomap, ALIGN_UP(bits, 8), 8); 135 140 } 136 141 irq_spinlock_unlock(&TASK->lock, false); -
kernel/arch/ia32/include/pm.h
r982e3d8 r8e189ef 75 75 76 76 #define TSS_BASIC_SIZE 104 77 #define TSS_IOMAP_SIZE ( 16 * 1024 + 1) /* 16K for bitmap + 1 terminating byte for convenience */77 #define TSS_IOMAP_SIZE (8 * 1024 + 1) /* 8K for bitmap + 1 terminating byte for convenience */ 78 78 79 79 #define IO_PORTS (64 * 1024) -
kernel/arch/ia32/src/ddi/ddi.c
r982e3d8 r8e189ef 127 127 bitmap_initialize(&iomap, CPU->arch.tss->iomap, 128 128 TSS_IOMAP_SIZE * 8); 129 bitmap_copy(&iomap, &TASK->arch.iomap, TASK->arch.iomap.bits);129 bitmap_copy(&iomap, &TASK->arch.iomap, bits); 130 130 131 /* 132 * Set the trailing bits in the last byte of the map to disable 133 * I/O access. 134 */ 135 bitmap_set_range(&iomap, bits, ALIGN_UP(bits, 8) - bits); 131 136 /* 132 137 * It is safe to set the trailing eight bits because of the 133 138 * extra convenience byte in TSS_IOMAP_SIZE. 134 139 */ 135 bitmap_set_range(&iomap, ALIGN_UP( TASK->arch.iomap.bits, 8), 8);140 bitmap_set_range(&iomap, ALIGN_UP(bits, 8), 8); 136 141 } 137 142 irq_spinlock_unlock(&TASK->lock, false); -
kernel/generic/src/adt/bitmap.c
r982e3d8 r8e189ef 32 32 /** 33 33 * @file 34 * @brief Implementation of bitmap ADT.34 * @brief Implementation of bitmap ADT. 35 35 * 36 36 * This file implements bitmap ADT and provides functions for … … 51 51 * No portion of the bitmap is set or cleared by this function. 52 52 * 53 * @param bitmap Bitmap structure.54 * @param map Address of the memory used to hold the map.55 * @param bits Number of bits stored in bitmap.53 * @param bitmap Bitmap structure. 54 * @param map Address of the memory used to hold the map. 55 * @param bits Number of bits stored in bitmap. 56 56 */ 57 57 void bitmap_initialize(bitmap_t *bitmap, uint8_t *map, size_t bits) … … 63 63 /** Set range of bits. 64 64 * 65 * @param bitmap Bitmap structure.66 * @param start Starting bit.67 * @param bits Number of bits to set.65 * @param bitmap Bitmap structure. 66 * @param start Starting bit. 67 * @param bits Number of bits to set. 68 68 */ 69 69 void bitmap_set_range(bitmap_t *bitmap, size_t start, size_t bits) … … 71 71 size_t i = 0; 72 72 size_t aligned_start; 73 size_t lub; /* leading unaligned bits */74 size_t amb; /* aligned middle bits */75 size_t tab; /* trailing aligned bits */73 size_t lub; /* leading unaligned bits */ 74 size_t amb; /* aligned middle bits */ 75 size_t tab; /* trailing aligned bits */ 76 76 77 77 ASSERT(start + bits <= bitmap->bits); … … 82 82 tab = amb % 8; 83 83 84 if ( start + bits < aligned_start ) { 85 /* 86 * Set bits in the middle of byte 87 */ 88 bitmap->map[start / 8] |= ((1 << lub)-1) << (start&7); 89 return; 84 if (!bits) 85 return; 86 87 if (start + bits < aligned_start) { 88 /* Set bits in the middle of byte. */ 89 bitmap->map[start / 8] |= ((1 << lub) - 1) << (start & 7); 90 return; 90 91 } 91 92 92 93 if (lub) { 93 /* 94 * Make sure to set any leading unaligned bits. 95 */ 94 /* Make sure to set any leading unaligned bits. */ 96 95 bitmap->map[start / 8] |= ~((1 << (8 - lub)) - 1); 97 96 } 98 97 for (i = 0; i < amb / 8; i++) { 99 /* 100 * The middle bits can be set byte by byte. 101 */ 98 /* The middle bits can be set byte by byte. */ 102 99 bitmap->map[aligned_start / 8 + i] = ALL_ONES; 103 100 } 104 101 if (tab) { 105 /* 106 * Make sure to set any trailing aligned bits. 107 */ 102 /* Make sure to set any trailing aligned bits. */ 108 103 bitmap->map[aligned_start / 8 + i] |= (1 << tab) - 1; 109 104 } … … 113 108 /** Clear range of bits. 114 109 * 115 * @param bitmap Bitmap structure.116 * @param start Starting bit.117 * @param bits Number of bits to clear.110 * @param bitmap Bitmap structure. 111 * @param start Starting bit. 112 * @param bits Number of bits to clear. 118 113 */ 119 114 void bitmap_clear_range(bitmap_t *bitmap, size_t start, size_t bits) … … 121 116 size_t i = 0; 122 117 size_t aligned_start; 123 size_t lub; /* leading unaligned bits */124 size_t amb; /* aligned middle bits */125 size_t tab; /* trailing aligned bits */118 size_t lub; /* leading unaligned bits */ 119 size_t amb; /* aligned middle bits */ 120 size_t tab; /* trailing aligned bits */ 126 121 127 122 ASSERT(start + bits <= bitmap->bits); … … 132 127 tab = amb % 8; 133 128 134 if ( start + bits < aligned_start)135 {136 /* 137 * Set bits in the middle of byte138 */139 bitmap->map[start / 8] &= ~(((1 << lub)-1) << (start&7));140 return;129 if (!bits) 130 return; 131 132 if (start + bits < aligned_start) { 133 /* Set bits in the middle of byte */ 134 bitmap->map[start / 8] &= ~(((1 << lub) - 1) << (start & 7)); 135 return; 141 136 } 142 137 143 144 138 if (lub) { 145 /* 146 * Make sure to clear any leading unaligned bits. 147 */ 139 /* Make sure to clear any leading unaligned bits. */ 148 140 bitmap->map[start / 8] &= (1 << (8 - lub)) - 1; 149 141 } 150 142 for (i = 0; i < amb / 8; i++) { 151 /* 152 * The middle bits can be cleared byte by byte. 153 */ 143 /* The middle bits can be cleared byte by byte. */ 154 144 bitmap->map[aligned_start / 8 + i] = ALL_ZEROES; 155 145 } 156 146 if (tab) { 157 /* 158 * Make sure to clear any trailing aligned bits. 159 */ 147 /* Make sure to clear any trailing aligned bits. */ 160 148 bitmap->map[aligned_start / 8 + i] &= ~((1 << tab) - 1); 161 149 } … … 165 153 /** Copy portion of one bitmap into another bitmap. 166 154 * 167 * @param dst Destination bitmap.168 * @param src Source bitmap.169 * @param bits Number of bits to copy.155 * @param dst Destination bitmap. 156 * @param src Source bitmap. 157 * @param bits Number of bits to copy. 170 158 */ 171 159 void bitmap_copy(bitmap_t *dst, bitmap_t *src, size_t bits)
Note:
See TracChangeset
for help on using the changeset viewer.
