Changeset bd1deed in mainline


Ignore:
Timestamp:
2007-02-11T20:04:08Z (18 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c993e45
Parents:
ce8aed1
Message:

experimental support for Objective C
(disabled by default)

Files:
2 added
21 edited

Legend:

Unmodified
Added
Removed
  • contrib/toolchain/toolchain.ia32.sh

    rce8aed1 rbd1deed  
    9292"${GCCDIR}/configure" "--host=${HOST}" "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" --with-gnu-as --with-gnu-ld --disable-nls --disable-threads --enable-languages=c,objc,c++,obj-c++ --disable-multilib --disable-libgcj --without-headers --disable-shared
    9393check_error $? "Error configuring GCC."
    94 PATH="${PATH}:${PREFIX}/bin" make all-gcc install-gcc
     94PATH="${PATH}:${PREFIX}/bin" make all-gcc install-gcc all-target-libobjc install-target-libobjc
    9595check_error $? "Error compiling/installing GCC."
    9696
  • contrib/toolchain/toolchain.sparc64.sh

    rce8aed1 rbd1deed  
    9292"${GCCDIR}/configure" "--host=${HOST}" "--target=${TARGET}" "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" --with-gnu-as --with-gnu-ld --disable-nls --disable-threads --enable-languages=c,objc,c++,obj-c++ --disable-multilib --disable-libgcj --without-headers --disable-shared
    9393check_error $? "Error configuring GCC."
    94 PATH="${PATH}:${PREFIX}/bin" make all-gcc install-gcc
     94PATH="${PATH}:${PREFIX}/bin" make all-gcc install-gcc all-target-libobjc install-target-libobjc
    9595check_error $? "Error compiling/installing GCC."
    9696
  • kernel/Makefile

    rce8aed1 rbd1deed  
    129129        OBJCOPY = objcopy
    130130        OBJDUMP = objdump
     131        LIBDIR = /usr/lib
    131132else
    132         CC = $(TOOLCHAIN_DIR)/$(TARGET)-gcc
    133         AS = $(TOOLCHAIN_DIR)/$(TARGET)-as
    134         LD = $(TOOLCHAIN_DIR)/$(TARGET)-ld
    135         OBJCOPY = $(TOOLCHAIN_DIR)/$(TARGET)-objcopy
    136         OBJDUMP = $(TOOLCHAIN_DIR)/$(TARGET)-objdump
     133        CC = $(TOOLCHAIN_DIR)/bin/$(TARGET)-gcc
     134        AS = $(TOOLCHAIN_DIR)/bin/$(TARGET)-as
     135        LD = $(TOOLCHAIN_DIR)/bin/$(TARGET)-ld
     136        OBJCOPY = $(TOOLCHAIN_DIR)/bin/$(TARGET)-objcopy
     137        OBJDUMP = $(TOOLCHAIN_DIR)/bin/$(TARGET)-objdump
     138        LIBDIR = $(TOOLCHAIN_DIR)/lib
    137139endif
    138140
     
    240242endif
    241243
     244## Experimental features
     245#
     246
     247ifeq ($(CONFIG_EXPERIMENTAL),y)
     248        GENERIC_SOURCES += generic/src/lib/objc.c
     249        EXTRA_OBJECTS = $(LIBDIR)/libobjc.a
     250        EXTRA_FLAGS += -x objective-c
     251endif
     252
    242253GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES)))
    243254ARCH_OBJECTS := $(addsuffix .o,$(basename $(ARCH_SOURCES)))
     
    280291generic/src/debug/real_map.bin: depend arch/$(ARCH)/_link.ld $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS)
    281292        $(OBJCOPY) -I binary -O $(BFD_NAME) -B $(BFD_ARCH) --prefix-sections=symtab Makefile generic/src/debug/empty_map.o
    282         $(LD) -T arch/$(ARCH)/_link.ld $(LFLAGS) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) generic/src/debug/empty_map.o -o $@ -Map kernel.map.pre
     293        $(LD) -T arch/$(ARCH)/_link.ld $(LFLAGS) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) generic/src/debug/empty_map.o -o $@ -Map kernel.map.pre
    283294        $(OBJDUMP) -t $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) > kernel.objdump
    284295        tools/genmap.py kernel.map.pre kernel.objdump generic/src/debug/real_map.bin
     
    286297        # on architectures, that have bss after symtab
    287298        $(OBJCOPY) -I binary -O $(BFD_NAME) -B $(BFD_ARCH) --prefix-sections=symtab generic/src/debug/real_map.bin generic/src/debug/sizeok_map.o
    288         $(LD) -T arch/$(ARCH)/_link.ld $(LFLAGS) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) generic/src/debug/sizeok_map.o -o $@ -Map kernel.map.pre
     299        $(LD) -T arch/$(ARCH)/_link.ld $(LFLAGS) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) generic/src/debug/sizeok_map.o -o $@ -Map kernel.map.pre
    289300        $(OBJDUMP) -t $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) > kernel.objdump
    290301        tools/genmap.py kernel.map.pre kernel.objdump generic/src/debug/real_map.bin
     
    294305
    295306kernel.raw: depend arch/$(ARCH)/_link.ld $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) generic/src/debug/real_map.o
    296         $(LD) -T arch/$(ARCH)/_link.ld $(LFLAGS) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) generic/src/debug/real_map.o -o $@ -Map kernel.map
     307        $(LD) -T arch/$(ARCH)/_link.ld $(LFLAGS) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) generic/src/debug/real_map.o -o $@ -Map kernel.map
    297308
    298309kernel.bin: kernel.raw
     
    309320
    310321%.o: %.c
    311         $(CC) $(DEFS) $(CFLAGS) -c $< -o $@
     322        $(CC) $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) -c $< -o $@
  • kernel/arch/amd64/Makefile.inc

    rce8aed1 rbd1deed  
    3434BFD = binary
    3535TARGET = amd64-linux-gnu
    36 TOOLCHAIN_DIR = /usr/local/amd64/bin
     36TOOLCHAIN_DIR = /usr/local/amd64
    3737
    3838CFLAGS += -fno-unwind-tables -m64 -mcmodel=kernel -mno-red-zone
  • kernel/arch/ia32/Makefile.inc

    rce8aed1 rbd1deed  
    3434BFD = binary
    3535TARGET = i686-pc-linux-gnu
    36 TOOLCHAIN_DIR = /usr/local/i686/bin
     36TOOLCHAIN_DIR = /usr/local/i686
    3737
    3838DEFS += -DMACHINE=$(MACHINE) -D__32_BITS__
  • kernel/arch/ia32/src/mm/as.c

    rce8aed1 rbd1deed  
    4040void as_arch_init(void)
    4141{
     42#ifndef __OBJC__
    4243        as_operations = &as_pt_operations;
     44#endif
    4345}
    4446
  • kernel/arch/ia32xen/Makefile.inc

    rce8aed1 rbd1deed  
    3434BFD = elf32-i386
    3535TARGET = i686-pc-linux-gnu
    36 TOOLCHAIN_DIR = /usr/local/i686/bin
     36TOOLCHAIN_DIR = /usr/local/i686
    3737
    3838DEFS += -DMACHINE=$(MACHINE) -D__32_BITS__
  • kernel/arch/ia64/Makefile.inc

    rce8aed1 rbd1deed  
    3434BFD = elf64-ia64-little
    3535TARGET = ia64-pc-linux-gnu
    36 TOOLCHAIN_DIR = /usr/local/ia64/bin
     36TOOLCHAIN_DIR = /usr/local/ia64
    3737
    3838INIT0_ADDRESS = 0xe000000000400000
  • kernel/arch/mips32/Makefile.inc

    rce8aed1 rbd1deed  
    3232BFD_ARCH = mips
    3333TARGET = mipsel-linux-gnu
    34 TOOLCHAIN_DIR = /usr/local/mipsel/bin
     34TOOLCHAIN_DIR = /usr/local/mipsel
    3535
    3636KERNEL_LOAD_ADDRESS = 0x80100000
  • kernel/arch/ppc32/Makefile.inc

    rce8aed1 rbd1deed  
    3434BFD = binary
    3535TARGET = ppc-linux-gnu
    36 TOOLCHAIN_DIR = /usr/local/ppc/bin
     36TOOLCHAIN_DIR = /usr/local/ppc
    3737
    3838CFLAGS += -mcpu=powerpc -msoft-float -m32
  • kernel/arch/ppc64/Makefile.inc

    rce8aed1 rbd1deed  
    3434BFD = binary
    3535TARGET = ppc64-linux-gnu
    36 TOOLCHAIN_DIR = /usr/local/ppc64/bin
     36TOOLCHAIN_DIR = /usr/local/ppc64
    3737
    3838CFLAGS += -mcpu=powerpc64 -msoft-float -m64
  • kernel/arch/sparc64/Makefile.inc

    rce8aed1 rbd1deed  
    3434BFD = binary
    3535TARGET = sparc64-linux-gnu
    36 TOOLCHAIN_DIR = /usr/local/sparc64/bin
     36TOOLCHAIN_DIR = /usr/local/sparc64
    3737
    3838CFLAGS += -mcpu=ultrasparc -m64
  • kernel/genarch/include/mm/page_pt.h

    rce8aed1 rbd1deed  
    108108#define PTE_EXECUTABLE(p)       PTE_EXECUTABLE_ARCH((p))
    109109
     110#ifndef __OBJC__
    110111extern as_operations_t as_pt_operations;
     112#endif
    111113extern page_mapping_operations_t pt_mapping_operations;
    112114
  • kernel/genarch/src/mm/as_pt.c

    rce8aed1 rbd1deed  
    5353static void pt_unlock(as_t *as, bool unlock);
    5454
     55#ifdef __OBJC__
     56@implementation as_t
     57
     58+ (pte_t *) page_table_create: (int) flags
     59{
     60        return ptl0_create(flags);
     61}
     62
     63+ (void) page_table_destroy: (pte_t *) page_table
     64{
     65        ptl0_destroy(page_table);
     66}
     67
     68- (void) page_table_lock: (bool) _lock
     69{
     70        pt_lock(self, _lock);
     71}
     72
     73- (void) page_table_unlock: (bool) unlock
     74{
     75        pt_unlock(self, unlock);
     76}
     77
     78@end
     79#else
    5580as_operations_t as_pt_operations = {
    5681        .page_table_create = ptl0_create,
     
    5984        .page_table_unlock = pt_unlock
    6085};
     86#endif
    6187
    6288/** Create PTL0.
  • kernel/generic/include/memstr.h

    rce8aed1 rbd1deed  
    4545extern void _memsetb(uintptr_t dst, size_t cnt, uint8_t x);
    4646extern void _memsetw(uintptr_t dst, size_t cnt, uint16_t x);
     47extern char *strcpy(char *dest, const char *src);
    4748
    4849#endif
  • kernel/generic/include/mm/as.h

    rce8aed1 rbd1deed  
    8080/** The page fault was caused by memcpy_from_uspace() or memcpy_to_uspace(). */
    8181#define AS_PF_DEFER             2
     82
     83#ifdef __OBJC__
     84@interface as_t {
     85        @public
     86                /** Protected by asidlock. */
     87                link_t inactive_as_with_asid_link;
     88               
     89                mutex_t lock;
     90               
     91                /** Number of references (i.e tasks that reference this as). */
     92                count_t refcount;
     93               
     94                /** Number of processors on wich is this address space active. */
     95                count_t cpu_refcount;
     96               
     97                /** B+tree of address space areas. */
     98                btree_t as_area_btree;
     99               
     100                /**
     101                 *  Address space identifier.
     102                 *  Constant on architectures that do not support ASIDs.
     103                 */
     104                asid_t asid;
     105               
     106                /** Non-generic content. */
     107                as_genarch_t genarch;
     108               
     109                /** Architecture specific content. */
     110                as_arch_t arch;
     111}
     112+ (pte_t *) page_table_create: (int) flags;
     113+ (void) page_table_destroy: (pte_t *) page_table;
     114- (void) page_table_lock: (bool) _lock;
     115- (void) page_table_unlock: (bool) unlock;
     116@end
     117
     118#else
    82119
    83120/** Address space structure.
     
    122159        void (* page_table_unlock)(as_t *as, bool unlock);
    123160} as_operations_t;
     161#endif
    124162
    125163/**
     
    202240
    203241extern as_t *AS_KERNEL;
     242
     243#ifndef __OBJC__
    204244extern as_operations_t *as_operations;
     245#endif
    205246
    206247SPINLOCK_EXTERN(inactive_as_with_asid_lock);
  • kernel/generic/include/print.h

    rce8aed1 rbd1deed  
    4545#define EOF (-1)
    4646
     47extern int puts(const char *s);
    4748extern int printf(const char *fmt, ...);
    4849extern int sprintf(char *str, const char *fmt, ...);
  • kernel/generic/src/lib/memstr.c

    rce8aed1 rbd1deed  
    7575        }
    7676               
    77         return (char *)src;
     77        return (char *) src;
    7878}
    7979
     
    9393        uint8_t *p = (uint8_t *) dst;
    9494       
    95         for(i=0; i<cnt; i++)
     95        for (i = 0; i < cnt; i++)
    9696                p[i] = x;
    9797}
     
    112112        uint16_t *p = (uint16_t *) dst;
    113113       
    114         for(i=0; i<cnt; i++)
     114        for (i = 0; i < cnt; i++)
    115115                p[i] = x;       
     116}
     117
     118/** Copy string
     119 *
     120 * Copy string from src address to dst address.
     121 * The copying is done char-by-char until the null
     122 * character. The source and destination memory areas
     123 * cannot overlap.
     124 *
     125 * @param src Origin string to copy from.
     126 * @param dst Origin string to copy to.
     127 *
     128 */
     129char *strcpy(char *dest, const char *src)
     130{
     131        char *orig = dest;
     132       
     133        while ((*(dest++) = *(src++)));
     134        return orig;
    116135}
    117136
  • kernel/generic/src/mm/as.c

    rce8aed1 rbd1deed  
    8282#endif /* CONFIG_VIRT_IDX_DCACHE */
    8383
     84#ifndef __OBJC__
    8485/**
    8586 * Each architecture decides what functions will be used to carry out
     
    8788 */
    8889as_operations_t *as_operations = NULL;
     90#endif
    8991
    9092/**
     
    993995pte_t *page_table_create(int flags)
    994996{
    995         ASSERT(as_operations);
    996         ASSERT(as_operations->page_table_create);
    997 
    998         return as_operations->page_table_create(flags);
     997#ifdef __OBJC__
     998        return [as_t page_table_create: flags];
     999#else
     1000        ASSERT(as_operations);
     1001        ASSERT(as_operations->page_table_create);
     1002       
     1003        return as_operations->page_table_create(flags);
     1004#endif
    9991005}
    10001006
     
    10071013void page_table_destroy(pte_t *page_table)
    10081014{
    1009         ASSERT(as_operations);
    1010         ASSERT(as_operations->page_table_destroy);
    1011 
    1012         as_operations->page_table_destroy(page_table);
     1015#ifdef __OBJC__
     1016        return [as_t page_table_destroy: page_table];
     1017#else
     1018        ASSERT(as_operations);
     1019        ASSERT(as_operations->page_table_destroy);
     1020       
     1021        as_operations->page_table_destroy(page_table);
     1022#endif
    10131023}
    10141024
     
    10271037void page_table_lock(as_t *as, bool lock)
    10281038{
     1039#ifdef __OBJC__
     1040        [as page_table_lock: lock];
     1041#else
    10291042        ASSERT(as_operations);
    10301043        ASSERT(as_operations->page_table_lock);
    1031 
     1044       
    10321045        as_operations->page_table_lock(as, lock);
     1046#endif
    10331047}
    10341048
     
    10401054void page_table_unlock(as_t *as, bool unlock)
    10411055{
     1056#ifdef __OBJC__
     1057        [as page_table_unlock: unlock];
     1058#else
    10421059        ASSERT(as_operations);
    10431060        ASSERT(as_operations->page_table_unlock);
    1044 
     1061       
    10451062        as_operations->page_table_unlock(as, unlock);
     1063#endif
    10461064}
    10471065
  • kernel/generic/src/printf/vprintf.c

    rce8aed1 rbd1deed  
    3737#include <putchar.h>
    3838
    39 int vprintf_write(const char *str, size_t count, void *unused);
     39static int vprintf_write(const char *str, size_t count, void *unused)
     40{
     41        size_t i;
     42        for (i = 0; i < count; i++)
     43                putchar(str[i]);
     44        return i;
     45}
    4046
    41 int vprintf_write(const char *str, size_t count, void *unused)
     47int puts(const char *s)
    4248{
    43         size_t i = 0;
    44         for (; i < count; i++)
    45                 putchar(str[i]);
     49        size_t i;
     50        for (i = 0; s[i] != 0; i++)
     51                putchar(s[i]);
    4652        return i;
    4753}
     
    4955int vprintf(const char *fmt, va_list ap)
    5056{
    51         struct printf_spec ps = {(int(*)(void *, size_t, void *))vprintf_write, NULL};
     57        struct printf_spec ps = {(int(*)(void *, size_t, void *)) vprintf_write, NULL};
    5258        return printf_core(fmt, &ps, ap);
    5359
  • kernel/kernel.config

    rce8aed1 rbd1deed  
    4141@ "i460GX" i460GX chipset machine
    4242! [ARCH=ia64] MACHINE (choice)
    43 
    4443
    4544# Framebuffer support
     
    127126# Compile kernel tests
    128127! CONFIG_TEST (y/n)
     128
     129
     130## Experimental features
     131
     132# Enable experimental features
     133! CONFIG_EXPERIMENTAL (n/y)
Note: See TracChangeset for help on using the changeset viewer.