Changeset 49a39c2 in mainline for arch/amd64/src/asm_utils.S


Ignore:
Timestamp:
2006-02-06T21:14:29Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8a1da55
Parents:
7febdde5
Message:

Preliminary work on AMD userspace.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • arch/amd64/src/asm_utils.S

    r7febdde5 r49a39c2  
    3535
    3636#include <arch/pm.h>
     37#include <arch/context_offset.h>
    3738       
    3839.text
     
    104105
    105106# Push all general purpose registers on stack except %rbp, %rsp
    106 .macro push_all_gpr
    107         pushq %rax
    108         pushq %rbx
    109         pushq %rcx
    110         pushq %rdx
    111         pushq %rsi
    112         pushq %rdi
    113         pushq %r8
    114         pushq %r9
    115         pushq %r10
    116         pushq %r11
    117         pushq %r12
    118         pushq %r13
    119         pushq %r14
    120         pushq %r15
     107.macro save_all_gpr
     108        movq %rbp, IOFFSET_RBP(%rsp)
     109        movq %rax, IOFFSET_RAX(%rsp)
     110        movq %rbx, IOFFSET_RBX(%rsp)
     111        movq %rcx, IOFFSET_RCX(%rsp)
     112        movq %rdx, IOFFSET_RDX(%rsp)
     113        movq %rsi, IOFFSET_RSI(%rsp)
     114        movq %rdi, IOFFSET_RDI(%rsp)
     115        movq %r8, IOFFSET_R8(%rsp)
     116        movq %r9, IOFFSET_R9(%rsp)
     117        movq %r10, IOFFSET_R10(%rsp)
     118        movq %r11, IOFFSET_R11(%rsp)
     119        movq %r12, IOFFSET_R12(%rsp)
     120        movq %r13, IOFFSET_R13(%rsp)
     121        movq %r14, IOFFSET_R14(%rsp)
     122        movq %r15, IOFFSET_R15(%rsp)
    121123.endm
    122124
    123 .macro pop_all_gpr
    124         popq %r15
    125         popq %r14
    126         popq %r13
    127         popq %r12
    128         popq %r11
    129         popq %r10
    130         popq %r9
    131         popq %r8
    132         popq %rdi
    133         popq %rsi
    134         popq %rdx
    135         popq %rcx
    136         popq %rbx
    137         popq %rax
     125.macro restore_all_gpr
     126        movq IOFFSET_RBP(%rsp), %rbp
     127        movq IOFFSET_RAX(%rsp), %rax
     128        movq IOFFSET_RBX(%rsp), %rbx
     129        movq IOFFSET_RCX(%rsp), %rcx
     130        movq IOFFSET_RDX(%rsp), %rdx
     131        movq IOFFSET_RSI(%rsp), %rsi
     132        movq IOFFSET_RDI(%rsp), %rdi
     133        movq IOFFSET_R8(%rsp), %r8
     134        movq IOFFSET_R9(%rsp), %r9
     135        movq IOFFSET_R10(%rsp), %r10
     136        movq IOFFSET_R11(%rsp), %r11
     137        movq IOFFSET_R12(%rsp), %r12
     138        movq IOFFSET_R13(%rsp), %r13
     139        movq IOFFSET_R14(%rsp), %r14
     140        movq IOFFSET_R15(%rsp), %r15
    138141.endm
    139142       
     
    147150#
    148151.macro handler i n
    149         pushq %rbp
    150         movq %rsp,%rbp
    151        
    152         push_all_gpr
     152        subq $IREGISTER_SPACE, %rsp
     153        save_all_gpr
    153154
    154155        movq $(\i),%rdi   # %rdi - first parameter
    155         movq %rbp, %rsi
    156         addq $8, %rsi     # %rsi - second parameter - original stack
     156        movq %rsp, %rsi   # %rsi - pointer to interrupt_context
    157157        call exc_dispatch       # exc_dispatch(i, stack)
    158158
     
    169169
    170170# Return with error word
    171         pop_all_gpr
    172        
    173         popq %rbp;
    174         addq $8,%rsp;    # Skip error word
     171        restore_all_gpr
     172        # $8 = Skip error word
     173        addq $IREGISTER_SPACE + 0x8, %rsp
    175174        iretq
    176175
    1771760:
    178177# Return with no error word
    179         pop_all_gpr
    180        
    181         popq %rbp
     178        restore_all_gpr
     179        addq $IREGISTER_SPACE, %rsp
    182180        iretq
    183181
Note: See TracChangeset for help on using the changeset viewer.