Add a dummy interrupt handler to nios2 crt0.s

Message ID 42c0373f-203a-d195-f55a-04e4f194142e@codesourcery.com
State New
Headers show
Series
  • Add a dummy interrupt handler to nios2 crt0.s
Related show

Commit Message

Sandra Loosemore April 2, 2019, 8:01 p.m.
The attached patch addresses another request from the QEMU maintainers 
in my quest to get the nios2 bare-metal support patches committed there: 
  the corresponding libgloss BSP needs to provide an interrupt handler 
so the QEMU emulation can point at it.

http://lists.nongnu.org/archive/html/qemu-devel/2019-03/msg07063.html

I added a dummy routine and placed it immediately after the 32-byte 
reset vector.  This matches where the real hardware (a 3c120 board) 
we've also used for testing expects to find the interrupt handler.

The dummy handler busy-waits in a loop, which is not terribly useful by 
itself, but you could set a breakpoint on it in the debugger, at least.

OK?

-Sandra

Comments

Corinna Vinschen April 3, 2019, 7:35 a.m. | #1
Hi Sandra,

On Apr  2 14:01, Sandra Loosemore wrote:
> The attached patch addresses another request from the QEMU maintainers in my

> quest to get the nios2 bare-metal support patches committed there:  the

> corresponding libgloss BSP needs to provide an interrupt handler so the QEMU

> emulation can point at it.

> 

> http://lists.nongnu.org/archive/html/qemu-devel/2019-03/msg07063.html

> 

> I added a dummy routine and placed it immediately after the 32-byte reset

> vector.  This matches where the real hardware (a 3c120 board) we've also

> used for testing expects to find the interrupt handler.

> 

> The dummy handler busy-waits in a loop, which is not terribly useful by

> itself, but you could set a breakpoint on it in the debugger, at least.

> 

> OK?


Can you please send patches in `git format-patch' format?


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat
Sandra Loosemore April 3, 2019, 2:19 p.m. | #2
On 4/3/19 1:35 AM, Corinna Vinschen wrote:
> 

> Can you please send patches in `git format-patch' format?


Do you have current patch submission requirements documented somewhere? 
I contribute to several open-source projects on an occasional basis and 
it's a little hard to keep track of conflicting expectations for patch 
submissions.  So I did look on the Newlib web site previously, but 
didn't see anything more specific than "Contributions are currently done 
by posting patches and ideas to newlib@sourceware.org".  If you have a 
documented preferred format/process for patch submission I will do my 
best to comply with it.

-Sandra
Corinna Vinschen April 3, 2019, 2:48 p.m. | #3
On Apr  3 08:19, Sandra Loosemore wrote:
> On 4/3/19 1:35 AM, Corinna Vinschen wrote:

> > 

> > Can you please send patches in `git format-patch' format?

> 

> Do you have current patch submission requirements documented somewhere? I

> contribute to several open-source projects on an occasional basis and it's a

> little hard to keep track of conflicting expectations for patch submissions.

> So I did look on the Newlib web site previously, but didn't see anything

> more specific than "Contributions are currently done by posting patches and

> ideas to newlib@sourceware.org".  If you have a documented preferred

> format/process for patch submission I will do my best to comply with it.


I added a shot patch submission rule to https://sourceware.org/newlib/.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

Patch

commit 56b4f94c123976e9de0e2b324f790a3ae3ec460f
Author: Sandra Loosemore <sandra@codesourcery.com>
Date:   Tue Apr 2 12:33:35 2019 -0700

    Add a dummy interrupt handler to nios2 crt0.s.
    
    The location of the handler at offset 0x20 from the start of memory,
    immediately after the 32-byte reset vector, matches the expectations
    of real hardware (e.g., a 3c120 board).

diff --git a/libgloss/nios2/crt0.S b/libgloss/nios2/crt0.S
index 77eacb3..c4dd4c6 100644
--- a/libgloss/nios2/crt0.S
+++ b/libgloss/nios2/crt0.S
@@ -1,6 +1,6 @@ 
 /* crt0.S -- startup code for Nios II QEMU generic-nommu board emulation.
 
-   Copyright (c) 2018 Mentor Graphics
+   Copyright (c) 2018-2019 Mentor Graphics
 
    The authors hereby grant permission to use, copy, modify, distribute,
    and license this software and its documentation for any purpose, provided
@@ -81,6 +81,18 @@  __reset:
 
 	.size __reset, . - __reset
 
+/* Provide a stub interrupt handler that waits in a busy loop.
+   The alignment puts it at offset 0x20 from the base of RAM.  */
+
+	.align 5
+
+        .globl  __interrupt_handler
+        .type   __interrupt_handler, @function
+__interrupt_handler:
+0:
+	br 0b
+
+	.size __interrupt_handler, . - __interrupt_handler
 
 /* __start is the ELF entry point.  */