> You need to explain in greater details > what you are trying to solve.
As I mentioned earlier, let's say you don't initialize the vertical display end registers, and set the minimum scanline register, the emulation will then have to allocate some display buffer, but because the vertical display end is initilized as 0 the buffer will be empty and the program break. Minimal example: mov al, 0x20 mov dx, 0x3c0 out dx, al mov dx, 0x3b4 ;mov ax, 0xff12 ;out dx, ax mov ax, 0xf09 out dx, ax uncommenting the commented lines will solve the issue. On Mon, May 5, 2025, 20:28 Marc-André Lureau <marcandre.lur...@gmail.com> wrote: > Hi > > On Mon, May 5, 2025 at 9:03 PM Elisha Hollander > <just4now666...@gmail.com> wrote: > > > > Not necessarily fdopen, can't remember why I chose it, we just need any > pointer as no data will be written into the buffer anyways > > > > NULL should be acceptable then. You need to explain in greater details > what you are trying to solve. > > > > > On Mon, May 5, 2025, 19:55 Marc-André Lureau <marcandre.lur...@gmail.com> > wrote: > >> > >> Hi > >> > >> On Wed, Mar 26, 2025 at 8:21 PM donno2048 <just4now666...@gmail.com> > wrote: > >> > > >> > This silently fixes issues resulting from trying to allocate 0 bytes. > >> > > >> > Fixes error, for example, for writing byte 0x20 to port 0x3c0, then > word 0xf09 to port 0x3b4 when CPU is initiated, which shouldn't break. > >> > > >> > >> This is worth a test. > >> > >> > Signed-off-by: donno2048 <just4now666...@gmail.com> > >> > --- > >> > util/memfd.c | 10 +++++++--- > >> > 1 file changed, 7 insertions(+), 3 deletions(-) > >> > > >> > diff --git a/util/memfd.c b/util/memfd.c > >> > index 07beab174d..4f2c4ea1dd 100644 > >> > --- a/util/memfd.c > >> > +++ b/util/memfd.c > >> > @@ -131,9 +131,13 @@ void *qemu_memfd_alloc(const char *name, size_t > size, unsigned int seals, > >> > } > >> > } > >> > > >> > - ptr = mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, mfd, 0); > >> > - if (ptr == MAP_FAILED) { > >> > - goto err; > >> > + if (size != 0) { > >> > + ptr = mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, mfd, > 0); > >> > + if (ptr == MAP_FAILED) { > >> > + goto err; > >> > + } > >> > + } else { > >> > + ptr = fdopen(mfd, "rw"); > >> > >> I don't understand fdopen() here, it returns a FILE* > >> > >> > } > >> > > >> > *fd = mfd; > >> > -- > >> > 2.30.2 > >> > > >> > > >> > >> > >> -- > >> Marc-André Lureau > > > > -- > Marc-André Lureau >