Nevermind. It looks like gcc-12+ has problems with static const declarations for lowmem_base and mem_base, especcially as they get defined later, so I've erased "const" in both definitions ( and extern declarations) and now it works, or at least so it seems. > ---------------------------------------- > From: Zeni Junker <zeni.junker445@xxxxxxxxxxxxx> > Date: Jul 30, 2023, 12:41:16 PM > To: <linux-msdos@xxxxxxxxxxxxxxx> > Subject: DOSEMU fails on start with SIGSEGV... > > > I'm running Gentoo ( if that matters) > I've tried with version 1.4.0 and latest from git repo and the result is the same. > Also, it fails the same way whether I start it as a root or ordinary user ( I've added lines for both in dosemu.usrs file: "username/root c_all" ). > > So I've compiled it with "debug" option tried to debug it with gdb. > > Well, this has lead me through the initialization. > > Thing is in main() (in emu.c - line 394) low_mem_init getc called and it fails. > > Peeking within it shows that low_mem_init ( init.c) calls alloc_mapping ( line 261), which fails. > > Peek into alloc_mapping ( file mapping.c) fails in line 419,, when it tries to copy pointer to allocated area to lowmem_base, which is 0 at that point: > line 419: " *(char **)(&lowmem_base) = addr; " > > Since low memory has never been allocated at that point, this causes SIGSEGV. > > At some point I thought this might be due to some kernel protection etc. Setting in/proc/sys/vm/mmap_min_addr was 65536, so I've reset it to 0 and retried, with the same result. > > Then I've noticed that lowmem_base gets declared as "char * const lowmem_base" in mapping.c and nothing ever sets it, so it is always 0. > Just to doublecheck, I've inspected /proc/proc_id/maps of debugged process and indeed there was nothing mapped at address 0 - all I've seen are high address map areas that one usually gets from mmap > in the range 0x7Fxxxxxxxx for various libs etc and 4 mappings of dosemu.bin, also at high adresses. > But nothing low, so naturally any acess outside of mapped areas SIGSEGVs. > > So, my question is, am I missing something ? > > Shouldn't lowmem_base be set somewhere ? > If not, shouldn't the low area be mapped in somewhere before that ? > > TIA, > > Zeni > > > -- > Sent with https://mailfence.com > Secure and private email -- Sent with https://mailfence.com Secure and private email