--- Log opened Mon Apr 10 00:00:23 2017 | ||
shorne | mithro: not much other than looking at them in memory? or looking at the tlb | 01:58 |
---|---|---|
shorne | sorry, I never had to debug something there yet | 01:58 |
mithro | shorne: No worries | 01:58 |
mithro | shorne_: I have working uart! http://paste.debian.net/926916/ | 15:40 |
mithro | shorne_: There is something foobared with the memory management | 15:40 |
mithro | The zone_sizes_init function is trashing the page cache | 15:41 |
mithro | I'm pretty sure it has something to do with pfn's and max_low_pfn | 15:42 |
shorne_ | mithro: ah, did you get the self modifying code to work? | 22:03 |
mithro | shorne_: Yeah | 22:03 |
mithro | shorne_: Although I'm confused at the correct way to generate the j instruction | 22:04 |
shorne_ | `are these getting set correctly? | 22:04 |
shorne_ | ram_start_pfn = PFN_UP(memory_start); | 22:04 |
shorne_ | ram_end_pfn = PFN_DOWN(memblock_end_of_DRAM()); | 22:04 |
shorne_ | memory_start should be what is in your devicetree | 22:05 |
mithro | I'm not sure what "correct" is? | 22:05 |
shorne_ | i.e. memory_start I think should be 0x40000000 | 22:05 |
shorne_ | pulled from device tree | 22:05 |
shorne_ | memblock_end_of_DRAM should be 0x40000000 + size of dram (also pulled from device tree).. | 22:06 |
shorne_ | memory { | 22:06 |
shorne_ | device_type = "memory"; | 22:06 |
shorne_ | reg = <0x40000000 268435456>; | 22:06 |
shorne_ | }; | 22:06 |
mithro | setup_memory: Memory: 0x40000000-0x44000000 | 22:06 |
mithro | Setting up paging and PTEs. | 22:06 |
mithro | map_ram: Memory: 0x40000000-0x44000000 | 22:06 |
shorne_ | during early init those ar scanned and set in memblock | 22:07 |
shorne_ | yeah, so should be ok | 22:07 |
shorne_ | PFN_UP and PFN_DOWN just set them as Page frame numbers | 22:07 |
shorne_ | rounding up, or down to nearest | 22:08 |
shorne_ | /* setup bootmem globals (we use no_bootmem, but mm still depends on this) */ | 22:08 |
shorne_ | min_low_pfn = ram_start_pfn; | 22:08 |
shorne_ | max_pfn = ram_end_pfn; | 22:08 |
shorne_ | max_low_pfn = ram_end_pfn; | 22:08 |
shorne_ | Oh, correct way to generate the j instruction... | 22:08 |
mithro | What should be the PFN the first memory position? | 22:09 |
mithro | -- l.j instruction is opcode 0 and does a PC ← exts(Immediate << 2) + JumpInsnAddr | 22:10 |
mithro | https://github.com/mithro/linux/blob/master/arch/openrisc/mm/init.c#L158-L203 | 22:11 |
shorne_ | well, for you it would be 0x40000000 > PAGE_SHIFT | 22:11 |
shorne_ | why are you doing << 2? | 22:15 |
shorne_ | shouldn't it be >> 2? | 22:15 |
shorne_ | sorry, reading wrong part | 22:16 |
mithro | boot_itlb_miss_handler is trying to convert a l.j instruction back to a memory address | 22:16 |
shorne_ | right, | 22:16 |
shorne_ | right here | 22:18 |
shorne_ | unsigned long pa_itlb_miss_handler = __pa(&itlb_miss_handler); | 22:18 |
shorne_ | you want to get the physical address of the real handler | 22:18 |
mithro | * IE pa(miss_handler)-pa(vector) == va(miss_handler)-va(vector) ? | 22:19 |
shorne_ | defined in arch/openrisc/include/asm/page.h | 22:19 |
shorne_ | __pq and __va, maybe its better to put the PHYSICAL_START thing in there? | 22:20 |
mithro | shorne_: I plan to just use the EVAR value | 22:21 |
shorne_ | I see... you already did update __va() and __pa() in include the physical_offset | 22:23 |
mithro | unsigned long *boot_itlb_miss_handler = ((*itlb_vector) << 2) + ((unsigned long)itlb_vector); | 22:26 |
mithro | That calculates the right address | 22:26 |
mithro | So to do the opposite | 22:26 |
mithro | (((unsigned long)boot_itlb_miss_handler) - (unsigned long)itlb_vector) >> 2; | 22:28 |
mithro | Right? | 22:28 |
shorne_ | so, give me a minute | 22:38 |
mithro | No worries | 22:44 |
shorne_ | this, looks right *boot_itlb_miss_handler = ((*itlb_vector) << 2) + ((unsigned long)itlb_vector); | 22:48 |
shorne_ | but thats not what I see on the link | 22:48 |
mithro | shorne_: Yeah - I just fixed it then | 22:48 |
shorne_ | but... this looks correct | 22:49 |
shorne_ | *itlb_vector = (((unsigned long)&itlb_miss_handler) - | 22:49 |
shorne_ | (unsigned long)itlb_vector) >> 2; | 22:49 |
mithro | https://gist.github.com/mithro/6a95b5506367463af1685f3c13c725af | 22:49 |
mithro | shorne_: Yeah - the output in dmesg looks correct and it seems to be working | 22:50 |
shorne_ | since its all vritual | 22:50 |
mithro | shorne_: I had a play at patching BNF and BF at https://gist.github.com/mithro/6a95b5506367463af1685f3c13c725af | 23:07 |
shorne_ | thats easier to read then what is there in the kernel | 23:13 |
shorne_ | it looks good, do you need it for anything? | 23:14 |
mithro | shorne_: Not really | 23:19 |
mithro | shorne_: BTW - Using watchpoints was a really good idea | 23:43 |
mithro | http://paste.debian.net/926962/ | 23:43 |
mithro | I put a watchpoint on the page table address where I'm getting clobberred | 23:43 |
shorne_ | cool | 23:45 |
shorne_ | what is lx-dmesg defined as? | 23:45 |
mithro | shorne_: Now I need to figure out why this is clobbering the value.... | 23:46 |
shorne_ | thats pretty handy | 23:46 |
shorne_ | is that built into gdb? | 23:46 |
mithro | shorne_: It's part of linux | 23:47 |
mithro | gdb has python scripting support | 23:47 |
mithro | https://github.com/mithro/linux/tree/master/scripts/gdb | 23:47 |
mithro | It would be nice if they had some page table stuff in there | 23:48 |
shorne_ | I never have seen this gdb helper script... I knew about scripting and I was doing some things myself | 23:49 |
shorne_ | this is better ! | 23:49 |
shorne_ | I have been debugging with a serial console | 23:58 |
--- Log closed Tue Apr 11 00:00:25 2017 |
Generated by irclog2html.py 2.15.2 by Marius Gedminas - find it at mg.pov.lt!