Subject: UVM/PMAP question
To: None <port-powerpc@netbsd.org>
From: John Gordon <john_94501@yahoo.com>
List: tech-kern
Date: 04/14/2003 18:19:14
Hello all,

I am stumped by what is happening with the NS 1000 port I am working on. For
reference, the device is a PowerPC 603 system. The source I am working on is
that from the netbsd-1-6-PATCH001-RC2 tag.

The problem I am having is that during the start_init() function
[kern/init_main.c] when the code tries to copy out the string '/sbin/init',
although the copyout() function returns without error, the string is not copied
into the memory.

I have added a lot of debug to the sequence in an attempt to work out what is
happening, but what I am seeing looks odd to me. Here's the debug output from
calls to the uvm_map_printit() and pmap_print_pte() functions:

addr = 0x7fffe000
BEFORE:
MAP 0xa01000: [0x0->0x7ffff000]
        #ent=0, sz=0, ref=1, version=0, flags=0x1
        pmap=0xa02000(resident=0)
1050228104.740638 uvm_map#53: called!
1050228105.031072 uvm_map#53: (map=0xa01000, *startp=0x7fffe000, size=4096,
flags=0xb0717)
1050228105.225589 uvm_map#53:   uobj/offset 0x0/-1
1050228105.378643 uvm_map_findspace#53: called!
1050228105.528563 uvm_map_findspace#53: (map=0xa01000, hint=0x7fffe000,
len=4096, flags=0xb0717)
1050228105.729303 uvm_map_lookup_entry#27: called!
1050228105.882342 uvm_map_lookup_entry#27:
(map=0xa01000,addr=0x7fffe000,ent=0xd6550a18)
1050228106.074789 uvm_map_lookup_entry#27: <- failed!
1050228106.230940 uvm_map_findspace#53: <- got it!  (result=0x7fffe000)
1050228106.405757 uvm_map#53:   allocating new map entry
1050228106.565020 uvm_mapent_alloc#12: called!
1050228106.713966 uvm_mapent_alloc#12: <- new entry=0xa20000 [kentry=0]
1050228106.888732 amap_alloc#0: called!
1050228107.030435 amap_alloc#0: <- done, amap = 0xa21000, sz=4096
1050228107.199066 uvm_map#53: <- done!
AFTER:
MAP 0xa01000: [0x0->0x7ffff000]
        #ent=1, sz=4096, ref=1, version=1, flags=0x1
        pmap=0xa02000(resident=0)
 - 0xa20000: 0x7fffe000->0x7ffff000: obj=0x0/0x0, amap=0xa21000/0
        submap=F, cow=T, nc=F, prot(max)=7/7, inh=1, wc=0, adv=0
0x7fffe000: Address not in pmap
init: copying out flags `-s' (3) to 0x7fffeffd
init: copying out path `/sbin/init' (11) to 0x7fffeff2
AFTER COPYOUT:
MAP 0xa01000: [0x0->0x7ffff000]
        #ent=1, sz=4096, ref=1, version=1, flags=0x1
        pmap=0xa02000(resident=0)
 - 0xa20000: 0x7fffe000->0x7ffff000: obj=0x0/0x0, amap=0xa21000/0
        submap=F, cow=T, nc=F, prot(max)=7/7, inh=1, wc=0, adv=0
0x7fffe000: Address not in pmap
copyin: error = 0, string = 

It would seem as though the call to uvm_map() works out that a new entry is
needed for the requested address (0x7fffe000), and the output after the
uvm_map() call (labelled just 'AFTER' in the above) shows that this new entry
in the UVM layer is there. The pmap debug though still doesn't know about this
address.

A little later, after the call to copyout() for the pathname (the second
copyout in fact, since it copies the args out first), I print the same debug,
and the pmap layer still doesn't have this address.

Finally, just after the copyout() call, I added a copyin() to get back a copy
of the string. As you can see, it got garbage back.

Any ideas of where I should start looking?

John...

=====
Rate Corporate America at http://exec-ratings.bluedonkey.org

__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://tax.yahoo.com