* [OpenRISC] trap exception handling in linux kernel
@ 2019-01-06 18:07 Vad Rulezz
2019-03-03 15:29 ` Stafford Horne
0 siblings, 1 reply; 5+ messages in thread
From: Vad Rulezz @ 2019-01-06 18:07 UTC (permalink / raw)
To: openrisc
Hello
In arch/openrisc/kernel/traps.c we have a function:
asmlinkage void do_trap(struct pt_regs *regs, unsigned long address)
{
force_sig_fault(SIGTRAP, TRAP_TRACE, (void __user *)address, current);
regs->pc += 4;
}
Is there a reason for regs->pc increment?
I think typically debuggers wants to resume program execution from the same address which caused a trap (after disabling a breakpoint, and it's a sw breakpoint after replacing an instruction at this address).
Vad Rulezz
^ permalink raw reply [flat|nested] 5+ messages in thread* [OpenRISC] trap exception handling in linux kernel
2019-01-06 18:07 [OpenRISC] trap exception handling in linux kernel Vad Rulezz
@ 2019-03-03 15:29 ` Stafford Horne
2019-03-03 19:37 ` Vad Rulezz
0 siblings, 1 reply; 5+ messages in thread
From: Stafford Horne @ 2019-03-03 15:29 UTC (permalink / raw)
To: openrisc
Hello,
Did you ever get a response for this? I believe this is to allow
jumping over the openrisc l.trap instruction. But, as you say
GDB/debuggers will replace that instruction with the real instruction,
so it shouldn't be needed.
Have you noticed an issue or are you just auditing this? We don't
usually run GDB from within openrisc linux, I haven't run into this
issue before.
-Stafford
On Mon, Jan 7, 2019 at 3:07 AM Vad Rulezz <vad@vr5.epicgamer.org> wrote:
>
> Hello
>
> In arch/openrisc/kernel/traps.c we have a function:
>
> asmlinkage void do_trap(struct pt_regs *regs, unsigned long address)
> {
> force_sig_fault(SIGTRAP, TRAP_TRACE, (void __user *)address, current);
>
> regs->pc += 4;
> }
>
> Is there a reason for regs->pc increment?
>
> I think typically debuggers wants to resume program execution from the same address which caused a trap (after disabling a breakpoint, and it's a sw breakpoint after replacing an instruction at this address).
>
>
>
> Vad Rulezz
> _______________________________________________
> OpenRISC mailing list
> OpenRISC at lists.librecores.org
> https://lists.librecores.org/listinfo/openrisc
^ permalink raw reply [flat|nested] 5+ messages in thread* [OpenRISC] trap exception handling in linux kernel
2019-03-03 15:29 ` Stafford Horne
@ 2019-03-03 19:37 ` Vad Rulezz
2019-03-03 23:10 ` Stafford Horne
0 siblings, 1 reply; 5+ messages in thread
From: Vad Rulezz @ 2019-03-03 19:37 UTC (permalink / raw)
To: openrisc
I have actually discovered it in a native debugger, ofc it was not hard to remove the line in my copy of kernel and everything ran well after that,
but I still decided to ask because I thought that maybe there is a software that depends on existing behavior.
As noone except you replied I think it's safe to remove the increment in the mainline. It likely will simplify things for native GDB too.
Vad Rulezz
On 03.03.2019 18:29, Stafford Horne wrote:
> Did you ever get a response for this? I believe this is to allow
> jumping over the openrisc l.trap instruction. But, as you say
> GDB/debuggers will replace that instruction with the real instruction,
> so it shouldn't be needed.
>
> Have you noticed an issue or are you just auditing this? We don't
> usually run GDB from within openrisc linux, I haven't run into this
> issue before.
>
> -Stafford
>
> On Mon, Jan 7, 2019 at 3:07 AM Vad Rulezz <vad@vr5.epicgamer.org> wrote:
>>
>> Hello
>>
>> In arch/openrisc/kernel/traps.c we have a function:
>>
>> asmlinkage void do_trap(struct pt_regs *regs, unsigned long address)
>> {
>> force_sig_fault(SIGTRAP, TRAP_TRACE, (void __user *)address, current);
>>
>> regs->pc += 4;
>> }
>>
>> Is there a reason for regs->pc increment?
>>
>> I think typically debuggers wants to resume program execution from the same address which caused a trap (after disabling a breakpoint, and it's a sw breakpoint after replacing an instruction at this address).
>>
>>
>>
>> Vad Rulezz
>> _______________________________________________
>> OpenRISC mailing list
>> OpenRISC at lists.librecores.org
>> https://lists.librecores.org/listinfo/openrisc
>
^ permalink raw reply [flat|nested] 5+ messages in thread* [OpenRISC] trap exception handling in linux kernel
2019-03-03 19:37 ` Vad Rulezz
@ 2019-03-03 23:10 ` Stafford Horne
2019-03-04 1:15 ` Vad Rulezz
0 siblings, 1 reply; 5+ messages in thread
From: Stafford Horne @ 2019-03-03 23:10 UTC (permalink / raw)
To: openrisc
Hello,
That sounds good. I'll create a patch.
Btw were you using my gdb Linux support patches?
-Stafford
On Mon, Mar 4, 2019, 4:38 AM Vad Rulezz <vad@vr5.epicgamer.org> wrote:
> I have actually discovered it in a native debugger, ofc it was not hard to
> remove the line in my copy of kernel and everything ran well after that,
> but I still decided to ask because I thought that maybe there is a
> software that depends on existing behavior.
>
> As noone except you replied I think it's safe to remove the increment in
> the mainline. It likely will simplify things for native GDB too.
>
>
> Vad Rulezz
>
> On 03.03.2019 18:29, Stafford Horne wrote:
> > Did you ever get a response for this? I believe this is to allow
> > jumping over the openrisc l.trap instruction. But, as you say
> > GDB/debuggers will replace that instruction with the real instruction,
> > so it shouldn't be needed.
> >
> > Have you noticed an issue or are you just auditing this? We don't
> > usually run GDB from within openrisc linux, I haven't run into this
> > issue before.
> >
> > -Stafford
> >
> > On Mon, Jan 7, 2019 at 3:07 AM Vad Rulezz <vad@vr5.epicgamer.org> wrote:
> >>
> >> Hello
> >>
> >> In arch/openrisc/kernel/traps.c we have a function:
> >>
> >> asmlinkage void do_trap(struct pt_regs *regs, unsigned long address)
> >> {
> >> force_sig_fault(SIGTRAP, TRAP_TRACE, (void __user *)address,
> current);
> >>
> >> regs->pc += 4;
> >> }
> >>
> >> Is there a reason for regs->pc increment?
> >>
> >> I think typically debuggers wants to resume program execution from the
> same address which caused a trap (after disabling a breakpoint, and it's a
> sw breakpoint after replacing an instruction at this address).
> >>
> >>
> >>
> >> Vad Rulezz
> >> _______________________________________________
> >> OpenRISC mailing list
> >> OpenRISC at lists.librecores.org
> >> https://lists.librecores.org/listinfo/openrisc
> >
>
> _______________________________________________
> OpenRISC mailing list
> OpenRISC at lists.librecores.org
> https://lists.librecores.org/listinfo/openrisc
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.librecores.org/pipermail/openrisc/attachments/20190304/e12cca70/attachment.html>
^ permalink raw reply [flat|nested] 5+ messages in thread* [OpenRISC] trap exception handling in linux kernel
2019-03-03 23:10 ` Stafford Horne
@ 2019-03-04 1:15 ` Vad Rulezz
0 siblings, 0 replies; 5+ messages in thread
From: Vad Rulezz @ 2019-03-04 1:15 UTC (permalink / raw)
To: openrisc
> Btw were you using my gdb Linux support patches?
Actually no.
But maybe I'll give them a try.
Vad Rulezz
On 04.03.2019 02:10, Stafford Horne wrote:
> Hello,
>
> That sounds good. I'll create a patch.
>
> Btw were you using my gdb Linux support patches?
>
> -Stafford
>
> On Mon, Mar 4, 2019, 4:38 AM Vad Rulezz <vad at vr5.epicgamer.org <mailto:vad@vr5.epicgamer.org>> wrote:
>
> I have actually discovered it in a native debugger, ofc it was not hard to remove the line in my copy of kernel and everything ran well after that,
> but I still decided to ask because I thought that maybe there is a software that depends on existing behavior.
>
> As noone except you replied I think it's safe to remove the increment in the mainline. It likely will simplify things for native GDB too.
>
>
> Vad Rulezz
>
> On 03.03.2019 18:29, Stafford Horne wrote:
> > Did you ever get a response for this? I believe this is to allow
> > jumping over the openrisc l.trap instruction. But, as you say
> > GDB/debuggers will replace that instruction with the real instruction,
> > so it shouldn't be needed.
> >
> > Have you noticed an issue or are you just auditing this? We don't
> > usually run GDB from within openrisc linux, I haven't run into this
> > issue before.
> >
> > -Stafford
> >
> > On Mon, Jan 7, 2019 at 3:07 AM Vad Rulezz <vad at vr5.epicgamer.org <mailto:vad@vr5.epicgamer.org>> wrote:
> >>
> >> Hello
> >>
> >> In arch/openrisc/kernel/traps.c we have a function:
> >>
> >> asmlinkage void do_trap(struct pt_regs *regs, unsigned long address)
> >> {
> >> force_sig_fault(SIGTRAP, TRAP_TRACE, (void __user *)address, current);
> >>
> >> regs->pc += 4;
> >> }
> >>
> >> Is there a reason for regs->pc increment?
> >>
> >> I think typically debuggers wants to resume program execution from the same address which caused a trap (after disabling a breakpoint, and it's a sw breakpoint after replacing an instruction at this address).
> >>
> >>
> >>
> >> Vad Rulezz
> >> _______________________________________________
> >> OpenRISC mailing list
> >> OpenRISC at lists.librecores.org <mailto:OpenRISC@lists.librecores.org>
> >> https://lists.librecores.org/listinfo/openrisc
> >
>
> _______________________________________________
> OpenRISC mailing list
> OpenRISC at lists.librecores.org <mailto:OpenRISC@lists.librecores.org>
> https://lists.librecores.org/listinfo/openrisc
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-03-04 1:15 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-06 18:07 [OpenRISC] trap exception handling in linux kernel Vad Rulezz
2019-03-03 15:29 ` Stafford Horne
2019-03-03 19:37 ` Vad Rulezz
2019-03-03 23:10 ` Stafford Horne
2019-03-04 1:15 ` Vad Rulezz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox