Changeset 5a7d9d1 in mainline
- Timestamp:
- 2006-03-17T10:07:28Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4e49572
- Parents:
- 226a654
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/amd64/include/mm/as.h
r226a654 r5a7d9d1 30 30 #define __amd64_AS_H__ 31 31 32 # include <arch/types.h>32 #define KERNEL_ADDRESS_SPACE_SHADOWED_ARCH 0 33 33 34 34 #define KERNEL_ADDRESS_SPACE_START_ARCH (__address) 0xffff800000000000 -
arch/ia32/include/mm/as.h
r226a654 r5a7d9d1 30 30 #define __ia32_AS_H__ 31 31 32 # include <arch/types.h>32 #define KERNEL_ADDRESS_SPACE_SHADOWED_ARCH 0 33 33 34 34 #define KERNEL_ADDRESS_SPACE_START_ARCH ((__address) 0x80000000) -
arch/ia64/include/mm/as.h
r226a654 r5a7d9d1 30 30 #define __ia64_AS_H__ 31 31 32 # include <arch/types.h>32 #define KERNEL_ADDRESS_SPACE_SHADOWED_ARCH 0 33 33 34 34 #define KERNEL_ADDRESS_SPACE_START_ARCH (__address) 0xe000000000000000ULL -
arch/mips32/include/mm/as.h
r226a654 r5a7d9d1 30 30 #define __mips32_AS_H__ 31 31 32 #include <arch/types.h> 33 #include <typedefs.h> 32 #define KERNEL_ADDRESS_SPACE_SHADOWED_ARCH 0 34 33 35 34 #define KERNEL_ADDRESS_SPACE_START_ARCH (__address) 0x80000000 -
arch/ppc32/include/mm/as.h
r226a654 r5a7d9d1 30 30 #define __ppc32_AS_H__ 31 31 32 # include <arch/types.h>32 #define KERNEL_ADDRESS_SPACE_SHADOWED_ARCH 0 33 33 34 34 #define KERNEL_ADDRESS_SPACE_START_ARCH ((__address) 0x80000000) -
arch/sparc64/include/mm/as.h
r226a654 r5a7d9d1 30 30 #define __sparc64_AS_H__ 31 31 32 # include <arch/types.h>32 #define KERNEL_ADDRESS_SPACE_SHADOWED_ARCH 1 33 33 34 34 #define KERNEL_ADDRESS_SPACE_START_ARCH (__address) 0x0000000000000000 -
generic/include/macros.h
r226a654 r5a7d9d1 40 40 #define max(a,b) ((a)>(b)?(a):(b)) 41 41 42 /* Return true if the interlvals overlap*/43 static inline int overlaps(__address s1, size_t sz1, __address s2, size_t sz2)42 /** Return true if the interlvals overlap. */ 43 static inline int overlaps(__address s1, size_t sz1, __address s2, size_t sz2) 44 44 { 45 45 __address e1 = s1+sz1; -
generic/include/mm/as.h
r226a654 r5a7d9d1 37 37 #include <synch/spinlock.h> 38 38 #include <adt/list.h> 39 40 /** Defined to be true if user address space and kernel address space shadow each other. */ 41 #define KERNEL_ADDRESS_SPACE_SHADOWED KERNEL_ADDRESS_SPACE_SHADOWED_ARCH 39 42 40 43 #define KERNEL_ADDRESS_SPACE_START KERNEL_ADDRESS_SPACE_START_ARCH -
generic/src/lib/elf.c
r226a654 r5a7d9d1 166 166 } 167 167 168 /*169 * Check if the segment doesn't interfere with kernel address space.170 */171 if (entry->p_vaddr + ALIGN_UP(entry->p_memsz, PAGE_SIZE) >= USER_ADDRESS_SPACE_END)172 return EE_MEMORY;173 174 168 if (entry->p_flags & PF_X) 175 169 flags |= AS_AREA_EXEC; … … 196 190 a = as_area_create(as, flags, entry->p_memsz, entry->p_vaddr); 197 191 if (!a) 198 return EE_ IRRECOVERABLE;192 return EE_MEMORY; 199 193 200 194 for (i = 0; i < SIZE2FRAMES(entry->p_filesz); i++) { -
generic/src/mm/as.c
r226a654 r5a7d9d1 52 52 #include <debug.h> 53 53 #include <memstr.h> 54 #include <macros.h> 54 55 #include <arch.h> 55 56 #include <print.h> … … 538 539 as_area_t *a; 539 540 541 /* 542 * We don't want any area to have conflicts with NULL page. 543 */ 544 if (overlaps(va, size, NULL, PAGE_SIZE)) 545 return false; 546 540 547 for (cur = as->as_area_head.next; cur != &as->as_area_head; cur = cur->next) { 541 __address start;542 __address end;548 __address a_start; 549 size_t a_size; 543 550 544 551 a = list_get_instance(cur, as_area_t, link); … … 548 555 spinlock_lock(&a->lock); 549 556 550 start = a->base;551 end = a->base + a->pages * PAGE_SIZE - 1;557 a_start = a->base; 558 a_size = a->pages * PAGE_SIZE; 552 559 553 560 spinlock_unlock(&a->lock); 554 561 555 if ((va >= start) && (va <= end)) { 556 /* 557 * Tested area is inside another area. 558 */ 559 return false; 560 } 561 562 if ((start >= va) && (start < va + size)) { 563 /* 564 * Another area starts in tested area. 565 */ 566 return false; 567 } 568 569 if ((end >= va) && (end < va + size)) { 570 /* 571 * Another area ends in tested area. 572 */ 573 return false; 574 } 575 562 if (overlaps(va, size, a_start, a_size)) 563 return false; 564 565 } 566 567 /* 568 * So far, the area does not conflict with other areas. 569 * Check if it doesn't conflict with kernel address space. 570 */ 571 if (!KERNEL_ADDRESS_SPACE_SHADOWED) { 572 return !overlaps(va, size, 573 KERNEL_ADDRESS_SPACE_START, KERNEL_ADDRESS_SPACE_END-KERNEL_ADDRESS_SPACE_START); 576 574 } 577 575
Note:
See TracChangeset
for help on using the changeset viewer.