Applied, thanks!

Damien Zammit, le dim. 27 oct. 2024 09:28:41 +0000, a ecrit:
> ---
>  i386/Makefrag.am        |  2 ++
>  i386/i386at/conf.c      |  8 +++++++
>  i386/i386at/mbinfo.c    | 49 +++++++++++++++++++++++++++++++++++++++++
>  i386/i386at/mbinfo.h    | 33 +++++++++++++++++++++++++++
>  i386/i386at/model_dep.c |  3 +++
>  5 files changed, 95 insertions(+)
>  create mode 100644 i386/i386at/mbinfo.c
>  create mode 100644 i386/i386at/mbinfo.h
> 
> diff --git a/i386/Makefrag.am b/i386/Makefrag.am
> index 7a339417..906ccc2d 100644
> --- a/i386/Makefrag.am
> +++ b/i386/Makefrag.am
> @@ -69,6 +69,8 @@ libkernel_a_SOURCES += \
>       i386/i386at/kd_mouse.h \
>       i386/i386at/kdasm.S \
>       i386/i386at/kdsoft.h \
> +     i386/i386at/mbinfo.c \
> +     i386/i386at/mbinfo.h \
>       i386/i386at/mem.c \
>       i386/i386at/mem.h \
>       i386/i386at/rtc.c \
> diff --git a/i386/i386at/conf.c b/i386/i386at/conf.c
> index ecbf1e45..ba056ea1 100644
> --- a/i386/i386at/conf.c
> +++ b/i386/i386at/conf.c
> @@ -71,6 +71,9 @@
>  #include <device/intr.h>
>  #define irqname                      "irq"
>  
> +#include <i386at/mbinfo.h>
> +#define mbinfoname           "mbinfo"
> +
>  /*
>   * List of devices - console must be at slot 0
>   */
> @@ -157,6 +160,11 @@ struct dev_ops   dev_name_list[] =
>            nodev_async_in,        nulldev_reset,        nulldev_portdeath,0,
>            nodev_info },
>  
> +        { mbinfoname,        nulldev_open,   nulldev_close,  mbinforead,
> +          nulldev_write,nulldev_getstat,nulldev_setstat,nomap,
> +          nodev_async_in,    nulldev_reset,  nulldev_portdeath,0,
> +          nodev_info },
> +
>  };
>  int  dev_name_count = sizeof(dev_name_list)/sizeof(dev_name_list[0]);
>  
> diff --git a/i386/i386at/mbinfo.c b/i386/i386at/mbinfo.c
> new file mode 100644
> index 00000000..54486acb
> --- /dev/null
> +++ b/i386/i386at/mbinfo.c
> @@ -0,0 +1,49 @@
> +/*
> + * Copyright (c) 2024 Free Software Foundation, Inc.
> + *
> + * This program is free software: you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation, either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program.  If not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +#include <string.h>
> +#include <i386at/mbinfo.h>
> +#include <mach/vm_param.h>
> +#include <vm/pmap.h>
> +#include <device/ds_routines.h>
> +
> +struct multiboot_raw_info mb_info;
> +
> +void
> +mbinfo_register_boot_data(const struct multiboot_raw_info *mbi)
> +{
> +     mb_info = *mbi;
> +}
> +
> +io_return_t
> +mbinforead(dev_t dev, io_req_t ior)
> +{
> +     int err;
> +
> +     /* Check if IO_COUNT is valid */
> +     if (ior->io_count > sizeof(struct multiboot_raw_info))
> +         return D_INVALID_SIZE;
> +
> +     err = device_read_alloc(ior, (vm_size_t)ior->io_count);
> +     if (err != KERN_SUCCESS)
> +         return (err);
> +
> +     memcpy ((uint8_t *)ior->io_data, (uint8_t *)&mb_info, ior->io_count);
> +
> +     ior->io_residual = 0;
> +     return (D_SUCCESS);
> +}
> diff --git a/i386/i386at/mbinfo.h b/i386/i386at/mbinfo.h
> new file mode 100644
> index 00000000..120996f2
> --- /dev/null
> +++ b/i386/i386at/mbinfo.h
> @@ -0,0 +1,33 @@
> +/*
> + * Copyright (c) 2024 Free Software Foundation, Inc.
> + *
> + * This program is free software: you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation, either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program.  If not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +#ifndef _I386AT_MBINFO_H_
> +#define _I386AT_MBINFO_H_    1
> +
> +#include <sys/types.h>
> +
> +#include <vm/vm_types.h>
> +#include <mach/vm_prot.h>
> +#include <device/device_types.h>
> +#include <device/io_req.h>
> +#include <mach/machine/multiboot.h>
> +
> +void mbinfo_register_boot_data(const struct multiboot_raw_info *mbi);
> +
> +io_return_t mbinforead(dev_t dev, io_req_t ior);
> +
> +#endif /* !_I386AT_MBINFO_H_ */
> diff --git a/i386/i386at/model_dep.c b/i386/i386at/model_dep.c
> index a3e9b630..01489353 100644
> --- a/i386/i386at/model_dep.c
> +++ b/i386/i386at/model_dep.c
> @@ -75,6 +75,7 @@
>  #include <i386at/int_init.h>
>  #include <i386at/kd.h>
>  #include <i386at/rtc.h>
> +#include <i386at/mbinfo.h>
>  #include <i386at/model_dep.h>
>  #include <machine/irq.h>
>  
> @@ -354,6 +355,8 @@ register_boot_data(const struct multiboot_raw_info *mbi)
>                               biosmem_register_boot_data(shdr->addr, 
> shdr->addr + shdr->size, FALSE);
>               }
>       }
> +
> +     mbinfo_register_boot_data(mbi);
>  }
>  
>  #endif /* MACH_HYP */
> -- 
> 2.45.2
> 
> 
> 

-- 
Samuel
N: beep beep Miam miam? 
y: ++
a: kill -MIAM -1
 -+- #runtime < /dev/miam -+-

Reply via email to