Hello,
Damien Zammit, le jeu. 24 oct. 2024 00:11:11 +0000, a ecrit:
> +io_return_t
> +mbinforead(dev_t dev, io_req_t ior)
> +{
> + int err, count;
> +
> + /* Check if IO_COUNT is valid */
> + if (ior->io_count != sizeof(struct multiboot_raw_info))
> + return D_INVALID_SIZE;
This should rather be > ?
Whenever more information would be added to struct multiboot_raw_info,
userland would not necessarily try to read it, so for backward
compatibility we'd rather accept reading less.
> + count = 0;
> + uint8_t *byte = (uint8_t *)&mb_info;
> + while (count < ior->io_count) {
> + *(uint8_t *)(&ior->io_data[count]) = *byte;
> + count++;
> + byte++;
> + }
Why not just memcpy?
> + ior->io_residual = ior->io_count - count;
> + return (D_SUCCESS);
> +}
> diff --git a/i386/i386at/mbinfo.h b/i386/i386at/mbinfo.h
> new file mode 100644
> index 00000000..0e623250
> --- /dev/null
> +++ b/i386/i386at/mbinfo.h
[...]
> +extern struct multiboot_raw_info mb_info;
It doesn't seem to be needed outside mbinfo.c?
Samuel