From b20e5adb661f95f639324b252a3028ac0abeca2f Mon Sep 17 00:00:00 2001 From: Paul Mundt Date: Tue, 8 Jan 2008 08:44:43 +0000 Subject: Bring sh64 support back from the dead. --- libc/sysdeps/linux/sh64/Makefile | 61 ++----------- libc/sysdeps/linux/sh64/Makefile.arch | 12 +++ libc/sysdeps/linux/sh64/__longjmp.S | 141 +++++++++++++++++++++++++++++++ libc/sysdeps/linux/sh64/bits/stackinfo.h | 28 ++++++ libc/sysdeps/linux/sh64/crt0.S | 86 ------------------- libc/sysdeps/linux/sh64/crt1.S | 86 +++++++++++++++++++ libc/sysdeps/linux/sh64/longjmp.S | 140 ------------------------------ libc/sysdeps/linux/sh64/sys/procfs.h | 126 +++++++++++++++++++++++++++ 8 files changed, 399 insertions(+), 281 deletions(-) create mode 100644 libc/sysdeps/linux/sh64/Makefile.arch create mode 100644 libc/sysdeps/linux/sh64/__longjmp.S create mode 100644 libc/sysdeps/linux/sh64/bits/stackinfo.h delete mode 100644 libc/sysdeps/linux/sh64/crt0.S create mode 100644 libc/sysdeps/linux/sh64/crt1.S delete mode 100644 libc/sysdeps/linux/sh64/longjmp.S create mode 100644 libc/sysdeps/linux/sh64/sys/procfs.h (limited to 'libc/sysdeps/linux/sh64') diff --git a/libc/sysdeps/linux/sh64/Makefile b/libc/sysdeps/linux/sh64/Makefile index 020cc76c8..ecbf14228 100644 --- a/libc/sysdeps/linux/sh64/Makefile +++ b/libc/sysdeps/linux/sh64/Makefile @@ -5,60 +5,11 @@ # # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +top_srcdir=../../../../ +top_builddir=../../../../ +all: objs +include $(top_builddir)Rules.mak +include Makefile.arch +include $(top_srcdir)Makerules TOPDIR=../../../../ include $(TOPDIR)Rules.mak - -CFLAGS += -I.. -ASFLAGS += -I.. -D__ASSEMBLER__ -DASM_GLOBAL_DIRECTIVE=.globl - -TARGET_MACHINE_TYPE=$(shell $(CC) -dumpmachine) - -CRT_SRC := crt0.S -CRT_OBJ := crt0.o crt1.o -CTOR_TARGETS := $(TOPDIR)lib/crti.o $(TOPDIR)lib/crtn.o - -SSRC := setjmp.S longjmp.S -SOBJ := $(patsubst %.S,%.o, $(SSRC)) - -CSRC := __init_brk.c brk.c sbrk.c syscall.c -COBJ := $(patsubst %.c,%.o, $(CSRC)) - -OBJS := $(SOBJ) $(COBJ) - -OBJ_LIST := ../../../obj.sysdeps.$(TARGET_ARCH) - -all: $(OBJ_LIST) $(CTOR_TARGETS) - -$(OBJ_LIST): $(OBJS) $(CRT_OBJ) - $(STRIPTOOL) -x -R .note -R .comment $^ - $(INSTALL) -d $(TOPDIR)lib/ - cp $(CRT_OBJ) $(TOPDIR)lib/ - echo $(patsubst %, sysdeps/linux/$(TARGET_ARCH)/%, $(OBJS)) > $@ - -$(CRT_OBJ): $(CRT_SRC) - $(CC) $(ASFLAGS) -DL_$* $< -c -o $*.o - -$(SOBJ): %.o : %.S - $(CC) $(ASFLAGS) -c $< -o $@ - -$(COBJ): %.o : %.c - $(CC) $(CFLAGS) -c $< -o $@ - -ifeq ($(UCLIBC_CTOR_DTOR),y) -$(TOPDIR)lib/crti.o: crti.S - $(INSTALL) -d $(TOPDIR)lib/ - $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c $< -o $@ - -$(TOPDIR)lib/crtn.o: crtn.S - $(INSTALL) -d $(TOPDIR)lib/ - $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c $< -o $@ -else -$(CTOR_TARGETS): - $(INSTALL) -d $(TOPDIR)lib/ - $(AR) $(ARFLAGS) $@ -endif - -headers: - -clean: - $(RM) *.o *~ core diff --git a/libc/sysdeps/linux/sh64/Makefile.arch b/libc/sysdeps/linux/sh64/Makefile.arch new file mode 100644 index 000000000..d49540ebe --- /dev/null +++ b/libc/sysdeps/linux/sh64/Makefile.arch @@ -0,0 +1,12 @@ +# Makefile for uClibc +# +# Copyright (C) 2008 Paul Mundt +# +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +# + +CSRC := __init_brk.c brk.c sbrk.c syscall.c + +SSRC := setjmp.S __longjmp.S + +include $(top_srcdir)libc/sysdeps/linux/Makefile.commonarch diff --git a/libc/sysdeps/linux/sh64/__longjmp.S b/libc/sysdeps/linux/sh64/__longjmp.S new file mode 100644 index 000000000..ca7925f76 --- /dev/null +++ b/libc/sysdeps/linux/sh64/__longjmp.S @@ -0,0 +1,141 @@ +/* __longjmp for SH-5. + Copyright (C) 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + + +#define _SETJMP_H +#define _ASM +#include + + +#define INTEGER(reg,offset) ld.q r2, offset*8, reg +#define DOUBLE(reg,offset) fld.d r2, offset*8, reg + + + .file "__longjmp.S" + + .section .text64,"xa" + .align 2 + + .global __longjmp + .type __longjmp,@function + +__longjmp: + /* + * extern void __longjmp(jmp_buf env, int val); + * + * r2 == env + * r3 == val + * r4 == temporary + */ + + /* callee-save registers R10-R16 */ + INTEGER(r10, __SETJMP_INT(0)) + INTEGER(r11, __SETJMP_INT(1)) + INTEGER(r12, __SETJMP_INT(2)) + INTEGER(r13, __SETJMP_INT(3)) + INTEGER(r14, __SETJMP_INT(4)) + INTEGER(r15, __SETJMP_INT(5)) + INTEGER(r16, __SETJMP_INT(6)) + + /* callee-save registers R28-R35 */ + INTEGER(r28, __SETJMP_INT(7)) + INTEGER(r29, __SETJMP_INT(8)) + INTEGER(r30, __SETJMP_INT(9)) + INTEGER(r31, __SETJMP_INT(10)) + INTEGER(r32, __SETJMP_INT(11)) + INTEGER(r33, __SETJMP_INT(12)) + INTEGER(r34, __SETJMP_INT(13)) + INTEGER(r35, __SETJMP_INT(14)) + + /* callee-save registers R44-R59 */ + INTEGER(r44, __SETJMP_INT(15)) + INTEGER(r45, __SETJMP_INT(16)) + INTEGER(r46, __SETJMP_INT(17)) + INTEGER(r47, __SETJMP_INT(18)) + INTEGER(r48, __SETJMP_INT(19)) + INTEGER(r49, __SETJMP_INT(20)) + INTEGER(r50, __SETJMP_INT(21)) + INTEGER(r51, __SETJMP_INT(22)) + INTEGER(r52, __SETJMP_INT(23)) + INTEGER(r53, __SETJMP_INT(24)) + INTEGER(r54, __SETJMP_INT(25)) + INTEGER(r55, __SETJMP_INT(26)) + INTEGER(r56, __SETJMP_INT(27)) + INTEGER(r57, __SETJMP_INT(28)) + INTEGER(r58, __SETJMP_INT(29)) + INTEGER(r59, __SETJMP_INT(30)) + + #if __SETJMP_NUM_INT != 31 + #error __SETJMP_NUM_INT does agree with expected value + #endif + +#if __SETJMP_NUM_DBL > 0 + /* callee-save registers FR12-FR15 */ + DOUBLE(d12, __SETJMP_DBL(0)) + DOUBLE(d14, __SETJMP_DBL(1)) + + /* callee-save registers FR36-FR63 */ + DOUBLE(d36, __SETJMP_DBL(2)) + DOUBLE(d38, __SETJMP_DBL(3)) + DOUBLE(d40, __SETJMP_DBL(4)) + DOUBLE(d42, __SETJMP_DBL(5)) + DOUBLE(d44, __SETJMP_DBL(6)) + DOUBLE(d46, __SETJMP_DBL(7)) + DOUBLE(d48, __SETJMP_DBL(8)) + DOUBLE(d50, __SETJMP_DBL(9)) + DOUBLE(d52, __SETJMP_DBL(10)) + DOUBLE(d54, __SETJMP_DBL(11)) + DOUBLE(d56, __SETJMP_DBL(12)) + DOUBLE(d58, __SETJMP_DBL(13)) + DOUBLE(d60, __SETJMP_DBL(14)) + DOUBLE(d62, __SETJMP_DBL(15)) + + #if __SETJMP_NUM_DBL != 16 + #error __SETJMP_NUM_DBL does agree with expected value + #endif + +#endif /* __SETJMP_NUM_DBL > 0 */ + + /* callee-save registers TR5-TR7 */ + INTEGER(r4, __SETJMP_TRG(0)) + ptabs r4, tr5 + INTEGER(r4, __SETJMP_TRG(1)) + ptabs r4, tr6 + INTEGER(r4, __SETJMP_TRG(2)) + ptabs r4, tr7 + + #if __SETJMP_NUM_TRG != 3 + #error __SETJMP_NUM_TRG does agree with expected value + #endif + + /* restore Linkage Register (LR) for __longjmp return */ + INTEGER(r18, __SETJMP_LR) + ptabs/l r18, tr0 + + /* + * must ensure __longjmp() never returns 0. + * if 'val' == 0, then return 1. + */ + cmpeq r3, r63, r2 /* r2 = (r3==0) ? 1 : 0; */ + add.l r3, r2, r2 /* return value */ + + /* return to caller */ + blink tr0, r63 + +libc_hidden_def(__longjmp) diff --git a/libc/sysdeps/linux/sh64/bits/stackinfo.h b/libc/sysdeps/linux/sh64/bits/stackinfo.h new file mode 100644 index 000000000..e65338f25 --- /dev/null +++ b/libc/sysdeps/linux/sh64/bits/stackinfo.h @@ -0,0 +1,28 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* This file contains a bit of information about the stack allocation + of the processor. */ + +#ifndef _STACKINFO_H +#define _STACKINFO_H 1 + +/* On SH the stack grows down. */ +#define _STACK_GROWS_DOWN 1 + +#endif /* stackinfo.h */ diff --git a/libc/sysdeps/linux/sh64/crt0.S b/libc/sysdeps/linux/sh64/crt0.S deleted file mode 100644 index 271dfbaca..000000000 --- a/libc/sysdeps/linux/sh64/crt0.S +++ /dev/null @@ -1,86 +0,0 @@ -/* Startup code for SH5 & ELF. - Copyright (C) 1999 Free Software Foundation, Inc. - Copyright (C) 2001 Hewlett-Packard Australia - - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* This is the canonical entry point, usually the first thing in the text - segment. - - At this entry point, most registers' values are unspecified, except: - - sp The stack contains the arguments and environment: - 0(sp) argc - 4(sp) argv[0] - ... - (4*argc)(sp) NULL - (4*(argc+1))(sp) envp[0] - ... - NULL -*/ - - .file "crt0.S" - - .globl _start - .globl __main - - .type __uClibc_start_main,@function - - .section .text64,"xa" - .align 2 /* 2^2 = 4 */ - -_start: - /* Clear the frame pointer since this is the outermost frame. */ -### mov #0, r14 # qqq - - /* Pop argc off the stack and save a pointer to argv */ - ld.l r15, 0, r2 /* argc */ - addi r15, 4, r3 /* argv */ - - /* set up the value for the environment pointer r4 = (argc+1)*4+argv */ - addi r2, 1, r4 /* envp = argc + 1 */ - shlli r4, 2, r4 /* envp = envp * 4 */ - add r3, r4, r4 /* envp = envp + argv */ - - /* call main() */ - movi __uClibc_start_main,r17 - ptabs/l r17,tr0 - blink tr0,r18 - - /* should never get here....*/ -### movi abort@lh,r17 -### shori abort@ll,r17 - ptabs/l r17,tr0 - blink tr0,r63 /* call abort() => (r63) do not come back ... */ - - /* - * The following is a stub to stop the GNU toolchain - * from calling its C-RTL initialization routines. - */ -__main: - ptabs/l r18,tr0 - blink tr0,r63 - -/* Define a symbol for the first piece of initialized data. */ - .data - .globl __data_start -__data_start: - .long 0 - .weak data_start - data_start = __data_start - diff --git a/libc/sysdeps/linux/sh64/crt1.S b/libc/sysdeps/linux/sh64/crt1.S new file mode 100644 index 000000000..271dfbaca --- /dev/null +++ b/libc/sysdeps/linux/sh64/crt1.S @@ -0,0 +1,86 @@ +/* Startup code for SH5 & ELF. + Copyright (C) 1999 Free Software Foundation, Inc. + Copyright (C) 2001 Hewlett-Packard Australia + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* This is the canonical entry point, usually the first thing in the text + segment. + + At this entry point, most registers' values are unspecified, except: + + sp The stack contains the arguments and environment: + 0(sp) argc + 4(sp) argv[0] + ... + (4*argc)(sp) NULL + (4*(argc+1))(sp) envp[0] + ... + NULL +*/ + + .file "crt0.S" + + .globl _start + .globl __main + + .type __uClibc_start_main,@function + + .section .text64,"xa" + .align 2 /* 2^2 = 4 */ + +_start: + /* Clear the frame pointer since this is the outermost frame. */ +### mov #0, r14 # qqq + + /* Pop argc off the stack and save a pointer to argv */ + ld.l r15, 0, r2 /* argc */ + addi r15, 4, r3 /* argv */ + + /* set up the value for the environment pointer r4 = (argc+1)*4+argv */ + addi r2, 1, r4 /* envp = argc + 1 */ + shlli r4, 2, r4 /* envp = envp * 4 */ + add r3, r4, r4 /* envp = envp + argv */ + + /* call main() */ + movi __uClibc_start_main,r17 + ptabs/l r17,tr0 + blink tr0,r18 + + /* should never get here....*/ +### movi abort@lh,r17 +### shori abort@ll,r17 + ptabs/l r17,tr0 + blink tr0,r63 /* call abort() => (r63) do not come back ... */ + + /* + * The following is a stub to stop the GNU toolchain + * from calling its C-RTL initialization routines. + */ +__main: + ptabs/l r18,tr0 + blink tr0,r63 + +/* Define a symbol for the first piece of initialized data. */ + .data + .globl __data_start +__data_start: + .long 0 + .weak data_start + data_start = __data_start + diff --git a/libc/sysdeps/linux/sh64/longjmp.S b/libc/sysdeps/linux/sh64/longjmp.S deleted file mode 100644 index d22a1677d..000000000 --- a/libc/sysdeps/linux/sh64/longjmp.S +++ /dev/null @@ -1,140 +0,0 @@ -/* longjmp for SH-5. - Copyright (C) 1999, 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - - -#define _SETJMP_H -#define _ASM -#include - - -#define INTEGER(reg,offset) ld.q r2, offset*8, reg -#define DOUBLE(reg,offset) fld.d r2, offset*8, reg - - - .file "longjmp.S" - - .section .text64,"xa" - .align 2 - - .global longjmp - .type longjmp,@function - -longjmp: - /* - * extern void longjmp(jmp_buf env, int val); - * - * r2 == env - * r3 == val - * r4 == temporary - */ - - /* callee-save registers R10-R16 */ - INTEGER(r10, __SETJMP_INT(0)) - INTEGER(r11, __SETJMP_INT(1)) - INTEGER(r12, __SETJMP_INT(2)) - INTEGER(r13, __SETJMP_INT(3)) - INTEGER(r14, __SETJMP_INT(4)) - INTEGER(r15, __SETJMP_INT(5)) - INTEGER(r16, __SETJMP_INT(6)) - - /* callee-save registers R28-R35 */ - INTEGER(r28, __SETJMP_INT(7)) - INTEGER(r29, __SETJMP_INT(8)) - INTEGER(r30, __SETJMP_INT(9)) - INTEGER(r31, __SETJMP_INT(10)) - INTEGER(r32, __SETJMP_INT(11)) - INTEGER(r33, __SETJMP_INT(12)) - INTEGER(r34, __SETJMP_INT(13)) - INTEGER(r35, __SETJMP_INT(14)) - - /* callee-save registers R44-R59 */ - INTEGER(r44, __SETJMP_INT(15)) - INTEGER(r45, __SETJMP_INT(16)) - INTEGER(r46, __SETJMP_INT(17)) - INTEGER(r47, __SETJMP_INT(18)) - INTEGER(r48, __SETJMP_INT(19)) - INTEGER(r49, __SETJMP_INT(20)) - INTEGER(r50, __SETJMP_INT(21)) - INTEGER(r51, __SETJMP_INT(22)) - INTEGER(r52, __SETJMP_INT(23)) - INTEGER(r53, __SETJMP_INT(24)) - INTEGER(r54, __SETJMP_INT(25)) - INTEGER(r55, __SETJMP_INT(26)) - INTEGER(r56, __SETJMP_INT(27)) - INTEGER(r57, __SETJMP_INT(28)) - INTEGER(r58, __SETJMP_INT(29)) - INTEGER(r59, __SETJMP_INT(30)) - - #if __SETJMP_NUM_INT != 31 - #error __SETJMP_NUM_INT does agree with expected value - #endif - -#if __SETJMP_NUM_DBL > 0 - /* callee-save registers FR12-FR15 */ - DOUBLE(d12, __SETJMP_DBL(0)) - DOUBLE(d14, __SETJMP_DBL(1)) - - /* callee-save registers FR36-FR63 */ - DOUBLE(d36, __SETJMP_DBL(2)) - DOUBLE(d38, __SETJMP_DBL(3)) - DOUBLE(d40, __SETJMP_DBL(4)) - DOUBLE(d42, __SETJMP_DBL(5)) - DOUBLE(d44, __SETJMP_DBL(6)) - DOUBLE(d46, __SETJMP_DBL(7)) - DOUBLE(d48, __SETJMP_DBL(8)) - DOUBLE(d50, __SETJMP_DBL(9)) - DOUBLE(d52, __SETJMP_DBL(10)) - DOUBLE(d54, __SETJMP_DBL(11)) - DOUBLE(d56, __SETJMP_DBL(12)) - DOUBLE(d58, __SETJMP_DBL(13)) - DOUBLE(d60, __SETJMP_DBL(14)) - DOUBLE(d62, __SETJMP_DBL(15)) - - #if __SETJMP_NUM_DBL != 16 - #error __SETJMP_NUM_DBL does agree with expected value - #endif - -#endif /* __SETJMP_NUM_DBL > 0 */ - - /* callee-save registers TR5-TR7 */ - INTEGER(r4, __SETJMP_TRG(0)) - ptabs r4, tr5 - INTEGER(r4, __SETJMP_TRG(1)) - ptabs r4, tr6 - INTEGER(r4, __SETJMP_TRG(2)) - ptabs r4, tr7 - - #if __SETJMP_NUM_TRG != 3 - #error __SETJMP_NUM_TRG does agree with expected value - #endif - - /* restore Linkage Register (LR) for longjmp return */ - INTEGER(r18, __SETJMP_LR) - ptabs/l r18, tr0 - - /* - * must ensure longjmp() never returns 0. - * if 'val' == 0, then return 1. - */ - cmpeq r3, r63, r2 /* r2 = (r3==0) ? 1 : 0; */ - add.l r3, r2, r2 /* return value */ - - /* return to caller */ - blink tr0, r63 - diff --git a/libc/sysdeps/linux/sh64/sys/procfs.h b/libc/sysdeps/linux/sh64/sys/procfs.h new file mode 100644 index 000000000..aad21e5f8 --- /dev/null +++ b/libc/sysdeps/linux/sh64/sys/procfs.h @@ -0,0 +1,126 @@ +/* Copyright (C) 1996, 1997, 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_PROCFS_H +#define _SYS_PROCFS_H 1 + +/* This is somehow modelled after the file of the same name on SysVr4 + systems. It provides a definition of the core file format for ELF + used on Linux. */ + +#include +#include +#include +#include +#include +#include + +__BEGIN_DECLS + +/* + * ELF register definitions... + */ +typedef unsigned long elf_greg_t; + +#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t)) +typedef elf_greg_t elf_gregset_t[ELF_NGREG]; + +typedef struct user_fpu_struct elf_fpregset_t; + +struct elf_siginfo + { + int si_signo; /* Signal number. */ + int si_code; /* Extra code. */ + int si_errno; /* Errno. */ + }; + + +/* Definitions to generate Intel SVR4-like core files. These mostly + have the same names as the SVR4 types with "elf_" tacked on the + front to prevent clashes with linux definitions, and the typedef + forms have been avoided. This is mostly like the SVR4 structure, + but more Linuxy, with things that Linux does not support and which + gdb doesn't really use excluded. Fields present but not used are + marked with "XXX". */ +struct elf_prstatus + { +#if 0 + long int pr_flags; /* XXX Process flags. */ + short int pr_why; /* XXX Reason for process halt. */ + short int pr_what; /* XXX More detailed reason. */ +#endif + struct elf_siginfo pr_info; /* Info associated with signal. */ + short int pr_cursig; /* Current signal. */ + unsigned long int pr_sigpend; /* Set of pending signals. */ + unsigned long int pr_sighold; /* Set of held signals. */ +#if 0 + struct sigaltstack pr_altstack; /* Alternate stack info. */ + struct sigaction pr_action; /* Signal action for current sig. */ +#endif + __pid_t pr_pid; + __pid_t pr_ppid; + __pid_t pr_pgrp; + __pid_t pr_sid; + struct timeval pr_utime; /* User time. */ + struct timeval pr_stime; /* System time. */ + struct timeval pr_cutime; /* Cumulative user time. */ + struct timeval pr_cstime; /* Cumulative system time. */ +#if 0 + long int pr_instr; /* Current instruction. */ +#endif + elf_gregset_t pr_reg; /* GP registers. */ + int pr_fpvalid; /* True if math copro being used. */ + }; + + +#define ELF_PRARGSZ (80) /* Number of chars for args */ + +struct elf_prpsinfo + { + char pr_state; /* Numeric process state. */ + char pr_sname; /* Char for pr_state. */ + char pr_zomb; /* Zombie. */ + char pr_nice; /* Nice val. */ + unsigned long int pr_flag; /* Flags. */ + long pr_uid; + long pr_gid; + int pr_pid, pr_ppid, pr_pgrp, pr_sid; + /* Lots missing */ + char pr_fname[16]; /* Filename of executable. */ + char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ + }; + + +/* Addresses. */ +typedef void *psaddr_t; + +/* Register sets. Linux has different names. */ +typedef elf_gregset_t prgregset_t; +typedef elf_fpregset_t prfpregset_t; + +/* We don't have any differences between processes and threads, + therefore habe only ine PID type. */ +typedef __pid_t lwpid_t; + + +typedef struct elf_prstatus prstatus_t; +typedef struct elf_prpsinfo prpsinfo_t; + +__END_DECLS + +#endif /* sys/procfs.h */ -- cgit v1.2.3