Changeset e8067c0 in mainline


Ignore:
Timestamp:
2011-08-06T09:40:22Z (13 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3666d38, 86ffa27f
Parents:
a8bb38c
Message:

Write register state in core files / mips32 (not working).

File:
1 edited

Legend:

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

    ra8bb38c re8067c0  
    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 pad0[6];
     48
     49        uint32_t r0;
     50        uint32_t r1;
     51        uint32_t r2;
     52        uint32_t r3;
     53        uint32_t r4;
     54        uint32_t r5;
     55        uint32_t r6;
     56        uint32_t r7;
     57        uint32_t r8;
     58        uint32_t r9;
     59        uint32_t r10;
     60        uint32_t r11;
     61        uint32_t r12;
     62        uint32_t r13;
     63        uint32_t r14;
     64        uint32_t r15;
     65        uint32_t r16;
     66        uint32_t r17;
     67        uint32_t r18;
     68        uint32_t r19;
     69        uint32_t r20;
     70        uint32_t r21;
     71        uint32_t r22;
     72        uint32_t r23;
     73        uint32_t r24;
     74        uint32_t r25;
     75        uint32_t r26;
     76        uint32_t r27;
     77        uint32_t r28;
     78        uint32_t r29;
     79        uint32_t r30;
     80        uint32_t r31;
     81
     82        uint32_t cp0_status;
     83        uint32_t hi;
     84        uint32_t lo;
     85        uint32_t cp0_badvaddr;
     86        uint32_t cp0_cause;
     87        uint32_t cp0_epc;
    4488} elf_regs_t;
    4589
     90/** Convert istate_t to elf_regs_t. */
    4691static inline void istate_to_elf_regs(istate_t *istate, elf_regs_t *elf_regs)
    4792{
    48         /* TODO */
    49         (void) istate; (void) elf_regs;
     93        elf_regs->r1 = istate->at;
     94        elf_regs->r2 = istate->v0;
     95        elf_regs->r3 = istate->v1;
     96        elf_regs->r4 = istate->a0;
     97        elf_regs->r5 = istate->a1;
     98        elf_regs->r6 = istate->a2;
     99        elf_regs->r7 = istate->a3;
     100        elf_regs->r8 = istate->t0;
     101        elf_regs->r9 = istate->t1;
     102        elf_regs->r10 = istate->t2;
     103        elf_regs->r11 = istate->t3;
     104        elf_regs->r12 = istate->t4;
     105        elf_regs->r13 = istate->t5;
     106        elf_regs->r14 = istate->t6;
     107        elf_regs->r15 = istate->t7;
     108        elf_regs->r16 = istate->s0;
     109        elf_regs->r17 = istate->s1;
     110        elf_regs->r18 = istate->s2;
     111        elf_regs->r19 = istate->s3;
     112        elf_regs->r20 = istate->s4;
     113        elf_regs->r21 = istate->s5;
     114        elf_regs->r22 = istate->s6;
     115        elf_regs->r23 = istate->s7;
     116        elf_regs->r24 = istate->t8;
     117        elf_regs->r25 = istate->t9;
     118        elf_regs->r26 = istate->kt0;
     119        elf_regs->r27 = istate->kt1;
     120        elf_regs->r28 = istate->gp;
     121        elf_regs->r29 = istate->sp;
     122        elf_regs->r30 = istate->s8;
     123        elf_regs->r31 = istate->ra;
     124
     125        elf_regs->cp0_status = istate->status;
     126        elf_regs->hi = istate->hi;
     127        elf_regs->lo = istate->lo;
     128        elf_regs->cp0_epc = istate->epc;
    50129}
    51130
Note: See TracChangeset for help on using the changeset viewer.