Changeset ffcd542 in rtems-libbsd


Ignore:
Timestamp:
Oct 18, 2013, 12:12:17 PM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, c1e05b9ea378b2971e3d7704779112b4bc4296da, freebsd-9.3, 4a77611a223ea883fb548679b516d326a020d447
Children:
2a08d43
Parents:
a9be4b0
git-author:
Sebastian Huber <sebastian.huber@…> (10/18/13 12:12:17)
git-committer:
Sebastian Huber <sebastian.huber@…> (10/31/13 12:18:48)
Message:

Move TIMEOUT(9) and ZONE(9) initialization

Delete most of virtual memory support.

Files:
1 added
1 deleted
8 edited
1 moved

Legend:

Unmodified
Added
Removed
  • Makefile

    ra9be4b0 rffcd542  
    8888LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-thread.c
    8989LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-timesupport.c
    90 LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-vm_glue.c
    9190LIB_C_FILES += rtemsbsd/rtems/rtems-kvm.c
    9291LIB_C_FILES += rtemsbsd/rtems/rtems-net-setup.c
  • freebsd-to-rtems.py

    ra9be4b0 rffcd542  
    645645                'rtems/rtems-bsd-thread.c',
    646646                'rtems/rtems-bsd-timesupport.c',
    647                 'rtems/rtems-bsd-vm_glue.c',
    648647                'rtems/rtems-kvm.c',
    649648                'rtems/rtems-net-setup.c',
     
    779778                'sys/vm/uma.h',
    780779                'sys/vm/uma_int.h',
     780                'sys/vm/vm_extern.h',
    781781                'sys/vm/vm.h',
    782782        ]
  • freebsd/sys/kern/kern_sysctl.c

    ra9be4b0 rffcd542  
    6868
    6969#include <security/mac/mac_framework.h>
    70 #ifndef __rtems__
    7170#include <vm/vm.h>
    7271#include <vm/vm_extern.h>
    73 #endif
    7472
    7573#ifdef __rtems__
     
    12081206        SYSCTL_SUNLOCK();
    12091207
    1210 #ifndef __rtems__
    12111208        if (req.lock == REQ_WIRED && req.validlen > 0)
    12121209                vsunlock(req.oldptr, req.validlen);
    1213 #endif /* __rtems__ */
    12141210
    12151211        if (error && error != ENOMEM)
  • freebsd/sys/kern/kern_timeout.c

    ra9be4b0 rffcd542  
    158158 *      and may be called more then once.
    159159 */
     160#ifdef __rtems__
     161static void rtems_bsd_timeout_init(void *);
     162
     163static void callout_cpu_init(struct callout_cpu *);
     164
     165SYSINIT(rtems_bsd_timeout, SI_SUB_VM, SI_ORDER_FIRST, rtems_bsd_timeout_init,
     166    NULL);
     167
     168static void
     169rtems_bsd_timeout_init(void *unused)
     170#else /* __rtems__ */
    160171caddr_t
    161172kern_timeout_callwheel_alloc(caddr_t v)
     173#endif /* __rtems__ */
    162174{
    163175        struct callout_cpu *cc;
     176#ifdef __rtems__
     177        caddr_t v;
     178
     179        (void) unused;
     180#endif /* __rtems__ */
    164181
    165182        timeout_cpu = PCPU_GET(cpuid);
     
    174191        callwheelmask = callwheelsize - 1;
    175192
     193#ifdef __rtems__
     194        v = malloc(ncallout * sizeof(*cc->cc_callout) + callwheelsize
     195            * sizeof(*cc->cc_callwheel), M_CALLOUT, M_ZERO | M_WAITOK);
     196#endif /* __rtems__ */
    176197        cc->cc_callout = (struct callout *)v;
    177198        v = (caddr_t)(cc->cc_callout + ncallout);
    178199        cc->cc_callwheel = (struct callout_tailq *)v;
    179200        v = (caddr_t)(cc->cc_callwheel + callwheelsize);
     201#ifndef __rtems__
    180202        return(v);
     203#else /* __rtems__ */
     204        callout_cpu_init(cc);
     205#endif /* __rtems__ */
    181206}
    182207
     
    202227}
    203228
     229#ifndef __rtems__
    204230/*
    205231 * kern_timeout_callwheel_init() - initialize previously reserved callwheel
     
    214240        callout_cpu_init(CC_CPU(timeout_cpu));
    215241}
     242#endif /* __rtems__ */
    216243
    217244/*
  • freebsd/sys/vm/uma_core.c

    ra9be4b0 rffcd542  
    9494#include <vm/uma_dbg.h>
    9595
    96 #ifndef __rtems__
    9796#include <machine/vmparam.h>
    9897
    9998#include <ddb/ddb.h>
    100 #endif /* __rtems__ */
    10199
    102100/*
     
    126124static MALLOC_DEFINE(M_UMAHASH, "UMAHash", "UMA Hash Buckets");
    127125
     126#ifndef __rtems__
    128127/*
    129128 * Are we allowed to allocate buckets?
    130129 */
    131130static int bucketdisable = 1;
     131#endif /* __rtems__ */
    132132
    133133/* Linked list of all kegs in the system */
     
    137137static struct mtx uma_mtx;
    138138
     139#ifndef __rtems__
    139140/* Linked list of boot time pages */
    140141static LIST_HEAD(,uma_slab) uma_boot_pages =
     
    146147/* Is the VM done starting up? */
    147148static int booted = 0;
     149#endif /* __rtems__ */
    148150
    149151/* Maximum number of allowed items-per-slab if the slab header is OFFPAGE */
     
    221223#endif /* __rtems__ */
    222224static void *page_alloc(uma_zone_t, int, u_int8_t *, int);
     225#ifndef __rtems__
    223226static void *startup_alloc(uma_zone_t, int, u_int8_t *, int);
     227#endif /* __rtems__ */
    224228static void page_free(void *, int, u_int8_t);
    225229static uma_slab_t keg_alloc_slab(uma_keg_t, uma_zone_t, int);
     
    251255static int zone_alloc_bucket(uma_zone_t zone, int flags);
    252256static uma_slab_t zone_fetch_slab(uma_zone_t zone, uma_keg_t last, int flags);
     257#ifndef __rtems__
    253258static uma_slab_t zone_fetch_slab_multi(uma_zone_t zone, uma_keg_t last, int flags);
     259#endif /* __rtems__ */
    254260static void *slab_alloc_item(uma_zone_t zone, uma_slab_t slab);
    255261static uma_keg_t uma_kcreate(uma_zone_t zone, size_t size, uma_init uminit,
     
    286292                bucketdisable = 1;
    287293        else
     294                bucketdisable = 0;
    288295#endif /* __rtems__ */
    289                 bucketdisable = 0;
    290296}
    291297
     
    337343        uma_bucket_t bucket;
    338344
     345#ifndef __rtems__
    339346        /*
    340347         * This is to stop us from allocating per cpu buckets while we're
     
    345352        if (bucketdisable)
    346353                return (NULL);
     354#endif /* __rtems__ */
    347355
    348356        ubz = bucket_zone_lookup(entries);
     
    945953}
    946954
     955#ifndef __rtems__
    947956/*
    948957 * This function is intended to be used early on in place of page_alloc() so
     
    9981007        return keg->uk_allocf(zone, bytes, pflag, wait);
    9991008}
     1009#endif /* __rtems__ */
    10001010
    10011011/*
     
    10101020 *      NULL if M_NOWAIT is set.
    10111021 */
    1012 #ifdef __rtems__
    1013 #define PAGE_MASK       (PAGE_SIZE-1)
    1014 
    1015 #define round_page(x) ((((unsigned long )(x)) + PAGE_MASK) & ~(PAGE_MASK))
    1016 #endif
    10171022static void *
    10181023page_alloc(uma_zone_t zone, int bytes, u_int8_t *pflag, int wait)
     
    13651370                keg->uk_freef = uma_small_free;
    13661371#endif
     1372#ifndef __rtems__
    13671373                if (booted == 0)
    13681374                        keg->uk_allocf = startup_alloc;
    13691375        } else if (booted == 0 && (keg->uk_flags & UMA_ZFLAG_INTERNAL))
    13701376                keg->uk_allocf = startup_alloc;
     1377#else /* __rtems__ */
     1378        }
     1379#endif /* __rtems__ */
    13711380
    13721381        /*
     
    16391648{
    16401649        struct uma_zctor_args args;
     1650#ifndef __rtems__
    16411651        uma_slab_t slab;
     1652#endif /* __rtems__ */
    16421653        u_int slabsize;
    16431654        u_int objsize, totsize, wsize;
     1655#ifndef __rtems__
    16441656        int i;
     1657#endif /* __rtems__ */
    16451658
    16461659#ifdef UMA_DEBUG
     
    17331746        zone_ctor(kegs, sizeof(struct uma_zone), &args, M_WAITOK);
    17341747
     1748#ifndef __rtems__
    17351749#ifdef UMA_DEBUG
    17361750        printf("Filling boot free list.\n");
     
    17431757        }
    17441758        mtx_init(&uma_boot_pages_mtx, "UMA boot pages", NULL, MTX_DEF);
     1759#endif /* __rtems__ */
    17451760
    17461761#ifdef UMA_DEBUG
     
    18071822#endif
    18081823}
    1809 
     1824#ifdef __rtems__
     1825static void
     1826rtems_bsd_uma_startup(void *unused)
     1827{
     1828        (void) unused;
     1829
     1830        uma_startup(NULL, 0);
     1831}
     1832
     1833SYSINIT(rtems_bsd_uma_startup, SI_SUB_VM, SI_ORDER_FIRST,
     1834    rtems_bsd_uma_startup, NULL);
     1835#endif /* __rtems__ */
     1836
     1837#ifndef __rtems__
    18101838/* see uma.h */
    18111839void
     
    18131841{
    18141842        booted = 1;
    1815 #ifndef __rtems__
    18161843        bucket_enable();
    1817 #endif /* __rtems__ */
    18181844#ifdef UMA_DEBUG
    18191845        printf("UMA startup2 complete.\n");
    18201846#endif
    18211847}
     1848#endif /* __rtems__ */
    18221849
    18231850/*
     
    19081935}
    19091936
     1937#ifndef __rtems__
    19101938static void
    19111939zone_lock_pair(uma_zone_t a, uma_zone_t b)
     
    19281956}
    19291957
    1930 #ifndef __rtems__
    19311958int
    19321959uma_zsecond_add(uma_zone_t zone, uma_zone_t master)
     
    22852312}
    22862313
     2314#ifndef __rtems__
    22872315/*
    22882316 * uma_zone_fetch_slab_multi:  Fetches a slab from one available keg.  Returns
     
    23612389        return (NULL);
    23622390}
     2391#endif /* __rtems__ */
    23632392
    23642393static void *
     
    30793108        printf("UMA: vm asked us to release pages!\n");
    30803109#endif
    3081 #ifndef __rtems__
    30823110        bucket_enable();
    3083 #endif /* __rtems__ */
    30843111        zone_foreach(zone_drain);
    30853112        /*
  • testsuite/timeout01/init.c

    ra9be4b0 rffcd542  
    5050        assert(sc == RTEMS_SUCCESSFUL);
    5151
    52         timeout_table_init();
    5352        callout_tick_task_init();
    5453
  • testsuite/timeout01/timeout_helper.c

    ra9be4b0 rffcd542  
    3939
    4040#include "timeout_helper.h"
    41 
    42 void timeout_table_init()
    43 {
    44         size_t size = 0;
    45         caddr_t v = 0;
    46         void* firstaddr = 0;
    47 
    48         /* calculates how much memory is needed */
    49         v = kern_timeout_callwheel_alloc(v);
    50 
    51         /* allocate memory */
    52         size = (size_t)v;
    53         firstaddr = malloc(round_page(size));
    54         assert(firstaddr != NULL);
    55 
    56         /* now set correct addresses for callwheel */
    57         v = (caddr_t) firstaddr;
    58         v = kern_timeout_callwheel_alloc(v);
    59 
    60         assert((size_t)((void *)v - firstaddr) == size);
    61 
    62         /* Initialize the callouts we just allocated. */
    63         kern_timeout_callwheel_init();
    64 }
    6541
    6642#define CALLOUT_TICK_TASK_PRIO          (PRIORITY_DEFAULT_MAXIMUM - 1)
  • testsuite/timeout01/timeout_helper.h

    ra9be4b0 rffcd542  
    3737#endif /* __cplusplus */
    3838
    39 void timeout_table_init(void);
    4039void callout_tick_task_init(void);
    4140
Note: See TracChangeset for help on using the changeset viewer.