Changeset 4b2c872d in mainline for arch


Ignore:
Timestamp:
2005-10-18T09:33:02Z (20 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8005218
Parents:
22f7769
Message:

Create generic context_save() and context_restore().
These two functions are defined inline and only call context_save_arch() and context_restore_arch(), respectively.
The main purpose of this is to enable centralized commenting of these important and tricky functions.

Location:
arch
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • arch/amd64/include/context.h

    r22f7769 r4b2c872d  
    4545 */
    4646struct context {
    47     __u64 sp;
    48     __u64 pc;
     47    __address sp;
     48    __address pc;
    4949   
    5050    __u64 rbx;
  • arch/amd64/src/context.S

    r22f7769 r4b2c872d  
    2929.text
    3030
    31 .global context_save
    32 .global context_restore
     31.global context_save_arch
     32.global context_restore_arch
    3333
    3434#include <arch/context_offset.h>
     
    3636## Save current CPU context
    3737#
    38 # Save CPU context to the kernel_context variable
     38# Save CPU context to context_t variable
    3939# pointed by the 1st argument. Returns 1 in EAX.
    4040#
    41 context_save:
     41context_save_arch:
    4242        movq (%rsp), %rdx     # the caller's return %eip
    4343        # In %edi is passed 1st argument
     
    5959## Restore current CPU context
    6060#
    61 # Restore CPU context from the kernel_context variable
     61# Restore CPU context from context_t variable
    6262# pointed by the 1st argument. Returns 0 in EAX.
    6363#
    64 context_restore:       
     64context_restore_arch:   
    6565        movq OFFSET_R15(%rdi), %r15
    6666        movq OFFSET_R14(%rdi), %r14
  • arch/ia32/include/context.h

    r22f7769 r4b2c872d  
    4747 */
    4848struct context {
    49         __u32 sp;
    50         __u32 pc;
     49        __address sp;
     50        __address pc;
    5151        __u32 ebx;
    5252        __u32 esi;
  • arch/ia32/src/context.s

    r22f7769 r4b2c872d  
    2929.text
    3030
    31 .global context_save
    32 .global context_restore
     31.global context_save_arch
     32.global context_restore_arch
    3333
    3434
    3535## Save current CPU context
    3636#
    37 # Save CPU context to the kernel_context variable
     37# Save CPU context to the context_t variable
    3838# pointed by the 1st argument. Returns 1 in EAX.
    3939#
    40 context_save:
     40context_save_arch:
    4141        movl 0(%esp),%eax       # the caller's return %eip
    4242        movl 4(%esp),%edx       # address of the kernel_context variable to save context to
     
    5454
    5555
    56 ## Restore current CPU context
     56## Restore saved CPU context
    5757#
    58 # Restore CPU context from the kernel_context variable
     58# Restore CPU context from context_t variable
    5959# pointed by the 1st argument. Returns 0 in EAX.
    6060#
    61 context_restore:
     61context_restore_arch:
    6262        movl 4(%esp),%eax       # address of the kernel_context variable to restore context from
    6363        movl 0(%eax),%esp       # ctx->sp -> %esp
  • arch/ia64/include/context.h

    r22f7769 r4b2c872d  
    3131
    3232#include <arch/types.h>
     33#include <typedefs.h>
    3334#include <align.h>
    3435
     
    5152        (c)->pc = (__address) _pc;                                                      \
    5253        (c)->bsp = ((__address) stack) + ALIGN(sizeof(the_t), STACK_ALIGNMENT);         \
    53         (c)->sp = ((__address) stack) + ALIGN((size) - SP_DELTA, STACK_ALIGNMENT);
     54        (c)->sp = ((__address) stack) + ALIGN((size), STACK_ALIGNMENT) - SP_DELTA;
    5455
    5556/*
     
    6667        __u64 ar_unat_callee;
    6768        __u64 ar_rsc;
    68         __u64 bsp;      /* ar_bsp */
     69        __address bsp;          /* ar_bsp */
    6970        __u64 ar_rnat;
    7071        __u64 ar_lc;
     
    7879        __u64 r6;
    7980        __u64 r7;
    80         __u64 sp;               /* r12 */
     81        __address sp;           /* r12 */
    8182        __u64 r13;
    8283       
     
    8485         * Branch registers
    8586         */
    86         __u64 pc;               /* b0 */
     87        __address pc;           /* b0 */
    8788        __u64 b1;
    8889        __u64 b2;
  • arch/ia64/src/context.S

    r22f7769 r4b2c872d  
    2929.text
    3030
    31 .global context_save
    32 .global context_restore
     31.global context_save_arch
     32.global context_restore_arch
    3333
    34 context_save:
     34context_save_arch:
    3535        alloc loc0 = ar.pfs, 1, 8, 0, 0
    3636        mov loc1 = ar.unat      ;;
     
    113113        br.ret.sptk.many b0
    114114
    115 context_restore:
     115context_restore_arch:
    116116        alloc loc0 = ar.pfs, 1, 8, 0, 0 ;;
    117117
  • arch/mips32/include/context.h

    r22f7769 r4b2c872d  
    4949 */
    5050struct context {
    51         __u32 sp;
    52         __u32 pc;
     51        __address sp;
     52        __address pc;
    5353       
    5454        __u32 s0;
  • arch/mips32/src/context.S

    r22f7769 r4b2c872d  
    3737.set nomacro
    3838
    39 .global context_save
    40 .global context_restore
     39.global context_save_arch
     40.global context_restore_arch
    4141
    4242.macro CONTEXT_STORE r
     
    7373
    7474       
    75 context_save:
     75context_save_arch:
    7676        CONTEXT_STORE $a0
    7777
     
    8080        li $2, 1       
    8181       
    82 context_restore:
     82context_restore_arch:
    8383        CONTEXT_LOAD $a0
    8484
  • arch/ppc32/include/context.h

    r22f7769 r4b2c872d  
    3636struct context {
    3737        __u32 r0;
    38         __u32 sp;
     38        __address sp;
    3939        __u32 r2;
    4040        __u32 r3;
     
    6767        __u32 r30;
    6868        __u32 r31;
    69         __u32 pc;
     69        __address pc;
    7070        ipl_t ipl;
    7171} __attribute__ ((packed));
  • arch/ppc32/src/context.S

    r22f7769 r4b2c872d  
    3131.text   
    3232
    33 .global context_save
    34 .global context_restore
     33.global context_save_arch
     34.global context_restore_arch
    3535
    36 context_save:
     36context_save_arch:
    3737        REGISTERS_STORE r3
    3838       
     
    4444        blr
    4545       
    46 context_restore:
     46context_restore_arch:
    4747        REGISTERS_LOAD r3
    4848       
Note: See TracChangeset for help on using the changeset viewer.