Home | History | Annotate | Line # | Download | only in gdb.arch
      1  1.1  christos /* Copyright 2023-2024 Free Software Foundation, Inc.
      2  1.1  christos 
      3  1.1  christos    This program is free software; you can redistribute it and/or modify
      4  1.1  christos    it under the terms of the GNU General Public License as published by
      5  1.1  christos    the Free Software Foundation; either version 3 of the License, or
      6  1.1  christos    (at your option) any later version.
      7  1.1  christos 
      8  1.1  christos    This program is distributed in the hope that it will be useful,
      9  1.1  christos    but WITHOUT ANY WARRANTY; without even the implied warranty of
     10  1.1  christos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     11  1.1  christos    GNU General Public License for more details.
     12  1.1  christos 
     13  1.1  christos    You should have received a copy of the GNU General Public License
     14  1.1  christos    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
     15  1.1  christos 
     16  1.1  christos 
     17  1.1  christos /* Simple asm function that makes use of c.li and c.lui in the
     18  1.1  christos    function prologue before the return address and frame pointers are
     19  1.1  christos    written the stack.  This ensures that GDB's prologue unwinder can
     20  1.1  christos    understand these instructions.  */
     21  1.1  christos 
     22  1.1  christos 	.option pic
     23  1.1  christos 	.text
     24  1.1  christos 
     25  1.1  christos 	.globl	foo
     26  1.1  christos 	.type	foo, @function
     27  1.1  christos foo:
     28  1.1  christos 	addi	sp,sp,-32
     29  1.1  christos 	sd	s1,8(sp)
     30  1.1  christos 
     31  1.1  christos 	c.li	s1,-4
     32  1.1  christos 	c.lui	s1,4
     33  1.1  christos 
     34  1.1  christos 	sd	fp,24(sp)
     35  1.1  christos 	sd	ra,16(sp)
     36  1.1  christos 	addi	fp,sp,32
     37  1.1  christos 
     38  1.1  christos 	call	bar@plt
     39  1.1  christos 
     40  1.1  christos 	ld	s1,8(sp)
     41  1.1  christos 	ld	ra,16(sp)
     42  1.1  christos 	ld	fp,24(sp)
     43  1.1  christos 	addi	sp,sp,32
     44  1.1  christos 	jr	ra
     45  1.1  christos 
     46  1.1  christos 	.size	foo, .-foo
     47  1.1  christos 	.section	.note.GNU-stack,"",@progbits
     48