Changeset 0f81ceb7 in mainline


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

remove platform dependent constructs from generic code

Location:
kernel/generic
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/arch.h

    r8a72a9a r0f81ceb7  
    8080extern void reboot(void);
    8181extern void arch_reboot(void);
     82extern void *arch_construct_function(fncptr_t *fptr, void *addr, void *caller);
    8283
    8384#endif
  • kernel/generic/include/ddi/irq.h

    r8a72a9a r0f81ceb7  
    4747        CMD_PORT_READ_1,
    4848        CMD_PORT_WRITE_1,
    49         CMD_IA64_GETCHAR,
    50         CMD_PPC32_GETCHAR,
    5149        CMD_LAST
    5250} irq_cmd_type;
  • kernel/generic/include/fpu_context.h

    r8a72a9a r0f81ceb7  
    3838#include <arch/fpu_context.h>
    3939
    40 #if defined(CONFIG_FPU_LAZY) && !defined(ARCH_HAS_FPU)
    41 # error "CONFIG_FPU_LAZY defined, but no ARCH_HAS_FPU"
    42 #endif
    43 
    4440extern void fpu_context_save(fpu_context_t *);
    4541extern void fpu_context_restore(fpu_context_t *);
  • kernel/generic/src/console/cmd.c

    r8a72a9a r0f81ceb7  
    617617        uintptr_t symaddr;
    618618        char *symbol;
    619         unative_t (*f)(void);
    620 #ifdef ia64
    621         struct {
    622                 unative_t f;
    623                 unative_t gp;
    624         } fptr;
    625 #endif
    626 
     619        unative_t (*fnc)(void);
     620        fncptr_t fptr;
     621       
    627622        symaddr = get_symbol_addr((char *) argv->buffer);
    628623        if (!symaddr)
     
    633628        } else {
    634629                symbol = get_symtab_entry(symaddr);
     630                fnc = (unative_t (*)(void)) arch_construct_function(&fptr, (void *) symaddr, (void *) cmd_call0);
    635631                printf("Calling %s() (%p)\n", symbol, symaddr);
    636 #ifdef ia64
    637                 fptr.f = symaddr;
    638                 fptr.gp = ((unative_t *)cmd_call2)[1];
    639                 f =  (unative_t (*)(void)) &fptr;
    640 #else
    641                 f =  (unative_t (*)(void)) symaddr;
    642 #endif
    643                 printf("Result: %#" PRIxn "\n", f());
     632                printf("Result: %#" PRIxn "\n", fnc());
    644633        }
    645634       
     
    681670        uintptr_t symaddr;
    682671        char *symbol;
    683         unative_t (*f)(unative_t,...);
     672        unative_t (*fnc)(unative_t, ...);
    684673        unative_t arg1 = argv[1].intval;
    685 #ifdef ia64
    686         struct {
    687                 unative_t f;
    688                 unative_t gp;
    689         } fptr;
    690 #endif
    691 
     674        fncptr_t fptr;
     675       
    692676        symaddr = get_symbol_addr((char *) argv->buffer);
    693677        if (!symaddr)
     
    698682        } else {
    699683                symbol = get_symtab_entry(symaddr);
    700 
     684                fnc = (unative_t (*)(unative_t, ...)) arch_construct_function(&fptr, (void *) symaddr, (void *) cmd_call1);
    701685                printf("Calling f(%#" PRIxn "): %p: %s\n", arg1, symaddr, symbol);
    702 #ifdef ia64
    703                 fptr.f = symaddr;
    704                 fptr.gp = ((unative_t *)cmd_call2)[1];
    705                 f =  (unative_t (*)(unative_t,...)) &fptr;
    706 #else
    707                 f =  (unative_t (*)(unative_t,...)) symaddr;
    708 #endif
    709                 printf("Result: %#" PRIxn "\n", f(arg1));
     686                printf("Result: %#" PRIxn "\n", fnc(arg1));
    710687        }
    711688       
     
    718695        uintptr_t symaddr;
    719696        char *symbol;
    720         unative_t (*f)(unative_t,unative_t,...);
     697        unative_t (*fnc)(unative_t, unative_t, ...);
    721698        unative_t arg1 = argv[1].intval;
    722699        unative_t arg2 = argv[2].intval;
    723 #ifdef ia64
    724         struct {
    725                 unative_t f;
    726                 unative_t gp;
    727         }fptr;
    728 #endif
    729 
     700        fncptr_t fptr;
     701       
    730702        symaddr = get_symbol_addr((char *) argv->buffer);
    731703        if (!symaddr)
     
    736708        } else {
    737709                symbol = get_symtab_entry(symaddr);
     710                fnc = (unative_t (*)(unative_t, unative_t, ...)) arch_construct_function(&fptr, (void *) symaddr, (void *) cmd_call2);
    738711                printf("Calling f(%#" PRIxn ", %#" PRIxn "): %p: %s\n",
    739712                       arg1, arg2, symaddr, symbol);
    740 #ifdef ia64
    741                 fptr.f = symaddr;
    742                 fptr.gp = ((unative_t *)cmd_call2)[1];
    743                 f =  (unative_t (*)(unative_t,unative_t,...)) &fptr;
    744 #else
    745                 f =  (unative_t (*)(unative_t,unative_t,...)) symaddr;
    746 #endif
    747                 printf("Result: %#" PRIxn "\n", f(arg1, arg2));
     713                printf("Result: %#" PRIxn "\n", fnc(arg1, arg2));
    748714        }
    749715       
     
    756722        uintptr_t symaddr;
    757723        char *symbol;
    758         unative_t (*f)(unative_t,unative_t,unative_t,...);
     724        unative_t (*fnc)(unative_t, unative_t, unative_t, ...);
    759725        unative_t arg1 = argv[1].intval;
    760726        unative_t arg2 = argv[2].intval;
    761727        unative_t arg3 = argv[3].intval;
    762 #ifdef ia64
    763         struct {
    764                 unative_t f;
    765                 unative_t gp;
    766         }fptr;
    767 #endif
    768 
     728        fncptr_t fptr;
     729       
    769730        symaddr = get_symbol_addr((char *) argv->buffer);
    770731        if (!symaddr)
     
    775736        } else {
    776737                symbol = get_symtab_entry(symaddr);
     738                fnc = (unative_t (*)(unative_t, unative_t, unative_t, ...)) arch_construct_function(&fptr, (void *) symaddr, (void *) cmd_call3);
    777739                printf("Calling f(%#" PRIxn ",%#" PRIxn ", %#" PRIxn "): %p: %s\n",
    778740                       arg1, arg2, arg3, symaddr, symbol);
    779 #ifdef ia64
    780                 fptr.f = symaddr;
    781                 fptr.gp = ((unative_t *)cmd_call2)[1];
    782                 f =  (unative_t (*)(unative_t,unative_t,unative_t,...)) &fptr;
    783 #else
    784                 f =  (unative_t (*)(unative_t,unative_t,unative_t,...)) symaddr;
    785 #endif
    786                 printf("Result: %#" PRIxn "\n", f(arg1, arg2, arg3));
     741                printf("Result: %#" PRIxn "\n", fnc(arg1, arg2, arg3));
    787742        }
    788743       
     
    997952       
    998953        for (test = tests; test->name != NULL; test++)
    999                 printf("%s\t\t%s%s\n", test->name, test->desc, (test->safe ? "" : " (unsafe)"));
    1000        
    1001         printf("*\t\tRun all safe tests\n");
     954                printf("%-10s %s%s\n", test->name, test->desc, (test->safe ? "" : " (unsafe)"));
     955       
     956        printf("%-10s Run all safe tests\n", "*");
    1002957        return 1;
    1003958}
  • kernel/generic/src/ipc/irq.c

    r8a72a9a r0f81ceb7  
    101101                            code->cmds[i].value;
    102102                        break;
    103 #if defined(ia32) || defined(amd64) || defined(ia64)
    104103                case CMD_PORT_READ_1:
    105104                        dstval = inb((long) code->cmds[i].addr);
     
    108107                        outb((long) code->cmds[i].addr, code->cmds[i].value);
    109108                        break;
    110 #endif
    111 #if defined(ia64) && defined(SKI)
    112                 case CMD_IA64_GETCHAR:
    113                         dstval = _getc(&ski_uconsole);
    114                         break;
    115 #endif
    116 #if defined(ppc32)
    117                 case CMD_PPC32_GETCHAR:
    118                         dstval = cuda_get_scancode();
    119                         break;
    120 #endif
    121109                default:
    122110                        break;
  • kernel/generic/src/main/version.c

    r8a72a9a r0f81ceb7  
    3535#include <main/version.h>
    3636#include <print.h>
     37#include <macros.h>
    3738
    3839char *project = "SPARTAN kernel";
    39 char *copyright = "Copyright (c) 2001-2008 HelenOS project";
    40 char *release = RELEASE;
    41 char *name = NAME;
    42 char *arch = ARCH;
     40char *copyright = "Copyright (c) 2001-2009 HelenOS project";
     41char *release = STRING(RELEASE);
     42char *name = STRING(NAME);
     43char *arch = STRING(KARCH);
    4344
    4445#ifdef REVISION
    45         char *revision = ", revision " REVISION;
     46        char *revision = ", revision " STRING(REVISION);
    4647#else
    4748        char *revision = "";
     
    4950
    5051#ifdef TIMESTAMP
    51         char *timestamp = " on " TIMESTAMP;
     52        char *timestamp = " on " STRING(TIMESTAMP);
    5253#else
    5354        char *timestamp = "";
  • kernel/generic/src/proc/thread.c

    r8a72a9a r0f81ceb7  
    103103
    104104static slab_cache_t *thread_slab;
    105 #ifdef ARCH_HAS_FPU
     105#ifdef CONFIG_FPU
    106106slab_cache_t *fpu_context_slab;
    107107#endif
     
    162162        thr_constructor_arch(t);
    163163       
    164 #ifdef ARCH_HAS_FPU
     164#ifdef CONFIG_FPU
    165165#ifdef CONFIG_FPU_LAZY
    166166        t->saved_fpu_context = NULL;
     
    170170                return -1;
    171171#endif
    172 #endif 
     172#endif
    173173
    174174        t->kstack = (uint8_t *) frame_alloc(STACK_FRAMES, FRAME_KA | kmflags);
    175175        if (!t->kstack) {
    176 #ifdef ARCH_HAS_FPU
     176#ifdef CONFIG_FPU
    177177                if (t->saved_fpu_context)
    178178                        slab_free(fpu_context_slab, t->saved_fpu_context);
     
    197197
    198198        frame_free(KA2PA(t->kstack));
    199 #ifdef ARCH_HAS_FPU
     199#ifdef CONFIG_FPU
    200200        if (t->saved_fpu_context)
    201201                slab_free(fpu_context_slab, t->saved_fpu_context);
     
    216216            thr_constructor, thr_destructor, 0);
    217217
    218 #ifdef ARCH_HAS_FPU
     218#ifdef CONFIG_FPU
    219219        fpu_context_slab = slab_cache_create("fpu_slab", sizeof(fpu_context_t),
    220220            FPU_CONTEXT_ALIGN, NULL, NULL, 0);
Note: See TracChangeset for help on using the changeset viewer.