Changeset 4e49572 in mainline for arch/amd64/include/asm.h


Ignore:
Timestamp:
2006-03-17T11:41:05Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
23d22eb
Parents:
5a7d9d1
Message:

Added debugger to AMD64.
Added automatic debugging of AS if it is not rewritten with zero.
Did small changes to IPC infrastructure.

File:
1 edited

Legend:

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

    r5a7d9d1 r4e49572  
    142142}
    143143
    144 /** Read CR0
    145  *
    146  * Return value in CR0
    147  *
    148  * @return Value read.
    149  */
    150 static inline __u64 read_cr0(void)
    151 {
    152         __u64 v;
    153         __asm__ volatile ("movq %%cr0,%0\n" : "=r" (v));
    154         return v;
    155 }
    156 
    157 /** Read CR2
    158  *
    159  * Return value in CR2
    160  *
    161  * @return Value read.
    162  */
    163 static inline __u64 read_cr2(void)
    164 {
    165         __u64 v;
    166         __asm__ volatile ("movq %%cr2,%0\n" : "=r" (v));
    167         return v;
    168 }
    169 
    170 /** Write CR3
    171  *
    172  * Write value to CR3.
    173  *
    174  * @param v Value to be written.
    175  */
    176 static inline void write_cr3(__u64 v)
    177 {
    178         __asm__ volatile ("movq %0,%%cr3\n" : : "r" (v));
    179 }
    180 
    181 /** Read CR3
    182  *
    183  * Return value in CR3
    184  *
    185  * @return Value read.
    186  */
    187 static inline __u64 read_cr3(void)
    188 {
    189         __u64 v;
    190         __asm__ volatile ("movq %%cr3,%0" : "=r" (v));
    191         return v;
    192 }
    193 
    194144/** Write to MSR */
    195145static inline void write_msr(__u32 msr, __u64 value)
     
    251201}
    252202
     203#define GEN_READ_REG(reg) static inline __native read_ ##reg (void) \
     204    { \
     205        __native res; \
     206        __asm__ volatile ("movq %%" #reg ", %0" : "=r" (res) ); \
     207        return res; \
     208    }
     209
     210#define GEN_WRITE_REG(reg) static inline void write_ ##reg (__native regn) \
     211    { \
     212        __asm__ volatile ("movq %0, %%" #reg : : "r" (regn)); \
     213    }
     214
     215GEN_READ_REG(cr0);
     216GEN_READ_REG(cr2);
     217GEN_READ_REG(cr3);
     218GEN_WRITE_REG(cr3);
     219
     220GEN_READ_REG(dr0);
     221GEN_READ_REG(dr1);
     222GEN_READ_REG(dr2);
     223GEN_READ_REG(dr3);
     224GEN_READ_REG(dr6);
     225GEN_READ_REG(dr7);
     226
     227GEN_WRITE_REG(dr0);
     228GEN_WRITE_REG(dr1);
     229GEN_WRITE_REG(dr2);
     230GEN_WRITE_REG(dr3);
     231GEN_WRITE_REG(dr6);
     232GEN_WRITE_REG(dr7);
     233
     234
    253235extern size_t interrupt_handler_size;
    254236extern void interrupt_handlers(void);
Note: See TracChangeset for help on using the changeset viewer.