Changeset 3fab770 in mainline


Ignore:
Timestamp:
2011-07-29T20:26:14Z (13 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
12bcae0, a33f0a6
Parents:
74e6b1f
Message:

Write register state to core files (arm32, ppc32). ppc32 is untested
(no way to copy out core file).

Location:
uspace/lib/c/arch
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/arch/arm32/include/elf_linux.h

    r74e6b1f r3fab770  
    3030 * @{
    3131 */
    32 /** @file
     32/** @file Definitions needed to write core files in Linux-ELF format.
    3333 */
    3434
     
    3939#include <sys/types.h>
    4040
     41/** Linux kernel struct pt_regs structure.
     42 *
     43 * We need this to save register state to a core file in Linux format
     44 * (readable by GDB configured for Linux target).
     45 */
    4146typedef struct {
    42         /* TODO */
    43         uint32_t pad[16];
     47        uint32_t r0;
     48        uint32_t r1;
     49        uint32_t r2;
     50        uint32_t r3;
     51        uint32_t r4;
     52        uint32_t r5;
     53        uint32_t r6;
     54        uint32_t r7;
     55        uint32_t r8;
     56        uint32_t r9;
     57        uint32_t r10;
     58        uint32_t fp;
     59        uint32_t r12;
     60        uint32_t sp;
     61        uint32_t lr;
     62        uint32_t pc;
     63        uint32_t cpsr;
     64        uint32_t old_r0;
    4465} elf_regs_t;
    4566
     67/** Convert istate_t to elf_regs_t. */
    4668static inline void istate_to_elf_regs(istate_t *istate, elf_regs_t *elf_regs)
    4769{
    48         /* TODO */
    49         (void) istate; (void) elf_regs;
     70        elf_regs->r0 = istate->r0;
     71        elf_regs->r1 = istate->r1;
     72        elf_regs->r2 = istate->r2;
     73        elf_regs->r3 = istate->r3;
     74        elf_regs->r4 = istate->r4;
     75        elf_regs->r5 = istate->r5;
     76        elf_regs->r6 = istate->r6;
     77        elf_regs->r7 = istate->r7;
     78        elf_regs->r8 = istate->r8;
     79        elf_regs->r9 = istate->r9;
     80        elf_regs->r10 = istate->r10;
     81
     82        elf_regs->fp = istate->fp;
     83        elf_regs->r12 = istate->r12;
     84        elf_regs->sp = istate->sp;
     85        elf_regs->lr = istate->lr;
     86        elf_regs->pc = istate->pc;
     87        elf_regs->cpsr = istate->spsr;
     88        elf_regs->old_r0 = 0;
    5089}
    5190
  • uspace/lib/c/arch/ppc32/include/elf_linux.h

    r74e6b1f r3fab770  
    3030 * @{
    3131 */
    32 /** @file
     32/** @file Definitions needed to write core files in Linux-ELF format.
    3333 */
    3434
     
    3939#include <sys/types.h>
    4040
     41/** Linux kernel struct pt_regs structure.
     42 *
     43 * We need this to save register state to a core file in Linux format
     44 * (readable by GDB configured for Linux target).
     45 */
    4146typedef struct {
    42         /* TODO */
    43         uint32_t pad[16];
     47        uint32_t r0;
     48        uint32_t r1;
     49        uint32_t r2;
     50        uint32_t r3;
     51        uint32_t r4;
     52        uint32_t r5;
     53        uint32_t r6;
     54        uint32_t r7;
     55        uint32_t r8;
     56        uint32_t r9;
     57        uint32_t r10;
     58        uint32_t r11;
     59        uint32_t r12;
     60        uint32_t r13;
     61        uint32_t r14;
     62        uint32_t r15;
     63        uint32_t r16;
     64        uint32_t r17;
     65        uint32_t r18;
     66        uint32_t r19;
     67        uint32_t r20;
     68        uint32_t r21;
     69        uint32_t r22;
     70        uint32_t r23;
     71        uint32_t r24;
     72        uint32_t r25;
     73        uint32_t r26;
     74        uint32_t r27;
     75        uint32_t r28;
     76        uint32_t r29;
     77        uint32_t r30;
     78        uint32_t r31;
     79
     80        uint32_t nip;
     81        uint32_t msr;
     82        uint32_t old_r3;
     83        uint32_t ctr;
     84        uint32_t link;
     85        uint32_t xer;
     86        uint32_t ccr;
     87        uint32_t mq;
     88        uint32_t trap;
     89        uint32_t dar;
     90        uint32_t dsisr;
     91        uint32_t result;
    4492} elf_regs_t;
    4593
     94/** Convert istate_t to elf_regs_t. */
    4695static inline void istate_to_elf_regs(istate_t *istate, elf_regs_t *elf_regs)
    4796{
    48         /* TODO */
    49         (void) istate; (void) elf_regs;
     97        elf_regs->r0 = istate->r0;
     98        elf_regs->r1 = istate->sp;
     99        elf_regs->r2 = istate->r2;
     100        elf_regs->r3 = istate->r3;
     101        elf_regs->r4 = istate->r4;
     102        elf_regs->r5 = istate->r5;
     103        elf_regs->r6 = istate->r6;
     104        elf_regs->r7 = istate->r7;
     105        elf_regs->r8 = istate->r8;
     106        elf_regs->r9 = istate->r9;
     107        elf_regs->r10 = istate->r10;
     108        elf_regs->r11 = istate->r11;
     109        elf_regs->r12 = istate->r12;
     110        elf_regs->r13 = istate->r13;
     111        elf_regs->r14 = istate->r14;
     112        elf_regs->r15 = istate->r15;
     113        elf_regs->r16 = istate->r16;
     114        elf_regs->r17 = istate->r17;
     115        elf_regs->r18 = istate->r18;
     116        elf_regs->r19 = istate->r19;
     117        elf_regs->r20 = istate->r20;
     118        elf_regs->r21 = istate->r21;
     119        elf_regs->r22 = istate->r22;
     120        elf_regs->r23 = istate->r23;
     121        elf_regs->r24 = istate->r24;
     122        elf_regs->r25 = istate->r25;
     123        elf_regs->r26 = istate->r26;
     124        elf_regs->r27 = istate->r27;
     125        elf_regs->r28 = istate->r28;
     126        elf_regs->r29 = istate->r29;
     127        elf_regs->r30 = istate->r30;
     128        elf_regs->r31 = istate->r31;
     129
     130        elf_regs->ctr = istate->ctr;
     131        elf_regs->link = istate->lr;
     132        elf_regs->xer = istate->xer;
     133        elf_regs->ccr = istate->cr;
     134        elf_regs->dar = istate->dar;
    50135}
    51136
Note: See TracChangeset for help on using the changeset viewer.