Add macro KERNAUX_MULTIBOOT2_TAG_NEXT

This commit is contained in:
Alex Kotov 2022-01-13 17:53:22 +05:00
parent 0a309ec182
commit 23c479c411
5 changed files with 9 additions and 8 deletions

View File

@ -11,6 +11,9 @@ extern "C" {
#define KERNAUX_MULTIBOOT2_MAGIC 0x36d76289
#define KERNAUX_MULTIBOOT2_DATA(ptr) (((uint8_t*)(ptr)) + sizeof(*(ptr)))
#define KERNAUX_MULTIBOOT2_TAG_NEXT(tag_base) \
((uint8_t*)tag_base + KERNAUX_MULTIBOOT2_TAG_SIZE_ALIGN(tag_base))
#define KERNAUX_MULTIBOOT2_TAG_SIZE_ALIGN(tag_base) \
(((tag_base)->size + 7) & ~7)

View File

@ -25,7 +25,7 @@ const struct KernAux_Multiboot2_HTagBase
if (tag_base->type == tag_type) return tag_base;
tag_base = (struct KernAux_Multiboot2_HTagBase*)(
(uint8_t*)tag_base + KERNAUX_MULTIBOOT2_TAG_SIZE_ALIGN(tag_base)
KERNAUX_MULTIBOOT2_TAG_NEXT(tag_base)
);
}
@ -51,7 +51,7 @@ const struct KernAux_Multiboot2_HTagBase
if (tag_base->type == tag_type && tag_base > after_tag) return tag_base;
tag_base = (struct KernAux_Multiboot2_HTagBase*)(
(uint8_t*)tag_base + KERNAUX_MULTIBOOT2_TAG_SIZE_ALIGN(tag_base)
KERNAUX_MULTIBOOT2_TAG_NEXT(tag_base)
);
}

View File

@ -24,7 +24,7 @@ const struct KernAux_Multiboot2_ITagBase
if (tag_base->type == tag_type) return tag_base;
tag_base = (struct KernAux_Multiboot2_ITagBase*)(
(uint8_t*)tag_base + KERNAUX_MULTIBOOT2_TAG_SIZE_ALIGN(tag_base)
KERNAUX_MULTIBOOT2_TAG_NEXT(tag_base)
);
}
@ -49,7 +49,7 @@ const struct KernAux_Multiboot2_ITagBase
if (tag_base->type == tag_type && tag_base > after_tag) return tag_base;
tag_base = (struct KernAux_Multiboot2_ITagBase*)(
(uint8_t*)tag_base + KERNAUX_MULTIBOOT2_TAG_SIZE_ALIGN(tag_base)
KERNAUX_MULTIBOOT2_TAG_NEXT(tag_base)
);
}

View File

@ -30,8 +30,7 @@ bool KernAux_Multiboot2_Info_is_valid(
}
tag_base = (struct KernAux_Multiboot2_ITagBase*)(
(unsigned char*)tag_base +
KERNAUX_MULTIBOOT2_TAG_SIZE_ALIGN(tag_base)
KERNAUX_MULTIBOOT2_TAG_NEXT(tag_base)
);
}

View File

@ -94,8 +94,7 @@ void KernAux_Multiboot2_Info_print(
KernAux_Multiboot2_ITagBase_print(tag_base, printf);
tag_base = (struct KernAux_Multiboot2_ITagBase*)(
(unsigned char*)tag_base +
KERNAUX_MULTIBOOT2_TAG_SIZE_ALIGN(tag_base)
KERNAUX_MULTIBOOT2_TAG_NEXT(tag_base)
);
}
}