that reminds me that the first kernel-level program i ran on new ports was wump (hunt the wumpus), partly to debug similar effects, but also because it's fun if not just silly
On Thu, 29 May 2025 at 22:05, Ron Minnich <[email protected]> wrote: > Daniel and Shawn made good progress on the risc-v port, and their > experience reminded me of a standard test I used to use while doing > ports. > > long story short, for blue gene and other ports (early amd64) we added > this test in main > > ulong x = 0x12345678; > > main() > { > if (x != 0x12345678) panic("unaligned data"): > > ... > > how can this test fail? x is in the data segment, but the immediate in > the test is in the text segment. This test is a quick and easy way to > check if your data segment is correctly loaded in memory. > > In some ports, the data is aligned by code in l.s that moves it. > > There are some really nasty, confusing errors that will arise in a > seemingly working kernel if data is not aligned. > > I always add this test when I'm doing a port. It catches a problem > that is otherwise very confusing, and presents as strings not set up > right, variables wrong, etc. ------------------------------------------ 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/T2fa5d9bbce09411d-M0d096182de1b987e8ea4146d Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
