Changeset 6da1013f in mainline


Ignore:
Timestamp:
2009-02-12T20:09:19Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
84266669
Parents:
7004747
Message:

simplify configuration
introduce arch_construct_function and inb/outb (sometimes empty) on all platforms
various code cleanup

Location:
kernel/arch
Files:
1 deleted
27 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/amd64/src/amd64.c

    r7004747 r6da1013f  
    227227}
    228228
     229/** Construct function pointer
     230 *
     231 * @param fptr   function pointer structure
     232 * @param addr   function address
     233 * @param caller calling function address
     234 *
     235 * @return address of the function pointer
     236 *
     237 */
     238void *arch_construct_function(fncptr_t *fptr, void *addr, void *caller)
     239{
     240        return addr;
     241}
     242
    229243/** @}
    230244 */
  • kernel/arch/amd64/src/debugger.c

    r7004747 r6da1013f  
    205205        /* Send IPI */
    206206#ifdef CONFIG_SMP
    207 //      ipi_broadcast(VECTOR_DEBUG_IPI);       
     207//      ipi_broadcast(VECTOR_DEBUG_IPI);
    208208#endif 
    209209
     
    211211}
    212212
    213 #ifdef amd64
    214 #       define getip(x) ((x)->rip)
     213#ifdef __64_BITS__
     214        #define getip(x)  ((x)->rip)
    215215#else
    216 #       define getip(x) ((x)->eip)
     216        #define getip(x)  ((x)->eip)
    217217#endif
    218218
     
    277277       
    278278        /* Set RF to restart the instruction  */
    279 #ifdef amd64       
     279#ifdef __64_BITS__
    280280        istate->rflags |= RFLAGS_RF;
    281281#else
     
    349349        char *symbol;
    350350
    351 #ifdef __32_BITS__     
     351#ifdef __32_BITS__
    352352        printf("#  Count Address    In symbol\n");
    353353        printf("-- ----- ---------- ---------\n");
  • kernel/arch/amd64/src/interrupt.c

    r7004747 r6da1013f  
    143143static void nm_fault(int n, istate_t *istate)
    144144{
    145 #ifdef CONFIG_FPU_LAZY     
     145#ifdef CONFIG_FPU_LAZY
    146146        scheduler_fpu_lazy_request();
    147147#else
  • kernel/arch/arm32/include/asm.h

    r7004747 r6da1013f  
    4747}
    4848
     49/** No I/O port address space on ARM. */
     50static inline void outb(ioport_t port, uint8_t v)
     51{
     52}
     53
     54/** No I/O port address space on ARM. */
     55static inline uint8_t inb(ioport_t port)
     56{
     57        return 0;
     58}
     59
    4960/** Return base address of current stack.
    5061 *
  • kernel/arch/arm32/src/arm32.c

    r7004747 r6da1013f  
    9393                .y = 480,
    9494                .scan = 1920,
    95                 .visual = VISUAL_RGB_8_8_8,
     95                .visual = VISUAL_BGR_8_8_8,
    9696        };
    9797        fb_init(&prop);
     
    165165{
    166166        /* not implemented */
    167         for (;;)
    168                 ;
     167        while (1);
     168}
     169
     170/** Construct function pointer
     171 *
     172 * @param fptr   function pointer structure
     173 * @param addr   function address
     174 * @param caller calling function address
     175 *
     176 * @return address of the function pointer
     177 *
     178 */
     179void *arch_construct_function(fncptr_t *fptr, void *addr, void *caller)
     180{
     181        return addr;
    169182}
    170183
  • kernel/arch/ia32/_link.ld.in

    r7004747 r6da1013f  
    11/** IA-32 linker script
    2  * 
     2 *
    33 * umapped section:
    4  *      kernel text
    5  *      kernel data
     4 *  kernel text
     5 *  kernel data
    66 * mapped section:
    7  *      kernel text
    8  *      kernel data
     7 *  kernel text
     8 *  kernel data
    99 */
    1010
     
    2929               
    3030                kdata_start = .;
    31                 *(.data);                       /* initialized data */
    32                 *(.rodata*);                    /* string literals */
    33                 *(COMMON);                      /* global variables */
     31                *(.data);               /* initialized data */
     32                *(.rodata*);            /* string literals */
     33                *(COMMON);              /* global variables */
    3434                hardcoded_load_address = .;
    3535                LONG(PA2KA(BOOT_OFFSET));
     
    4343                LONG(unmapped_kdata_end - unmapped_kdata_start);
    4444                symbol_table = .;
    45                 *(symtab.*);                    /* Symbol table, must be LAST symbol! */
    46                 *(.bss);                        /* uninitialized static variables */
     45                *(symtab.*);            /* Symbol table, must be LAST symbol! */
     46                *(.bss);                /* uninitialized static variables */
    4747                kdata_end = .;
    4848        }
    49 
     49       
    5050        /DISCARD/ : {
    51                 *(.note.GNU-stack);             
     51                *(.note.GNU-stack);
    5252                *(.comment);
    5353        }
    5454       
    55 #ifdef CONFIG_SMP       
     55#ifdef CONFIG_SMP
    5656       
    5757        _hardcoded_unmapped_size = (unmapped_ktext_end - unmapped_ktext_start) + (unmapped_kdata_end - unmapped_kdata_start);
     
    5959        ap_gdtr = unmapped_ap_gdtr - BOOT_OFFSET + AP_BOOT_OFFSET;
    6060        protected_ap_gdtr = PA2KA(ap_gdtr);
    61 
     61       
    6262#endif /* CONFIG_SMP */
    63 
     63       
    6464}
  • kernel/arch/ia32/include/fpu_context.h

    r7004747 r6da1013f  
    3838#include <arch/types.h>
    3939
    40 #define ARCH_HAS_FPU
    4140#define FPU_CONTEXT_ALIGN 16
    4241
  • kernel/arch/ia32/src/ia32.c

    r7004747 r6da1013f  
    178178}
    179179
     180/** Construct function pointer
     181 *
     182 * @param fptr   function pointer structure
     183 * @param addr   function address
     184 * @param caller calling function address
     185 *
     186 * @return address of the function pointer
     187 *
     188 */
     189void *arch_construct_function(fncptr_t *fptr, void *addr, void *caller)
     190{
     191        return addr;
     192}
     193
    180194/** @}
    181195 */
  • kernel/arch/ia64/include/asm.h

    r7004747 r6da1013f  
    4242#define IA64_IOSPACE_ADDRESS 0xE001000000000000ULL
    4343
    44 static inline void  outb(ioport_t port, uint8_t v)
     44static inline void outb(ioport_t port, uint8_t v)
    4545{
    4646        *((uint8_t *)(IA64_IOSPACE_ADDRESS +
     
    5050}
    5151
    52 static inline void  outw(ioport_t port, uint16_t v)
     52static inline void outw(ioport_t port, uint16_t v)
    5353{
    5454        *((uint16_t *)(IA64_IOSPACE_ADDRESS +
     
    5858}
    5959
    60 static inline void  outl(ioport_t port, uint32_t v)
     60static inline void outl(ioport_t port, uint32_t v)
    6161{
    6262        *((uint32_t *)(IA64_IOSPACE_ADDRESS +
  • kernel/arch/ia64/include/drivers/kbd.h

    r7004747 r6da1013f  
    3636#define KERN_ia64_KBD_H_
    3737
    38 
    39 #define KBD_UNKNOWN 0
    40 #define KBD_SKI 1
    41 #define KBD_LEGACY 2
    42 #define KBD_NS16550 3
    43 
     38#define KBD_UNKNOWN  0
     39#define KBD_SKI      1
     40#define KBD_LEGACY   2
     41#define KBD_NS16550  3
    4442
    4543#endif
  • kernel/arch/ia64/include/fpu_context.h

    r7004747 r6da1013f  
    3636#define KERN_ia64_FPU_CONTEXT_H_
    3737
    38 #define ARCH_HAS_FPU 1
    3938#define FPU_CONTEXT_ALIGN 16
    4039
  • kernel/arch/ia64/include/interrupt.h

    r7004747 r6da1013f  
    154154extern void disabled_fp_register(uint64_t vector, istate_t *istate);
    155155
     156extern void trap_virtual_enable_irqs(uint16_t irqmask);
     157
    156158#endif
    157159
  • kernel/arch/ia64/src/ia64.c

    r7004747 r6da1013f  
    133133#ifdef SKI
    134134                ski_init_console();
    135 #else   
     135#else
    136136                ega_init(EGA_BASE, EGA_VIDEORAM);
    137 #endif 
     137#endif
    138138        }
    139139        it_init();
     
    266266#ifdef SKI
    267267        ski_kbd_release();
    268 #else   
     268#else
    269269#ifdef CONFIG_NS16550
    270270        ns16550_release();
    271 #else   
     271#else
    272272        i8042_release();
    273 #endif 
     273#endif
    274274#endif
    275275}
     
    282282}
    283283
     284/** Construct function pointer
     285 *
     286 * @param fptr   function pointer structure
     287 * @param addr   function address
     288 * @param caller calling function address
     289 *
     290 * @return address of the function pointer
     291 *
     292 */
     293void *arch_construct_function(fncptr_t *fptr, void *addr, void *caller)
     294{
     295        fptr->fnc = (unative_t) addr;
     296        fptr->gp = ((unative_t *) caller)[1];
     297       
     298        return (void *) fptr;
     299}
     300
    284301/** @}
    285302 */
  • kernel/arch/ia64/src/interrupt.c

    r7004747 r6da1013f  
    195195void disabled_fp_register(uint64_t vector, istate_t *istate)
    196196{
    197 #ifdef CONFIG_FPU_LAZY 
    198         scheduler_fpu_lazy_request();   
     197#ifdef CONFIG_FPU_LAZY
     198        scheduler_fpu_lazy_request();
    199199#else
    200200        fault_if_from_uspace(istate, "Interruption: %#hx (%s).",
     
    302302}
    303303
     304void trap_virtual_enable_irqs(uint16_t irqmask)
     305{
     306}
     307
    304308/** @}
    305309 */
  • kernel/arch/ia64/src/ski/ski.c

    r7004747 r6da1013f  
    4747#include <arch/drivers/kbd.h>
    4848
    49 #define SKI_KBD_INR     0
     49#define SKI_KBD_INR  0
    5050
    5151static irq_t ski_kbd_irq;
     
    115115{
    116116        int ch;
    117 
    118         while(!(ch = ski_getchar()))
    119                 ;
     117       
     118        while(!(ch = ski_getchar()));
     119       
    120120        if (ch == '\r')
    121121                ch = '\n';
     
    129129        static char last;
    130130        ipl_t ipl;
    131 
     131       
    132132        ipl = interrupts_disable();
    133 
     133       
    134134        if (kbd_disabled) {
    135135                interrupts_restore(ipl);
    136136                return;
    137137        }
    138                
     138       
    139139        spinlock_lock(&ski_kbd_irq.lock);
    140 
     140       
    141141        ch = ski_getchar();
    142142        if(ch == '\r')
     
    178178static void ski_kbd_disable(chardev_t *d)
    179179{
    180         kbd_disabled = true;   
     180        kbd_disabled = true;
    181181}
    182182
  • kernel/arch/mips32/include/asm.h

    r7004747 r6da1013f  
    7171extern ipl_t interrupts_read(void);
    7272
     73/** No I/O port address space on MIPS. */
     74static inline void outb(ioport_t port, uint8_t v)
     75{
     76}
     77
     78/** No I/O port address space on MIPS. */
     79static inline uint8_t inb(ioport_t port)
     80{
     81        return 0;
     82}
     83
    7384#endif
    7485
  • kernel/arch/mips32/include/context_offset.h

    r7004747 r6da1013f  
    115115        sw $gp,OFFSET_GP(\ctx)
    116116
    117 #ifndef KERNEL         
     117#ifndef KERNEL
    118118        sw $k1,OFFSET_TLS(\ctx)
    119119
    120 # ifdef CONFIG_MIPS_FPU
     120#ifdef CONFIG_FPU
    121121        mfc1 $t0,$20
    122122        sw $t0, OFFSET_F20(\ctx)
     
    151151        mfc1 $t0,$30
    152152        sw $t0, OFFSET_F30(\ctx)
    153 # endif /* CONFIG_MIPS_FPU */   
     153#endif /* CONFIG_FPU */
    154154#endif /* KERNEL */
    155155
     
    173173        lw $k1,OFFSET_TLS(\ctx)
    174174
    175 # ifdef CONFIG_MIPS_FPU
     175#ifdef CONFIG_FPU
    176176        lw $t0, OFFSET_F20(\ctx)
    177177        mtc1 $t0,$20
     
    206206        lw $t0, OFFSET_F30(\ctx)
    207207        mtc1 $t0,$30
    208 # endif /* CONFIG_MIPS_FPU */
    209        
     208#endif /* CONFIG_FPU */
    210209#endif /* KERNEL */
     210
    211211        lw $ra,OFFSET_PC(\ctx)
    212212        lw $sp,OFFSET_SP(\ctx)
  • kernel/arch/mips32/src/asm.S

    r7004747 r6da1013f  
    160160.global fpu_context_save
    161161fpu_context_save:
    162 #ifdef ARCH_HAS_FPU
     162#ifdef CONFIG_FPU
    163163        fpu_gp_save 0,$a0
    164164        fpu_gp_save 1,$a0
     
    231231.global fpu_context_restore
    232232fpu_context_restore:
    233 #ifdef ARCH_HAS_FPU
     233#ifdef CONFIG_FPU
    234234        fpu_gp_restore 0,$a0
    235235        fpu_gp_restore 1,$a0
  • kernel/arch/mips32/src/drivers/msim.c

    r7004747 r6da1013f  
    7777}
    7878
    79 #include <print.h>
    8079/** Read character using polling, assume interrupts disabled */
    8180static char msim_do_read(chardev_t *dev)
  • kernel/arch/mips32/src/fpu_context.c

    r7004747 r6da1013f  
    4141void fpu_disable(void)
    4242{       
    43 #ifdef ARCH_HAS_FPU
     43#ifdef CONFIG_FPU
    4444        cp0_status_write(cp0_status_read() & ~cp0_status_fpu_bit);
    4545#endif
     
    4848void fpu_enable(void)
    4949{
    50 #ifdef ARCH_HAS_FPU
     50#ifdef CONFIG_FPU
    5151        cp0_status_write(cp0_status_read() | cp0_status_fpu_bit);
    5252#endif
  • kernel/arch/mips32/src/mips32.c

    r7004747 r6da1013f  
    112112        cp0_status_write(cp0_status_read() &
    113113            ~(cp0_status_bev_bootstrap_bit | cp0_status_erl_error_bit));
    114 
    115         /* 
    116          * Mask all interrupts 
     114       
     115        /*
     116         * Mask all interrupts
    117117         */
    118118        cp0_mask_all_int();
    119                
     119       
    120120        debugger_init();
    121121}
     
    133133                .y = 480,
    134134                .scan = 1920,
    135                 .visual = VISUAL_RGB_8_8_8,
     135                .visual = VISUAL_BGR_8_8_8,
    136136        };
    137137        fb_init(&gxemul_prop);
    138138#endif
    139         sysinfo_set_item_val("machine." STRING(MACHINE), NULL, 1);
     139
     140#ifdef msim
     141        sysinfo_set_item_val("machine.msim", NULL, 1);
     142#endif
     143
     144#ifdef simics
     145        sysinfo_set_item_val("machine.simics", NULL, 1);
     146#endif
     147
     148#ifdef bgxemul
     149        sysinfo_set_item_val("machine.bgxemul", NULL, 1);
     150#endif
     151
     152#ifdef lgxemul
     153        sysinfo_set_item_val("machine.lgxemul", NULL, 1);
     154#endif
    140155}
    141156
     
    162177            (uintptr_t) kernel_uarg->uspace_entry);
    163178       
    164         while (1)
    165                 ;
     179        while (1);
    166180}
    167181
     
    196210        ___halt();
    197211       
    198         while (1)
    199                 ;
     212        while (1);
     213}
     214
     215/** Construct function pointer
     216 *
     217 * @param fptr   function pointer structure
     218 * @param addr   function address
     219 * @param caller calling function address
     220 *
     221 * @return address of the function pointer
     222 *
     223 */
     224void *arch_construct_function(fncptr_t *fptr, void *addr, void *caller)
     225{
     226        return addr;
    200227}
    201228
  • kernel/arch/mips32/src/mm/frame.c

    r7004747 r6da1013f  
    7676static bool frame_available(pfn_t frame)
    7777{
    78 #if MACHINE == msim
     78#ifdef msim
    7979        /* MSIM device (dprinter) */
    8080        if (frame == (KA2PA(MSIM_VIDEORAM) >> ZERO_PAGE_WIDTH))
     
    8686#endif
    8787
    88 #if MACHINE == simics
     88#ifdef simics
    8989        /* Simics device (serial line) */
    9090        if (frame == (KA2PA(SERIAL_ADDRESS) >> ZERO_PAGE_WIDTH))
     
    9292#endif
    9393
    94 #if (MACHINE == lgxemul) || (MACHINE == bgxemul)
     94#if defined(lgxemul) || defined(bgxemul)
    9595        /* gxemul devices */
    9696        if (overlaps(frame << ZERO_PAGE_WIDTH, ZERO_PAGE_SIZE,
     
    219219                                        if (ZERO_PAGE_VALUE != 0xdeadbeef)
    220220                                                avail = false;
    221 #if (MACHINE == lgxemul) || (MACHINE == bgxemul)
     221#if defined(lgxemul) || defined(bgxemul)
    222222                                        else {
    223223                                                ZERO_PAGE_VALUE_KSEG1(frame) = 0xaabbccdd;
  • kernel/arch/ppc32/include/asm.h

    r7004747 r6da1013f  
    150150extern void userspace_asm(uintptr_t uspace_uarg, uintptr_t stack, uintptr_t entry);
    151151
     152/** No I/O port address space on PowerPC. */
     153static inline void outb(ioport_t port, uint8_t v)
     154{
     155}
     156
     157/** No I/O port address space on PowerPC. */
     158static inline uint8_t inb(ioport_t port)
     159{
     160        return 0;
     161}
     162
    152163#endif
    153164
  • kernel/arch/ppc32/src/ppc32.c

    r7004747 r6da1013f  
    168168}
    169169
     170/** Construct function pointer
     171 *
     172 * @param fptr   function pointer structure
     173 * @param addr   function address
     174 * @param caller calling function address
     175 *
     176 * @return address of the function pointer
     177 *
     178 */
     179void *arch_construct_function(fncptr_t *fptr, void *addr, void *caller)
     180{
     181        return addr;
     182}
     183
    170184/** @}
    171185 */
  • kernel/arch/sparc64/_link.ld.in

    r7004747 r6da1013f  
    22 *
    33 *  It is ELF format, but its only section looks like this:
    4  *  kernel text
    5  *  kernel data
     4 *   kernel text
     5 *   kernel data
    66 *
    77 */
     
    1212
    1313SECTIONS {
    14         .image VMA: AT (LMA) { 
     14        .image VMA: AT (LMA) {
    1515                ktext_start = .;
    1616                *(K_TEXT_START)
     
    2222                *(.rodata);
    2323                *(.rodata.*);
    24                 *(.data);               /* initialized data */
     24                *(.data);                   /* initialized data */
    2525                *(.sdata);
    2626                *(.sdata2);
     
    2828                . = ALIGN(8);
    2929                hardcoded_ktext_size = .;
    30                 QUAD(ktext_end - ktext_start); 
     30                QUAD(ktext_end - ktext_start);
    3131                hardcoded_kdata_size = .;
    3232                QUAD(kdata_end - kdata_start);
    3333                hardcoded_load_address = .;
    3434                QUAD(VMA);
    35                 *(.bss);                /* uninitialized static variables */   
    36                 *(COMMON);              /* global variables */
    37 
     35                *(.bss);                    /* uninitialized static variables */
     36                *(COMMON);                  /* global variables */
     37               
    3838                symbol_table = .;
    39                 *(symtab.*);            /* Symbol table, must be LAST symbol!*/
    40 
     39                *(symtab.*);                /* Symbol table, must be LAST symbol!*/
     40               
    4141                kdata_end = .;
    4242        }
     
    4545                *(*);
    4646        }
    47 
     47       
    4848}
  • kernel/arch/sparc64/include/fpu_context.h

    r7004747 r6da1013f  
    3838#include <arch/types.h>
    3939
    40 #define ARCH_HAS_FPU
    4140#define FPU_CONTEXT_ALIGN       8
    4241
  • kernel/arch/sparc64/src/sparc64.c

    r7004747 r6da1013f  
    162162}
    163163
     164/** Construct function pointer
     165 *
     166 * @param fptr   function pointer structure
     167 * @param addr   function address
     168 * @param caller calling function address
     169 *
     170 * @return address of the function pointer
     171 *
     172 */
     173void *arch_construct_function(fncptr_t *fptr, void *addr, void *caller)
     174{
     175        return addr;
     176}
     177
    164178/** @}
    165179 */
Note: See TracChangeset for help on using the changeset viewer.