Port-atari archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Current kernel with http://gnats.netbsd.org/39965 and pmap patches



On Tue, Dec 30, 2008 at 6:53 PM, Izumi Tsutsui 
<tsutsui%ceres.dti.ne.jp@localhost> wrote:
> Okay, with a quick glance, reloc operation for options RELOC_KERNEL
> is done after all necessary bootstrap STEs and PTEs are initialized,
> so we have to carefully use the following three types of addresses
> in the start_c() function:
>
> (1) physicall address before relocation
>  This should be used to fetch global variables in start_c()
>  before relocation (including page table addresses initialized
>  during bootstrap).
>
> (2) physicall address after relocation
>  This should be used for physical address pointers
>  which will be used after MMU is enabled.
>  (including PA values stored into STEs and PTEs)
>
> (3) kernel virtual address
>  This should be used for virtual address pointers
>  which will be used after MMU is enabled, and
>  for virtual address to calculate STE/PTE indexes during bootstrap.
>
> On the other hand, (1) and (3) have the same values
> (at least in kernel text/data/bss) and some variables
> used in start_c() have both meanings.
> It actually confuses readers...
>
> I've cleaned up various variables in atari_init.c (attached)
> (BTW that means it's no longer sync'ed with amiga ;-p).

That's good :) Amiga uses also independent variables for vstart and pstart;
I think that atari_init.c is now clearer.

> Summary of changes are:
>
> - use independent variables for (1) and (3) (pstart and vstart etc.)
>  even if they have the same values (since they have different meanings)
>
> - only global Sysseg_pa and Sysptmap_pa belong (2),
>  so initialize them as (1) first and
>  use explicit address reloc conversion for PTE and STE values,
>  then update these global variables as (2)
>  after all bootstrap initialization is complete
>
> - make mmu0[34]0_setup() (and cpu_init_kcorehdr()) take
>  Sysseg_pa (before relocation) as an arg, to avoid reference of
>  global Sysseg_pa (it could be changed at some point as noted above)
>
> - use properly variable types (st_entry_t, pt_entry_t etc) for readability
>  (XXX: we should also use paddr_t/vaddr_t/psize_t/vsize_t properly)
>
> - don't map Sysptmap and kernel page tables with PG_CI
>  but only do so for Sysseg on 040/060
>  (amiga pmap seems to have the same bug, though
>   those KVA ranges seem used only for debug printfs)
>
> - misc style nits
>
> ...I'm afraid I'd put various botches, though.
> (it's really hard to implement without real hardware ;-)
>
> I've also put new kernels with this change:
> http://www.ceres.dti.ne.jp/~tsutsui/netbsd/netbsd-ATARITT-HEAD-20081230.gz
> http://www.ceres.dti.ne.jp/~tsutsui/netbsd/netbsd-BOOT-HEAD-20081230.gz
> http://www.ceres.dti.ne.jp/~tsutsui/netbsd/netbsd-FALCON-HEAD-20081230.gz

Great work! I tested FALCON kernel and I can now boot with RELOC_KERNEL (and
with 68060 :). However I can't test RELOC_KERNEL with 68030 because 68060
accelerator has TT-RAM.

Thanks!

-Tuomo


Home | Main Index | Thread Index | Old Index