Re: Fix BUG_ON() reporting in real mode on powerpc
From: Paul Mackerras <hidden>
Date: 2016-02-17 08:23:50
On Wed, Feb 17, 2016 at 01:33:32PM +0530, Anshuman Khandual wrote:
On 02/17/2016 12:46 PM, Balbir Singh wrote:quoted
quoted
quoted
It might be a little better to do this: bugaddr = regs->nip; if (REGION_ID(bugaddr) == 0 && !(regs->msr & MSR_IR)) bugaddr += PAGE_OFFSET; It is possible to execute from addresses with the 0xc000... on top in real mode, because the CPU ignores the top 4 address bits in real mode.Good catch! Thank you Changelog: Don't add PAGE_OFFSET blindly, check if REGION_ID is 0Cant we use USER_REGION_ID directly ?
If we use USER_REGION_ID then the reader needs to know that the user region is region 0 to understand the code. Thus I think it is clearer to use REGION_ID(bugaddr) == 0. Whether or not the address is a user region address is not really relevant to the question of whether it's a physical address being accessed directly in real mode vs. a kernel virtual address, which is what we're trying to determine. Paul.