mirror of https://github.com/tailix/libkernaux.git
Fix struct KernAux_Multiboot2_Tag_BootCmdLine
This commit is contained in:
parent
6ce8ab0e97
commit
949c43436e
|
@ -5,10 +5,13 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#define KERNAUX_MULTIBOOT2_MAGIC 0x36d76289
|
||||
|
||||
#define KERNAUX_MULTIBOOT2_TAG_DATA(tag) (((uint8_t*)(tag)) + sizeof(*(tag)))
|
||||
|
||||
/****************
|
||||
* Common types *
|
||||
****************/
|
||||
|
@ -67,8 +70,6 @@ struct KernAux_Multiboot2_Tag_BootCmdLine {
|
|||
// type = 1
|
||||
// size = ?
|
||||
struct KernAux_Multiboot2_TagBase base;
|
||||
|
||||
char cmdline[];
|
||||
}
|
||||
__attribute__((packed));
|
||||
|
||||
|
|
|
@ -63,5 +63,5 @@ const char *KernAux_Multiboot2_boot_cmd_line(
|
|||
|
||||
if (!tag) return NULL;
|
||||
|
||||
return tag->cmdline;
|
||||
return (char*)KERNAUX_MULTIBOOT2_TAG_DATA(tag);
|
||||
}
|
||||
|
|
|
@ -162,7 +162,7 @@ bool KernAux_Multiboot2_Tag_BootCmdLine_is_valid(
|
|||
size_t index = 1;
|
||||
|
||||
for (
|
||||
const char *ptr = tag->cmdline;
|
||||
const char *ptr = (char*)KERNAUX_MULTIBOOT2_TAG_DATA(tag);
|
||||
*ptr && index < tag->base.size;
|
||||
++ptr
|
||||
) {
|
||||
|
|
|
@ -120,7 +120,9 @@ void KernAux_Multiboot2_TagBase_print(
|
|||
case KERNAUX_MULTIBOOT2_TAGTYPE_BOOT_CMD_LINE:
|
||||
printf(
|
||||
" cmdline: %s\n",
|
||||
((struct KernAux_Multiboot2_Tag_BootCmdLine*)tag_base)->cmdline
|
||||
KERNAUX_MULTIBOOT2_TAG_DATA(
|
||||
(struct KernAux_Multiboot2_Tag_BootCmdLine*)tag_base
|
||||
)
|
||||
);
|
||||
break;
|
||||
case KERNAUX_MULTIBOOT2_TAGTYPE_BOOT_LOADER_NAME:
|
||||
|
|
Loading…
Reference in New Issue