Changeset b3f8fb7 in mainline for kernel/arch/ia32


Ignore:
Timestamp:
2007-01-28T13:25:49Z (18 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8e8c1a5
Parents:
1ba41c5
Message:

huge type system cleanup
remove cyclical type dependencies across multiple header files
many minor coding style fixes

Location:
kernel/arch/ia32
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/ia32/_link.ld.in

    r1ba41c5 rb3f8fb7  
    99 */
    1010
    11 #define __ASM__
    1211#include <arch/boot/boot.h>
    1312#include <arch/mm/page.h>
  • kernel/arch/ia32/include/atomic.h

    r1ba41c5 rb3f8fb7  
    3939#include <arch/barrier.h>
    4040#include <preemption.h>
    41 #include <typedefs.h>
    4241
    4342static inline void atomic_inc(atomic_t *val) {
  • kernel/arch/ia32/include/boot/memmap.h

    r1ba41c5 rb3f8fb7  
    5858#include <arch/types.h>
    5959
    60 struct e820memmap_ {
     60typedef struct {
    6161        uint64_t base_address;
    6262        uint64_t size;
    6363        uint32_t type;
    64 } __attribute__ ((packed));
     64} __attribute__ ((packed)) e820memmap_t;
    6565
    66 extern struct e820memmap_ e820table[MEMMAP_E820_MAX_RECORDS];
    67 
     66extern e820memmap_t e820table[MEMMAP_E820_MAX_RECORDS];
    6867extern uint8_t e820counter;
    69 
    70 extern uint32_t e801memorysize; /**< Size of available memory in KB. */
     68extern uint32_t e801memorysize;         /**< Size of available memory in KB. */
    7169
    7270#endif
  • kernel/arch/ia32/include/cpu.h

    r1ba41c5 rb3f8fb7  
    3636#define KERN_ia32_CPU_H_
    3737
    38 #include <typedefs.h>
    3938#include <arch/pm.h>
    4039#include <arch/asm.h>
  • kernel/arch/ia32/include/interrupt.h

    r1ba41c5 rb3f8fb7  
    6969#define VECTOR_DEBUG_IPI                        (IVT_FREEBASE + 2)
    7070
    71 struct istate {
     71typedef struct {
    7272        uint32_t eax;
    7373        uint32_t ecx;
     
    8888        uint32_t eflags;
    8989        uint32_t stack[];
    90 };
     90} istate_t;
    9191
    9292/** Return true if exception happened while in userspace */
  • kernel/arch/ia32/include/mm/as.h

    r1ba41c5 rb3f8fb7  
    4848} as_arch_t;
    4949
     50#include <genarch/mm/as_pt.h>
     51
    5052#define as_constructor_arch(as, flags)          (as != as)
    5153#define as_destructor_arch(as)                  (as != as)
  • kernel/arch/ia32/include/mm/asid.h

    r1ba41c5 rb3f8fb7  
    4343#define KERN_ia32_ASID_H_
    4444
    45 typedef int asid_t;
     45#include <arch/types.h>
     46
     47typedef int32_t asid_t;
    4648
    4749#define ASID_MAX_ARCH           3
    4850
    49 #define asid_get()              (ASID_START+1)
     51#define asid_get()              (ASID_START + 1)
    5052#define asid_put(asid)
    5153
  • kernel/arch/ia32/include/mm/memory_init.h

    r1ba41c5 rb3f8fb7  
    3737#define KERN_ia32_MEMORY_INIT_H_
    3838
    39 #include <typedefs.h>
    40 
    4139size_t get_memory_size(void);
    4240
  • kernel/arch/ia32/include/mm/page.h

    r1ba41c5 rb3f8fb7  
    6262#define PTL3_ENTRIES_ARCH       1024
    6363
    64 #define PTL0_INDEX_ARCH(vaddr)  (((vaddr)>>22)&0x3ff)
     64#define PTL0_INDEX_ARCH(vaddr)  (((vaddr) >> 22) & 0x3ff)
    6565#define PTL1_INDEX_ARCH(vaddr)  0
    6666#define PTL2_INDEX_ARCH(vaddr)  0
    67 #define PTL3_INDEX_ARCH(vaddr)  (((vaddr)>>12)&0x3ff)
     67#define PTL3_INDEX_ARCH(vaddr)  (((vaddr) >> 12) & 0x3ff)
    6868
    69 #define GET_PTL1_ADDRESS_ARCH(ptl0, i)          ((pte_t *)((((pte_t *)(ptl0))[(i)].frame_address)<<12))
     69#define GET_PTL1_ADDRESS_ARCH(ptl0, i)          ((pte_t *)((((pte_t *)(ptl0))[(i)].frame_address) << 12))
    7070#define GET_PTL2_ADDRESS_ARCH(ptl1, i)          (ptl1)
    7171#define GET_PTL3_ADDRESS_ARCH(ptl2, i)          (ptl2)
    72 #define GET_FRAME_ADDRESS_ARCH(ptl3, i)         ((uintptr_t)((((pte_t *)(ptl3))[(i)].frame_address)<<12))
     72#define GET_FRAME_ADDRESS_ARCH(ptl3, i)         ((uintptr_t)((((pte_t *)(ptl3))[(i)].frame_address) << 12))
    7373
    7474#define SET_PTL0_ADDRESS_ARCH(ptl0)             (write_cr3((uintptr_t) (ptl0)))
     
    9090#define PTE_VALID_ARCH(p)                       (*((uint32_t *) (p)) != 0)
    9191#define PTE_PRESENT_ARCH(p)                     ((p)->present != 0)
    92 #define PTE_GET_FRAME_ARCH(p)                   ((p)->frame_address<<FRAME_WIDTH)
     92#define PTE_GET_FRAME_ARCH(p)                   ((p)->frame_address << FRAME_WIDTH)
    9393#define PTE_WRITABLE_ARCH(p)                    ((p)->writeable != 0)
    9494#define PTE_EXECUTABLE_ARCH(p)                  1
     
    9696#ifndef __ASM__
    9797
    98 #include <mm/page.h>
    99 #include <arch/types.h>
    100 #include <arch/mm/frame.h>
    101 #include <typedefs.h>
     98#include <mm/mm.h>
     99#include <arch/interrupt.h>
    102100
    103101/* Page fault error codes. */
    104102
    105103/** When bit on this position is 0, the page fault was caused by a not-present page. */
    106 #define PFERR_CODE_P            (1<<0)
     104#define PFERR_CODE_P            (1 << 0)
    107105
    108106/** When bit on this position is 1, the page fault was caused by a write. */
    109 #define PFERR_CODE_RW           (1<<1)
     107#define PFERR_CODE_RW           (1 << 1)
    110108
    111109/** When bit on this position is 1, the page fault was caused in user mode. */
    112 #define PFERR_CODE_US           (1<<2)
     110#define PFERR_CODE_US           (1 << 2)
    113111
    114112/** When bit on this position is 1, a reserved bit was set in page directory. */
    115 #define PFERR_CODE_RSVD         (1<<3) 
    116 
    117 /** Page Table Entry. */
    118 struct page_specifier {
    119         unsigned present : 1;
    120         unsigned writeable : 1;
    121         unsigned uaccessible : 1;
    122         unsigned page_write_through : 1;
    123         unsigned page_cache_disable : 1;
    124         unsigned accessed : 1;
    125         unsigned dirty : 1;
    126         unsigned pat : 1;
    127         unsigned global : 1;
    128         unsigned soft_valid : 1;        /**< Valid content even if the present bit is not set. */
    129         unsigned avl : 2;
    130         unsigned frame_address : 20;
    131 } __attribute__ ((packed));
     113#define PFERR_CODE_RSVD         (1 << 3)       
    132114
    133115static inline int get_pt_flags(pte_t *pt, index_t i)
     
    136118       
    137119        return (
    138                 (!p->page_cache_disable)<<PAGE_CACHEABLE_SHIFT |
    139                 (!p->present)<<PAGE_PRESENT_SHIFT |
    140                 p->uaccessible<<PAGE_USER_SHIFT |
     120                (!p->page_cache_disable) << PAGE_CACHEABLE_SHIFT |
     121                (!p->present) << PAGE_PRESENT_SHIFT |
     122                p->uaccessible << PAGE_USER_SHIFT |
    141123                1<<PAGE_READ_SHIFT |
    142                 p->writeable<<PAGE_WRITE_SHIFT |
     124                p->writeable << PAGE_WRITE_SHIFT |
    143125                1<<PAGE_EXEC_SHIFT |
    144                 p->global<<PAGE_GLOBAL_SHIFT
     126                p->global << PAGE_GLOBAL_SHIFT
    145127        );
    146128}
  • kernel/arch/ia32/include/pm.h

    r1ba41c5 rb3f8fb7  
    8282
    8383#include <arch/types.h>
    84 #include <typedefs.h>
    8584#include <arch/context.h>
    8685
  • kernel/arch/ia32/include/proc/task.h

    r1ba41c5 rb3f8fb7  
    3636#define KERN_ia32_TASK_H_
    3737
    38 #include <typedefs.h>
    3938#include <arch/types.h>
    4039#include <adt/bitmap.h>
  • kernel/arch/ia32/include/smp/apic.h

    r1ba41c5 rb3f8fb7  
    108108#define ICRlo           (0x300/sizeof(uint32_t))
    109109#define ICRhi           (0x310/sizeof(uint32_t))
    110 struct icr {
     110typedef struct {
    111111        union {
    112112                uint32_t lo;
     
    131131                } __attribute__ ((packed));
    132132        };
    133 } __attribute__ ((packed));
    134 typedef struct icr icr_t;
     133} __attribute__ ((packed)) icr_t;
    135134
    136135/* End Of Interrupt. */
     
    139138/** Error Status Register. */
    140139#define ESR             (0x280/sizeof(uint32_t))
    141 union esr {
     140typedef union {
    142141        uint32_t value;
    143142        uint8_t err_bitmap;
     
    153152                unsigned : 24;
    154153        } __attribute__ ((packed));
    155 };
    156 typedef union esr esr_t;
     154} esr_t;
    157155
    158156/* Task Priority Register */
    159157#define TPR             (0x080/sizeof(uint32_t))
    160 union tpr {
     158typedef union {
    161159        uint32_t value;
    162160        struct {
     
    164162                unsigned pri : 4;               /**< Task Priority. */
    165163        } __attribute__ ((packed));
    166 };
    167 typedef union tpr tpr_t;
     164} tpr_t;
    168165
    169166/** Spurious-Interrupt Vector Register. */
    170167#define SVR             (0x0f0/sizeof(uint32_t))
    171 union svr {
     168typedef union {
    172169        uint32_t value;
    173170        struct {
     
    177174                unsigned : 22;                  /**< Reserved. */
    178175        } __attribute__ ((packed));
    179 };
    180 typedef union svr svr_t;
     176} svr_t;
    181177
    182178/** Time Divide Configuration Register. */
    183179#define TDCR            (0x3e0/sizeof(uint32_t))
    184 union tdcr {
     180typedef union {
    185181        uint32_t value;
    186182        struct {
     
    188184                unsigned : 28;                  /**< Reserved. */
    189185        } __attribute__ ((packed));
    190 };
    191 typedef union tdcr tdcr_t;
     186} tdcr_t;
    192187
    193188/* Initial Count Register for Timer */
     
    199194/** LVT Timer register. */
    200195#define LVT_Tm          (0x320/sizeof(uint32_t))
    201 union lvt_tm {
     196typedef union {
    202197        uint32_t value;
    203198        struct {
     
    210205                unsigned : 14;          /**< Reserved. */
    211206        } __attribute__ ((packed));
    212 };
    213 typedef union lvt_tm lvt_tm_t;
     207} lvt_tm_t;
    214208
    215209/** LVT LINT registers. */
    216210#define LVT_LINT0       (0x350/sizeof(uint32_t))
    217211#define LVT_LINT1       (0x360/sizeof(uint32_t))
    218 union lvt_lint {
     212typedef union {
    219213        uint32_t value;
    220214        struct {
     
    229223                unsigned : 15;                  /**< Reserved. */
    230224        } __attribute__ ((packed));
    231 };
    232 typedef union lvt_lint lvt_lint_t;
     225} lvt_lint_t;
    233226
    234227/** LVT Error register. */
    235228#define LVT_Err         (0x370/sizeof(uint32_t))
    236 union lvt_error {
     229typedef union {
    237230        uint32_t value;
    238231        struct {
     
    244237                unsigned : 15;          /**< Reserved. */
    245238        } __attribute__ ((packed));
    246 };
    247 typedef union lvt_error lvt_error_t;
     239} lvt_error_t;
    248240
    249241/** Local APIC ID Register. */
    250242#define L_APIC_ID       (0x020/sizeof(uint32_t))
    251 union l_apic_id {
     243typedef union {
    252244        uint32_t value;
    253245        struct {
     
    255247                uint8_t apic_id;                /**< Local APIC ID. */
    256248        } __attribute__ ((packed));
    257 };
    258 typedef union l_apic_id l_apic_id_t;
     249} l_apic_id_t;
    259250
    260251/** Local APIC Version Register */
     
    267258/** Logical Destination Register. */
    268259#define  LDR            (0x0d0/sizeof(uint32_t))
    269 union ldr {
     260typedef union {
    270261        uint32_t value;
    271262        struct {
     
    273264                uint8_t id;             /**< Logical APIC ID. */
    274265        } __attribute__ ((packed));
    275 };
    276 typedef union ldr ldr_t;
     266} ldr_t;
    277267
    278268/** Destination Format Register. */
    279269#define DFR             (0x0e0/sizeof(uint32_t))
    280 union dfr {
     270typedef union {
    281271        uint32_t value;
    282272        struct {
     
    284274                unsigned model : 4;     /**< Model. */
    285275        } __attribute__ ((packed));
    286 };
    287 typedef union dfr dfr_t;
     276} dfr_t;
    288277
    289278/* IO APIC */
     
    297286
    298287/** I/O Register Select Register. */
    299 union io_regsel {
     288typedef union {
    300289        uint32_t value;
    301290        struct {
     
    303292                unsigned : 24;          /**< Reserved. */
    304293        } __attribute__ ((packed));
    305 };
    306 typedef union io_regsel io_regsel_t;
     294} io_regsel_t;
    307295
    308296/** I/O Redirection Register. */
    309 struct io_redirection_reg {
     297typedef struct io_redirection_reg {
    310298        union {
    311299                uint32_t lo;
     
    330318        };
    331319       
    332 } __attribute__ ((packed));
    333 typedef struct io_redirection_reg io_redirection_reg_t;
     320} __attribute__ ((packed)) io_redirection_reg_t;
    334321
    335322
    336323/** IO APIC Identification Register. */
    337 union io_apic_id {
     324typedef union {
    338325        uint32_t value;
    339326        struct {
     
    342329                unsigned : 4;           /**< Reserved. */
    343330        } __attribute__ ((packed));
    344 };
    345 typedef union io_apic_id io_apic_id_t;
     331} io_apic_id_t;
    346332
    347333extern volatile uint32_t *l_apic;
  • kernel/arch/ia32/include/smp/mps.h

    r1ba41c5 rb3f8fb7  
    3737
    3838#include <arch/types.h>
    39 #include <typedefs.h>
    4039#include <synch/waitq.h>
    4140#include <config.h>
  • kernel/arch/ia32/include/smp/smp.h

    r1ba41c5 rb3f8fb7  
    3737
    3838#include <arch/types.h>
    39 #include <typedefs.h>
    4039
    4140/** SMP config opertaions interface. */
  • kernel/arch/ia32/include/types.h

    r1ba41c5 rb3f8fb7  
    3737
    3838#define NULL 0
     39#define false 0
     40#define true 1
    3941
    4042typedef signed char int8_t;
     
    4850typedef unsigned long long uint64_t;
    4951
     52typedef uint32_t size_t;
     53typedef uint32_t count_t;
     54typedef uint32_t index_t;
     55
    5056typedef uint32_t uintptr_t;
    5157typedef uint32_t pfn_t;
     
    5662typedef int32_t native_t;
    5763
    58 typedef struct page_specifier pte_t;
     64typedef uint8_t bool;
     65typedef uint64_t task_id_t;
     66typedef uint32_t context_id_t;
     67
     68typedef int32_t inr_t;
     69typedef int32_t devno_t;
     70
     71/** Page Table Entry. */
     72typedef struct {
     73        unsigned present : 1;
     74        unsigned writeable : 1;
     75        unsigned uaccessible : 1;
     76        unsigned page_write_through : 1;
     77        unsigned page_cache_disable : 1;
     78        unsigned accessed : 1;
     79        unsigned dirty : 1;
     80        unsigned pat : 1;
     81        unsigned global : 1;
     82        unsigned soft_valid : 1;        /**< Valid content even if the present bit is not set. */
     83        unsigned avl : 2;
     84        unsigned frame_address : 20;
     85} __attribute__ ((packed)) pte_t;
    5986
    6087#endif
  • kernel/arch/ia32/src/boot/boot.S

    r1ba41c5 rb3f8fb7  
    7575
    7676        mov $VESA_INIT_SEGMENT << 4, %edi
    77         jmpl %edi
     77        jmpl *%edi
    7878       
    7979        vesa_meeting_point:
  • kernel/arch/ia32/src/cpu/cpu.c

    r1ba41c5 rb3f8fb7  
    4040#include <arch/types.h>
    4141#include <print.h>
    42 #include <typedefs.h>
    4342#include <fpu_context.h>
    4443
  • kernel/arch/ia32/src/ddi/ddi.c

    r1ba41c5 rb3f8fb7  
    3737#include <proc/task.h>
    3838#include <arch/types.h>
    39 #include <typedefs.h>
    4039#include <adt/bitmap.h>
    4140#include <mm/slab.h>
  • kernel/arch/ia32/src/drivers/vesa.c

    r1ba41c5 rb3f8fb7  
    4848#include <arch/asm.h>
    4949#include <arch/types.h>
    50 #include <typedefs.h>
    5150#include <memstr.h>
    5251#include <bitops.h>
  • kernel/arch/ia32/src/ia32.c

    r1ba41c5 rb3f8fb7  
    3636
    3737#include <arch/types.h>
    38 #include <typedefs.h>
    3938
    4039#include <arch/pm.h>
  • kernel/arch/ia32/src/mm/as.c

    r1ba41c5 rb3f8fb7  
    3535
    3636#include <arch/mm/as.h>
    37 #include <genarch/mm/as_pt.h>
     37#include <genarch/mm/page_pt.h>
    3838
    3939/** Architecture dependent address space init. */
  • kernel/arch/ia32/src/mm/memory_init.c

    r1ba41c5 rb3f8fb7  
    3939
    4040uint8_t e820counter = 0xff;
    41 struct e820memmap_ e820table[MEMMAP_E820_MAX_RECORDS];
     41e820memmap_t e820table[MEMMAP_E820_MAX_RECORDS];
    4242uint32_t e801memorysize;
    4343
  • kernel/arch/ia32/src/pm.c

    r1ba41c5 rb3f8fb7  
    3636#include <config.h>
    3737#include <arch/types.h>
    38 #include <typedefs.h>
    3938#include <arch/interrupt.h>
    4039#include <arch/asm.h>
  • kernel/arch/ia32/src/smp/mps.c

    r1ba41c5 rb3f8fb7  
    4343#include <func.h>
    4444#include <arch/types.h>
    45 #include <typedefs.h>
    4645#include <cpu.h>
    4746#include <arch/asm.h>
Note: See TracChangeset for help on using the changeset viewer.