Ignore:
Timestamp:
Jun 28, 2017, 3:24:02 PM (7 years ago)
Author:
max@…
Message:

enable the timer (not yet calibrated)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/hal/x86_64/core/hal_kentry.h

    r51 r86  
    4545#define T_USER  0x100
    4646
     47#define TF_REGSIZE      (19 * 8)
     48
     49#define INTR_SAVE_REGS  \
     50        subq    $TF_REGSIZE,%rsp        ; \
     51        movq    %rax,TF_RAX(%rsp)       ; \
     52        movq    %rbx,TF_RBX(%rsp)       ; \
     53        movq    %rcx,TF_RCX(%rsp)       ; \
     54        movq    %rdx,TF_RDX(%rsp)       ; \
     55        movq    %rbp,TF_RBP(%rsp)       ; \
     56        movq    %rdi,TF_RDI(%rsp)       ; \
     57        movq    %rsi,TF_RSI(%rsp)       ; \
     58        movq    %r8,TF_R8(%rsp)         ; \
     59        movq    %r9,TF_R9(%rsp)         ; \
     60        movq    %r10,TF_R10(%rsp)       ; \
     61        movq    %r11,TF_R11(%rsp)       ; \
     62        movq    %r12,TF_R12(%rsp)       ; \
     63        movq    %r13,TF_R13(%rsp)       ; \
     64        movq    %r14,TF_R14(%rsp)       ; \
     65        movq    %r15,TF_R15(%rsp)       ; \
     66        movw    %gs,TF_GS(%rsp)         ; \
     67        movw    %fs,TF_FS(%rsp)         ; \
     68        movw    %es,TF_ES(%rsp)         ; \
     69        movw    %ds,TF_DS(%rsp)         ; \
     70        cld
     71
     72#define INTR_RESTORE_REGS       \
     73        movq    TF_RAX(%rsp),%rax       ; \
     74        movq    TF_RBX(%rsp),%rbx       ; \
     75        movq    TF_RCX(%rsp),%rcx       ; \
     76        movq    TF_RDX(%rsp),%rdx       ; \
     77        movq    TF_RBP(%rsp),%rbp       ; \
     78        movq    TF_RDI(%rsp),%rdi       ; \
     79        movq    TF_RSI(%rsp),%rsi       ; \
     80        movq    TF_R8(%rsp),%r8         ; \
     81        movq    TF_R9(%rsp),%r9         ; \
     82        movq    TF_R10(%rsp),%r10       ; \
     83        movq    TF_R11(%rsp),%r11       ; \
     84        movq    TF_R12(%rsp),%r12       ; \
     85        movq    TF_R13(%rsp),%r13       ; \
     86        movq    TF_R14(%rsp),%r14       ; \
     87        movq    TF_R15(%rsp),%r15       ; \
     88        movw    TF_GS(%rsp),%gs         ; \
     89        movw    TF_FS(%rsp),%fs         ; \
     90        movw    TF_ES(%rsp),%es         ; \
     91        movw    TF_DS(%rsp),%ds         ; \
     92        addq    $TF_REGSIZE,%rsp        ; \
     93        cld
     94
    4795#ifndef x86_ASM
    4896
     
    5199 */
    52100struct trapframe {
     101        /* Pushed by INTR_SAVE_REGS */
     102        uint64_t tf_rax;
     103        uint64_t tf_rbx;
     104        uint64_t tf_rcx;
     105        uint64_t tf_rdx;
    53106        uint64_t tf_rdi;
    54107        uint64_t tf_rsi;
    55         uint64_t tf_rdx;
    56         uint64_t tf_r10;
     108        uint64_t tf_rbp;
    57109        uint64_t tf_r8;
    58110        uint64_t tf_r9;
    59 
    60         uint64_t tf_arg6;
    61         uint64_t tf_arg7;
    62         uint64_t tf_arg8;
    63         uint64_t tf_arg9;
    64 
    65         uint64_t tf_rcx;
     111        uint64_t tf_r10;
    66112        uint64_t tf_r11;
    67113        uint64_t tf_r12;
     
    69115        uint64_t tf_r14;
    70116        uint64_t tf_r15;
    71         uint64_t tf_rbp;
    72         uint64_t tf_rbx;
    73         uint64_t tf_rax;
    74 
    75117        uint64_t tf_gs;
    76118        uint64_t tf_fs;
     
    78120        uint64_t tf_ds;
    79121
     122        /* Pushed by the ISR */
    80123        uint64_t tf_trapno;
    81124
     
    98141
    99142        /* These are pushed for a trap */
    100         uint64_t tf_err;
     143        uint64_t tf_err;        /* in fact, this one may not... */
    101144        uint64_t tf_rip;
    102145        uint64_t tf_cs;
     
    108151};
    109152
     153#else
     154
     155/* offsets in the trapframe structure */
     156#define TF_RAX  0
     157#define TF_RBX  8
     158#define TF_RCX  16
     159#define TF_RDX  24
     160#define TF_RDI  32
     161#define TF_RSI  40
     162#define TF_RBP  48
     163#define TF_R8   56
     164#define TF_R9   64
     165#define TF_R10  72
     166#define TF_R11  80
     167#define TF_R12  88
     168#define TF_R13  96
     169#define TF_R14  104
     170#define TF_R15  112
     171#define TF_GS   120
     172#define TF_FS   128
     173#define TF_ES   136
     174#define TF_DS   144
     175
    110176#endif
    111177
Note: See TracChangeset for help on using the changeset viewer.