Changeset b9e97fb in mainline for arch/amd64/include/pm.h


Ignore:
Timestamp:
2005-08-31T10:53:34Z (20 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8f91729
Parents:
9756131
Message:

Better types for ia32 drivers, so that they can be reused in amd64.
Build script cleanup amd64.
New code / not working yet / in amd64.

File:
1 edited

Legend:

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

    r9756131 rb9e97fb  
    3737
    3838#define IDT_ITEMS 64
    39 #define GDT_ITEMS 7
     39#define GDT_ITEMS 8
    4040
    4141#define NULL_DES        0
     
    4747#define TSS_DES         6
    4848
    49 #define selector(des)   ((des)<<3)
     49#define gdtselector(des)        ((des)<<3)
     50#define idtselector(des)        ((des)<<4)
    5051
    5152#define PL_KERNEL       0
     
    5758#define AR_WRITABLE     (1<<1)
    5859#define AR_READABLE     (1<<1)
    59 #define AR_INTERRUPT    (0xe)
    6060#define AR_TSS          (0x9)
     61#define AR_INTERRUPT    (0xe)
     62#define AR_TRAP         (0xf)
    6163
    6264#define DPL_KERNEL      (PL_KERNEL<<5)
     
    6668
    6769#ifndef __ASM__
    68 
    69 struct ptr_16_32 {
    70         __u16 limit;
    71         __u32 base;
    72 } __attribute__ ((packed));
    7370
    7471struct descriptor {
     
    8582} __attribute__ ((packed));
    8683
     84struct tss_descriptor {
     85        unsigned limit_0_15: 16;
     86        unsigned base_0_15: 16;
     87        unsigned base_16_23: 8;
     88        unsigned type: 4;
     89        unsigned reserve1 : 1;
     90        unsigned dpl : 2;
     91        unsigned present : 1;
     92        unsigned limit_16_19: 4;
     93        unsigned available: 1;
     94        unsigned reserve2: 2;
     95        unsigned granularity : 1;
     96        unsigned base_24_31: 8;
     97        unsigned base_32_63 : 32;
     98        unsigned reserve3 : 32;
     99} __attribute__ ((packed));
     100
    87101struct idescriptor {
    88102        unsigned offset_0_15: 16;
    89103        unsigned selector: 16;
    90         unsigned unused: 8;
    91         unsigned access: 8;
     104        unsigned ist:3;
     105        unsigned unused: 5;
     106        unsigned type: 5;
     107        unsigned dpl: 2;
     108        unsigned present : 1;
    92109        unsigned offset_16_31: 16;
     110        unsigned offset_32_63: 16;
     111        unsigned reserved : 32;
    93112} __attribute__ ((packed));
    94113
     114struct ptr_16_64 {
     115        __u16 limit;
     116        __u64 base;
     117} __attribute__ ((packed));
    95118
    96119struct tss {
    97         __u16 link;
    98         unsigned : 16;
    99         __u32 esp0;
    100         __u16 ss0;
    101         unsigned : 16;
    102         __u32 esp1;
    103         __u16 ss1;
    104         unsigned : 16;
    105         __u32 esp2;
    106         __u16 ss2;
    107         unsigned : 16;
    108         __u32 cr3;
    109         __u32 eip;
    110         __u32 eflags;
    111         __u32 eax;
    112         __u32 ecx;
    113         __u32 edx;
    114         __u32 ebx;
    115         __u32 esp;
    116         __u32 ebp;
    117         __u32 esi;
    118         __u32 edi;
    119         __u16 es;
    120         unsigned : 16;
    121         __u16 cs;
    122         unsigned : 16;
    123         __u16 ss;
    124         unsigned : 16;
    125         __u16 ds;
    126         unsigned : 16;
    127         __u16 fs;
    128         unsigned : 16;
    129         __u16 gs;
    130         unsigned : 16;
    131         __u16 ldtr;
    132         unsigned : 16;
    133         unsigned : 16;
    134         __u16 io_map_base;
     120        __u32 reserve1;
     121        __u64 rsp0;
     122        __u64 rsp1;
     123        __u64 rsp2;
     124        __u64 reserve2;
     125        __u64 ist1;
     126        __u64 ist2;
     127        __u64 ist3;
     128        __u64 ist4;
     129        __u64 ist5;
     130        __u64 ist6;
     131        __u64 ist7;
     132        __u64 reserve3;
     133        __u16 reserve4;
     134        __u16 iomap;
    135135} __attribute__ ((packed));
    136136
    137 extern struct ptr_16_32 gdtr;
    138137extern struct tss *tss_p;
    139138
     
    141140extern struct idescriptor idt[];
    142141
     142extern struct ptr_16_64 gdtr;
     143
    143144extern void pm_init(void);
    144145
    145 extern void gdt_setbase(struct descriptor *d, __address base);
    146 extern void gdt_setlimit(struct descriptor *d, __u32 limit);
     146extern void gdt_tss_setbase(struct descriptor *d, __address base);
     147extern void gdt_tss_setlimit(struct descriptor *d, __u32 limit);
    147148
    148149extern void idt_init(void);
Note: See TracChangeset for help on using the changeset viewer.