Hi, I'm porting OpenBSD to the Mango Pi D1. Most of the work is done but now is the time to try to get a RAMDISK kernel to boot.
I'm having an issue with atomic_store_64() as shown here (line 1192): 1184 for (; va < DMAP_MAX_ADDRESS && pa < max_pa; 1185 pa += L1_SIZE, va += L1_SIZE, l1_slot++) { 1186 KASSERT(l1_slot < Ln_ENTRIES); 1187 1188 /* gigapages */ 1189 pn = (pa / PAGE_SIZE); 1190 entry = PTE_KERN; 1191 entry |= (pn << PTE_PPN0_S); 1192 atomic_store_64(&l1[l1_slot], entry); 1193 } The D1 seems to hang on this call. To me that seems like the store hangs that I did on powerpc64 when memory was not aligned. When I replaced the AMO instruction with a simple C replacement it worked. So I wonder if the following is correct or not: entry = _ALIGN(PTE_KERN); I looked at riscv-privileged-202111203.pdf (page 79) which is for Sv32 and a few pages down is the Sv39 (page 84). But I can't make sense of it. And my Mona Lisa book that I have from Waterman mentions on page 101: ''Misaligned address exceptions occur when the effective address isn't divisible by the access size - for example, amoadd.w with an address of 0x12.'' I don't think in the bootstrapping of pmap that traps are turned on yet, but I could be mistaken, hence the hang. If you have another idea why I get these let me know, I'm going to bed now and won't be up until 6AM or later tomorrow. I'm letting my kernel compile on the slow QEMU host overnight. Best Regards, -peter -- Over thirty years experience on Unix-like Operating Systems starting with QNX.