Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 33add3a8 in mainline


Ignore:
Timestamp:
2014-09-03T21:37:33Z (7 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master
Children:
d5955a5
Parents:
4b334fd6
Message:

Autogenerate mips32 kernel context_t and its offsets.

Location:
kernel/arch/mips32
Files:
1 added
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/mips32/Makefile.inc

    r4b334fd6 r33add3a8  
    8686
    8787ARCH_AUTOGENS_AG = \
    88         arch/$(KARCH)/include/arch/istate_struct.ag
     88        arch/$(KARCH)/include/arch/istate_struct.ag \
     89        arch/$(KARCH)/include/arch/context_struct.ag
    8990
  • kernel/arch/mips32/include/arch/context.h

    r4b334fd6 r33add3a8  
    3838#include <align.h>
    3939#include <arch/stack.h>
     40#include <arch/context_struct.h>
     41#include <typedefs.h>
    4042
    4143/*
     
    4446#define SP_DELTA  (ABI_STACK_FRAME + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT))
    4547
    46 #ifndef __ASM__
    47 
    48 #include <typedefs.h>
    49 
    5048#define context_set(ctx, pc, stack, size) \
    5149    context_set_generic(ctx, pc, stack, size)
    52 
    53 /*
    54  * Only save registers that must be preserved across
    55  * function calls.
    56  */
    57 typedef struct {
    58         uintptr_t sp;
    59         uintptr_t pc;
    60        
    61         uint32_t s0;
    62         uint32_t s1;
    63         uint32_t s2;
    64         uint32_t s3;
    65         uint32_t s4;
    66         uint32_t s5;
    67         uint32_t s6;
    68         uint32_t s7;
    69         uint32_t s8;
    70         uint32_t gp;
    71 
    72         ipl_t ipl;
    73 } context_t;
    74 
    75 #endif /* __ASM__ */
    7650
    7751#endif
  • kernel/arch/mips32/src/context.S

    r4b334fd6 r33add3a8  
    2727#
    2828
    29 #include <arch/context_offset.h>
     29#include <arch/context_struct.h>
    3030
    3131.text
     
    3939
    4040context_save_arch:
    41         CONTEXT_SAVE_ARCH_CORE $a0
     41        sw $s0, CONTEXT_OFFSET_S0($a0)
     42        sw $s1, CONTEXT_OFFSET_S1($a0)
     43        sw $s2, CONTEXT_OFFSET_S2($a0)
     44        sw $s3, CONTEXT_OFFSET_S3($a0)
     45        sw $s4, CONTEXT_OFFSET_S4($a0)
     46        sw $s5, CONTEXT_OFFSET_S5($a0)
     47        sw $s6, CONTEXT_OFFSET_S6($a0)
     48        sw $s7, CONTEXT_OFFSET_S7($a0)
     49        sw $s8, CONTEXT_OFFSET_S8($a0)
     50        sw $gp, CONTEXT_OFFSET_GP($a0)
     51       
     52        sw $ra, CONTEXT_OFFSET_PC($a0)
     53        sw $sp, CONTEXT_OFFSET_SP($a0)
    4254       
    4355        # context_save returns 1
     
    4658
    4759context_restore_arch:
    48         CONTEXT_RESTORE_ARCH_CORE $a0
     60        lw $s0, CONTEXT_OFFSET_S0($a0)
     61        lw $s1, CONTEXT_OFFSET_S1($a0)
     62        lw $s2, CONTEXT_OFFSET_S2($a0)
     63        lw $s3, CONTEXT_OFFSET_S3($a0)
     64        lw $s4, CONTEXT_OFFSET_S4($a0)
     65        lw $s5, CONTEXT_OFFSET_S5($a0)
     66        lw $s6, CONTEXT_OFFSET_S6($a0)
     67        lw $s7, CONTEXT_OFFSET_S7($a0)
     68        lw $s8, CONTEXT_OFFSET_S8($a0)
     69        lw $gp, CONTEXT_OFFSET_GP($a0)
     70       
     71        lw $ra, CONTEXT_OFFSET_PC($a0)
     72        lw $sp, CONTEXT_OFFSET_SP($a0)
    4973       
    5074        # context_restore returns 0
  • kernel/arch/mips32/src/start.S

    r4b334fd6 r33add3a8  
    3030#include <arch/mm/page.h>
    3131#include <arch/asm/boot.h>
    32 #include <arch/context_offset.h>
    3332#include <arch/stack.h>
    3433#include <arch/istate_struct.h>
Note: See TracChangeset for help on using the changeset viewer.