Add macros KERNAUX_MULTIBOOT2_*TAG_NEXT

This commit is contained in:
Alex Kotov 2022-01-13 17:55:59 +05:00
parent 23c479c411
commit 2e83592c99
5 changed files with 10 additions and 18 deletions

View File

@ -12,6 +12,10 @@ extern "C" {
#define KERNAUX_MULTIBOOT2_DATA(ptr) (((uint8_t*)(ptr)) + sizeof(*(ptr)))
#define KERNAUX_MULTIBOOT2_HTAG_NEXT(tag_base) \
((struct KernAux_Multiboot2_HTagBase*)KERNAUX_MULTIBOOT2_TAG_NEXT(tag_base))
#define KERNAUX_MULTIBOOT2_ITAG_NEXT(tag_base) \
((struct KernAux_Multiboot2_ITagBase*)KERNAUX_MULTIBOOT2_TAG_NEXT(tag_base))
#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) \

View File

@ -24,9 +24,7 @@ const struct KernAux_Multiboot2_HTagBase
// if (!KernAux_Multiboot2_HTagBase_is_valid(tag_base)) return NULL;
if (tag_base->type == tag_type) return tag_base;
tag_base = (struct KernAux_Multiboot2_HTagBase*)(
KERNAUX_MULTIBOOT2_TAG_NEXT(tag_base)
);
tag_base = KERNAUX_MULTIBOOT2_HTAG_NEXT(tag_base);
}
return NULL;
@ -50,9 +48,7 @@ const struct KernAux_Multiboot2_HTagBase
// if (!KernAux_Multiboot2_HTagBase_is_valid(tag_base)) return NULL;
if (tag_base->type == tag_type && tag_base > after_tag) return tag_base;
tag_base = (struct KernAux_Multiboot2_HTagBase*)(
KERNAUX_MULTIBOOT2_TAG_NEXT(tag_base)
);
tag_base = KERNAUX_MULTIBOOT2_HTAG_NEXT(tag_base);
}
return NULL;

View File

@ -23,9 +23,7 @@ const struct KernAux_Multiboot2_ITagBase
if (!KernAux_Multiboot2_ITagBase_is_valid(tag_base)) return NULL;
if (tag_base->type == tag_type) return tag_base;
tag_base = (struct KernAux_Multiboot2_ITagBase*)(
KERNAUX_MULTIBOOT2_TAG_NEXT(tag_base)
);
tag_base = KERNAUX_MULTIBOOT2_ITAG_NEXT(tag_base);
}
return NULL;
@ -48,9 +46,7 @@ const struct KernAux_Multiboot2_ITagBase
if (!KernAux_Multiboot2_ITagBase_is_valid(tag_base)) return NULL;
if (tag_base->type == tag_type && tag_base > after_tag) return tag_base;
tag_base = (struct KernAux_Multiboot2_ITagBase*)(
KERNAUX_MULTIBOOT2_TAG_NEXT(tag_base)
);
tag_base = KERNAUX_MULTIBOOT2_ITAG_NEXT(tag_base);
}
return NULL;

View File

@ -29,9 +29,7 @@ bool KernAux_Multiboot2_Info_is_valid(
none_tag_base = tag_base;
}
tag_base = (struct KernAux_Multiboot2_ITagBase*)(
KERNAUX_MULTIBOOT2_TAG_NEXT(tag_base)
);
tag_base = KERNAUX_MULTIBOOT2_ITAG_NEXT(tag_base);
}
if (tag_base !=

View File

@ -93,9 +93,7 @@ void KernAux_Multiboot2_Info_print(
KernAux_Multiboot2_ITagBase_print(tag_base, printf);
tag_base = (struct KernAux_Multiboot2_ITagBase*)(
KERNAUX_MULTIBOOT2_TAG_NEXT(tag_base)
);
tag_base = KERNAUX_MULTIBOOT2_ITAG_NEXT(tag_base);
}
}