mirror of
https://github.com/drasko/codezero.git
synced 2026-01-15 12:23:15 +01:00
vma_intersect() was erroneous, replaced by a nice and simple set_intersection() routine.
Still testing sys_munmap(). It now correctly spots and unmaps the overlapping vma. The issue now is that if a split occurs, we forgot to add same objects to new vma.
This commit is contained in:
@@ -4,4 +4,19 @@
|
||||
#define min(x, y) (((x) < (y)) ? x : y)
|
||||
#define max(x, y) (((x) > (y)) ? x : y)
|
||||
|
||||
/* Tests if ranges a-b intersect with range c-d */
|
||||
static inline int set_intersection(unsigned long a, unsigned long b,
|
||||
unsigned long c, unsigned long d)
|
||||
{
|
||||
/*
|
||||
* Below is the complement (') of the intersection
|
||||
* of 2 ranges, much simpler ;-)
|
||||
*/
|
||||
if (b <= c || a >= d)
|
||||
return 0;
|
||||
|
||||
/* The rest is always intersecting */
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif /* __LIB_MATH_H__ */
|
||||
|
||||
Reference in New Issue
Block a user