void memory_mapping_filter(MemoryMappingList *list, int64_t begin,

                           int64_t length)

{

    MemoryMapping *cur, *next;



    QTAILQ_FOREACH_SAFE(cur, &list->head, next, next) {

        if (cur->phys_addr >= begin + length ||

            cur->phys_addr + cur->length <= begin) {

            QTAILQ_REMOVE(&list->head, cur, next);


            list->num--;

            continue;

        }



        if (cur->phys_addr < begin) {

            cur->length -= begin - cur->phys_addr;

            if (cur->virt_addr) {

                cur->virt_addr += begin - cur->phys_addr;

            }

            cur->phys_addr = begin;

        }



        if (cur->phys_addr + cur->length > begin + length) {

            cur->length -= cur->phys_addr + cur->length - begin - length;

        }

    }

}
void memory_mapping_filter(MemoryMappingList *list, int64_t begin,

                           int64_t length)

{

    MemoryMapping *cur, *next;



    QTAILQ_FOREACH_SAFE(cur, &list->head, next, next) {

        if (cur->phys_addr >= begin + length ||

            cur->phys_addr + cur->length <= begin) {

            QTAILQ_REMOVE(&list->head, cur, next);


            list->num--;

            continue;

        }



        if (cur->phys_addr < begin) {

            cur->length -= begin - cur->phys_addr;

            if (cur->virt_addr) {

                cur->virt_addr += begin - cur->phys_addr;

            }

            cur->phys_addr = begin;

        }



        if (cur->phys_addr + cur->length > begin + length) {

            cur->length -= cur->phys_addr + cur->length - begin - length;

        }

    }

}
void FUNC_0(MemoryMappingList *VAR_0, int64_t VAR_1,

                           int64_t VAR_2)

{

    MemoryMapping *cur, *next;



    QTAILQ_FOREACH_SAFE(cur, &VAR_0->head, next, next) {

        if (cur->phys_addr >= VAR_1 + VAR_2 ||

            cur->phys_addr + cur->VAR_2 <= VAR_1) {

            QTAILQ_REMOVE(&VAR_0->head, cur, next);


            VAR_0->num--;

            continue;

        }



        if (cur->phys_addr < VAR_1) {

            cur->VAR_2 -= VAR_1 - cur->phys_addr;

            if (cur->virt_addr) {

                cur->virt_addr += VAR_1 - cur->phys_addr;

            }

            cur->phys_addr = VAR_1;

        }



        if (cur->phys_addr + cur->VAR_2 > VAR_1 + VAR_2) {

            cur->VAR_2 -= cur->phys_addr + cur->VAR_2 - VAR_1 - VAR_2;

        }

    }

}
void FUNC_0(MemoryMappingList *VAR_0, int64_t VAR_1,
int64_t VAR_2)
{ MemoryMapping *cur, *next; QTAILQ_FOREACH_SAFE(cur, &VAR_0->head, next, next) { if (cur->phys_addr >= VAR_1 + VAR_2 ||
cur->phys_addr + cur->VAR_2 <= VAR_1) { QTAILQ_REMOVE(&VAR_0->head, cur, next); VAR_0->num--; continue; } if (cur->phys_addr < VAR_1) { cur->VAR_2 -= VAR_1 - cur->phys_addr; if (cur->virt_addr) { cur->virt_addr += VAR_1 - cur->phys_addr; } cur->phys_addr = VAR_1; } if (cur->phys_addr + cur->VAR_2 > VAR_1 + VAR_2) { cur->VAR_2 -= cur->phys_addr + cur->VAR_2 - VAR_1 - VAR_2; } } }