/kernel/branches/falloc_bad/generic/include/mm/as.h |
---|
0,0 → 1,101 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __AS_H__ |
#define __AS_H__ |
#include <arch/mm/page.h> |
#include <arch/mm/as.h> |
#include <arch/mm/asid.h> |
#include <arch/types.h> |
#include <typedefs.h> |
#include <synch/spinlock.h> |
#include <list.h> |
#define KERNEL_ADDRESS_SPACE_START KERNEL_ADDRESS_SPACE_START_ARCH |
#define KERNEL_ADDRESS_SPACE_END KERNEL_ADDRESS_SPACE_END_ARCH |
#define USER_ADDRESS_SPACE_START USER_ADDRESS_SPACE_START_ARCH |
#define USER_ADDRESS_SPACE_END USER_ADDRESS_SPACE_END_ARCH |
#define IS_KA(addr) ((addr)>=KERNEL_ADDRESS_SPACE_START && (addr)<=KERNEL_ADDRESS_SPACE_END) |
#define UTEXT_ADDRESS UTEXT_ADDRESS_ARCH |
#define USTACK_ADDRESS USTACK_ADDRESS_ARCH |
#define UDATA_ADDRESS UDATA_ADDRESS_ARCH |
enum as_area_type { |
AS_AREA_TEXT = 1, AS_AREA_DATA, AS_AREA_STACK |
}; |
/** Address space area structure. |
* |
* Each as_area_t structure describes one contiguous area of virtual memory. |
* In the future, it should not be difficult to support shared areas. |
*/ |
struct as_area { |
SPINLOCK_DECLARE(lock); |
link_t link; |
as_area_type_t type; |
size_t size; /**< Size of this area. */ |
__address base; /**< Base address of this area. */ |
index_t *mapping; /**< Map of physical frame numbers mapped to virtual page numbers in this area. */ |
}; |
/** Address space structure. |
* |
* as_t contains the list of as_areas of userspace accessible |
* pages for one or more tasks. Ranges of kernel memory pages are not |
* supposed to figure in the list as they are shared by all tasks and |
* set up during system initialization. |
*/ |
struct as { |
SPINLOCK_DECLARE(lock); |
link_t as_area_head; |
pte_t *ptl0; |
asid_t asid; /**< Address space identifier. */ |
}; |
extern as_t * as_create(pte_t *ptl0); |
extern as_area_t *as_area_create(as_t *as, as_area_type_t type, size_t size, __address base); |
extern void as_area_set_mapping(as_area_t *a, index_t vpn, index_t pfn); |
extern int as_page_fault(__address page); |
extern void as_install(as_t *m); |
/* |
* Each architecture should implement this function. |
* Its main purpose is to do TLB purges according |
* to architecture's requirements. Note that |
* some architectures invalidate their TLB automatically |
* on hardware address space switch (e.g. ia32 and |
* amd64). |
*/ |
#ifndef as_install_arch |
extern void as_install_arch(as_t *as); |
#endif /* !def as_install_arch */ |
#endif |
/kernel/branches/falloc_bad/generic/include/mm/page.h |
---|
0,0 → 1,76 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __PAGE_H__ |
#define __PAGE_H__ |
#include <arch/mm/asid.h> |
#include <arch/types.h> |
#include <typedefs.h> |
#define PAGE_CACHEABLE_SHIFT 0 |
#define PAGE_NOT_CACHEABLE_SHIFT PAGE_CACHEABLE_SHIFT |
#define PAGE_PRESENT_SHIFT 1 |
#define PAGE_NOT_PRESENT_SHIFT PAGE_PRESENT_SHIFT |
#define PAGE_USER_SHIFT 2 |
#define PAGE_KERNEL_SHIFT PAGE_USER_SHIFT |
#define PAGE_READ_SHIFT 3 |
#define PAGE_WRITE_SHIFT 4 |
#define PAGE_EXEC_SHIFT 5 |
#define PAGE_GLOBAL_SHIFT 6 |
#define PAGE_NOT_CACHEABLE (0<<PAGE_CACHEABLE_SHIFT) |
#define PAGE_CACHEABLE (1<<PAGE_CACHEABLE_SHIFT) |
#define PAGE_PRESENT (0<<PAGE_PRESENT_SHIFT) |
#define PAGE_NOT_PRESENT (1<<PAGE_PRESENT_SHIFT) |
#define PAGE_USER (1<<PAGE_USER_SHIFT) |
#define PAGE_KERNEL (0<<PAGE_USER_SHIFT) |
#define PAGE_READ (1<<PAGE_READ_SHIFT) |
#define PAGE_WRITE (1<<PAGE_WRITE_SHIFT) |
#define PAGE_EXEC (1<<PAGE_EXEC_SHIFT) |
#define PAGE_GLOBAL (1<<PAGE_GLOBAL_SHIFT) |
/** Operations to manipulate page mappings. */ |
struct page_operations { |
void (* mapping_insert)(__address page, asid_t asid, __address frame, int flags, __address root); |
pte_t *(* mapping_find)(__address page, asid_t asid, __address root); |
}; |
typedef struct page_operations page_operations_t; |
extern page_operations_t *page_operations; |
extern void page_init(void); |
extern void page_mapping_insert(__address page, asid_t asid, __address frame, int flags, __address root); |
extern pte_t *page_mapping_find(__address page, asid_t asid, __address root); |
extern void map_structure(__address s, size_t size); |
#endif |
/kernel/branches/falloc_bad/generic/include/mm/frame.h |
---|
0,0 → 1,125 |
/* |
* Copyright (C) 2005 Jakub Jermar |
* Copyright (C) 2005 Sergey Bondari |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __FRAME_H__ |
#define __FRAME_H__ |
#include <arch/types.h> |
#include <typedefs.h> |
#include <list.h> |
#include <synch/spinlock.h> |
#include <mm/buddy.h> |
#define ONE_FRAME 0 |
#define FRAME_KA 1 /* skip frames conflicting with user address space */ |
#define FRAME_PANIC 2 /* panic on failure */ |
#define FRAME_NON_BLOCKING 4 /* do not panic and do not sleep on failure */ |
#define FRAME_OK 0 /* frame_alloc return status */ |
#define FRAME_NO_MEMORY 1 /* frame_alloc return status */ |
#define FRAME_ERROR 2 /* frame_alloc return status */ |
#define FRAME2ADDR(zone, frame) ((zone)->base + ((frame) - (zone)->frames) * FRAME_SIZE) |
#define ADDR2FRAME(zone, addr) (&((zone)->frames[((addr) - (zone)->base) / FRAME_SIZE])) |
#define FRAME_INDEX(zone, frame) ((index_t)((frame) - (zone)->frames)) |
#define FRAME_INDEX_VALID(zone, index) (((index) >= 0) && ((index) < ((zone)->free_count + (zone)->busy_count))) |
#define IS_BUDDY_ORDER_OK(index, order) ((~(((__native) -1) << (order)) & (index)) == 0) |
#define IS_BUDDY_LEFT_BLOCK(zone, frame) (((FRAME_INDEX((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 0) |
#define IS_BUDDY_RIGHT_BLOCK(zone, frame) (((FRAME_INDEX((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 1) |
#define ZONE_BLACKLIST_SIZE 4 |
struct zone { |
link_t link; /**< link to previous and next zone */ |
SPINLOCK_DECLARE(lock); /**< this lock protects everything below */ |
__address base; /**< physical address of the first frame in the frames array */ |
frame_t *frames; /**< array of frame_t structures in this zone */ |
count_t free_count; /**< number of free frame_t structures */ |
count_t busy_count; /**< number of busy frame_t structures */ |
buddy_system_t * buddy_system; /**< buddy system for the zone */ |
int flags; |
}; |
struct frame { |
count_t refcount; /**< tracking of shared frames */ |
__u8 buddy_order; /**< buddy system block order */ |
link_t buddy_link; /**< link to the next free block inside one order */ |
}; |
struct region { |
__address base; |
size_t size; |
}; |
extern region_t zone_blacklist[]; |
extern count_t zone_blacklist_count; |
extern void frame_region_not_free(__address base, size_t size); |
extern void zone_create_in_region(__address base, size_t size); |
extern spinlock_t zone_head_lock; /**< this lock protects zone_head list */ |
extern link_t zone_head; /**< list of all zones in the system */ |
extern zone_t *zone_create(__address start, size_t size, int flags); |
extern void zone_attach(zone_t *zone); |
extern void frame_init(void); |
extern void frame_initialize(frame_t *frame, zone_t *zone); |
__address frame_alloc(int flags, __u8 order, int * status); |
extern void frame_free(__address addr); |
zone_t * get_zone_by_frame(frame_t * frame); |
/* |
* Buddy system operations |
*/ |
link_t * zone_buddy_find_buddy(buddy_system_t *b, link_t * buddy); |
link_t * zone_buddy_bisect(buddy_system_t *b, link_t * block); |
link_t * zone_buddy_coalesce(buddy_system_t *b, link_t * buddy_l, link_t * buddy_r); |
void zone_buddy_set_order(buddy_system_t *b, link_t * block, __u8 order); |
__u8 zone_buddy_get_order(buddy_system_t *b, link_t * block); |
void zone_buddy_mark_busy(buddy_system_t *b, link_t * block); |
/* |
* TODO: Implement the following functions. |
*/ |
extern frame_t *frame_reference(frame_t *frame); |
extern void frame_release(frame_t *frame); |
/* |
* Console functions |
*/ |
extern void zone_print_list(void); |
extern void zone_print_one(__address base); |
#endif |
/kernel/branches/falloc_bad/generic/include/mm/asid.h |
---|
0,0 → 1,34 |
/* |
* Copyright (C) 2006 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __ASID_H__ |
#define __ASID_H__ |
#define ASID_KERNEL 0 |
#endif |
/kernel/branches/falloc_bad/generic/include/mm/buddy.h |
---|
0,0 → 1,61 |
/* |
* Copyright (C) 2005 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __BUDDY_H__ |
#define __BUDDY_H__ |
#include <arch/types.h> |
#include <typedefs.h> |
#define BUDDY_SYSTEM_INNER_BLOCK 0xff |
/** Buddy system operations to be implemented by each implementations. */ |
struct buddy_system_operations { |
link_t *(* find_buddy)(buddy_system_t *, link_t *); /**< Return pointer to left-side or right-side buddy for block passed as argument. */ |
link_t *(* bisect)(buddy_system_t *, link_t *); /**< Bisect the block passed as argument and return pointer to the new right-side buddy. */ |
link_t *(* coalesce)(buddy_system_t *, link_t *, link_t *); /**< Coalesce two buddies into a bigger block. */ |
void (*set_order)(buddy_system_t *, link_t *, __u8); /**< Set order of block passed as argument. */ |
__u8 (*get_order)(buddy_system_t *, link_t *); /**< Return order of block passed as argument. */ |
void (*mark_busy)(buddy_system_t *, link_t *); /**< Mark block as busy */ |
}; |
struct buddy_system { |
__u8 max_order; |
link_t *order; |
buddy_system_operations_t *op; |
void *data; /**< Pointer to be used by the implementation. */ |
}; |
extern buddy_system_t *buddy_system_create(__u8 max_order, buddy_system_operations_t *op, void *data); |
extern link_t *buddy_system_alloc(buddy_system_t *b, __u8 i); |
extern bool buddy_system_can_alloc(buddy_system_t *b, __u8 order); |
extern void buddy_system_free(buddy_system_t *b, link_t *block); |
extern void buddy_system_structure_print(buddy_system_t *b, size_t elem_size); |
#endif |
/kernel/branches/falloc_bad/generic/include/mm/tlb.h |
---|
0,0 → 1,76 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __TLB_H__ |
#define __TLB_H__ |
#include <arch/mm/asid.h> |
#include <arch/types.h> |
extern void tlb_init(void); |
#ifdef CONFIG_SMP |
extern void tlb_shootdown_start(void); |
extern void tlb_shootdown_finalize(void); |
extern void tlb_shootdown_ipi_recv(void); |
#else |
# define tlb_shootdown_start() ; |
# define tlb_shootdown_finalize() ; |
# define tlb_shootdown_ipi_recv() ; |
#endif /* CONFIG_SMP */ |
/** Type of TLB shootdown message. */ |
enum tlb_invalidate_type { |
TLB_INVL_INVALID = 0, /**< Invalid type. */ |
TLB_INVL_ALL, /**< Invalidate all entries in TLB. */ |
TLB_INVL_ASID, /**< Invalidate all entries belonging to one address space. */ |
TLB_INVL_PAGE /**< Invalidate one entry for specified page. */ |
}; |
typedef enum tlb_invalidate_type tlb_invalidate_type_t; |
/** TLB shootdown message. */ |
struct tlb_shootdown_msg { |
tlb_invalidate_type_t type; /**< Message type. */ |
asid_t asid; /**< Address space identifier. */ |
__address page; /**< Page address. */ |
}; |
typedef struct tlb_shootdown_msg tlb_shootdown_msg_t; |
/* Export TLB interface that each architecture must implement. */ |
extern void tlb_arch_init(void); |
extern void tlb_print(void); |
extern void tlb_invalidate(asid_t asid); |
extern void tlb_shootdown_ipi_send(void); |
extern void tlb_invalidate_all(void); |
extern void tlb_invalidate_asid(asid_t asid); |
extern void tlb_invalidate_page(asid_t asid, __address page); |
#endif |
/kernel/branches/falloc_bad/generic/include/mm/heap.h |
---|
0,0 → 1,51 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __HEAP_H__ |
#define __HEAP_H__ |
#include <arch/types.h> |
#include <typedefs.h> |
#define malloc(size) early_malloc(size) |
#define free(ptr) early_free(ptr) |
struct chunk { |
int used; |
chunk_t *next; |
chunk_t *prev; |
__u32 size; |
__native data[0]; |
}; |
extern void early_heap_init(__address heap, size_t size); |
extern void *early_malloc(size_t size) __attribute__ ((malloc)); |
extern void early_free(void *ptr); |
#endif |
/kernel/branches/falloc_bad/generic/include/main/uinit.h |
---|
0,0 → 1,36 |
/* |
* Copyright (C) 2005 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __UINIT_H__ |
#define __UINIT_H__ |
#include <arch/types.h> |
extern void uinit(void *arg); |
#endif |
/kernel/branches/falloc_bad/generic/include/main/version.h |
---|
0,0 → 1,34 |
/* |
* Copyright (C) 2006 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __VERSION_H__ |
#define __VERSION_H__ |
extern void version_print(void); |
#endif |
/kernel/branches/falloc_bad/generic/include/main/kinit.h |
---|
0,0 → 1,34 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __KINIT_H__ |
#define __KINIT_H__ |
extern void kinit(void *arg); |
#endif |
/kernel/branches/falloc_bad/generic/include/syscall/syscall.h |
---|
0,0 → 1,47 |
/* |
* Copyright (C) 2005 Martin Decky |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __SYSCALL_H__ |
#define __SYSCALL_H__ |
#include <typedefs.h> |
typedef enum { |
SYS_CTL = 0, |
SYS_IO = 1, |
SYSCALL_END |
} syscall_t; |
typedef int (*syshandler_t)(); |
extern int sys_ctl(void); |
extern int sys_io(int fd, const void *buf, size_t count); |
extern syshandler_t syscall_table[SYSCALL_END]; |
#endif |
/kernel/branches/falloc_bad/generic/include/proc/task.h |
---|
0,0 → 1,50 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __TASK_H__ |
#define __TASK_H__ |
#include <typedefs.h> |
#include <synch/spinlock.h> |
#include <list.h> |
/** Task structure. */ |
struct task { |
SPINLOCK_DECLARE(lock); |
link_t th_head; /**< List of threads contained in this task. */ |
link_t tasks_link; /**< Link to other tasks within the system. */ |
as_t *as; /**< Address space. */ |
}; |
extern spinlock_t tasks_lock; |
extern link_t tasks_head; |
extern void task_init(void); |
extern task_t *task_create(as_t *as); |
#endif |
/kernel/branches/falloc_bad/generic/include/proc/scheduler.h |
---|
0,0 → 1,63 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __SCHEDULER_H__ |
#define __SCHEDULER_H__ |
#include <synch/spinlock.h> |
#include <time/clock.h> /* HZ */ |
#include <typedefs.h> |
#include <arch/atomic.h> |
#include <list.h> |
#define RQ_COUNT 16 |
#define NEEDS_RELINK_MAX (HZ) |
/** Scheduler run queue structure. */ |
struct runq { |
SPINLOCK_DECLARE(lock); |
link_t rq_head; /**< List of ready threads. */ |
count_t n; /**< Number of threads in rq_ready. */ |
}; |
extern atomic_t nrdy; |
extern void scheduler_init(void); |
extern void scheduler_fpu_lazy_request(void); |
extern void scheduler(void); |
extern void kcpulb(void *arg); |
extern void before_thread_runs(void); |
/* |
* To be defined by architectures: |
*/ |
extern void before_thread_runs_arch(void); |
#endif |
/kernel/branches/falloc_bad/generic/include/proc/thread.h |
---|
0,0 → 1,137 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __THREAD_H__ |
#define __THREAD_H__ |
#include <arch/thread.h> |
#include <synch/spinlock.h> |
#include <arch/context.h> |
#include <fpu_context.h> |
#include <arch/types.h> |
#include <typedefs.h> |
#include <time/timeout.h> |
#include <synch/rwlock.h> |
#include <config.h> |
#include <list.h> |
#define THREAD_STACK_SIZE STACK_SIZE |
#define THREAD_USER_STACK 1 |
enum state { |
Invalid, /**< It is an error, if thread is found in this state. */ |
Running, /**< State of a thread that is currently executing on some CPU. */ |
Sleeping, /**< Thread in this state is waiting for an event. */ |
Ready, /**< State of threads in a run queue. */ |
Entering, /**< Threads are in this state before they are first readied. */ |
Exiting /**< After a thread calls thread_exit(), it is put into Exiting state. */ |
}; |
extern char *thread_states[]; |
#define X_WIRED (1<<0) |
#define X_STOLEN (1<<1) |
struct thread { |
link_t rq_link; /**< Run queue link. */ |
link_t wq_link; /**< Wait queue link. */ |
link_t th_link; /**< Links to threads within containing task. */ |
link_t threads_link; /**< Link to the list of all threads. */ |
/** Lock protecting thread structure. |
* |
* Protects the whole thread structure except list links above. |
* Must be acquired before T.lock for each T of type task_t. |
* |
*/ |
SPINLOCK_DECLARE(lock); |
void (* thread_code)(void *); /**< Function implementing the thread. */ |
void *thread_arg; /**< Argument passed to thread_code() function. */ |
context_t saved_context; /**< From here, the stored context is restored when the thread is scheduled. */ |
context_t sleep_timeout_context; /**< From here, the stored failover context is restored when sleep times out. */ |
waitq_t *sleep_queue; /**< Wait queue in which this thread sleeps. */ |
timeout_t sleep_timeout; /**< Timeout used for timeoutable sleeping. */ |
volatile int timeout_pending; /**< Flag signalling sleep timeout in progress. */ |
fpu_context_t saved_fpu_context; |
int fpu_context_exists; |
/* |
* Defined only if thread doesn't run. |
* It means that fpu context is in CPU that last time executes this thread. |
* This disables migration |
*/ |
int fpu_context_engaged; |
rwlock_type_t rwlock_holder_type; |
void (* call_me)(void *); /**< Funtion to be called in scheduler before the thread is put asleep. */ |
void *call_me_with; /**< Argument passed to call_me(). */ |
state_t state; /**< Thread's state. */ |
int flags; /**< Thread's flags. */ |
cpu_t *cpu; /**< Thread's CPU. */ |
task_t *task; /**< Containing task. */ |
__u64 ticks; /**< Ticks before preemption. */ |
int priority; /**< Thread's priority. Implemented as index to CPU->rq */ |
__u32 tid; /**< Thread ID. */ |
ARCH_THREAD_DATA; /**< Architecture-specific data. */ |
__u8 *kstack; /**< Thread's kernel stack. */ |
__u8 *ustack; /**< Thread's user stack. */ |
}; |
/** Thread list lock. |
* |
* This lock protects all link_t structures chained in threads_head. |
* Must be acquired before T.lock for each T of type thread_t. |
* |
*/ |
extern spinlock_t threads_lock; |
extern link_t threads_head; /**< List of all threads in the system. */ |
extern void thread_init(void); |
extern thread_t *thread_create(void (* func)(void *), void *arg, task_t *task, int flags); |
extern void thread_ready(thread_t *t); |
extern void thread_exit(void); |
extern void thread_sleep(__u32 sec); |
extern void thread_usleep(__u32 usec); |
extern void thread_register_call_me(void (* call_me)(void *), void *call_me_with); |
#endif |
/kernel/branches/falloc_bad/generic/include/arch.h |
---|
0,0 → 1,74 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __ARCH_H__ |
#define __ARCH_H__ |
#include <arch/types.h> |
#include <typedefs.h> |
#include <cpu.h> |
#include <arch/cpu.h> |
#include <arch/asm.h> |
#define CPU THE->cpu |
#define THREAD THE->thread |
#define TASK THE->task |
#define AS THE->as |
#define PREEMPTION_DISABLED THE->preemption_disabled |
/** |
* For each possible kernel stack, structure |
* of the following type will be placed at |
* the bottom of the stack. |
*/ |
struct the { |
count_t preemption_disabled; /**< Preemption disabled counter. */ |
thread_t *thread; /**< Current thread. */ |
task_t *task; /**< Current task. */ |
cpu_t *cpu; /**< Executing cpu. */ |
as_t *as; /**< Current address space. */ |
}; |
#define THE ((the_t *)(get_stack_base())) |
extern void the_initialize(the_t *the); |
extern void the_copy(the_t *src, the_t *dst); |
extern void arch_pre_mm_init(void); |
extern void arch_post_mm_init(void); |
extern void arch_pre_smp_init(void); |
extern void arch_post_smp_init(void); |
extern void calibrate_delay_loop(void); |
extern ipl_t interrupts_disable(void); |
extern ipl_t interrupts_enable(void); |
extern void interrupts_restore(ipl_t ipl); |
extern ipl_t interrupts_read(void); |
#endif |
/kernel/branches/falloc_bad/generic/include/typedefs.h |
---|
0,0 → 1,91 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __TYPEDEFS_H__ |
#define __TYPEDEFS_H__ |
#define false 0 |
#define true 1 |
typedef short bool; |
typedef unsigned int size_t; |
typedef unsigned int count_t; |
typedef unsigned int index_t; |
typedef struct config config_t; |
typedef struct cpu_info cpu_info_t; |
typedef struct cpu cpu_t; |
typedef struct cpu_arch cpu_arch_t; |
typedef struct task task_t; |
typedef enum state state_t; |
typedef struct thread thread_t; |
typedef struct context context_t; |
typedef struct fpu_context fpu_context_t; |
typedef struct timeout timeout_t; |
typedef struct runq runq_t; |
typedef struct spinlock spinlock_t; |
typedef struct mutex mutex_t; |
typedef struct semaphore semaphore_t; |
typedef struct rwlock rwlock_t; |
typedef enum rwlock_type rwlock_type_t; |
typedef struct condvar condvar_t; |
typedef struct waitq waitq_t; |
typedef struct chunk chunk_t; |
typedef struct buddy_system buddy_system_t; |
typedef struct buddy_system_operations buddy_system_operations_t; |
typedef struct zone zone_t; |
typedef struct frame frame_t; |
typedef struct region region_t; |
typedef enum as_area_type as_area_type_t; |
typedef struct as_area as_area_t; |
typedef struct as as_t; |
typedef struct link link_t; |
typedef char *char_ptr; |
typedef struct the the_t; |
typedef struct chardev chardev_t; |
typedef enum cmd_arg_type cmd_arg_type_t; |
typedef struct cmd_arg cmd_arg_t; |
typedef struct cmd_info cmd_info_t; |
typedef void (* iroutine)(int n, void *stack); |
#endif |
/kernel/branches/falloc_bad/generic/include/cpu.h |
---|
0,0 → 1,95 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __CPU_H__ |
#define __CPU_H__ |
#include <arch/cpu.h> |
#include <proc/scheduler.h> |
#include <synch/spinlock.h> |
#include <synch/waitq.h> |
#include <arch/types.h> |
#include <typedefs.h> |
#include <arch/context.h> |
#include <config.h> |
#include <list.h> |
#define CPU_STACK_SIZE STACK_SIZE |
/** CPU structure. |
* |
* There is one structure like this for every processor. |
*/ |
struct cpu { |
SPINLOCK_DECLARE(lock); |
context_t saved_context; |
volatile count_t nrdy; |
runq_t rq[RQ_COUNT]; |
volatile count_t needs_relink; |
SPINLOCK_DECLARE(timeoutlock); |
link_t timeout_active_head; |
#ifdef CONFIG_SMP |
atomic_t kcpulbstarted; |
waitq_t kcpulb_wq; |
#endif /* CONFIG_SMP */ |
/** |
* Processor ID assigned by kernel. |
*/ |
int id; |
int active; |
int tlb_active; |
__u16 frequency_mhz; |
__u32 delay_loop_const; |
cpu_arch_t arch; |
thread_t *fpu_owner; |
/** |
* Stack used by scheduler when there is no running thread. |
*/ |
__u8 *stack; |
}; |
extern cpu_t *cpus; |
extern void cpu_init(void); |
extern void cpu_list(void); |
extern void cpu_arch_init(void); |
extern void cpu_identify(void); |
extern void cpu_print_report(cpu_t *m); |
#endif |
/kernel/branches/falloc_bad/generic/include/console/chardev.h |
---|
0,0 → 1,68 |
/* |
* Copyright (C) 2005 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __CHARDEV_H__ |
#define __CHARDEV_H__ |
#include <typedefs.h> |
#include <arch/types.h> |
#include <synch/waitq.h> |
#include <synch/spinlock.h> |
#define CHARDEV_BUFLEN 512 |
/* Character device operations interface. */ |
struct chardev_operations { |
void (* suspend)(chardev_t *); /**< Suspend pushing characters. */ |
void (* resume)(chardev_t *); /**< Resume pushing characters. */ |
void (* write)(chardev_t *, char c); /**< Write character to stream. */ |
/** Read character directly from device, assume interrupts disabled */ |
char (* read)(chardev_t *); |
}; |
typedef struct chardev_operations chardev_operations_t; |
/** Character input device. */ |
struct chardev { |
char *name; |
waitq_t wq; |
SPINLOCK_DECLARE(lock); /**< Protects everything below. */ |
__u8 buffer[CHARDEV_BUFLEN]; |
count_t counter; |
chardev_operations_t *op; /**< Implementation of chardev operations. */ |
index_t index; |
void *data; |
}; |
extern void chardev_initialize(char *name, |
chardev_t *chardev, |
chardev_operations_t *op); |
extern void chardev_push_character(chardev_t *chardev, __u8 ch); |
#endif /* __CHARDEV_H__ */ |
/kernel/branches/falloc_bad/generic/include/console/kconsole.h |
---|
0,0 → 1,75 |
/* |
* Copyright (C) 2005 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __KCONSOLE_H__ |
#define __KCONSOLE_H__ |
#include <typedefs.h> |
#include <list.h> |
#include <synch/spinlock.h> |
#define MAX_CMDLINE 256 |
#define KCONSOLE_HISTORY 10 |
enum cmd_arg_type { |
ARG_TYPE_INVALID = 0, |
ARG_TYPE_INT, |
ARG_TYPE_STRING, |
ARG_TYPE_VAR /**< Variable type - either symbol or string */ |
}; |
/** Structure representing one argument of kconsole command line. */ |
struct cmd_arg { |
cmd_arg_type_t type; /**< Type descriptor. */ |
void *buffer; /**< Buffer where to store data. */ |
size_t len; /**< Size of the buffer. */ |
__native intval; /**< Integer value */ |
cmd_arg_type_t vartype; /**< Resulting type of variable arg */ |
}; |
/** Structure representing one kconsole command. */ |
struct cmd_info { |
link_t link; /**< Command list link. */ |
SPINLOCK_DECLARE(lock); /**< This lock protects everything below. */ |
const char *name; /**< Command name. */ |
const char *description; /**< Textual description. */ |
int (* func)(cmd_arg_t *); /**< Function implementing the command. */ |
count_t argc; /**< Number of arguments. */ |
cmd_arg_t *argv; /**< Argument vector. */ |
void (* help)(void); /**< Function for printing detailed help. */ |
}; |
extern spinlock_t cmd_lock; |
extern link_t cmd_head; |
extern void kconsole_init(void); |
extern void kconsole(void *prompt); |
extern int cmd_register(cmd_info_t *cmd); |
#endif |
/kernel/branches/falloc_bad/generic/include/console/console.h |
---|
0,0 → 1,43 |
/* |
* Copyright (C) 2005 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __CONSOLE_H__ |
#define __CONSOLE_H__ |
#include <arch/types.h> |
#include <typedefs.h> |
extern chardev_t *stdin; |
extern chardev_t *stdout; |
extern __u8 getc(chardev_t *chardev); |
__u8 _getc(chardev_t *chardev); |
extern count_t gets(chardev_t *chardev, char *buf, size_t buflen); |
extern void putchar(char c); |
#endif /* __CHARDEV_H__ */ |
/kernel/branches/falloc_bad/generic/include/console/cmd.h |
---|
0,0 → 1,37 |
/* |
* Copyright (C) 2005 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __CMD_H__ |
#define __CMD_H__ |
#include <typedefs.h> |
extern void cmd_initialize(cmd_info_t *cmd); |
extern void cmd_init(void); |
#endif |
/kernel/branches/falloc_bad/generic/include/interrupt.h |
---|
0,0 → 1,47 |
/* |
* Copyright (C) 2005 Ondrej Palkovsky |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __INTERRUPT_H__ |
#define __INTERRUPT_H__ |
#include <arch/interrupt.h> |
#include <typedefs.h> |
#ifndef IVT_ITEMS |
# define IVT_ITEMS 0 |
#endif |
#ifndef IVT_FIRST |
# define IVT_FIRST 0 |
#endif |
extern iroutine exc_register(int n, const char *name, iroutine f); |
extern void exc_dispatch(int n, void *stack); |
void exc_init(void); |
#endif |
/kernel/branches/falloc_bad/generic/include/config.h |
---|
0,0 → 1,61 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __CONFIG_H__ |
#define __CONFIG_H__ |
#include <arch/types.h> |
#include <typedefs.h> |
#include <arch/mm/page.h> |
#define STACK_SIZE PAGE_SIZE |
#define CONFIG_MEMORY_SIZE (8*1024*1024) |
#define CONFIG_HEAP_SIZE (300*1024) |
#define CONFIG_STACK_SIZE STACK_SIZE |
struct config { |
count_t cpu_count; |
volatile count_t cpu_active; |
__address base; |
size_t memory_size; |
__address init_addr; |
size_t init_size; |
__address heap_addr; |
size_t heap_size; |
size_t heap_delta; /**< Extra space between heap and stack (enforced by alignment requirements) */ |
size_t kernel_size; /**< Size of memory in bytes taken by kernel, heap and stack */ |
}; |
extern config_t config; |
#endif |
/kernel/branches/falloc_bad/generic/include/debug.h |
---|
0,0 → 1,61 |
/* |
* Copyright (C) 2005 Martin Decky |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __DEBUG_H__ |
#define __DEBUG_H__ |
#include <panic.h> |
#include <arch/debug.h> |
#include <arch.h> |
#define CALLER ((__address)__builtin_return_address(0)) |
#ifndef HERE |
/** Current Instruction Pointer address */ |
# define HERE ((__address *)0) |
#endif |
/** Debugging ASSERT macro |
* |
* If CONFIG_DEBUG is set, the ASSERT() macro |
* evaluates expr and if it is false raises |
* kernel panic. |
* |
* @param expr Expression which is expected to be true. |
* |
*/ |
#ifdef CONFIG_DEBUG |
# define ASSERT(expr) if (!(expr)) { panic("assertion failed (%s), caller=%P\n", #expr, CALLER); } |
#else |
# define ASSERT(expr) |
#endif |
#define STRING(arg) STRING_ARG(arg) |
#define STRING_ARG(arg) #arg |
#endif |
/kernel/branches/falloc_bad/generic/include/func.h |
---|
0,0 → 1,45 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __FUNC_H__ |
#define __FUNC_H__ |
#include <arch/types.h> |
#include <typedefs.h> |
#include <arch/atomic.h> |
extern atomic_t haltstate; |
extern void halt(void); |
extern size_t strlen(const char *str); |
extern int strncmp(const char *src, const char *dst, size_t len); |
extern void strncpy(char *dest, const char *src, size_t len); |
extern __native atoi(const char *text); |
#endif |
/kernel/branches/falloc_bad/generic/include/synch/spinlock.h |
---|
0,0 → 1,86 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __SPINLOCK_H__ |
#define __SPINLOCK_H__ |
#include <arch/types.h> |
#include <typedefs.h> |
#include <preemption.h> |
#include <arch/atomic.h> |
#ifdef CONFIG_SMP |
struct spinlock { |
#ifdef CONFIG_DEBUG_SPINLOCK |
char *name; |
#endif |
atomic_t val; |
}; |
/* |
* SPINLOCK_DECLARE is to be used for dynamically allocated spinlocks, |
* where the lock gets initialized in run time. |
*/ |
#define SPINLOCK_DECLARE(slname) spinlock_t slname |
/* |
* SPINLOCK_INITIALIZE is to be used for statically allocated spinlocks. |
* It declares and initializes the lock. |
*/ |
#ifdef CONFIG_DEBUG_SPINLOCK |
#define SPINLOCK_INITIALIZE(slname) \ |
spinlock_t slname = { \ |
.name = #slname, \ |
.val = { 0 } \ |
} |
#else |
#define SPINLOCK_INITIALIZE(slname) \ |
spinlock_t slname = { \ |
.val = { 0 } \ |
} |
#endif |
extern void spinlock_initialize(spinlock_t *sl, char *name); |
extern void spinlock_lock(spinlock_t *sl); |
extern int spinlock_trylock(spinlock_t *sl); |
extern void spinlock_unlock(spinlock_t *sl); |
#else |
/* On UP systems, spinlocks are effectively left out. */ |
#define SPINLOCK_DECLARE(name) |
#define SPINLOCK_INITIALIZE(name) |
#define spinlock_initialize(x,name) |
#define spinlock_lock(x) preemption_disable() |
#define spinlock_trylock(x) (preemption_disable(), 1) |
#define spinlock_unlock(x) preemption_enable() |
#endif |
#endif |
/kernel/branches/falloc_bad/generic/include/synch/rwlock.h |
---|
0,0 → 1,69 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __RWLOCK_H__ |
#define __RWLOCK_H__ |
#include <arch/types.h> |
#include <typedefs.h> |
#include <synch/mutex.h> |
#include <synch/synch.h> |
#include <synch/spinlock.h> |
enum rwlock_type { |
RWLOCK_NONE, |
RWLOCK_READER, |
RWLOCK_WRITER |
}; |
struct rwlock { |
SPINLOCK_DECLARE(lock); |
mutex_t exclusive; /**< Mutex for writers, readers can bypass it if readers_in is positive. */ |
count_t readers_in; /**< Number of readers in critical section. */ |
}; |
#define rwlock_write_lock(rwl) \ |
_rwlock_write_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_BLOCKING) |
#define rwlock_read_lock(rwl) \ |
_rwlock_read_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_BLOCKING) |
#define rwlock_write_trylock(rwl) \ |
_rwlock_write_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_NON_BLOCKING) |
#define rwlock_read_trylock(rwl) \ |
_rwlock_read_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_NON_BLOCKING) |
#define rwlock_write_lock_timeout(rwl,usec) \ |
_rwlock_write_lock_timeout((rwl),(usec),SYNCH_NON_BLOCKING) |
#define rwlock_read_lock_timeout(rwl,usec) \ |
_rwlock_read_lock_timeout((rwl),(usec),SYNCH_NON_BLOCKING) |
extern void rwlock_initialize(rwlock_t *rwl); |
extern void rwlock_read_unlock(rwlock_t *rwl); |
extern void rwlock_write_unlock(rwlock_t *rwl); |
extern int _rwlock_read_lock_timeout(rwlock_t *rwl, __u32 usec, int trylock); |
extern int _rwlock_write_lock_timeout(rwlock_t *rwl, __u32 usec, int trylock); |
#endif |
/kernel/branches/falloc_bad/generic/include/synch/waitq.h |
---|
0,0 → 1,64 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __WAITQ_H__ |
#define __WAITQ_H__ |
#include <arch/types.h> |
#include <typedefs.h> |
#include <synch/spinlock.h> |
#include <synch/synch.h> |
#include <list.h> |
#define WAKEUP_FIRST 0 |
#define WAKEUP_ALL 1 |
/** Wait queue structure. */ |
struct waitq { |
/** Lock protecting wait queue structure. |
* |
* Must be acquired before T.lock for each T of type thread_t. |
*/ |
SPINLOCK_DECLARE(lock); |
int missed_wakeups; /**< Number of waitq_wakeup() calls that didn't find a thread to wake up. */ |
link_t head; /**< List of sleeping threads for wich there was no missed_wakeup. */ |
}; |
#define waitq_sleep(wq) \ |
waitq_sleep_timeout((wq),SYNCH_NO_TIMEOUT,SYNCH_BLOCKING) |
extern void waitq_interrupted_sleep(void *data); |
extern void waitq_initialize(waitq_t *wq); |
extern int waitq_sleep_timeout(waitq_t *wq, __u32 usec, int nonblocking); |
extern void waitq_wakeup(waitq_t *wq, bool all); |
extern void _waitq_wakeup_unsafe(waitq_t *wq, bool all); |
#endif |
/kernel/branches/falloc_bad/generic/include/synch/synch.h |
---|
0,0 → 1,44 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __SYNCH_H__ |
#define __SYNCH_H__ |
#define SYNCH_NO_TIMEOUT 0 /**< Request with no timeout. */ |
#define SYNCH_BLOCKING 0 /**< Blocking operation request. */ |
#define SYNCH_NON_BLOCKING 1 /**< Non-blocking operation request. */ |
#define ESYNCH_WOULD_BLOCK 1 /**< Could not satisfy the request without going to sleep. */ |
#define ESYNCH_TIMEOUT 2 /**< Timeout occurred. */ |
#define ESYNCH_OK_ATOMIC 4 /**< Operation succeeded without sleeping. */ |
#define ESYNCH_OK_BLOCKED 8 /**< Operation succeeded and did sleep. */ |
#define SYNCH_FAILED(rc) ((rc) & (ESYNCH_WOULD_BLOCK | ESYNCH_TIMEOUT)) |
#define SYNCH_OK(rc) ((rc) & (ESYNCH_OK_ATOMIC | ESYNCH_OK_BLOCKED)) |
#endif |
/kernel/branches/falloc_bad/generic/include/synch/semaphore.h |
---|
0,0 → 1,53 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __SEMAPHORE_H__ |
#define __SEMAPHORE_H__ |
#include <arch/types.h> |
#include <typedefs.h> |
#include <synch/waitq.h> |
#include <synch/synch.h> |
struct semaphore |
{ |
waitq_t wq; |
}; |
#define semaphore_down(s) \ |
_semaphore_down_timeout((s),SYNCH_NO_TIMEOUT,SYNCH_BLOCKING) |
#define semaphore_trydown(s) \ |
_semaphore_down_timeout((s),SYNCH_NO_TIMEOUT,SYNCH_NON_BLOCKING) |
#define semaphore_down_timeout(s,usec) \ |
_semaphore_down_timeout((s),(usec),SYNCH_NON_BLOCKING) |
extern void semaphore_initialize(semaphore_t *s, int val); |
extern int _semaphore_down_timeout(semaphore_t *s, __u32 usec, int trydown); |
extern void semaphore_up(semaphore_t *s); |
#endif |
/kernel/branches/falloc_bad/generic/include/synch/condvar.h |
---|
0,0 → 1,53 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __CONDVAR_H__ |
#define __CONDVAR_H__ |
#include <arch/types.h> |
#include <synch/waitq.h> |
#include <typedefs.h> |
#include <synch/synch.h> |
struct condvar { |
waitq_t wq; |
}; |
#define condvar_wait(cv,mtx) \ |
_condvar_wait_timeout((cv),(mtx),SYNCH_NO_TIMEOUT,SYNCH_BLOCKING) |
#define condvar_trywait(cv,mtx) \ |
_condvar_wait_timeout((cv),(mtx),SYNCH_NO_TIMEOUT,SYNCH_NON_BLOCKING) |
#define condvar_wait_timeout(cv,mtx,usec) \ |
_condvar_wait_timeout((cv),(mtx),(usec),SYNCH_NON_BLOCKING) |
extern void condvar_initialize(condvar_t *cv); |
extern void condvar_signal(condvar_t *cv); |
extern void condvar_broadcast(condvar_t *cv); |
extern int _condvar_wait_timeout(condvar_t *cv, mutex_t *mtx, __u32 usec, int trywait); |
#endif |
/kernel/branches/falloc_bad/generic/include/synch/mutex.h |
---|
0,0 → 1,52 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __MUTEX_H__ |
#define __MUTEX_H__ |
#include <arch/types.h> |
#include <typedefs.h> |
#include <synch/semaphore.h> |
#include <synch/synch.h> |
struct mutex { |
semaphore_t sem; |
}; |
#define mutex_lock(mtx) \ |
_mutex_lock_timeout((mtx),SYNCH_NO_TIMEOUT,SYNCH_BLOCKING) |
#define mutex_trylock(mtx) \ |
_mutex_lock_timeout((mtx),SYNCH_NO_TIMEOUT,SYNCH_NON_BLOCKING) |
#define mutex_lock_timeout(mtx,usec) \ |
_mutex_lock_timeout((mtx),(usec),SYNCH_NON_BLOCKING) |
extern void mutex_initialize(mutex_t *mtx); |
extern int _mutex_lock_timeout(mutex_t *mtx, __u32 usec, int trylock); |
extern void mutex_unlock(mutex_t *mtx); |
#endif |
/kernel/branches/falloc_bad/generic/include/list.h |
---|
0,0 → 1,177 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __LIST_H__ |
#define __LIST_H__ |
#include <arch/types.h> |
#include <typedefs.h> |
/** Doubly linked list head and link type. */ |
struct link { |
link_t *prev; /**< Pointer to the previous item in the list. */ |
link_t *next; /**< Pointer to the next item in the list. */ |
}; |
/** Declare and initialize statically allocated list. |
* |
* @param name Name of the new statically allocated list. |
*/ |
#define LIST_INITIALIZE(name) link_t name = { .prev = &name, .next = &name } |
/** Initialize doubly-linked circular list link |
* |
* Initialize doubly-linked list link. |
* |
* @param link Pointer to link_t structure to be initialized. |
*/ |
static inline void link_initialize(link_t *link) |
{ |
link->prev = NULL; |
link->next = NULL; |
} |
/** Initialize doubly-linked circular list |
* |
* Initialize doubly-linked circular list. |
* |
* @param head Pointer to link_t structure representing head of the list. |
*/ |
static inline void list_initialize(link_t *head) |
{ |
head->prev = head; |
head->next = head; |
} |
/** Add item to the beginning of doubly-linked circular list |
* |
* Add item to the beginning of doubly-linked circular list. |
* |
* @param link Pointer to link_t structure to be added. |
* @param head Pointer to link_t structure representing head of the list. |
*/ |
static inline void list_prepend(link_t *link, link_t *head) |
{ |
link->next = head->next; |
link->prev = head; |
head->next->prev = link; |
head->next = link; |
} |
/** Add item to the end of doubly-linked circular list |
* |
* Add item to the end of doubly-linked circular list. |
* |
* @param link Pointer to link_t structure to be added. |
* @param head Pointer to link_t structure representing head of the list. |
*/ |
static inline void list_append(link_t *link, link_t *head) |
{ |
link->prev = head->prev; |
link->next = head; |
head->prev->next = link; |
head->prev = link; |
} |
/** Remove item from doubly-linked circular list |
* |
* Remove item from doubly-linked circular list. |
* |
* @param link Pointer to link_t structure to be removed from the list it is contained in. |
*/ |
static inline void list_remove(link_t *link) |
{ |
link->next->prev = link->prev; |
link->prev->next = link->next; |
link_initialize(link); |
} |
/** Query emptiness of doubly-linked circular list |
* |
* Query emptiness of doubly-linked circular list. |
* |
* @param head Pointer to link_t structure representing head of the list. |
*/ |
static inline bool list_empty(link_t *head) |
{ |
return head->next == head ? true : false; |
} |
/** Split or concatenate headless doubly-linked circular list |
* |
* Split or concatenate headless doubly-linked circular list. |
* |
* Note that the algorithm works both directions: |
* concatenates splitted lists and splits concatenated lists. |
* |
* @param part1 Pointer to link_t structure leading the first (half of the headless) list. |
* @param part2 Pointer to link_t structure leading the second (half of the headless) list. |
*/ |
static inline void headless_list_split_or_concat(link_t *part1, link_t *part2) |
{ |
link_t *hlp; |
part1->prev->next = part2; |
part2->prev->next = part1; |
hlp = part1->prev; |
part1->prev = part2->prev; |
part2->prev = hlp; |
} |
/** Split headless doubly-linked circular list |
* |
* Split headless doubly-linked circular list. |
* |
* @param part1 Pointer to link_t structure leading the first half of the headless list. |
* @param part2 Pointer to link_t structure leading the second half of the headless list. |
*/ |
static inline void headless_list_split(link_t *part1, link_t *part2) |
{ |
headless_list_split_or_concat(part1, part2); |
} |
/** Concatenate two headless doubly-linked circular lists |
* |
* Concatenate two headless doubly-linked circular lists. |
* |
* @param part1 Pointer to link_t structure leading the first headless list. |
* @param part2 Pointer to link_t structure leading the second headless list. |
*/ |
static inline void headless_list_concat(link_t *part1, link_t *part2) |
{ |
headless_list_split_or_concat(part1, part2); |
} |
#define list_get_instance(link,type,member) (type *)(((__u8*)(link))-((__u8*)&(((type *)NULL)->member))) |
extern bool list_member(const link_t *link, const link_t *head); |
extern void list_concat(link_t *head1, link_t *head2); |
#endif |
/kernel/branches/falloc_bad/generic/include/time/timeout.h |
---|
0,0 → 1,60 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __TIMEOUT_H__ |
#define __TIMEOUT_H__ |
#include <arch/types.h> |
#include <typedefs.h> |
#include <synch/spinlock.h> |
#include <list.h> |
#define us2ticks(us) ((__u64)(((__u32) (us)/(1000000/HZ)))) |
typedef void (* timeout_handler_t)(void *arg); |
struct timeout { |
SPINLOCK_DECLARE(lock); |
link_t link; /**< Link to the list of active timeouts on THE->cpu */ |
__u64 ticks; /**< Timeout will be activated in this amount of clock() ticks. */ |
timeout_handler_t handler; /**< Function that will be called on timeout activation. */ |
void *arg; /**< Argument to be passed to handler() function. */ |
cpu_t *cpu; /**< On which processor is this timeout registered. */ |
}; |
extern void timeout_init(void); |
extern void timeout_initialize(timeout_t *t); |
extern void timeout_reinitialize(timeout_t *t); |
extern void timeout_register(timeout_t *t, __u64 usec, timeout_handler_t f, void *arg); |
extern bool timeout_unregister(timeout_t *t); |
#endif |
/kernel/branches/falloc_bad/generic/include/time/clock.h |
---|
0,0 → 1,36 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __CLOCK_H__ |
#define __CLOCK_H__ |
#define HZ 100 |
extern void clock(void); |
#endif |
/kernel/branches/falloc_bad/generic/include/time/delay.h |
---|
0,0 → 1,36 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __DELAY_H__ |
#define __DELAY_H__ |
#include <arch/types.h> |
extern void delay(__u32 microseconds); |
#endif |
/kernel/branches/falloc_bad/generic/include/panic.h |
---|
0,0 → 1,40 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __PANIC_H__ |
#define __PANIC_H__ |
#ifdef CONFIG_DEBUG |
# define panic(format, ...) panic_printf("Kernel panic in %s() at %s on line %d: " format, __FUNCTION__, __FILE__, __LINE__, ##__VA_ARGS__); |
#else |
# define panic(format, ...) panic_printf("Kernel panic: " format, ##__VA_ARGS__); |
#endif |
extern void panic_printf(char *fmt, ...) __attribute__((noreturn)) ; |
#endif |
/kernel/branches/falloc_bad/generic/include/symtab.h |
---|
0,0 → 1,49 |
/* |
* Copyright (C) 2005 Ondrej Palkovsky |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __SYMTAB_H__ |
#define __SYMTAB_H__ |
#include <arch/types.h> |
#define MAX_SYMBOL_NAME 64 |
struct symtab_entry { |
__u64 address_le; |
char symbol_name[MAX_SYMBOL_NAME]; |
}; |
extern char * get_symtab_entry(__native addr); |
extern __address get_symbol_addr(const char *name); |
extern void symtab_print_search(const char *name); |
extern int symtab_compl(char *name); |
/* Symtable linked together by build process */ |
extern struct symtab_entry symbol_table[]; |
#endif |
/kernel/branches/falloc_bad/generic/include/align.h |
---|
0,0 → 1,51 |
/* |
* Copyright (C) 2005 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __ALIGN_H__ |
#define __ALIGN_H__ |
/** Align to the nearest lower address. |
* |
* @param s Address or size to be aligned. |
* @param a Size of alignment, must be power of 2. |
*/ |
#define ALIGN_DOWN(s, a) ((s) & ~((a) - 1)) |
/** Align to the nearest higher address. |
* |
* @param s Address or size to be aligned. |
* @param a Size of alignment, must be power of 2. |
*/ |
#ifdef ppc32 /* Nasty ppc32 hack. FIX ME. */ |
# define ALIGN_UP(s, a) ((s) % (a) ? (((s) / (a)) + 1) * (a) : (s)) |
#else |
# define ALIGN_UP(s, a) (((s) + ((a) - 1)) & ~((a) - 1)) |
#endif |
#endif |
/kernel/branches/falloc_bad/generic/include/print.h |
---|
0,0 → 1,41 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __PRINT_H__ |
#define __PRINT_H__ |
#include <arch/types.h> |
#define INT8 1 |
#define INT16 2 |
#define INT32 4 |
#define INT64 8 |
extern void printf(const char *fmt, ...); |
#endif |
/kernel/branches/falloc_bad/generic/include/sort.h |
---|
0,0 → 1,48 |
/* |
* Copyright (C) 2005 Sergey Bondari |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __SORT_H__ |
#define __SORT_H__ |
#include <arch/types.h> |
/* |
* sorting routines |
*/ |
extern void bubblesort(void * data, count_t n, size_t e_size, int (* cmp) (void * a, void * b)); |
extern void qsort(void * data, count_t n, size_t e_size, int (* cmp) (void * a, void * b)); |
/* |
* default sorting comparators |
*/ |
extern int int_cmp(void * a, void * b); |
extern int __u32_cmp(void * a, void * b); |
extern int __u16_cmp(void * a, void * b); |
extern int __u8_cmp(void * a, void * b); |
#endif |
/kernel/branches/falloc_bad/generic/include/macros.h |
---|
0,0 → 1,42 |
/* |
* Copyright (C) 2005 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __MACROS_H__ |
#define __MACROS_H__ |
#define is_digit(d) (((d) >= '0') && ((d)<='9')) |
#define is_lower(c) (((c) >= 'a') && ((c) <= 'z')) |
#define is_upper(c) (((c) >= 'A') && ((c) <= 'Z')) |
#define is_alpha(c) (is_lower(c) || is_upper(c)) |
#define is_alphanum(c) (is_alpha(c) || is_digit(c)) |
#define is_white(c) (((c) == ' ') || ((c) == '\t') || ((c) == '\n') || ((c) == '\r')) |
#define min(a,b) ((a)<(b)?(a):(b)) |
#define max(a,b) ((a)>(b)?(a):(b)) |
#endif |
/kernel/branches/falloc_bad/generic/include/smp/smp.h |
---|
0,0 → 1,38 |
/* |
* Copyright (C) 2005 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __SMP_H__ |
#define __SMP_H__ |
#ifdef CONFIG_SMP |
extern void smp_init(void); |
#else |
#define smp_init() ; |
#endif /* CONFIG_SMP */ |
#endif /* __SMP_H__ */ |
/kernel/branches/falloc_bad/generic/include/smp/ipi.h |
---|
0,0 → 1,39 |
/* |
* Copyright (C) 2005 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __IPI_H__ |
#define __IPI_H__ |
#ifdef CONFIG_SMP |
extern void ipi_broadcast(int ipi); |
extern void ipi_broadcast_arch(int ipi); |
#else |
#define ipi_broadcast(x) ; |
#endif /* CONFIG_SMP */ |
#endif |
/kernel/branches/falloc_bad/generic/include/context.h |
---|
0,0 → 1,84 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __CONTEXT_H__ |
#define __CONTEXT_H__ |
#include <arch/types.h> |
#include <typedefs.h> |
#include <arch/context.h> |
#ifndef context_set |
#define context_set(c, _pc, stack, size) \ |
(c)->pc = (__address) (_pc); \ |
(c)->sp = ((__address) (stack)) + (size) - SP_DELTA; |
#endif /* context_set */ |
extern int context_save_arch(context_t *c); |
extern void context_restore_arch(context_t *c) __attribute__ ((noreturn)); |
/** Save register context. |
* |
* Save current register context (including stack pointers) |
* to context structure. |
* |
* Note that call to context_restore() will return at the same |
* address as the corresponding call to context_save(). |
* |
* @param c Context structure. |
* |
* @return context_save() returns 1, context_restore() returns 0. |
*/ |
static inline int context_save(context_t *c) |
{ |
return context_save_arch(c); |
} |
/** Restore register context. |
* |
* Restore previously saved register context (including stack pointers) |
* from context structure. |
* |
* Note that this function does not normally return. |
* Instead, it returns at the same address as the |
* corresponding call to context_save(), the only |
* difference being return value. |
* |
* Note that content of any local variable defined by |
* the caller of context_save() is undefined after |
* context_restore(). |
* |
* @param c Context structure. |
*/ |
static inline void context_restore(context_t *c) |
{ |
context_restore_arch(c); |
} |
#endif |
/kernel/branches/falloc_bad/generic/include/fpu_context.h |
---|
0,0 → 1,44 |
/* |
* Copyright (C) 2005 Jakub Vana |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __FPU_CONTEXT_H__ |
#define __FPU_CONTEXT_H__ |
#include <arch/fpu_context.h> |
#include <typedefs.h> |
extern void fpu_context_save(fpu_context_t *); |
extern void fpu_context_restore(fpu_context_t *); |
extern void fpu_init(void); |
extern void fpu_enable(void); |
extern void fpu_disable(void); |
#endif /* __FPU_CONTEXT_H__ */ |
/kernel/branches/falloc_bad/generic/include/memstr.h |
---|
0,0 → 1,43 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __MEMSTR_H__ |
#define __MEMSTR_H__ |
#include <typedefs.h> |
#include <arch/types.h> |
#include <arch/memstr.h> |
/* |
* Architecture independent variants. |
*/ |
extern void *_memcpy(void *dst, const void *src, size_t cnt); |
extern void _memsetb(__address dst, size_t cnt, __u8 x); |
extern void _memsetw(__address dst, size_t cnt, __u16 x); |
#endif |
/kernel/branches/falloc_bad/generic/include/byteorder.h |
---|
0,0 → 1,52 |
/* |
* Copyright (C) 2005 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __BYTEORDER_H__ |
#define __BYTEORDER_H__ |
static inline __u64 __u64_byteorder_swap(__u64 n) |
{ |
return ((n & 0xff) << 56) | |
((n & 0xff00) << 40) | |
((n & 0xff0000) << 24) | |
((n & 0xff000000LL) << 8) | |
((n & 0xff00000000LL) >>8) | |
((n & 0xff0000000000LL) >> 24) | |
((n & 0xff000000000000LL) >> 40) | |
((n & 0xff00000000000000LL) >> 56); |
} |
static inline __u32 __u32_byteorder_swap(__u32 n) |
{ |
return ((n & 0xff) << 24) | |
((n & 0xff00) << 8) | |
((n & 0xff0000) >> 8) | |
((n & 0xff000000) >> 24); |
} |
#endif |
/kernel/branches/falloc_bad/generic/include/stackarg.h |
---|
0,0 → 1,55 |
/* |
* Copyright (C) 2005 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
/* |
* Variable argument list manipulation macros |
* for architectures using stack to pass arguments. |
*/ |
#ifndef __STACKARG_H__ |
#define __STACKARG_H__ |
#include <arch/types.h> |
typedef struct va_list { |
int pos; |
__u8 *last; |
} va_list; |
#define va_start(ap, lst) \ |
(ap).pos = sizeof(lst); \ |
(ap).last = (__u8 *) &(lst) |
#define va_arg(ap, type) \ |
(*((type *)((ap).last + ((ap).pos += sizeof(type) ) - sizeof(type)))) |
#define va_end(ap) |
#endif |
/kernel/branches/falloc_bad/generic/include/fb/font-8x16.h |
---|
0,0 → 1,37 |
/* |
* Copyright (C) 2005 Martin Decky |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __FONT_8X16_H__ |
#define __FONT_8X16_H__ |
#define FONT_GLIPHS 256 |
#define FONT_SCANLINES 16 |
extern unsigned char fb_font[FONT_GLIPHS * FONT_SCANLINES]; |
#endif |
/kernel/branches/falloc_bad/generic/include/preemption.h |
---|
0,0 → 1,35 |
/* |
* Copyright (C) 2005 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __PREEMPTION_H__ |
#define __PREEMPTION_H__ |
extern void preemption_disable(void); |
extern void preemption_enable(void); |
#endif |
/kernel/branches/falloc_bad/generic/include/userspace.h |
---|
0,0 → 1,34 |
/* |
* Copyright (C) 2005 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __USERSPACE_H__ |
#define __USERSPACE_H__ |
extern void userspace(void) __attribute__ ((noreturn)); /**< Switch to user-space (CPU user priviledge level) */ |
#endif |
/kernel/branches/falloc_bad/generic/include/putchar.h |
---|
0,0 → 1,34 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __PUTCHAR_H__ |
#define __PUTCHAR_H__ |
extern void putchar(const char ch); |
#endif |
/kernel/branches/falloc_bad/generic/include/stdarg.h |
---|
0,0 → 1,44 |
/* |
* Copyright (C) 2005 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
/* |
* Variable argument list manipulation macros |
* for all architectures with compiler support for __builtin_va_*. |
*/ |
#ifndef __STDARG_H__ |
#define __STDARG_H__ |
typedef __builtin_va_list va_list; |
#define va_start(ap, last) __builtin_va_start(ap, last) |
#define va_arg(ap, type) __builtin_va_arg(ap, type) |
#define va_end(ap) __builtin_va_end(ap) |
#endif |
/kernel/branches/falloc_bad/generic/include/test.h |
---|
0,0 → 1,34 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __TEST_H__ |
#define __TEST_H__ |
extern void test(void); |
#endif |
/kernel/branches/falloc_bad/generic/src/main/kinit.c |
---|
0,0 → 1,196 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <main/kinit.h> |
#include <main/uinit.h> |
#include <config.h> |
#include <arch.h> |
#include <proc/scheduler.h> |
#include <proc/task.h> |
#include <proc/thread.h> |
#include <panic.h> |
#include <func.h> |
#include <cpu.h> |
#include <arch/asm.h> |
#include <mm/page.h> |
#include <arch/mm/page.h> |
#include <mm/as.h> |
#include <mm/frame.h> |
#include <print.h> |
#include <memstr.h> |
#include <console/console.h> |
#include <interrupt.h> |
#include <console/kconsole.h> |
#ifdef CONFIG_SMP |
#include <arch/smp/mps.h> |
#endif /* CONFIG_SMP */ |
#include <synch/waitq.h> |
#include <synch/spinlock.h> |
#ifdef CONFIG_TEST |
#include <test.h> |
#endif /* CONFIG_TEST */ |
/** Kernel initialization thread. |
* |
* kinit takes care of higher level kernel |
* initialization (i.e. thread creation, |
* userspace initialization etc.). |
* |
* @param arg Not used. |
*/ |
void kinit(void *arg) |
{ |
thread_t *t; |
as_t *as; |
as_area_t *a; |
index_t frame, frames; |
index_t pfn; |
task_t *u; |
interrupts_disable(); |
#ifdef CONFIG_SMP |
if (config.cpu_count > 1) { |
/* |
* Create the kmp thread and wait for its completion. |
* cpu1 through cpuN-1 will come up consecutively and |
* not mess together with kcpulb threads. |
* Just a beautification. |
*/ |
if ((t = thread_create(kmp, NULL, TASK, 0))) { |
spinlock_lock(&t->lock); |
t->flags |= X_WIRED; |
t->cpu = &cpus[0]; |
spinlock_unlock(&t->lock); |
thread_ready(t); |
waitq_sleep(&kmp_completion_wq); |
} |
else panic("thread_create/kmp\n"); |
} |
#endif /* CONFIG_SMP */ |
/* |
* Now that all CPUs are up, we can report what we've found. |
*/ |
cpu_list(); |
#ifdef CONFIG_SMP |
if (config.cpu_count > 1) { |
int i; |
/* |
* For each CPU, create its load balancing thread. |
*/ |
for (i = 0; i < config.cpu_count; i++) { |
if ((t = thread_create(kcpulb, NULL, TASK, 0))) { |
spinlock_lock(&t->lock); |
t->flags |= X_WIRED; |
t->cpu = &cpus[i]; |
spinlock_unlock(&t->lock); |
thread_ready(t); |
} |
else panic("thread_create/kcpulb\n"); |
} |
} |
#endif /* CONFIG_SMP */ |
/* |
* At this point SMP, if present, is configured. |
*/ |
arch_post_smp_init(); |
/* |
* Create kernel console. |
*/ |
if ((t = thread_create(kconsole, "kconsole", TASK, 0))) |
thread_ready(t); |
else |
panic("thread_create/kconsole\n"); |
interrupts_enable(); |
if (config.init_size > 0) { |
/* |
* Create the first user task. |
*/ |
if (KA2PA(config.init_addr) % FRAME_SIZE) |
panic("config.init_addr is not frame aligned"); |
as = as_create(NULL); |
if (!as) |
panic("as_create\n"); |
u = task_create(as); |
if (!u) |
panic("task_create\n"); |
t = thread_create(uinit, NULL, u, THREAD_USER_STACK); |
if (!t) |
panic("thread_create\n"); |
/* |
* Create the text as_area and copy the userspace code there. |
*/ |
frame = KA2PA(config.init_addr) / FRAME_SIZE; |
frames = config.init_size / FRAME_SIZE; |
if (config.init_size % FRAME_SIZE > 0) |
frames++; |
a = as_area_create(as, AS_AREA_TEXT, frames, UTEXT_ADDRESS); |
if (!a) |
panic("as_area_create: text\n"); |
for (pfn = 0; pfn < frames; pfn++) |
as_area_set_mapping(a, pfn, frame + pfn); |
/* |
* Create the data as_area. |
*/ |
a = as_area_create(as, AS_AREA_STACK, 1, USTACK_ADDRESS); |
if (!a) |
panic("as_area_create: stack\n"); |
thread_ready(t); |
} |
#ifdef CONFIG_TEST |
test(); |
#endif /* CONFIG_TEST */ |
if (!stdin) { |
while (1) { |
thread_sleep(1); |
printf("kinit... "); |
} |
} |
} |
/kernel/branches/falloc_bad/generic/src/main/main.c |
---|
0,0 → 1,284 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <arch/asm.h> |
#include <context.h> |
#include <print.h> |
#include <panic.h> |
#include <debug.h> |
#include <config.h> |
#include <time/clock.h> |
#include <proc/scheduler.h> |
#include <proc/thread.h> |
#include <proc/task.h> |
#include <main/kinit.h> |
#include <main/version.h> |
#include <console/kconsole.h> |
#include <cpu.h> |
#include <align.h> |
#include <interrupt.h> |
#include <arch/mm/memory_init.h> |
#include <mm/heap.h> |
#include <mm/frame.h> |
#include <mm/page.h> |
#include <genarch/mm/page_pt.h> |
#include <mm/tlb.h> |
#include <mm/as.h> |
#include <synch/waitq.h> |
#include <arch/arch.h> |
#include <arch.h> |
#include <arch/faddr.h> |
#include <typedefs.h> |
#ifdef CONFIG_SMP |
#include <arch/smp/apic.h> |
#include <arch/smp/mps.h> |
#endif /* CONFIG_SMP */ |
#include <smp/smp.h> |
config_t config; /**< Global configuration structure. */ |
context_t ctx; |
/** |
* These 'hardcoded' variables will be intialized by |
* the linker or the low level assembler code with |
* appropriate sizes and addresses. |
*/ |
__address hardcoded_load_address = 0; |
size_t hardcoded_ktext_size = 0; |
size_t hardcoded_kdata_size = 0; |
__address init_addr = 0; |
size_t init_size = 0; |
void main_bsp(void); |
void main_ap(void); |
/* |
* These two functions prevent stack from underflowing during the |
* kernel boot phase when SP is set to the very top of the reserved |
* space. The stack could get corrupted by a fooled compiler-generated |
* pop sequence otherwise. |
*/ |
static void main_bsp_separated_stack(void); |
#ifdef CONFIG_SMP |
static void main_ap_separated_stack(void); |
#endif |
/** Bootstrap CPU main kernel routine |
* |
* Initializes the kernel by bootstrap CPU. |
* This function passes control directly to |
* main_bsp_separated_stack(). |
* |
* Assuming interrupts_disable(). |
* |
*/ |
void main_bsp(void) |
{ |
config.cpu_count = 1; |
config.cpu_active = 1; |
config.base = hardcoded_load_address; |
config.memory_size = get_memory_size(); |
config.init_addr = init_addr; |
config.init_size = init_size; |
if (init_size > 0) |
config.heap_addr = init_addr + init_size; |
else |
config.heap_addr = hardcoded_load_address + hardcoded_ktext_size + hardcoded_kdata_size; |
config.heap_size = CONFIG_HEAP_SIZE + (config.memory_size / FRAME_SIZE) * sizeof(frame_t); |
config.kernel_size = ALIGN_UP(config.heap_addr - hardcoded_load_address + config.heap_size, PAGE_SIZE); |
config.heap_delta = config.kernel_size - (config.heap_addr - hardcoded_load_address + config.heap_size); |
config.kernel_size = config.kernel_size + CONFIG_STACK_SIZE; |
context_save(&ctx); |
context_set(&ctx, FADDR(main_bsp_separated_stack), config.base + config.kernel_size, CONFIG_STACK_SIZE); |
context_restore(&ctx); |
/* not reached */ |
} |
/** Bootstrap CPU main kernel routine stack wrapper |
* |
* Second part of main_bsp(). |
* |
*/ |
void main_bsp_separated_stack(void) |
{ |
as_t *as; |
task_t *k; |
thread_t *t; |
the_initialize(THE); |
/* |
* kconsole data structures must be initialized very early |
* because other subsystems will register their respective |
* commands. |
*/ |
kconsole_init(); |
/* Exception handler initialization, before architecture |
* starts adding its own handlers |
*/ |
exc_init(); |
arch_pre_mm_init(); |
early_heap_init(config.heap_addr, config.heap_size + config.heap_delta); |
frame_init(); |
page_init(); |
tlb_init(); |
arch_post_mm_init(); |
version_print(); |
printf("%P: hardcoded_ktext_size=%dK, hardcoded_kdata_size=%dK\n", |
config.base, hardcoded_ktext_size/1024, hardcoded_kdata_size/1024); |
arch_pre_smp_init(); |
smp_init(); |
printf("config.memory_size=%dM\n", config.memory_size/(1024*1024)); |
printf("config.cpu_count=%d\n", config.cpu_count); |
cpu_init(); |
calibrate_delay_loop(); |
timeout_init(); |
scheduler_init(); |
task_init(); |
thread_init(); |
if (config.init_size > 0) |
printf("config.init_addr=%X, config.init_size=%d\n", config.init_addr, config.init_size); |
/* |
* Create kernel address space. |
*/ |
as = as_create(GET_PTL0_ADDRESS()); |
if (!as) |
panic("can't create kernel address space\n"); |
/* |
* Create kernel task. |
*/ |
k = task_create(as); |
if (!k) |
panic("can't create kernel task\n"); |
/* |
* Create the first thread. |
*/ |
t = thread_create(kinit, NULL, k, 0); |
if (!t) |
panic("can't create kinit thread\n"); |
thread_ready(t); |
/* |
* This call to scheduler() will return to kinit, |
* starting the thread of kernel threads. |
*/ |
scheduler(); |
/* not reached */ |
} |
#ifdef CONFIG_SMP |
/** Application CPUs main kernel routine |
* |
* Executed by application processors, temporary stack |
* is at ctx.sp which was set during BP boot. |
* This function passes control directly to |
* main_ap_separated_stack(). |
* |
* Assuming interrupts_disable()'d. |
* |
*/ |
void main_ap(void) |
{ |
/* |
* Incrementing the active CPU counter will guarantee that the |
* pm_init() will not attempt to build GDT and IDT tables again. |
* Neither frame_init() will do the complete thing. Neither cpu_init() |
* will do. |
*/ |
config.cpu_active++; |
/* |
* The THE structure is well defined because ctx.sp is used as stack. |
*/ |
the_initialize(THE); |
arch_pre_mm_init(); |
frame_init(); |
page_init(); |
tlb_init(); |
arch_post_mm_init(); |
cpu_init(); |
calibrate_delay_loop(); |
l_apic_init(); |
l_apic_debug(); |
the_copy(THE, (the_t *) CPU->stack); |
/* |
* If we woke kmp up before we left the kernel stack, we could |
* collide with another CPU coming up. To prevent this, we |
* switch to this cpu's private stack prior to waking kmp up. |
*/ |
context_set(&CPU->saved_context, FADDR(main_ap_separated_stack), (__address) CPU->stack, CPU_STACK_SIZE); |
context_restore(&CPU->saved_context); |
/* not reached */ |
} |
/** Application CPUs main kernel routine stack wrapper |
* |
* Second part of main_ap(). |
* |
*/ |
void main_ap_separated_stack(void) |
{ |
/* |
* Configure timeouts for this cpu. |
*/ |
timeout_init(); |
waitq_wakeup(&ap_completion_wq, WAKEUP_FIRST); |
scheduler(); |
/* not reached */ |
} |
#endif /* CONFIG_SMP */ |
/kernel/branches/falloc_bad/generic/src/main/version.c |
---|
0,0 → 1,54 |
/* |
* Copyright (C) 2006 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <main/version.h> |
#include <print.h> |
char *project = "SPARTAN kernel"; |
char *copyright = "Copyright (C) 2001-2006 HelenOS project"; |
char *release = RELEASE; |
char *name = NAME; |
char *arch = ARCH; |
#ifdef REVISION |
char *revision = ", revision " REVISION; |
#else |
char *revision = ""; |
#endif |
#ifdef TIMESTAMP |
char *timestamp = " on " TIMESTAMP; |
#else |
char *timestamp = ""; |
#endif |
/** Print version information. */ |
void version_print(void) |
{ |
printf("%s, release %s (%s)%s\nBuilt%s for %s\n%s\n", project, release, name, revision, timestamp, arch, copyright); |
} |
/kernel/branches/falloc_bad/generic/src/main/uinit.c |
---|
0,0 → 1,40 |
/* |
* Copyright (C) 2005 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <main/uinit.h> |
#include <arch/types.h> |
#include <proc/thread.h> |
#include <userspace.h> |
#include <print.h> |
void uinit(void *arg) |
{ |
printf("USER task, uinit thread: kernel mode\n"); |
userspace(); |
} |
/kernel/branches/falloc_bad/generic/src/mm/as.c |
---|
0,0 → 1,306 |
/* |
* Copyright (C) 2001-2006 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
/* |
* This file contains address space manipulation functions. |
* Roughly speaking, this is a higher-level client of |
* Virtual Address Translation (VAT) subsystem. |
*/ |
#include <mm/as.h> |
#include <mm/page.h> |
#include <mm/frame.h> |
#include <mm/tlb.h> |
#include <mm/heap.h> |
#include <arch/mm/page.h> |
#include <genarch/mm/page_pt.h> |
#include <arch/mm/asid.h> |
#include <arch/mm/as.h> |
#include <arch/types.h> |
#include <typedefs.h> |
#include <synch/spinlock.h> |
#include <config.h> |
#include <list.h> |
#include <panic.h> |
#include <arch/asm.h> |
#include <debug.h> |
#include <memstr.h> |
#include <arch.h> |
#include <print.h> |
#define KAS_START_INDEX PTL0_INDEX(KERNEL_ADDRESS_SPACE_START) |
#define KAS_END_INDEX PTL0_INDEX(KERNEL_ADDRESS_SPACE_END) |
#define KAS_INDICES (1+(KAS_END_INDEX-KAS_START_INDEX)) |
/* |
* Here we assume that PFN (Physical Frame Number) space |
* is smaller than the width of index_t. UNALLOCATED_PFN |
* can be then used to mark mappings wich were not |
* yet allocated a physical frame. |
*/ |
#define UNALLOCATED_PFN ((index_t) -1) |
/** Create address space. */ |
/* |
* FIXME: this interface must be meaningful for all possible VAT |
* (Virtual Address Translation) mechanisms. |
*/ |
as_t *as_create(pte_t *ptl0) |
{ |
as_t *as; |
as = (as_t *) malloc(sizeof(as_t)); |
if (as) { |
spinlock_initialize(&as->lock, "as_lock"); |
list_initialize(&as->as_area_head); |
as->asid = asid_get(); |
as->ptl0 = ptl0; |
if (!as->ptl0) { |
pte_t *src_ptl0, *dst_ptl0; |
src_ptl0 = (pte_t *) PA2KA((__address) GET_PTL0_ADDRESS()); |
dst_ptl0 = (pte_t *) frame_alloc(FRAME_KA | FRAME_PANIC, ONE_FRAME, NULL); |
// memsetb((__address) dst_ptl0, PAGE_SIZE, 0); |
// memcpy((void *) &dst_ptl0[KAS_START_INDEX], (void *) &src_ptl0[KAS_START_INDEX], KAS_INDICES); |
memcpy((void *) dst_ptl0,(void *) src_ptl0, PAGE_SIZE); |
as->ptl0 = (pte_t *) KA2PA((__address) dst_ptl0); |
} |
} |
return as; |
} |
/** Create address space area of common attributes. |
* |
* The created address space area is added to the target address space. |
* |
* @param as Target address space. |
* @param type Type of area. |
* @param size Size of area in multiples of PAGE_SIZE. |
* @param base Base address of area. |
* |
* @return Address space area on success or NULL on failure. |
*/ |
as_area_t *as_area_create(as_t *as, as_area_type_t type, size_t size, __address base) |
{ |
ipl_t ipl; |
as_area_t *a; |
if (base % PAGE_SIZE) |
panic("addr not aligned to a page boundary"); |
ipl = interrupts_disable(); |
spinlock_lock(&as->lock); |
/* |
* TODO: test as_area which is to be created doesn't overlap with an existing one. |
*/ |
a = (as_area_t *) malloc(sizeof(as_area_t)); |
if (a) { |
int i; |
a->mapping = (index_t *) malloc(size * sizeof(index_t)); |
if (!a->mapping) { |
free(a); |
spinlock_unlock(&as->lock); |
interrupts_restore(ipl); |
return NULL; |
} |
for (i=0; i<size; i++) { |
/* |
* Frames will be allocated on-demand by |
* as_page_fault() or preloaded by |
* as_area_set_mapping(). |
*/ |
a->mapping[i] = UNALLOCATED_PFN; |
} |
spinlock_initialize(&a->lock, "as_area_lock"); |
link_initialize(&a->link); |
a->type = type; |
a->size = size; |
a->base = base; |
list_append(&a->link, &as->as_area_head); |
} |
spinlock_unlock(&as->lock); |
interrupts_restore(ipl); |
return a; |
} |
/** Load mapping for address space area. |
* |
* Initialize a->mapping. |
* |
* @param a Target address space area. |
* @param vpn Page number relative to area start. |
* @param pfn Frame number to map. |
*/ |
void as_area_set_mapping(as_area_t *a, index_t vpn, index_t pfn) |
{ |
ASSERT(vpn < a->size); |
ASSERT(a->mapping[vpn] == UNALLOCATED_PFN); |
ASSERT(pfn != UNALLOCATED_PFN); |
ipl_t ipl; |
ipl = interrupts_disable(); |
spinlock_lock(&a->lock); |
a->mapping[vpn] = pfn; |
spinlock_unlock(&a->lock); |
interrupts_restore(ipl); |
} |
/** Handle page fault within the current address space. |
* |
* This is the high-level page fault handler. |
* Interrupts are assumed disabled. |
* |
* @param page Faulting page. |
* |
* @return 0 on page fault, 1 on success. |
*/ |
int as_page_fault(__address page) |
{ |
int flags; |
link_t *cur; |
as_area_t *a, *area = NULL; |
index_t vpn; |
__address frame; |
ASSERT(AS); |
spinlock_lock(&AS->lock); |
/* |
* Search this areas of this address space for presence of 'page'. |
*/ |
for (cur = AS->as_area_head.next; cur != &AS->as_area_head; cur = cur->next) { |
a = list_get_instance(cur, as_area_t, link); |
spinlock_lock(&a->lock); |
if ((page >= a->base) && (page < a->base + a->size * PAGE_SIZE)) { |
/* |
* We found the area containing 'page'. |
* TODO: access checking |
*/ |
vpn = (page - a->base) / PAGE_SIZE; |
area = a; |
break; |
} |
spinlock_unlock(&a->lock); |
} |
if (!area) { |
/* |
* No area contained mapping for 'page'. |
* Signal page fault to low-level handler. |
*/ |
spinlock_unlock(&AS->lock); |
return 0; |
} |
/* |
* Note: area->lock is held. |
*/ |
/* |
* Decide if a frame needs to be allocated. |
* If so, allocate it and adjust area->mapping map. |
*/ |
if (area->mapping[vpn] == UNALLOCATED_PFN) { |
frame = frame_alloc(0, ONE_FRAME, NULL); |
memsetb(PA2KA(frame), FRAME_SIZE, 0); |
area->mapping[vpn] = frame / FRAME_SIZE; |
ASSERT(area->mapping[vpn] != UNALLOCATED_PFN); |
} else |
frame = area->mapping[vpn] * FRAME_SIZE; |
switch (area->type) { |
case AS_AREA_TEXT: |
flags = PAGE_EXEC | PAGE_READ | PAGE_USER | PAGE_PRESENT | PAGE_CACHEABLE; |
break; |
case AS_AREA_DATA: |
case AS_AREA_STACK: |
flags = PAGE_READ | PAGE_WRITE | PAGE_USER | PAGE_PRESENT | PAGE_CACHEABLE; |
break; |
default: |
panic("unexpected as_area_type_t %d", area->type); |
} |
/* |
* Map 'page' to 'frame'. |
* Note that TLB shootdown is not attempted as only new information is being |
* inserted into page tables. |
*/ |
page_mapping_insert(page, AS->asid, frame, flags, (__address) AS->ptl0); |
spinlock_unlock(&area->lock); |
spinlock_unlock(&AS->lock); |
return 1; |
} |
/** Install address space on CPU. |
* |
* @param as Address space. |
*/ |
void as_install(as_t *as) |
{ |
ipl_t ipl; |
ipl = interrupts_disable(); |
spinlock_lock(&as->lock); |
ASSERT(as->ptl0); |
SET_PTL0_ADDRESS(as->ptl0); |
spinlock_unlock(&as->lock); |
interrupts_restore(ipl); |
/* |
* Perform architecture-specific steps. |
* (e.g. invalidate TLB, install ASID etc.) |
*/ |
as_install_arch(as); |
AS = as; |
} |
/kernel/branches/falloc_bad/generic/src/mm/frame.c |
---|
0,0 → 1,560 |
/* |
* Copyright (C) 2001-2005 Jakub Jermar |
* Copyright (C) 2005 Sergey Bondari |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <typedefs.h> |
#include <arch/types.h> |
#include <mm/heap.h> |
#include <mm/frame.h> |
#include <mm/as.h> |
#include <panic.h> |
#include <debug.h> |
#include <list.h> |
#include <synch/spinlock.h> |
#include <arch/asm.h> |
#include <arch.h> |
#include <print.h> |
#include <align.h> |
SPINLOCK_INITIALIZE(zone_head_lock); /**< this lock protects zone_head list */ |
LIST_INITIALIZE(zone_head); /**< list of all zones in the system */ |
/** Blacklist containing non-available areas of memory. |
* |
* This blacklist is used to exclude frames that cannot be allocated |
* (e.g. kernel memory) from available memory map. |
*/ |
region_t zone_blacklist[ZONE_BLACKLIST_SIZE]; |
count_t zone_blacklist_count = 0; |
static struct buddy_system_operations zone_buddy_system_operations = { |
.find_buddy = zone_buddy_find_buddy, |
.bisect = zone_buddy_bisect, |
.coalesce = zone_buddy_coalesce, |
.set_order = zone_buddy_set_order, |
.get_order = zone_buddy_get_order, |
.mark_busy = zone_buddy_mark_busy, |
}; |
/** Initialize physical memory management |
* |
* Initialize physical memory managemnt. |
*/ |
void frame_init(void) |
{ |
if (config.cpu_active == 1) { |
frame_region_not_free(KA2PA(config.base), config.kernel_size); |
if (config.init_size > 0) |
frame_region_not_free(KA2PA(config.init_addr), config.init_size); |
} |
frame_arch_init(); |
} |
/** Allocate power-of-two frames of physical memory. |
* |
* @param flags Flags for host zone selection and address processing. |
* @param order Allocate exactly 2^order frames. |
* |
* @return Allocated frame. |
*/ |
__address frame_alloc(int flags, __u8 order, int * status) |
{ |
ipl_t ipl; |
link_t *cur, *tmp; |
zone_t *z; |
zone_t *zone = NULL; |
frame_t *frame = NULL; |
__address v; |
loop: |
ipl = interrupts_disable(); |
spinlock_lock(&zone_head_lock); |
/* |
* First, find suitable frame zone. |
*/ |
for (cur = zone_head.next; cur != &zone_head; cur = cur->next) { |
z = list_get_instance(cur, zone_t, link); |
spinlock_lock(&z->lock); |
/* Check if the zone has 2^order frames area available */ |
if (buddy_system_can_alloc(z->buddy_system, order)) { |
zone = z; |
break; |
} |
spinlock_unlock(&z->lock); |
} |
if (!zone) { |
if (flags & FRAME_PANIC) |
panic("Can't allocate frame.\n"); |
/* |
* TODO: Sleep until frames are available again. |
*/ |
spinlock_unlock(&zone_head_lock); |
interrupts_restore(ipl); |
if (flags & FRAME_NON_BLOCKING) { |
ASSERT(status != NULL); |
*status = FRAME_NO_MEMORY; |
return NULL; |
} |
panic("Sleep not implemented.\n"); |
goto loop; |
} |
/* Allocate frames from zone buddy system */ |
tmp = buddy_system_alloc(zone->buddy_system, order); |
ASSERT(tmp); |
/* Update zone information. */ |
zone->free_count -= (1 << order); |
zone->busy_count += (1 << order); |
/* Frame will be actually a first frame of the block. */ |
frame = list_get_instance(tmp, frame_t, buddy_link); |
/* get frame address */ |
v = FRAME2ADDR(zone, frame); |
spinlock_unlock(&zone->lock); |
spinlock_unlock(&zone_head_lock); |
interrupts_restore(ipl); |
if (flags & FRAME_KA) |
v = PA2KA(v); |
if (flags & FRAME_NON_BLOCKING) { |
ASSERT(status != NULL); |
*status = FRAME_OK; |
} |
return v; |
} |
/** Free a frame. |
* |
* Find respective frame structrue for supplied addr. |
* Decrement frame reference count. |
* If it drops to zero, move the frame structure to free list. |
* |
* @param addr Address of the frame to be freed. It must be a multiple of FRAME_SIZE. |
*/ |
void frame_free(__address addr) |
{ |
ipl_t ipl; |
link_t *cur; |
zone_t *z; |
zone_t *zone = NULL; |
frame_t *frame; |
ASSERT(addr % FRAME_SIZE == 0); |
ipl = interrupts_disable(); |
spinlock_lock(&zone_head_lock); |
/* |
* First, find host frame zone for addr. |
*/ |
for (cur = zone_head.next; cur != &zone_head; cur = cur->next) { |
z = list_get_instance(cur, zone_t, link); |
spinlock_lock(&z->lock); |
if (IS_KA(addr)) |
addr = KA2PA(addr); |
/* |
* Check if addr belongs to z. |
*/ |
if ((addr >= z->base) && (addr <= z->base + (z->free_count + z->busy_count) * FRAME_SIZE)) { |
zone = z; |
break; |
} |
spinlock_unlock(&z->lock); |
} |
ASSERT(zone != NULL); |
frame = ADDR2FRAME(zone, addr); |
ASSERT(frame->refcount); |
if (!--frame->refcount) { |
buddy_system_free(zone->buddy_system, &frame->buddy_link); |
} |
/* Update zone information. */ |
zone->free_count += (1 << frame->buddy_order); |
zone->busy_count -= (1 << frame->buddy_order); |
spinlock_unlock(&zone->lock); |
spinlock_unlock(&zone_head_lock); |
interrupts_restore(ipl); |
} |
/** Mark frame region not free. |
* |
* Mark frame region not free. |
* |
* @param base Base address of non-available region. |
* @param size Size of non-available region. |
*/ |
void frame_region_not_free(__address base, size_t size) |
{ |
index_t index; |
index = zone_blacklist_count++; |
/* Force base to the nearest lower address frame boundary. */ |
base = ALIGN_DOWN(base, FRAME_SIZE); |
/* Align size to frame boundary. */ |
size = ALIGN_UP(size, FRAME_SIZE); |
ASSERT(index < ZONE_BLACKLIST_SIZE); |
zone_blacklist[index].base = base; |
zone_blacklist[index].size = size; |
} |
/** Create frame zones in region of available memory. |
* |
* Avoid any black listed areas of non-available memory. |
* Assume that the black listed areas cannot overlap |
* one another or cross available memory region boundaries. |
* |
* @param base Base address of available memory region. |
* @param size Size of the region. |
*/ |
void zone_create_in_region(__address base, size_t size) { |
int i; |
zone_t * z; |
__address s; |
size_t sz; |
ASSERT(base % FRAME_SIZE == 0); |
ASSERT(size % FRAME_SIZE == 0); |
if (!size) |
return; |
for (i = 0; i < zone_blacklist_count; i++) { |
if (zone_blacklist[i].base >= base && zone_blacklist[i].base < base + size) { |
s = base; sz = zone_blacklist[i].base - base; |
ASSERT(base != s || sz != size); |
zone_create_in_region(s, sz); |
s = zone_blacklist[i].base + zone_blacklist[i].size; |
sz = (base + size) - (zone_blacklist[i].base + zone_blacklist[i].size); |
ASSERT(base != s || sz != size); |
zone_create_in_region(s, sz); |
return; |
} |
} |
z = zone_create(base, size, 0); |
if (!z) { |
panic("Cannot allocate zone (base=%P, size=%d).\n", base, size); |
} |
zone_attach(z); |
} |
/** Create frame zone |
* |
* Create new frame zone. |
* |
* @param start Physical address of the first frame within the zone. |
* @param size Size of the zone. Must be a multiple of FRAME_SIZE. |
* @param flags Zone flags. |
* |
* @return Initialized zone. |
*/ |
zone_t * zone_create(__address start, size_t size, int flags) |
{ |
zone_t *z; |
count_t cnt; |
int i; |
__u8 max_order; |
ASSERT(start % FRAME_SIZE == 0); |
ASSERT(size % FRAME_SIZE == 0); |
cnt = size / FRAME_SIZE; |
z = (zone_t *) early_malloc(sizeof(zone_t)); |
if (z) { |
link_initialize(&z->link); |
spinlock_initialize(&z->lock, "zone_lock"); |
z->base = start; |
z->flags = flags; |
z->free_count = cnt; |
z->busy_count = 0; |
z->frames = (frame_t *) early_malloc(cnt * sizeof(frame_t)); |
if (!z->frames) { |
early_free(z); |
return NULL; |
} |
for (i = 0; i<cnt; i++) { |
frame_initialize(&z->frames[i], z); |
} |
/* |
* Create buddy system for the zone |
*/ |
for (max_order = 0; cnt >> max_order; max_order++) |
; |
z->buddy_system = buddy_system_create(max_order, &zone_buddy_system_operations, (void *) z); |
/* Stuffing frames */ |
for (i = 0; i<cnt; i++) { |
z->frames[i].refcount = 0; |
buddy_system_free(z->buddy_system, &z->frames[i].buddy_link); |
} |
} |
return z; |
} |
/** Attach frame zone |
* |
* Attach frame zone to zone list. |
* |
* @param zone Zone to be attached. |
*/ |
void zone_attach(zone_t *zone) |
{ |
ipl_t ipl; |
ipl = interrupts_disable(); |
spinlock_lock(&zone_head_lock); |
list_append(&zone->link, &zone_head); |
spinlock_unlock(&zone_head_lock); |
interrupts_restore(ipl); |
} |
/** Initialize frame structure |
* |
* Initialize frame structure. |
* |
* @param frame Frame structure to be initialized. |
* @param zone Host frame zone. |
*/ |
void frame_initialize(frame_t *frame, zone_t *zone) |
{ |
frame->refcount = 1; |
frame->buddy_order = 0; |
} |
/** Buddy system find_buddy implementation |
* |
* @param b Buddy system. |
* @param block Block for which buddy should be found |
* |
* @return Buddy for given block if found |
*/ |
link_t * zone_buddy_find_buddy(buddy_system_t *b, link_t * block) { |
frame_t * frame; |
zone_t * zone; |
index_t index; |
bool is_left, is_right; |
frame = list_get_instance(block, frame_t, buddy_link); |
zone = (zone_t *) b->data; |
ASSERT(IS_BUDDY_ORDER_OK(FRAME_INDEX(zone, frame), frame->buddy_order)); |
is_left = IS_BUDDY_LEFT_BLOCK(zone, frame); |
is_right = IS_BUDDY_RIGHT_BLOCK(zone, frame); |
ASSERT(is_left ^ is_right); |
if (is_left) { |
index = (FRAME_INDEX(zone, frame)) + (1 << frame->buddy_order); |
} else { // if (is_right) |
index = (FRAME_INDEX(zone, frame)) - (1 << frame->buddy_order); |
} |
if (FRAME_INDEX_VALID(zone, index)) { |
if ( zone->frames[index].buddy_order == frame->buddy_order && |
zone->frames[index].refcount == 0) { |
return &zone->frames[index].buddy_link; |
} |
} |
return NULL; |
} |
/** Buddy system bisect implementation |
* |
* @param b Buddy system. |
* @param block Block to bisect |
* |
* @return right block |
*/ |
link_t * zone_buddy_bisect(buddy_system_t *b, link_t * block) { |
frame_t * frame_l, * frame_r; |
frame_l = list_get_instance(block, frame_t, buddy_link); |
frame_r = (frame_l + (1 << (frame_l->buddy_order - 1))); |
return &frame_r->buddy_link; |
} |
/** Buddy system coalesce implementation |
* |
* @param b Buddy system. |
* @param block_1 First block |
* @param block_2 First block's buddy |
* |
* @return Coalesced block (actually block that represents lower address) |
*/ |
link_t * zone_buddy_coalesce(buddy_system_t *b, link_t * block_1, link_t * block_2) { |
frame_t * frame1, * frame2; |
frame1 = list_get_instance(block_1, frame_t, buddy_link); |
frame2 = list_get_instance(block_2, frame_t, buddy_link); |
return frame1 < frame2 ? block_1 : block_2; |
} |
/** Buddy system set_order implementation |
* |
* @param b Buddy system. |
* @param block Buddy system block |
* @param order Order to set |
*/ |
void zone_buddy_set_order(buddy_system_t *b, link_t * block, __u8 order) { |
frame_t * frame; |
frame = list_get_instance(block, frame_t, buddy_link); |
frame->buddy_order = order; |
} |
/** Buddy system get_order implementation |
* |
* @param b Buddy system. |
* @param block Buddy system block |
* |
* @return Order of block |
*/ |
__u8 zone_buddy_get_order(buddy_system_t *b, link_t * block) { |
frame_t * frame; |
frame = list_get_instance(block, frame_t, buddy_link); |
return frame->buddy_order; |
} |
/** Buddy system mark_busy implementation |
* |
* @param b Buddy system |
* @param block Buddy system block |
* |
*/ |
void zone_buddy_mark_busy(buddy_system_t *b, link_t * block) { |
frame_t * frame; |
frame = list_get_instance(block, frame_t, buddy_link); |
frame->refcount = 1; |
} |
/** Prints list of zones |
* |
*/ |
void zone_print_list(void) { |
zone_t *zone = NULL; |
link_t *cur; |
ipl_t ipl; |
ipl = interrupts_disable(); |
spinlock_lock(&zone_head_lock); |
printf("Base address\tFree Frames\tBusy Frames\n"); |
printf("------------\t-----------\t-----------\n"); |
for (cur = zone_head.next; cur != &zone_head; cur = cur->next) { |
zone = list_get_instance(cur, zone_t, link); |
spinlock_lock(&zone->lock); |
printf("%L\t%d\t\t%d\n",zone->base, zone->free_count, zone->busy_count); |
spinlock_unlock(&zone->lock); |
} |
spinlock_unlock(&zone_head_lock); |
interrupts_restore(ipl); |
} |
/** Prints zone details |
* |
* @param base Zone base address |
*/ |
void zone_print_one(__address base) { |
zone_t *zone = NULL, *z ; |
link_t *cur; |
ipl_t ipl; |
ipl = interrupts_disable(); |
spinlock_lock(&zone_head_lock); |
for (cur = zone_head.next; cur != &zone_head; cur = cur->next) { |
z = list_get_instance(cur, zone_t, link); |
if (base == z->base) { |
zone = z; |
break; |
} |
} |
if (!zone) { |
spinlock_unlock(&zone_head_lock); |
interrupts_restore(ipl); |
printf("No zone with address %X\n", base); |
return; |
} |
spinlock_lock(&zone->lock); |
printf("Memory zone information\n\n"); |
printf("Zone base address: %P\n", zone->base); |
printf("Zone size: %d frames (%dK)\n", zone->free_count + zone->busy_count, ((zone->free_count + zone->busy_count) * FRAME_SIZE) >> 10); |
printf("Allocated space: %d frames (%dK)\n", zone->busy_count, (zone->busy_count * FRAME_SIZE) >> 10); |
printf("Available space: %d (%dK)\n", zone->free_count, (zone->free_count * FRAME_SIZE) >> 10); |
printf("\nBuddy allocator structures:\n\n"); |
buddy_system_structure_print(zone->buddy_system, FRAME_SIZE); |
spinlock_unlock(&zone->lock); |
spinlock_unlock(&zone_head_lock); |
interrupts_restore(ipl); |
} |
/kernel/branches/falloc_bad/generic/src/mm/page.c |
---|
0,0 → 1,110 |
/* |
* Copyright (C) 2001-2006 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
/* |
* Virtual Address Translation subsystem. |
*/ |
#include <mm/page.h> |
#include <arch/mm/page.h> |
#include <arch/mm/asid.h> |
#include <mm/asid.h> |
#include <mm/frame.h> |
#include <arch/types.h> |
#include <typedefs.h> |
#include <arch/asm.h> |
#include <memstr.h> |
#include <debug.h> |
#include <arch.h> |
/** Virtual operations for page subsystem. */ |
page_operations_t *page_operations = NULL; |
void page_init(void) |
{ |
page_arch_init(); |
page_mapping_insert(0x0, 0, 0x0, PAGE_NOT_PRESENT, 0); |
} |
/** Map memory structure |
* |
* Identity-map memory structure |
* considering possible crossings |
* of page boundaries. |
* |
* @param s Address of the structure. |
* @param size Size of the structure. |
*/ |
void map_structure(__address s, size_t size) |
{ |
int i, cnt, length; |
length = size + (s - (s & ~(PAGE_SIZE-1))); |
cnt = length/PAGE_SIZE + (length%PAGE_SIZE>0); |
for (i = 0; i < cnt; i++) |
page_mapping_insert(s + i*PAGE_SIZE, ASID_KERNEL, s + i*PAGE_SIZE, PAGE_NOT_CACHEABLE, 0); |
} |
/** Map page to frame |
* |
* Map virtual address 'page' to physical address 'frame' |
* using 'flags'. Allocate and setup any missing page tables. |
* |
* @param page Virtual address of the page to be mapped. |
* @param asid Address space to wich page belongs. |
* @param frame Physical address of memory frame to which the mapping is done. |
* @param flags Flags to be used for mapping. |
* @param root Explicit PTL0 address. |
*/ |
void page_mapping_insert(__address page, asid_t asid, __address frame, int flags, __address root) |
{ |
ASSERT(page_operations); |
ASSERT(page_operations->mapping_insert); |
page_operations->mapping_insert(page, asid, frame, flags, root); |
} |
/** Find mapping for virtual page |
* |
* Find mapping for virtual page. |
* |
* @param page Virtual page. |
* @param asid Address space to wich page belongs. |
* @param root PTL0 address if non-zero. |
* |
* @return NULL if there is no such mapping; requested mapping otherwise. |
*/ |
pte_t *page_mapping_find(__address page, asid_t asid, __address root) |
{ |
ASSERT(page_operations); |
ASSERT(page_operations->mapping_find); |
return page_operations->mapping_find(page, asid, root); |
} |
/kernel/branches/falloc_bad/generic/src/mm/buddy.c |
---|
0,0 → 1,263 |
/* |
* Copyright (C) 2005 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <mm/buddy.h> |
#include <mm/frame.h> |
#include <mm/heap.h> |
#include <arch/types.h> |
#include <typedefs.h> |
#include <list.h> |
#include <debug.h> |
#include <print.h> |
/** Create buddy system |
* |
* Allocate memory for and initialize new buddy system. |
* |
* @param max_order The biggest allocable size will be 2^max_order. |
* @param op Operations for new buddy system. |
* @param data Pointer to be used by implementation. |
* |
* @return New buddy system. |
*/ |
buddy_system_t *buddy_system_create(__u8 max_order, buddy_system_operations_t *op, void *data) |
{ |
buddy_system_t *b; |
int i; |
ASSERT(max_order < BUDDY_SYSTEM_INNER_BLOCK); |
ASSERT(op->find_buddy); |
ASSERT(op->set_order); |
ASSERT(op->get_order); |
ASSERT(op->bisect); |
ASSERT(op->coalesce); |
ASSERT(op->mark_busy); |
/* |
* Allocate memory for structure describing the whole buddy system. |
*/ |
b = (buddy_system_t *) early_malloc(sizeof(buddy_system_t)); |
if (b) { |
/* |
* Allocate memory for all orders this buddy system will work with. |
*/ |
b->order = (link_t *) early_malloc(max_order * sizeof(link_t)); |
if (!b->order) { |
early_free(b); |
return NULL; |
} |
for (i = 0; i < max_order; i++) |
list_initialize(&b->order[i]); |
b->max_order = max_order; |
b->op = op; |
b->data = data; |
} |
return b; |
} |
/** Check if buddy system can allocate block |
* |
* @param b Buddy system pointer |
* @param i Size of the block (2^i) |
* |
* @return True if block can be allocated |
*/ |
bool buddy_system_can_alloc(buddy_system_t *b, __u8 i) { |
__u8 k; |
ASSERT(i < b->max_order); |
for (k=i; k < b->max_order; k++) { |
if (!list_empty(&b->order[k])) { |
return true; |
} |
} |
return false; |
} |
/** Allocate block from buddy system. |
* |
* @param b Buddy system pointer. |
* @param i Returned block will be 2^i big. |
* |
* @return Block of data represented by link_t. |
*/ |
link_t *buddy_system_alloc(buddy_system_t *b, __u8 i) |
{ |
link_t *res, *hlp; |
ASSERT(i < b->max_order); |
/* |
* If the list of order i is not empty, |
* the request can be immediatelly satisfied. |
*/ |
if (!list_empty(&b->order[i])) { |
res = b->order[i].next; |
list_remove(res); |
b->op->mark_busy(b, res); |
return res; |
} |
/* |
* If order i is already the maximal order, |
* the request cannot be satisfied. |
*/ |
if (i == b->max_order - 1) |
return NULL; |
/* |
* Try to recursively satisfy the request from higher order lists. |
*/ |
hlp = buddy_system_alloc(b, i + 1); |
/* |
* The request could not be satisfied |
* from higher order lists. |
*/ |
if (!hlp) |
return NULL; |
res = hlp; |
/* |
* Bisect the block and set order of both of its parts to i. |
*/ |
hlp = b->op->bisect(b, res); |
b->op->set_order(b, res, i); |
b->op->set_order(b, hlp, i); |
/* |
* Return the other half to buddy system. |
* PROBLEM!!!! FILL FIND OTHER PART AS BUDDY AND LINK TOGETHER |
*/ |
b->op->mark_busy(b, res); |
buddy_system_free(b, hlp); |
return res; |
} |
/** Return block to buddy system. |
* |
* @param b Buddy system pointer. |
* @param block Block to return. |
*/ |
void buddy_system_free(buddy_system_t *b, link_t *block) |
{ |
link_t *buddy, *hlp; |
__u8 i; |
/* |
* Determine block's order. |
*/ |
i = b->op->get_order(b, block); |
ASSERT(i < b->max_order); |
if (i != b->max_order - 1) { |
/* |
* See if there is any buddy in the list of order i. |
*/ |
buddy = b->op->find_buddy(b, block); |
if (buddy) { |
ASSERT(b->op->get_order(b, buddy) == i); |
/* |
* Remove buddy from the list of order i. |
*/ |
list_remove(buddy); |
/* |
* Invalidate order of both block and buddy. |
*/ |
b->op->set_order(b, block, BUDDY_SYSTEM_INNER_BLOCK); |
b->op->set_order(b, buddy, BUDDY_SYSTEM_INNER_BLOCK); |
/* |
* Coalesce block and buddy into one block. |
*/ |
hlp = b->op->coalesce(b, block, buddy); |
/* |
* Set order of the coalesced block to i + 1. |
*/ |
b->op->set_order(b, hlp, i + 1); |
/* |
* Recursively add the coalesced block to the list of order i + 1. |
*/ |
buddy_system_free(b, hlp); |
return; |
} |
} |
/* |
* Insert block into the list of order i. |
*/ |
list_append(block, &b->order[i]); |
} |
/** Prints out structure of buddy system |
* |
* @param b Pointer to buddy system |
* @param es Element size |
*/ |
void buddy_system_structure_print(buddy_system_t *b, size_t elem_size) { |
index_t i; |
count_t cnt, elem_count = 0, block_count = 0; |
link_t * cur; |
printf("Order\tBlocks\tSize \tBlock size\tElems per block\n"); |
printf("-----\t------\t--------\t----------\t---------------\n"); |
for (i=0;i < b->max_order; i++) { |
cnt = 0; |
if (!list_empty(&b->order[i])) { |
for (cur = b->order[i].next; cur != &b->order[i]; cur = cur->next) |
cnt++; |
} |
printf("#%d\t%d\t%dK\t\t%dK\t\t%d\n", i, cnt, (cnt * (1 << i) * elem_size) >> 10, ((1 << i) * elem_size) >> 10, 1 << i); |
block_count += cnt; |
elem_count += (1 << i) * cnt; |
} |
printf("-----\t------\t--------\t----------\t---------------\n"); |
printf("Buddy system contains %d free elements (%d blocks)\n" , elem_count, block_count); |
} |
/kernel/branches/falloc_bad/generic/src/mm/tlb.c |
---|
0,0 → 1,83 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <mm/tlb.h> |
#include <arch/mm/tlb.h> |
#include <smp/ipi.h> |
#include <synch/spinlock.h> |
#include <typedefs.h> |
#include <arch/atomic.h> |
#include <arch/interrupt.h> |
#include <config.h> |
#include <arch.h> |
#include <panic.h> |
SPINLOCK_INITIALIZE(tlblock); |
void tlb_init(void) |
{ |
tlb_arch_init(); |
} |
#ifdef CONFIG_SMP |
/* must be called with interrupts disabled */ |
void tlb_shootdown_start(void) |
{ |
int i; |
CPU->tlb_active = 0; |
spinlock_lock(&tlblock); |
tlb_shootdown_ipi_send(); |
tlb_invalidate(0); /* TODO: use valid ASID */ |
busy_wait: |
for (i = 0; i<config.cpu_count; i++) |
if (cpus[i].tlb_active) |
goto busy_wait; |
} |
void tlb_shootdown_finalize(void) |
{ |
spinlock_unlock(&tlblock); |
CPU->tlb_active = 1; |
} |
void tlb_shootdown_ipi_send(void) |
{ |
ipi_broadcast(VECTOR_TLB_SHOOTDOWN_IPI); |
} |
void tlb_shootdown_ipi_recv(void) |
{ |
CPU->tlb_active = 0; |
spinlock_lock(&tlblock); |
spinlock_unlock(&tlblock); |
tlb_invalidate(0); /* TODO: use valid ASID */ |
CPU->tlb_active = 1; |
} |
#endif /* CONFIG_SMP */ |
/kernel/branches/falloc_bad/generic/src/mm/heap.c |
---|
0,0 → 1,157 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <mm/heap.h> |
#include <synch/spinlock.h> |
#include <func.h> |
#include <memstr.h> |
#include <panic.h> |
#include <arch/types.h> |
#include <arch/asm.h> |
#include <arch.h> |
#include <align.h> |
/* |
* First-fit algorithm. |
* Simple, but hopefully correct. |
* Chunks being freed are tested for mergability with their neighbours. |
*/ |
static chunk_t *chunk0; |
SPINLOCK_INITIALIZE(heaplock); |
void early_heap_init(__address heap, size_t size) |
{ |
memsetb(heap, size, 0); |
chunk0 = (chunk_t *) heap; |
chunk0->used = 0; |
chunk0->size = size - sizeof(chunk_t); |
chunk0->next = NULL; |
chunk0->prev = NULL; |
} |
/* |
* Uses first-fit algorithm. |
*/ |
void *early_malloc(size_t size) |
{ |
ipl_t ipl; |
chunk_t *x, *y, *z; |
if (size == 0) |
panic("zero-size allocation request"); |
size = ALIGN_UP(size, sizeof(__native)); |
x = chunk0; |
ipl = interrupts_disable(); |
spinlock_lock(&heaplock); |
while (x) { |
if (x->used || x->size < size) { |
x = x->next; |
continue; |
} |
x->used = 1; |
/* |
* If the chunk exactly matches required size or if truncating |
* it would not provide enough space for storing a new chunk |
* header plus at least one byte of data, we are finished. |
*/ |
if (x->size < size + sizeof(chunk_t) + 1) { |
spinlock_unlock(&heaplock); |
interrupts_restore(ipl); |
return &x->data[0]; |
} |
/* |
* Truncate x and create a new chunk. |
*/ |
y = (chunk_t *) (((__address) x) + size + sizeof(chunk_t)); |
y->used = 0; |
y->size = x->size - size - sizeof(chunk_t); |
y->prev = x; |
y->next = NULL; |
z = x->next; |
if (z) { |
z->prev = y; |
y->next = z; |
} |
x->size = size; |
x->next = y; |
spinlock_unlock(&heaplock); |
interrupts_restore(ipl); |
return &x->data[0]; |
} |
spinlock_unlock(&heaplock); |
interrupts_restore(ipl); |
return NULL; |
} |
void early_free(void *ptr) |
{ |
ipl_t ipl; |
chunk_t *x, *y, *z; |
if (!ptr) |
panic("free on NULL"); |
y = (chunk_t *) (((__u8 *) ptr) - sizeof(chunk_t)); |
if (y->used != 1) |
panic("freeing unused/damaged chunk"); |
ipl = interrupts_disable(); |
spinlock_lock(&heaplock); |
x = y->prev; |
z = y->next; |
/* merge x and y */ |
if (x && !x->used) { |
x->size += y->size + sizeof(chunk_t); |
x->next = z; |
if (z) |
z->prev = x; |
y = x; |
} |
/* merge y and z or merge (x merged with y) and z */ |
if (z && !z->used) { |
y->size += z->size + sizeof(chunk_t); |
y->next = z->next; |
if (z->next) { |
/* y is either y or x */ |
z->next->prev = y; |
} |
} |
y->used = 0; |
spinlock_unlock(&heaplock); |
interrupts_restore(ipl); |
} |
/kernel/branches/falloc_bad/generic/src/syscall/syscall.c |
---|
0,0 → 1,56 |
/* |
* Copyright (C) 2005 Martin Decky |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <syscall/syscall.h> |
#include <proc/thread.h> |
#include <print.h> |
#include <putchar.h> |
int sys_ctl(void) { |
printf("Thread finished\n"); |
thread_exit(); |
/* Unreachable */ |
return 0; |
} |
int sys_io(int fd, const void * buf, size_t count) { |
// TODO: buf sanity checks and a lot of other stuff ... |
size_t i; |
for (i = 0; i < count; i++) |
putchar(((char *) buf)[i]); |
return count; |
} |
syshandler_t syscall_table[SYSCALL_END] = { |
sys_ctl, |
sys_io |
}; |
/kernel/branches/falloc_bad/generic/src/proc/scheduler.c |
---|
0,0 → 1,628 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <proc/scheduler.h> |
#include <proc/thread.h> |
#include <proc/task.h> |
#include <mm/heap.h> |
#include <mm/frame.h> |
#include <mm/page.h> |
#include <mm/as.h> |
#include <arch/asm.h> |
#include <arch/faddr.h> |
#include <arch/atomic.h> |
#include <synch/spinlock.h> |
#include <config.h> |
#include <context.h> |
#include <func.h> |
#include <arch.h> |
#include <list.h> |
#include <panic.h> |
#include <typedefs.h> |
#include <cpu.h> |
#include <print.h> |
#include <debug.h> |
atomic_t nrdy; |
/** Take actions before new thread runs |
* |
* Perform actions that need to be |
* taken before the newly selected |
* tread is passed control. |
* |
*/ |
void before_thread_runs(void) |
{ |
before_thread_runs_arch(); |
#ifdef CONFIG_FPU_LAZY |
if(THREAD==CPU->fpu_owner) |
fpu_enable(); |
else |
fpu_disable(); |
#else |
fpu_enable(); |
if (THREAD->fpu_context_exists) |
fpu_context_restore(&(THREAD->saved_fpu_context)); |
else { |
fpu_init(); |
THREAD->fpu_context_exists=1; |
} |
#endif |
} |
#ifdef CONFIG_FPU_LAZY |
void scheduler_fpu_lazy_request(void) |
{ |
fpu_enable(); |
if (CPU->fpu_owner != NULL) { |
fpu_context_save(&CPU->fpu_owner->saved_fpu_context); |
/* don't prevent migration */ |
CPU->fpu_owner->fpu_context_engaged=0; |
} |
if (THREAD->fpu_context_exists) |
fpu_context_restore(&THREAD->saved_fpu_context); |
else { |
fpu_init(); |
THREAD->fpu_context_exists=1; |
} |
CPU->fpu_owner=THREAD; |
THREAD->fpu_context_engaged = 1; |
} |
#endif |
/** Initialize scheduler |
* |
* Initialize kernel scheduler. |
* |
*/ |
void scheduler_init(void) |
{ |
} |
/** Get thread to be scheduled |
* |
* Get the optimal thread to be scheduled |
* according to thread accounting and scheduler |
* policy. |
* |
* @return Thread to be scheduled. |
* |
*/ |
static thread_t *find_best_thread(void) |
{ |
thread_t *t; |
runq_t *r; |
int i, n; |
ASSERT(CPU != NULL); |
loop: |
interrupts_disable(); |
spinlock_lock(&CPU->lock); |
n = CPU->nrdy; |
spinlock_unlock(&CPU->lock); |
interrupts_enable(); |
if (n == 0) { |
#ifdef CONFIG_SMP |
/* |
* If the load balancing thread is not running, wake it up and |
* set CPU-private flag that the kcpulb has been started. |
*/ |
if (test_and_set(&CPU->kcpulbstarted) == 0) { |
waitq_wakeup(&CPU->kcpulb_wq, 0); |
goto loop; |
} |
#endif /* CONFIG_SMP */ |
/* |
* For there was nothing to run, the CPU goes to sleep |
* until a hardware interrupt or an IPI comes. |
* This improves energy saving and hyperthreading. |
* On the other hand, several hardware interrupts can be ignored. |
*/ |
cpu_sleep(); |
goto loop; |
} |
interrupts_disable(); |
i = 0; |
retry: |
for (; i<RQ_COUNT; i++) { |
r = &CPU->rq[i]; |
spinlock_lock(&r->lock); |
if (r->n == 0) { |
/* |
* If this queue is empty, try a lower-priority queue. |
*/ |
spinlock_unlock(&r->lock); |
continue; |
} |
/* avoid deadlock with relink_rq() */ |
if (!spinlock_trylock(&CPU->lock)) { |
/* |
* Unlock r and try again. |
*/ |
spinlock_unlock(&r->lock); |
goto retry; |
} |
CPU->nrdy--; |
spinlock_unlock(&CPU->lock); |
atomic_dec(&nrdy); |
r->n--; |
/* |
* Take the first thread from the queue. |
*/ |
t = list_get_instance(r->rq_head.next, thread_t, rq_link); |
list_remove(&t->rq_link); |
spinlock_unlock(&r->lock); |
spinlock_lock(&t->lock); |
t->cpu = CPU; |
t->ticks = us2ticks((i+1)*10000); |
t->priority = i; /* eventually correct rq index */ |
/* |
* Clear the X_STOLEN flag so that t can be migrated when load balancing needs emerge. |
*/ |
t->flags &= ~X_STOLEN; |
spinlock_unlock(&t->lock); |
return t; |
} |
goto loop; |
} |
/** Prevent rq starvation |
* |
* Prevent low priority threads from starving in rq's. |
* |
* When the function decides to relink rq's, it reconnects |
* respective pointers so that in result threads with 'pri' |
* greater or equal 'start' are moved to a higher-priority queue. |
* |
* @param start Threshold priority. |
* |
*/ |
static void relink_rq(int start) |
{ |
link_t head; |
runq_t *r; |
int i, n; |
list_initialize(&head); |
spinlock_lock(&CPU->lock); |
if (CPU->needs_relink > NEEDS_RELINK_MAX) { |
for (i = start; i<RQ_COUNT-1; i++) { |
/* remember and empty rq[i + 1] */ |
r = &CPU->rq[i + 1]; |
spinlock_lock(&r->lock); |
list_concat(&head, &r->rq_head); |
n = r->n; |
r->n = 0; |
spinlock_unlock(&r->lock); |
/* append rq[i + 1] to rq[i] */ |
r = &CPU->rq[i]; |
spinlock_lock(&r->lock); |
list_concat(&r->rq_head, &head); |
r->n += n; |
spinlock_unlock(&r->lock); |
} |
CPU->needs_relink = 0; |
} |
spinlock_unlock(&CPU->lock); |
} |
/** Scheduler stack switch wrapper |
* |
* Second part of the scheduler() function |
* using new stack. Handling the actual context |
* switch to a new thread. |
* |
*/ |
static void scheduler_separated_stack(void) |
{ |
int priority; |
ASSERT(CPU != NULL); |
if (THREAD) { |
switch (THREAD->state) { |
case Running: |
THREAD->state = Ready; |
spinlock_unlock(&THREAD->lock); |
thread_ready(THREAD); |
break; |
case Exiting: |
frame_free((__address) THREAD->kstack); |
if (THREAD->ustack) { |
frame_free((__address) THREAD->ustack); |
} |
/* |
* Detach from the containing task. |
*/ |
spinlock_lock(&TASK->lock); |
list_remove(&THREAD->th_link); |
spinlock_unlock(&TASK->lock); |
spinlock_unlock(&THREAD->lock); |
spinlock_lock(&threads_lock); |
list_remove(&THREAD->threads_link); |
spinlock_unlock(&threads_lock); |
spinlock_lock(&CPU->lock); |
if(CPU->fpu_owner==THREAD) |
CPU->fpu_owner=NULL; |
spinlock_unlock(&CPU->lock); |
free(THREAD); |
break; |
case Sleeping: |
/* |
* Prefer the thread after it's woken up. |
*/ |
THREAD->priority = -1; |
/* |
* We need to release wq->lock which we locked in waitq_sleep(). |
* Address of wq->lock is kept in THREAD->sleep_queue. |
*/ |
spinlock_unlock(&THREAD->sleep_queue->lock); |
/* |
* Check for possible requests for out-of-context invocation. |
*/ |
if (THREAD->call_me) { |
THREAD->call_me(THREAD->call_me_with); |
THREAD->call_me = NULL; |
THREAD->call_me_with = NULL; |
} |
spinlock_unlock(&THREAD->lock); |
break; |
default: |
/* |
* Entering state is unexpected. |
*/ |
panic("tid%d: unexpected state %s\n", THREAD->tid, thread_states[THREAD->state]); |
break; |
} |
THREAD = NULL; |
} |
THREAD = find_best_thread(); |
spinlock_lock(&THREAD->lock); |
priority = THREAD->priority; |
spinlock_unlock(&THREAD->lock); |
relink_rq(priority); |
spinlock_lock(&THREAD->lock); |
/* |
* If both the old and the new task are the same, lots of work is avoided. |
*/ |
if (TASK != THREAD->task) { |
as_t *as1 = NULL; |
as_t *as2; |
if (TASK) { |
spinlock_lock(&TASK->lock); |
as1 = TASK->as; |
spinlock_unlock(&TASK->lock); |
} |
spinlock_lock(&THREAD->task->lock); |
as2 = THREAD->task->as; |
spinlock_unlock(&THREAD->task->lock); |
/* |
* Note that it is possible for two tasks to share one address space. |
*/ |
if (as1 != as2) { |
/* |
* Both tasks and address spaces are different. |
* Replace the old one with the new one. |
*/ |
as_install(as2); |
} |
TASK = THREAD->task; |
} |
THREAD->state = Running; |
#ifdef SCHEDULER_VERBOSE |
printf("cpu%d: tid %d (priority=%d,ticks=%d,nrdy=%d)\n", CPU->id, THREAD->tid, THREAD->priority, THREAD->ticks, CPU->nrdy); |
#endif |
/* |
* Copy the knowledge of CPU, TASK, THREAD and preemption counter to thread's stack. |
*/ |
the_copy(THE, (the_t *) THREAD->kstack); |
context_restore(&THREAD->saved_context); |
/* not reached */ |
} |
/** The scheduler |
* |
* The thread scheduling procedure. |
* Passes control directly to |
* scheduler_separated_stack(). |
* |
*/ |
void scheduler(void) |
{ |
volatile ipl_t ipl; |
ASSERT(CPU != NULL); |
ipl = interrupts_disable(); |
if (atomic_get(&haltstate)) |
halt(); |
if (THREAD) { |
spinlock_lock(&THREAD->lock); |
#ifndef CONFIG_FPU_LAZY |
fpu_context_save(&(THREAD->saved_fpu_context)); |
#endif |
if (!context_save(&THREAD->saved_context)) { |
/* |
* This is the place where threads leave scheduler(); |
*/ |
before_thread_runs(); |
spinlock_unlock(&THREAD->lock); |
interrupts_restore(THREAD->saved_context.ipl); |
return; |
} |
/* |
* Interrupt priority level of preempted thread is recorded here |
* to facilitate scheduler() invocations from interrupts_disable()'d |
* code (e.g. waitq_sleep_timeout()). |
*/ |
THREAD->saved_context.ipl = ipl; |
} |
/* |
* Through the 'THE' structure, we keep track of THREAD, TASK, CPU, VM |
* and preemption counter. At this point THE could be coming either |
* from THREAD's or CPU's stack. |
*/ |
the_copy(THE, (the_t *) CPU->stack); |
/* |
* We may not keep the old stack. |
* Reason: If we kept the old stack and got blocked, for instance, in |
* find_best_thread(), the old thread could get rescheduled by another |
* CPU and overwrite the part of its own stack that was also used by |
* the scheduler on this CPU. |
* |
* Moreover, we have to bypass the compiler-generated POP sequence |
* which is fooled by SP being set to the very top of the stack. |
* Therefore the scheduler() function continues in |
* scheduler_separated_stack(). |
*/ |
context_save(&CPU->saved_context); |
context_set(&CPU->saved_context, FADDR(scheduler_separated_stack), (__address) CPU->stack, CPU_STACK_SIZE); |
context_restore(&CPU->saved_context); |
/* not reached */ |
} |
#ifdef CONFIG_SMP |
/** Load balancing thread |
* |
* SMP load balancing thread, supervising thread supplies |
* for the CPU it's wired to. |
* |
* @param arg Generic thread argument (unused). |
* |
*/ |
void kcpulb(void *arg) |
{ |
thread_t *t; |
int count, i, j, k = 0; |
ipl_t ipl; |
loop: |
/* |
* Sleep until there's some work to do. |
*/ |
waitq_sleep(&CPU->kcpulb_wq); |
not_satisfied: |
/* |
* Calculate the number of threads that will be migrated/stolen from |
* other CPU's. Note that situation can have changed between two |
* passes. Each time get the most up to date counts. |
*/ |
ipl = interrupts_disable(); |
spinlock_lock(&CPU->lock); |
count = atomic_get(&nrdy) / config.cpu_active; |
count -= CPU->nrdy; |
spinlock_unlock(&CPU->lock); |
interrupts_restore(ipl); |
if (count <= 0) |
goto satisfied; |
/* |
* Searching least priority queues on all CPU's first and most priority queues on all CPU's last. |
*/ |
for (j=RQ_COUNT-1; j >= 0; j--) { |
for (i=0; i < config.cpu_active; i++) { |
link_t *l; |
runq_t *r; |
cpu_t *cpu; |
cpu = &cpus[(i + k) % config.cpu_active]; |
/* |
* Not interested in ourselves. |
* Doesn't require interrupt disabling for kcpulb is X_WIRED. |
*/ |
if (CPU == cpu) |
continue; |
restart: ipl = interrupts_disable(); |
r = &cpu->rq[j]; |
spinlock_lock(&r->lock); |
if (r->n == 0) { |
spinlock_unlock(&r->lock); |
interrupts_restore(ipl); |
continue; |
} |
t = NULL; |
l = r->rq_head.prev; /* search rq from the back */ |
while (l != &r->rq_head) { |
t = list_get_instance(l, thread_t, rq_link); |
/* |
* We don't want to steal CPU-wired threads neither threads already stolen. |
* The latter prevents threads from migrating between CPU's without ever being run. |
* We don't want to steal threads whose FPU context is still in CPU. |
*/ |
spinlock_lock(&t->lock); |
if ( (!(t->flags & (X_WIRED | X_STOLEN))) && (!(t->fpu_context_engaged)) ) { |
/* |
* Remove t from r. |
*/ |
spinlock_unlock(&t->lock); |
/* |
* Here we have to avoid deadlock with relink_rq(), |
* because it locks cpu and r in a different order than we do. |
*/ |
if (!spinlock_trylock(&cpu->lock)) { |
/* Release all locks and try again. */ |
spinlock_unlock(&r->lock); |
interrupts_restore(ipl); |
goto restart; |
} |
cpu->nrdy--; |
spinlock_unlock(&cpu->lock); |
atomic_dec(&nrdy); |
r->n--; |
list_remove(&t->rq_link); |
break; |
} |
spinlock_unlock(&t->lock); |
l = l->prev; |
t = NULL; |
} |
spinlock_unlock(&r->lock); |
if (t) { |
/* |
* Ready t on local CPU |
*/ |
spinlock_lock(&t->lock); |
#ifdef KCPULB_VERBOSE |
printf("kcpulb%d: TID %d -> cpu%d, nrdy=%d, avg=%d\n", CPU->id, t->tid, CPU->id, CPU->nrdy, nrdy / config.cpu_active); |
#endif |
t->flags |= X_STOLEN; |
spinlock_unlock(&t->lock); |
thread_ready(t); |
interrupts_restore(ipl); |
if (--count == 0) |
goto satisfied; |
/* |
* We are not satisfied yet, focus on another CPU next time. |
*/ |
k++; |
continue; |
} |
interrupts_restore(ipl); |
} |
} |
if (CPU->nrdy) { |
/* |
* Be a little bit light-weight and let migrated threads run. |
*/ |
scheduler(); |
} |
else { |
/* |
* We failed to migrate a single thread. |
* Something more sophisticated should be done. |
*/ |
scheduler(); |
} |
goto not_satisfied; |
satisfied: |
/* |
* Tell find_best_thread() to wake us up later again. |
*/ |
atomic_set(&CPU->kcpulbstarted,0); |
goto loop; |
} |
#endif /* CONFIG_SMP */ |
/kernel/branches/falloc_bad/generic/src/proc/the.c |
---|
0,0 → 1,58 |
/* |
* Copyright (C) 2005 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <arch.h> |
#include <typedefs.h> |
/** Initialize THE structure |
* |
* Initialize THE structure passed as argument. |
* |
* @param the THE structure to be initialized. |
*/ |
void the_initialize(the_t *the) |
{ |
the->preemption_disabled = 0; |
the->cpu = NULL; |
the->thread = NULL; |
the->task = NULL; |
the->as = NULL; |
} |
/** Copy THE structure |
* |
* Copy the source THE structure to the destination THE structure. |
* |
* @param src The source THE structure. |
* @param dst The destination THE structure. |
*/ |
void the_copy(the_t *src, the_t *dst) |
{ |
*dst = *src; |
} |
/kernel/branches/falloc_bad/generic/src/proc/task.c |
---|
0,0 → 1,82 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <proc/thread.h> |
#include <proc/task.h> |
#include <mm/as.h> |
#include <mm/heap.h> |
#include <synch/spinlock.h> |
#include <arch.h> |
#include <panic.h> |
#include <list.h> |
SPINLOCK_INITIALIZE(tasks_lock); |
LIST_INITIALIZE(tasks_head); |
/** Initialize tasks |
* |
* Initialize kernel tasks support. |
* |
*/ |
void task_init(void) |
{ |
TASK = NULL; |
} |
/** Create new task |
* |
* Create new task with no threads. |
* |
* @param as Task's address space. |
* |
* @return New task's structure on success, NULL on failure. |
* |
*/ |
task_t *task_create(as_t *as) |
{ |
ipl_t ipl; |
task_t *ta; |
ta = (task_t *) malloc(sizeof(task_t)); |
if (ta) { |
spinlock_initialize(&ta->lock, "task_ta_lock"); |
list_initialize(&ta->th_head); |
list_initialize(&ta->tasks_link); |
ta->as = as; |
ipl = interrupts_disable(); |
spinlock_lock(&tasks_lock); |
list_append(&ta->tasks_link, &tasks_head); |
spinlock_unlock(&tasks_lock); |
interrupts_restore(ipl); |
} |
return ta; |
} |
/kernel/branches/falloc_bad/generic/src/proc/thread.c |
---|
0,0 → 1,320 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <proc/scheduler.h> |
#include <proc/thread.h> |
#include <proc/task.h> |
#include <mm/heap.h> |
#include <mm/frame.h> |
#include <mm/page.h> |
#include <arch/asm.h> |
#include <arch.h> |
#include <synch/synch.h> |
#include <synch/spinlock.h> |
#include <synch/waitq.h> |
#include <synch/rwlock.h> |
#include <cpu.h> |
#include <func.h> |
#include <context.h> |
#include <list.h> |
#include <typedefs.h> |
#include <time/clock.h> |
#include <list.h> |
#include <config.h> |
#include <arch/interrupt.h> |
#include <smp/ipi.h> |
#include <arch/faddr.h> |
#include <arch/atomic.h> |
#include <memstr.h> |
char *thread_states[] = {"Invalid", "Running", "Sleeping", "Ready", "Entering", "Exiting"}; /**< Thread states */ |
SPINLOCK_INITIALIZE(threads_lock); /**< Lock protecting threads_head list. For locking rules, see declaration thereof. */ |
LIST_INITIALIZE(threads_head); /**< List of all threads. */ |
SPINLOCK_INITIALIZE(tidlock); |
__u32 last_tid = 0; |
/** Thread wrapper |
* |
* This wrapper is provided to ensure that every thread |
* makes a call to thread_exit() when its implementing |
* function returns. |
* |
* interrupts_disable() is assumed. |
* |
*/ |
static void cushion(void) |
{ |
void (*f)(void *) = THREAD->thread_code; |
void *arg = THREAD->thread_arg; |
/* this is where each thread wakes up after its creation */ |
before_thread_runs(); |
spinlock_unlock(&THREAD->lock); |
interrupts_enable(); |
f(arg); |
thread_exit(); |
/* not reached */ |
} |
/** Initialize threads |
* |
* Initialize kernel threads support. |
* |
*/ |
void thread_init(void) |
{ |
THREAD = NULL; |
atomic_set(&nrdy,0); |
} |
/** Make thread ready |
* |
* Switch thread t to the ready state. |
* |
* @param t Thread to make ready. |
* |
*/ |
void thread_ready(thread_t *t) |
{ |
cpu_t *cpu; |
runq_t *r; |
ipl_t ipl; |
int i, avg; |
ipl = interrupts_disable(); |
spinlock_lock(&t->lock); |
i = (t->priority < RQ_COUNT -1) ? ++t->priority : t->priority; |
cpu = CPU; |
if (t->flags & X_WIRED) { |
cpu = t->cpu; |
} |
spinlock_unlock(&t->lock); |
/* |
* Append t to respective ready queue on respective processor. |
*/ |
r = &cpu->rq[i]; |
spinlock_lock(&r->lock); |
list_append(&t->rq_link, &r->rq_head); |
r->n++; |
spinlock_unlock(&r->lock); |
atomic_inc(&nrdy); |
avg = atomic_get(&nrdy) / config.cpu_active; |
spinlock_lock(&cpu->lock); |
if ((++cpu->nrdy) > avg) { |
/* |
* If there are idle halted CPU's, this will wake them up. |
*/ |
ipi_broadcast(VECTOR_WAKEUP_IPI); |
} |
spinlock_unlock(&cpu->lock); |
interrupts_restore(ipl); |
} |
/** Create new thread |
* |
* Create a new thread. |
* |
* @param func Thread's implementing function. |
* @param arg Thread's implementing function argument. |
* @param task Task to which the thread belongs. |
* @param flags Thread flags. |
* |
* @return New thread's structure on success, NULL on failure. |
* |
*/ |
thread_t *thread_create(void (* func)(void *), void *arg, task_t *task, int flags) |
{ |
thread_t *t; |
__address frame_ks, frame_us = NULL; |
t = (thread_t *) malloc(sizeof(thread_t)); |
if (t) { |
ipl_t ipl; |
spinlock_initialize(&t->lock, "thread_t_lock"); |
frame_ks = frame_alloc(FRAME_KA, ONE_FRAME, NULL); |
if (THREAD_USER_STACK & flags) { |
frame_us = frame_alloc(FRAME_KA, ONE_FRAME, NULL); |
} |
ipl = interrupts_disable(); |
spinlock_lock(&tidlock); |
t->tid = ++last_tid; |
spinlock_unlock(&tidlock); |
interrupts_restore(ipl); |
memsetb(frame_ks, THREAD_STACK_SIZE, 0); |
link_initialize(&t->rq_link); |
link_initialize(&t->wq_link); |
link_initialize(&t->th_link); |
link_initialize(&t->threads_link); |
t->kstack = (__u8 *) frame_ks; |
t->ustack = (__u8 *) frame_us; |
context_save(&t->saved_context); |
context_set(&t->saved_context, FADDR(cushion), (__address) t->kstack, THREAD_STACK_SIZE); |
the_initialize((the_t *) t->kstack); |
ipl = interrupts_disable(); |
t->saved_context.ipl = interrupts_read(); |
interrupts_restore(ipl); |
t->thread_code = func; |
t->thread_arg = arg; |
t->ticks = -1; |
t->priority = -1; /* start in rq[0] */ |
t->cpu = NULL; |
t->flags = 0; |
t->state = Entering; |
t->call_me = NULL; |
t->call_me_with = NULL; |
timeout_initialize(&t->sleep_timeout); |
t->sleep_queue = NULL; |
t->timeout_pending = 0; |
t->rwlock_holder_type = RWLOCK_NONE; |
t->task = task; |
t->fpu_context_exists=0; |
t->fpu_context_engaged=0; |
/* |
* Register this thread in the system-wide list. |
*/ |
ipl = interrupts_disable(); |
spinlock_lock(&threads_lock); |
list_append(&t->threads_link, &threads_head); |
spinlock_unlock(&threads_lock); |
/* |
* Attach to the containing task. |
*/ |
spinlock_lock(&task->lock); |
list_append(&t->th_link, &task->th_head); |
spinlock_unlock(&task->lock); |
interrupts_restore(ipl); |
} |
return t; |
} |
/** Make thread exiting |
* |
* End current thread execution and switch it to the exiting |
* state. All pending timeouts are executed. |
* |
*/ |
void thread_exit(void) |
{ |
ipl_t ipl; |
restart: |
ipl = interrupts_disable(); |
spinlock_lock(&THREAD->lock); |
if (THREAD->timeout_pending) { /* busy waiting for timeouts in progress */ |
spinlock_unlock(&THREAD->lock); |
interrupts_restore(ipl); |
goto restart; |
} |
THREAD->state = Exiting; |
spinlock_unlock(&THREAD->lock); |
scheduler(); |
} |
/** Thread sleep |
* |
* Suspend execution of the current thread. |
* |
* @param sec Number of seconds to sleep. |
* |
*/ |
void thread_sleep(__u32 sec) |
{ |
thread_usleep(sec*1000000); |
} |
/** Thread usleep |
* |
* Suspend execution of the current thread. |
* |
* @param usec Number of microseconds to sleep. |
* |
*/ |
void thread_usleep(__u32 usec) |
{ |
waitq_t wq; |
waitq_initialize(&wq); |
(void) waitq_sleep_timeout(&wq, usec, SYNCH_NON_BLOCKING); |
} |
/** Register thread out-of-context invocation |
* |
* Register a function and its argument to be executed |
* on next context switch to the current thread. |
* |
* @param call_me Out-of-context function. |
* @param call_me_with Out-of-context function argument. |
* |
*/ |
void thread_register_call_me(void (* call_me)(void *), void *call_me_with) |
{ |
ipl_t ipl; |
ipl = interrupts_disable(); |
spinlock_lock(&THREAD->lock); |
THREAD->call_me = call_me; |
THREAD->call_me_with = call_me_with; |
spinlock_unlock(&THREAD->lock); |
interrupts_restore(ipl); |
} |
/kernel/branches/falloc_bad/generic/src/cpu/cpu.c |
---|
0,0 → 1,104 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <cpu.h> |
#include <arch.h> |
#include <arch/cpu.h> |
#include <mm/heap.h> |
#include <mm/page.h> |
#include <mm/frame.h> |
#include <arch/types.h> |
#include <config.h> |
#include <panic.h> |
#include <typedefs.h> |
#include <memstr.h> |
#include <list.h> |
#include <print.h> |
cpu_t *cpus; |
/** Initialize CPUs |
* |
* Initialize kernel CPUs support. |
* |
*/ |
void cpu_init(void) { |
int i, j; |
#ifdef CONFIG_SMP |
if (config.cpu_active == 1) { |
#endif /* CONFIG_SMP */ |
cpus = (cpu_t *) malloc(sizeof(cpu_t) * config.cpu_count); |
if (!cpus) |
panic("malloc/cpus"); |
/* initialize everything */ |
memsetb((__address) cpus, sizeof(cpu_t) * config.cpu_count, 0); |
for (i=0; i < config.cpu_count; i++) { |
cpus[i].stack = (__u8 *) frame_alloc(FRAME_KA | FRAME_PANIC, ONE_FRAME, NULL); |
cpus[i].id = i; |
spinlock_initialize(&cpus[i].lock, "cpu_t.lock"); |
#ifdef CONFIG_SMP |
waitq_initialize(&cpus[i].kcpulb_wq); |
#endif /* __SMP */ |
for (j = 0; j < RQ_COUNT; j++) { |
spinlock_initialize(&cpus[i].rq[j].lock, "rq_t.lock"); |
list_initialize(&cpus[i].rq[j].rq_head); |
} |
} |
#ifdef CONFIG_SMP |
} |
#endif /* CONFIG_SMP */ |
CPU = &cpus[config.cpu_active-1]; |
CPU->active = 1; |
CPU->tlb_active = 1; |
cpu_identify(); |
cpu_arch_init(); |
} |
/** List all processors. */ |
void cpu_list(void) |
{ |
int i; |
for (i = 0; i < config.cpu_count; i++) { |
if (cpus[i].active) |
cpu_print_report(&cpus[i]); |
else |
printf("cpu%d: not active\n", i); |
} |
} |
/kernel/branches/falloc_bad/generic/src/console/cmd.c |
---|
0,0 → 1,650 |
/* |
* Copyright (C) 2005 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
/** |
* This file is meant to contain all wrapper functions for |
* all kconsole commands. The point is in separating |
* kconsole specific wrappers from kconsole-unaware functions |
* from other subsystems. |
*/ |
#include <console/cmd.h> |
#include <console/kconsole.h> |
#include <print.h> |
#include <panic.h> |
#include <typedefs.h> |
#include <arch/types.h> |
#include <list.h> |
#include <arch.h> |
#include <func.h> |
#include <macros.h> |
#include <debug.h> |
#include <symtab.h> |
#include <cpu.h> |
#include <mm/tlb.h> |
#include <arch/mm/tlb.h> |
#include <mm/frame.h> |
#include <main/version.h> |
/** Data and methods for 'help' command. */ |
static int cmd_help(cmd_arg_t *argv); |
static cmd_info_t help_info = { |
.name = "help", |
.description = "List of supported commands.", |
.func = cmd_help, |
.argc = 0 |
}; |
static cmd_info_t exit_info = { |
.name = "exit", |
.description ="Exit kconsole", |
.argc = 0 |
}; |
/** Data and methods for 'description' command. */ |
static int cmd_desc(cmd_arg_t *argv); |
static void desc_help(void); |
static char desc_buf[MAX_CMDLINE+1]; |
static cmd_arg_t desc_argv = { |
.type = ARG_TYPE_STRING, |
.buffer = desc_buf, |
.len = sizeof(desc_buf) |
}; |
static cmd_info_t desc_info = { |
.name = "describe", |
.description = "Describe specified command.", |
.help = desc_help, |
.func = cmd_desc, |
.argc = 1, |
.argv = &desc_argv |
}; |
/** Data and methods for 'symaddr' command. */ |
static int cmd_symaddr(cmd_arg_t *argv); |
static char symaddr_buf[MAX_CMDLINE+1]; |
static cmd_arg_t symaddr_argv = { |
.type = ARG_TYPE_STRING, |
.buffer = symaddr_buf, |
.len = sizeof(symaddr_buf) |
}; |
static cmd_info_t symaddr_info = { |
.name = "symaddr", |
.description = "Return symbol address.", |
.func = cmd_symaddr, |
.argc = 1, |
.argv = &symaddr_argv |
}; |
static char set_buf[MAX_CMDLINE+1]; |
static int cmd_set4(cmd_arg_t *argv); |
static cmd_arg_t set4_argv[] = { |
{ |
.type = ARG_TYPE_STRING, |
.buffer = set_buf, |
.len = sizeof(set_buf) |
}, |
{ |
.type = ARG_TYPE_INT |
} |
}; |
static cmd_info_t set4_info = { |
.name = "set4", |
.description = "set <dest_addr> <value> - 4byte version", |
.func = cmd_set4, |
.argc = 2, |
.argv = set4_argv |
}; |
/** Data and methods for 'call0' command. */ |
static char call0_buf[MAX_CMDLINE+1]; |
static char carg1_buf[MAX_CMDLINE+1]; |
static char carg2_buf[MAX_CMDLINE+1]; |
static char carg3_buf[MAX_CMDLINE+1]; |
static int cmd_call0(cmd_arg_t *argv); |
static cmd_arg_t call0_argv = { |
.type = ARG_TYPE_STRING, |
.buffer = call0_buf, |
.len = sizeof(call0_buf) |
}; |
static cmd_info_t call0_info = { |
.name = "call0", |
.description = "call0 <function> -> call function().", |
.func = cmd_call0, |
.argc = 1, |
.argv = &call0_argv |
}; |
/** Data and methods for 'call1' command. */ |
static int cmd_call1(cmd_arg_t *argv); |
static cmd_arg_t call1_argv[] = { |
{ |
.type = ARG_TYPE_STRING, |
.buffer = call0_buf, |
.len = sizeof(call0_buf) |
}, |
{ |
.type = ARG_TYPE_VAR, |
.buffer = carg1_buf, |
.len = sizeof(carg1_buf) |
} |
}; |
static cmd_info_t call1_info = { |
.name = "call1", |
.description = "call1 <function> <arg1> -> call function(arg1).", |
.func = cmd_call1, |
.argc = 2, |
.argv = call1_argv |
}; |
/** Data and methods for 'call2' command. */ |
static int cmd_call2(cmd_arg_t *argv); |
static cmd_arg_t call2_argv[] = { |
{ |
.type = ARG_TYPE_STRING, |
.buffer = call0_buf, |
.len = sizeof(call0_buf) |
}, |
{ |
.type = ARG_TYPE_VAR, |
.buffer = carg1_buf, |
.len = sizeof(carg1_buf) |
}, |
{ |
.type = ARG_TYPE_VAR, |
.buffer = carg2_buf, |
.len = sizeof(carg2_buf) |
} |
}; |
static cmd_info_t call2_info = { |
.name = "call2", |
.description = "call2 <function> <arg1> <arg2> -> call function(arg1,arg2).", |
.func = cmd_call2, |
.argc = 3, |
.argv = call2_argv |
}; |
/** Data and methods for 'call3' command. */ |
static int cmd_call3(cmd_arg_t *argv); |
static cmd_arg_t call3_argv[] = { |
{ |
.type = ARG_TYPE_STRING, |
.buffer = call0_buf, |
.len = sizeof(call0_buf) |
}, |
{ |
.type = ARG_TYPE_VAR, |
.buffer = carg1_buf, |
.len = sizeof(carg1_buf) |
}, |
{ |
.type = ARG_TYPE_VAR, |
.buffer = carg2_buf, |
.len = sizeof(carg2_buf) |
}, |
{ |
.type = ARG_TYPE_VAR, |
.buffer = carg3_buf, |
.len = sizeof(carg3_buf) |
} |
}; |
static cmd_info_t call3_info = { |
.name = "call3", |
.description = "call3 <function> <arg1> <arg2> <arg3> -> call function(arg1,arg2,arg3).", |
.func = cmd_call3, |
.argc = 4, |
.argv = call3_argv |
}; |
/** Data and methods for 'halt' command. */ |
static int cmd_halt(cmd_arg_t *argv); |
static cmd_info_t halt_info = { |
.name = "halt", |
.description = "Halt the kernel.", |
.func = cmd_halt, |
.argc = 0 |
}; |
/** Data and methods for 'tlb' command. */ |
static int cmd_tlb(cmd_arg_t *argv); |
cmd_info_t tlb_info = { |
.name = "tlb", |
.description = "Print TLB of current processor.", |
.help = NULL, |
.func = cmd_tlb, |
.argc = 0, |
.argv = NULL |
}; |
/** Data and methods for 'zones' command */ |
static int cmd_zones(cmd_arg_t *argv); |
static cmd_info_t zones_info = { |
.name = "zones", |
.description = "List of memory zones.", |
.func = cmd_zones, |
.argc = 0 |
}; |
/** Data and methods for 'zone' command */ |
static int cmd_zone(cmd_arg_t *argv); |
static cmd_arg_t zone_argv = { |
.type = ARG_TYPE_INT, |
}; |
static cmd_info_t zone_info = { |
.name = "zone", |
.description = "Show memory zone structure.", |
.func = cmd_zone, |
.argc = 1, |
.argv = &zone_argv |
}; |
/** Data and methods for 'cpus' command. */ |
static int cmd_cpus(cmd_arg_t *argv); |
cmd_info_t cpus_info = { |
.name = "cpus", |
.description = "List all processors.", |
.help = NULL, |
.func = cmd_cpus, |
.argc = 0, |
.argv = NULL |
}; |
/** Data and methods for 'version' command. */ |
static int cmd_version(cmd_arg_t *argv); |
cmd_info_t version_info = { |
.name = "version", |
.description = "Print version information.", |
.help = NULL, |
.func = cmd_version, |
.argc = 0, |
.argv = NULL |
}; |
/** Initialize command info structure. |
* |
* @param cmd Command info structure. |
* |
*/ |
void cmd_initialize(cmd_info_t *cmd) |
{ |
spinlock_initialize(&cmd->lock, "cmd"); |
link_initialize(&cmd->link); |
} |
/** Initialize and register commands. */ |
void cmd_init(void) |
{ |
cmd_initialize(&help_info); |
if (!cmd_register(&help_info)) |
panic("could not register command %s\n", help_info.name); |
cmd_initialize(&desc_info); |
if (!cmd_register(&desc_info)) |
panic("could not register command %s\n", desc_info.name); |
cmd_initialize(&exit_info); |
if (!cmd_register(&exit_info)) |
panic("could not register command %s\n", exit_info.name); |
cmd_initialize(&symaddr_info); |
if (!cmd_register(&symaddr_info)) |
panic("could not register command %s\n", symaddr_info.name); |
cmd_initialize(&call0_info); |
if (!cmd_register(&call0_info)) |
panic("could not register command %s\n", call0_info.name); |
cmd_initialize(&call1_info); |
if (!cmd_register(&call1_info)) |
panic("could not register command %s\n", call1_info.name); |
cmd_initialize(&call2_info); |
if (!cmd_register(&call2_info)) |
panic("could not register command %s\n", call2_info.name); |
cmd_initialize(&call3_info); |
if (!cmd_register(&call3_info)) |
panic("could not register command %s\n", call3_info.name); |
cmd_initialize(&set4_info); |
if (!cmd_register(&set4_info)) |
panic("could not register command %s\n", set4_info.name); |
cmd_initialize(&halt_info); |
if (!cmd_register(&halt_info)) |
panic("could not register command %s\n", halt_info.name); |
cmd_initialize(&tlb_info); |
if (!cmd_register(&tlb_info)) |
panic("could not register command %s\n", tlb_info.name); |
cmd_initialize(&zones_info); |
if (!cmd_register(&zones_info)) |
panic("could not register command %s\n", zones_info.name); |
cmd_initialize(&zone_info); |
if (!cmd_register(&zone_info)) |
panic("could not register command %s\n", zone_info.name); |
cmd_initialize(&cpus_info); |
if (!cmd_register(&cpus_info)) |
panic("could not register command %s\n", cpus_info.name); |
cmd_initialize(&version_info); |
if (!cmd_register(&version_info)) |
panic("could not register command %s\n", version_info.name); |
} |
/** List supported commands. |
* |
* @param argv Argument vector. |
* |
* @return 0 on failure, 1 on success. |
*/ |
int cmd_help(cmd_arg_t *argv) |
{ |
link_t *cur; |
spinlock_lock(&cmd_lock); |
for (cur = cmd_head.next; cur != &cmd_head; cur = cur->next) { |
cmd_info_t *hlp; |
hlp = list_get_instance(cur, cmd_info_t, link); |
spinlock_lock(&hlp->lock); |
printf("%s - %s\n", hlp->name, hlp->description); |
spinlock_unlock(&hlp->lock); |
} |
spinlock_unlock(&cmd_lock); |
return 1; |
} |
/** Describe specified command. |
* |
* @param argv Argument vector. |
* |
* @return 0 on failure, 1 on success. |
*/ |
int cmd_desc(cmd_arg_t *argv) |
{ |
link_t *cur; |
spinlock_lock(&cmd_lock); |
for (cur = cmd_head.next; cur != &cmd_head; cur = cur->next) { |
cmd_info_t *hlp; |
hlp = list_get_instance(cur, cmd_info_t, link); |
spinlock_lock(&hlp->lock); |
if (strncmp(hlp->name, (const char *) argv->buffer, strlen(hlp->name)) == 0) { |
printf("%s - %s\n", hlp->name, hlp->description); |
if (hlp->help) |
hlp->help(); |
spinlock_unlock(&hlp->lock); |
break; |
} |
spinlock_unlock(&hlp->lock); |
} |
spinlock_unlock(&cmd_lock); |
return 1; |
} |
/** Search symbol table */ |
int cmd_symaddr(cmd_arg_t *argv) |
{ |
symtab_print_search(argv->buffer); |
return 1; |
} |
/** Call function with zero parameters */ |
int cmd_call0(cmd_arg_t *argv) |
{ |
__address symaddr; |
char *symbol; |
__native (*f)(void); |
symaddr = get_symbol_addr(argv->buffer); |
if (!symaddr) |
printf("Symbol %s not found.\n", argv->buffer); |
else if (symaddr == (__address) -1) { |
symtab_print_search(argv->buffer); |
printf("Duplicate symbol, be more specific.\n"); |
} else { |
symbol = get_symtab_entry(symaddr); |
printf("Calling f(): 0x%p: %s\n", symaddr, symbol); |
f = (__native (*)(void)) symaddr; |
printf("Result: 0x%p\n", f()); |
} |
return 1; |
} |
/** Call function with one parameter */ |
int cmd_call1(cmd_arg_t *argv) |
{ |
__address symaddr; |
char *symbol; |
__native (*f)(__native); |
__native arg1 = argv[1].intval; |
symaddr = get_symbol_addr(argv->buffer); |
if (!symaddr) |
printf("Symbol %s not found.\n", argv->buffer); |
else if (symaddr == (__address) -1) { |
symtab_print_search(argv->buffer); |
printf("Duplicate symbol, be more specific.\n"); |
} else { |
symbol = get_symtab_entry(symaddr); |
printf("Calling f(0x%x): 0x%p: %s\n", arg1, symaddr, symbol); |
f = (__native (*)(__native)) symaddr; |
printf("Result: 0x%p\n", f(arg1)); |
} |
return 1; |
} |
/** Call function with two parameters */ |
int cmd_call2(cmd_arg_t *argv) |
{ |
__address symaddr; |
char *symbol; |
__native (*f)(__native,__native); |
__native arg1 = argv[1].intval; |
__native arg2 = argv[2].intval; |
symaddr = get_symbol_addr(argv->buffer); |
if (!symaddr) |
printf("Symbol %s not found.\n", argv->buffer); |
else if (symaddr == (__address) -1) { |
symtab_print_search(argv->buffer); |
printf("Duplicate symbol, be more specific.\n"); |
} else { |
symbol = get_symtab_entry(symaddr); |
printf("Calling f(0x%x,0x%x): 0x%p: %s\n", |
arg1, arg2, symaddr, symbol); |
f = (__native (*)(__native,__native)) symaddr; |
printf("Result: 0x%p\n", f(arg1, arg2)); |
} |
return 1; |
} |
/** Call function with three parameters */ |
int cmd_call3(cmd_arg_t *argv) |
{ |
__address symaddr; |
char *symbol; |
__native (*f)(__native,__native,__native); |
__native arg1 = argv[1].intval; |
__native arg2 = argv[2].intval; |
__native arg3 = argv[3].intval; |
symaddr = get_symbol_addr(argv->buffer); |
if (!symaddr) |
printf("Symbol %s not found.\n", argv->buffer); |
else if (symaddr == (__address) -1) { |
symtab_print_search(argv->buffer); |
printf("Duplicate symbol, be more specific.\n"); |
} else { |
symbol = get_symtab_entry(symaddr); |
printf("Calling f(0x%x,0x%x, 0x%x): 0x%p: %s\n", |
arg1, arg2, arg3, symaddr, symbol); |
f = (__native (*)(__native,__native,__native)) symaddr; |
printf("Result: 0x%p\n", f(arg1, arg2, arg3)); |
} |
return 1; |
} |
/** Print detailed description of 'describe' command. */ |
void desc_help(void) |
{ |
printf("Syntax: describe command_name\n"); |
} |
/** Halt the kernel. |
* |
* @param argv Argument vector (ignored). |
* |
* @return 0 on failure, 1 on success (never returns). |
*/ |
int cmd_halt(cmd_arg_t *argv) |
{ |
halt(); |
return 1; |
} |
/** Command for printing TLB contents. |
* |
* @param argv Not used. |
* |
* @return Always returns 1. |
*/ |
int cmd_tlb(cmd_arg_t *argv) |
{ |
tlb_print(); |
return 1; |
} |
/** Write 4 byte value to address */ |
int cmd_set4(cmd_arg_t *argv) |
{ |
__u32 *addr ; |
__u32 arg1 = argv[1].intval; |
bool pointer = false; |
if (((char *)argv->buffer)[0] == '*') { |
addr = (__u32 *) get_symbol_addr(argv->buffer+1); |
pointer = true; |
} else if (((char *)argv->buffer)[0] >= '0' && |
((char *)argv->buffer)[0] <= '9') |
addr = (__u32 *)atoi((char *)argv->buffer); |
else |
addr = (__u32 *)get_symbol_addr(argv->buffer); |
if (!addr) |
printf("Symbol %s not found.\n", argv->buffer); |
else if (addr == (__u32 *) -1) { |
symtab_print_search(argv->buffer); |
printf("Duplicate symbol, be more specific.\n"); |
} else { |
if (pointer) |
addr = (__u32 *)(*(__native *)addr); |
printf("Writing 0x%x -> 0x%p\n", arg1, addr); |
*addr = arg1; |
} |
return 1; |
} |
/** Command for listing memory zones |
* |
* @param argv Ignored |
* |
* return Always 1 |
*/ |
int cmd_zones(cmd_arg_t * argv) { |
zone_print_list(); |
return 1; |
} |
/** Command for memory zone details |
* |
* @param argv Integer argument from cmdline expected |
* |
* return Always 1 |
*/ |
int cmd_zone(cmd_arg_t * argv) { |
zone_print_one(argv[0].intval); |
return 1; |
} |
/** Command for listing processors. |
* |
* @param argv Ignored. |
* |
* return Always 1. |
*/ |
int cmd_cpus(cmd_arg_t *argv) |
{ |
cpu_list(); |
return 1; |
} |
/** Command for printing kernel version. |
* |
* @param argv Ignored. |
* |
* return Always 1. |
*/ |
int cmd_version(cmd_arg_t *argv) |
{ |
version_print(); |
return 1; |
} |
/kernel/branches/falloc_bad/generic/src/console/kconsole.c |
---|
0,0 → 1,612 |
/* |
* Copyright (C) 2005 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <console/kconsole.h> |
#include <console/console.h> |
#include <console/chardev.h> |
#include <console/cmd.h> |
#include <print.h> |
#include <panic.h> |
#include <typedefs.h> |
#include <arch/types.h> |
#include <list.h> |
#include <arch.h> |
#include <macros.h> |
#include <debug.h> |
#include <func.h> |
#include <symtab.h> |
#include <macros.h> |
/** Simple kernel console. |
* |
* The console is realized by kernel thread kconsole. |
* It doesn't understand any useful command on its own, |
* but makes it possible for other kernel subsystems to |
* register their own commands. |
*/ |
/** Locking. |
* |
* There is a list of cmd_info_t structures. This list |
* is protected by cmd_lock spinlock. Note that specially |
* the link elements of cmd_info_t are protected by |
* this lock. |
* |
* Each cmd_info_t also has its own lock, which protects |
* all elements thereof except the link element. |
* |
* cmd_lock must be acquired before any cmd_info lock. |
* When locking two cmd info structures, structure with |
* lower address must be locked first. |
*/ |
SPINLOCK_INITIALIZE(cmd_lock); /**< Lock protecting command list. */ |
LIST_INITIALIZE(cmd_head); /**< Command list. */ |
static cmd_info_t *parse_cmdline(char *cmdline, size_t len); |
static bool parse_argument(char *cmdline, size_t len, index_t *start, index_t *end); |
static char history[KCONSOLE_HISTORY][MAX_CMDLINE] = {}; |
/** Initialize kconsole data structures. */ |
void kconsole_init(void) |
{ |
int i; |
cmd_init(); |
for (i=0; i<KCONSOLE_HISTORY; i++) |
history[i][0] = '\0'; |
} |
/** Register kconsole command. |
* |
* @param cmd Structure describing the command. |
* |
* @return 0 on failure, 1 on success. |
*/ |
int cmd_register(cmd_info_t *cmd) |
{ |
link_t *cur; |
spinlock_lock(&cmd_lock); |
/* |
* Make sure the command is not already listed. |
*/ |
for (cur = cmd_head.next; cur != &cmd_head; cur = cur->next) { |
cmd_info_t *hlp; |
hlp = list_get_instance(cur, cmd_info_t, link); |
if (hlp == cmd) { |
/* The command is already there. */ |
spinlock_unlock(&cmd_lock); |
return 0; |
} |
/* Avoid deadlock. */ |
if (hlp < cmd) { |
spinlock_lock(&hlp->lock); |
spinlock_lock(&cmd->lock); |
} else { |
spinlock_lock(&cmd->lock); |
spinlock_lock(&hlp->lock); |
} |
if ((strncmp(hlp->name, |
cmd->name, max(strlen(cmd->name), |
strlen(hlp->name))) == 0)) { |
/* The command is already there. */ |
spinlock_unlock(&hlp->lock); |
spinlock_unlock(&cmd->lock); |
spinlock_unlock(&cmd_lock); |
return 0; |
} |
spinlock_unlock(&hlp->lock); |
spinlock_unlock(&cmd->lock); |
} |
/* |
* Now the command can be added. |
*/ |
list_append(&cmd->link, &cmd_head); |
spinlock_unlock(&cmd_lock); |
return 1; |
} |
/** Print count times a character */ |
static void rdln_print_c(char ch, int count) |
{ |
int i; |
for (i=0;i<count;i++) |
putchar(ch); |
} |
/** Insert character to string */ |
static void insert_char(char *str, char ch, int pos) |
{ |
int i; |
for (i=strlen(str);i > pos; i--) |
str[i] = str[i-1]; |
str[pos] = ch; |
} |
/** Try to find a command beginning with prefix */ |
static const char * cmdtab_search_one(const char *name,link_t **startpos) |
{ |
int namelen = strlen(name); |
const char *curname; |
spinlock_lock(&cmd_lock); |
if (!*startpos) |
*startpos = cmd_head.next; |
for (;*startpos != &cmd_head;*startpos = (*startpos)->next) { |
cmd_info_t *hlp; |
hlp = list_get_instance(*startpos, cmd_info_t, link); |
curname = hlp->name; |
if (strlen(curname) < namelen) |
continue; |
if (strncmp(curname, name, namelen) == 0) { |
spinlock_unlock(&cmd_lock); |
return curname+namelen; |
} |
} |
spinlock_unlock(&cmd_lock); |
return NULL; |
} |
/** Command completion of the commands |
* |
* @param name - string to match, changed to hint on exit |
* @return number of found matches |
*/ |
static int cmdtab_compl(char *name) |
{ |
char output[MAX_SYMBOL_NAME+1]; |
link_t *startpos = NULL; |
const char *foundtxt; |
int found = 0; |
int i; |
output[0] = '\0'; |
while ((foundtxt = cmdtab_search_one(name, &startpos))) { |
startpos = startpos->next; |
if (!found) |
strncpy(output, foundtxt, strlen(foundtxt)+1); |
else { |
for (i=0; output[i] && foundtxt[i] && output[i]==foundtxt[i]; i++) |
; |
output[i] = '\0'; |
} |
found++; |
} |
if (!found) |
return 0; |
if (found > 1 && !strlen(output)) { |
printf("\n"); |
startpos = NULL; |
while ((foundtxt = cmdtab_search_one(name, &startpos))) { |
cmd_info_t *hlp; |
hlp = list_get_instance(startpos, cmd_info_t, link); |
printf("%s - %s\n", hlp->name, hlp->description); |
startpos = startpos->next; |
} |
} |
strncpy(name, output, MAX_SYMBOL_NAME); |
return found; |
} |
static char * clever_readline(const char *prompt, chardev_t *input) |
{ |
static int histposition = 0; |
char tmp[MAX_CMDLINE+1]; |
int curlen = 0, position = 0; |
char *current = history[histposition]; |
int i; |
char mod; /* Command Modifier */ |
char c; |
printf("%s> ", prompt); |
while (1) { |
c = _getc(input); |
if (c == '\n') { |
putchar(c); |
break; |
} if (c == '\b') { /* Backspace */ |
if (position == 0) |
continue; |
for (i=position; i<curlen;i++) |
current[i-1] = current[i]; |
curlen--; |
position--; |
putchar('\b'); |
for (i=position;i<curlen;i++) |
putchar(current[i]); |
putchar(' '); |
rdln_print_c('\b',curlen-position+1); |
continue; |
} |
if (c == '\t') { /* Tabulator */ |
int found; |
/* Move to the end of the word */ |
for (;position<curlen && current[position]!=' ';position++) |
putchar(current[position]); |
/* Copy to tmp last word */ |
for (i=position-1;i >= 0 && current[i]!=' ' ;i--) |
; |
/* If word begins with * or &, skip it */ |
if (tmp[0] == '*' || tmp[0] == '&') |
for (i=1;tmp[i];i++) |
tmp[i-1] = tmp[i]; |
i++; /* I is at the start of the word */ |
strncpy(tmp, current+i, position-i+1); |
if (i==0) { /* Command completion */ |
found = cmdtab_compl(tmp); |
} else { /* Symtab completion */ |
found = symtab_compl(tmp); |
} |
if (found == 0) |
continue; |
for (i=0;tmp[i] && curlen < MAX_CMDLINE;i++,curlen++) |
insert_char(current, tmp[i], i+position); |
if (strlen(tmp) || found==1) { /* If we have a hint */ |
for (i=position;i<curlen;i++) |
putchar(current[i]); |
position += strlen(tmp); |
/* Add space to end */ |
if (found == 1 && position == curlen && \ |
curlen < MAX_CMDLINE) { |
current[position] = ' '; |
curlen++; |
position++; |
putchar(' '); |
} |
} else { /* No hint, table was printed */ |
printf("%s> ", prompt); |
for (i=0; i<curlen;i++) |
putchar(current[i]); |
position += strlen(tmp); |
} |
rdln_print_c('\b', curlen-position); |
continue; |
} |
if (c == 0x1b) { /* Special command */ |
mod = _getc(input); |
c = _getc(input); |
if (mod != 0x5b && mod != 0x4f) |
continue; |
if (c == 0x33 && _getc(input) == 0x7e) { |
/* Delete */ |
if (position == curlen) |
continue; |
for (i=position+1; i<curlen;i++) { |
putchar(current[i]); |
current[i-1] = current[i]; |
} |
putchar(' '); |
rdln_print_c('\b',curlen-position); |
curlen--; |
} |
else if (c == 0x48) { /* Home */ |
rdln_print_c('\b',position); |
position = 0; |
} |
else if (c == 0x46) { /* End */ |
for (i=position;i<curlen;i++) |
putchar(current[i]); |
position = curlen; |
} |
else if (c == 0x44) { /* Left */ |
if (position > 0) { |
putchar('\b'); |
position--; |
} |
continue; |
} |
else if (c == 0x43) { /* Right */ |
if (position < curlen) { |
putchar(current[position]); |
position++; |
} |
continue; |
} |
else if (c == 0x41 || c == 0x42) { |
/* Up,down */ |
rdln_print_c('\b',position); |
rdln_print_c(' ',curlen); |
rdln_print_c('\b',curlen); |
if (c == 0x41) /* Up */ |
histposition--; |
else |
histposition++; |
if (histposition < 0) |
histposition = KCONSOLE_HISTORY -1 ; |
else |
histposition = histposition % KCONSOLE_HISTORY; |
current = history[histposition]; |
printf("%s", current); |
curlen = strlen(current); |
position = curlen; |
continue; |
} |
continue; |
} |
if (curlen >= MAX_CMDLINE) |
continue; |
insert_char(current, c, position); |
curlen++; |
for (i=position;i<curlen;i++) |
putchar(current[i]); |
position++; |
rdln_print_c('\b',curlen-position); |
} |
if (curlen) { |
histposition++; |
histposition = histposition % KCONSOLE_HISTORY; |
} |
current[curlen] = '\0'; |
return current; |
} |
/** Kernel console managing thread. |
* |
* @param arg Not used. |
*/ |
void kconsole(void *prompt) |
{ |
cmd_info_t *cmd_info; |
count_t len; |
char *cmdline; |
if (!stdin) { |
printf("%s: no stdin\n", __FUNCTION__); |
return; |
} |
while (true) { |
cmdline = clever_readline(prompt, stdin); |
len = strlen(cmdline); |
if (!len) |
continue; |
cmd_info = parse_cmdline(cmdline, len); |
if (!cmd_info) |
continue; |
if (strncmp(cmd_info->name,"exit", \ |
min(strlen(cmd_info->name),5)) == 0) |
break; |
(void) cmd_info->func(cmd_info->argv); |
} |
} |
static int parse_int_arg(char *text, size_t len, __native *result) |
{ |
char symname[MAX_SYMBOL_NAME]; |
__address symaddr; |
bool isaddr = false; |
bool isptr = false; |
/* If we get a name, try to find it in symbol table */ |
if (text[0] < '0' || text[0] > '9') { |
if (text[0] == '&') { |
isaddr = true; |
text++;len--; |
} else if (text[0] == '*') { |
isptr = true; |
text++;len--; |
} |
strncpy(symname, text, min(len+1, MAX_SYMBOL_NAME)); |
symaddr = get_symbol_addr(symname); |
if (!symaddr) { |
printf("Symbol %s not found.\n",symname); |
return -1; |
} |
if (symaddr == (__address) -1) { |
printf("Duplicate symbol %s.\n",symname); |
symtab_print_search(symname); |
return -1; |
} |
if (isaddr) |
*result = (__native)symaddr; |
else if (isptr) |
*result = **((__native **)symaddr); |
else |
*result = *((__native *)symaddr); |
} else /* It's a number - convert it */ |
*result = atoi(text); |
return 0; |
} |
/** Parse command line. |
* |
* @param cmdline Command line as read from input device. |
* @param len Command line length. |
* |
* @return Structure describing the command. |
*/ |
cmd_info_t *parse_cmdline(char *cmdline, size_t len) |
{ |
index_t start = 0, end = 0; |
cmd_info_t *cmd = NULL; |
link_t *cur; |
int i; |
int error = 0; |
if (!parse_argument(cmdline, len, &start, &end)) { |
/* Command line did not contain alphanumeric word. */ |
return NULL; |
} |
spinlock_lock(&cmd_lock); |
for (cur = cmd_head.next; cur != &cmd_head; cur = cur->next) { |
cmd_info_t *hlp; |
hlp = list_get_instance(cur, cmd_info_t, link); |
spinlock_lock(&hlp->lock); |
if (strncmp(hlp->name, &cmdline[start], max(strlen(hlp->name), |
end-start+1)) == 0) { |
cmd = hlp; |
break; |
} |
spinlock_unlock(&hlp->lock); |
} |
spinlock_unlock(&cmd_lock); |
if (!cmd) { |
/* Unknown command. */ |
printf("Unknown command.\n"); |
return NULL; |
} |
/* cmd == hlp is locked */ |
/* |
* The command line must be further analyzed and |
* the parameters therefrom must be matched and |
* converted to those specified in the cmd info |
* structure. |
*/ |
for (i = 0; i < cmd->argc; i++) { |
char *buf; |
start = end + 1; |
if (!parse_argument(cmdline, len, &start, &end)) { |
printf("Too few arguments.\n"); |
spinlock_unlock(&cmd->lock); |
return NULL; |
} |
error = 0; |
switch (cmd->argv[i].type) { |
case ARG_TYPE_STRING: |
buf = cmd->argv[i].buffer; |
strncpy(buf, (const char *) &cmdline[start], min((end - start) + 2, cmd->argv[i].len)); |
buf[min((end - start) + 1, cmd->argv[i].len - 1)] = '\0'; |
break; |
case ARG_TYPE_INT: |
if (parse_int_arg(cmdline+start, end-start+1, |
&cmd->argv[i].intval)) |
error = 1; |
break; |
case ARG_TYPE_VAR: |
if (start != end && cmdline[start] == '"' && cmdline[end] == '"') { |
buf = cmd->argv[i].buffer; |
strncpy(buf, (const char *) &cmdline[start+1], |
min((end-start), cmd->argv[i].len)); |
buf[min((end - start), cmd->argv[i].len - 1)] = '\0'; |
cmd->argv[i].intval = (__native) buf; |
cmd->argv[i].vartype = ARG_TYPE_STRING; |
} else if (!parse_int_arg(cmdline+start, end-start+1, |
&cmd->argv[i].intval)) |
cmd->argv[i].vartype = ARG_TYPE_INT; |
else { |
printf("Unrecognized variable argument.\n"); |
error = 1; |
} |
break; |
case ARG_TYPE_INVALID: |
default: |
printf("invalid argument type\n"); |
error = 1; |
break; |
} |
} |
if (error) { |
spinlock_unlock(&cmd->lock); |
return NULL; |
} |
start = end + 1; |
if (parse_argument(cmdline, len, &start, &end)) { |
printf("Too many arguments.\n"); |
spinlock_unlock(&cmd->lock); |
return NULL; |
} |
spinlock_unlock(&cmd->lock); |
return cmd; |
} |
/** Parse argument. |
* |
* Find start and end positions of command line argument. |
* |
* @param cmdline Command line as read from the input device. |
* @param len Number of characters in cmdline. |
* @param start On entry, 'start' contains pointer to the index |
* of first unprocessed character of cmdline. |
* On successful exit, it marks beginning of the next argument. |
* @param end Undefined on entry. On exit, 'end' points to the last character |
* of the next argument. |
* |
* @return false on failure, true on success. |
*/ |
bool parse_argument(char *cmdline, size_t len, index_t *start, index_t *end) |
{ |
int i; |
bool found_start = false; |
ASSERT(start != NULL); |
ASSERT(end != NULL); |
for (i = *start; i < len; i++) { |
if (!found_start) { |
if (is_white(cmdline[i])) |
(*start)++; |
else |
found_start = true; |
} else { |
if (is_white(cmdline[i])) |
break; |
} |
} |
*end = i - 1; |
return found_start; |
} |
/kernel/branches/falloc_bad/generic/src/console/console.c |
---|
0,0 → 1,138 |
/* |
* Copyright (C) 2003 Josef Cejka |
* Copyright (C) 2005 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <console/console.h> |
#include <console/chardev.h> |
#include <synch/waitq.h> |
#include <synch/spinlock.h> |
#include <arch/types.h> |
#include <typedefs.h> |
#include <arch.h> |
#include <func.h> |
#include <print.h> |
#include <arch/atomic.h> |
/** Standard input character device. */ |
chardev_t *stdin = NULL; |
chardev_t *stdout = NULL; |
/** Get character from character device. Do not echo character. |
* |
* @param chardev Character device. |
* |
* @return Character read. |
*/ |
__u8 _getc(chardev_t *chardev) |
{ |
__u8 ch; |
ipl_t ipl; |
if (atomic_get(&haltstate)) { |
/* If we are here, we are hopefully on the processor, that |
* issued the 'halt' command, so proceed to read the character |
* directly from input |
*/ |
if (chardev->op->read) |
return chardev->op->read(chardev); |
/* no other way of interacting with user, halt */ |
if (CPU) |
printf("cpu%d: ", CPU->id); |
else |
printf("cpu: "); |
printf("halted - no kconsole\n"); |
cpu_halt(); |
} |
waitq_sleep(&chardev->wq); |
ipl = interrupts_disable(); |
spinlock_lock(&chardev->lock); |
ch = chardev->buffer[(chardev->index - chardev->counter) % CHARDEV_BUFLEN]; |
chardev->counter--; |
spinlock_unlock(&chardev->lock); |
interrupts_restore(ipl); |
chardev->op->resume(chardev); |
return ch; |
} |
/** Get string from character device. |
* |
* Read characters from character device until first occurrence |
* of newline character. |
* |
* @param chardev Character device. |
* @param buf Buffer where to store string terminated by '\0'. |
* @param len Size of the buffer. |
* |
* @return Number of characters read. |
*/ |
count_t gets(chardev_t *chardev, char *buf, size_t buflen) |
{ |
index_t index = 0; |
char ch; |
while (index < buflen) { |
ch = _getc(chardev); |
if (ch == '\b') { |
if (index > 0) { |
index--; |
/* Space backspace, space */ |
putchar('\b'); |
putchar(' '); |
putchar('\b'); |
} |
continue; |
} |
putchar(ch); |
if (ch == '\n') { /* end of string => write 0, return */ |
buf[index] = '\0'; |
return (count_t) index; |
} |
buf[index++] = ch; |
} |
return (count_t) index; |
} |
/** Get character from device & echo it to screen */ |
__u8 getc(chardev_t *chardev) |
{ |
__u8 ch; |
ch = _getc(chardev); |
putchar(ch); |
return ch; |
} |
void putchar(char c) |
{ |
if (stdout->op->write) |
stdout->op->write(stdout, c); |
} |
/kernel/branches/falloc_bad/generic/src/console/chardev.c |
---|
0,0 → 1,69 |
/* |
* Copyright (C) 2005 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <console/chardev.h> |
#include <putchar.h> |
#include <synch/waitq.h> |
#include <synch/spinlock.h> |
/** Initialize character device. |
* |
* @param chardev Character device. |
* @param op Implementation of character device operations. |
*/ |
void chardev_initialize(char *name,chardev_t *chardev, |
chardev_operations_t *op) |
{ |
chardev->name = name; |
waitq_initialize(&chardev->wq); |
spinlock_initialize(&chardev->lock, "chardev"); |
chardev->counter = 0; |
chardev->index = 0; |
chardev->op = op; |
} |
/** Push character read from input character device. |
* |
* @param chardev Character device. |
* @param ch Character being pushed. |
*/ |
void chardev_push_character(chardev_t *chardev, __u8 ch) |
{ |
spinlock_lock(&chardev->lock); |
chardev->counter++; |
if (chardev->counter == CHARDEV_BUFLEN - 1) { |
/* buffer full => disable device interrupt */ |
chardev->op->suspend(chardev); |
} |
chardev->buffer[chardev->index++] = ch; |
chardev->index = chardev->index % CHARDEV_BUFLEN; /* index modulo size of buffer */ |
waitq_wakeup(&chardev->wq, WAKEUP_FIRST); |
spinlock_unlock(&chardev->lock); |
} |
/kernel/branches/falloc_bad/generic/src/debug/print.c |
---|
0,0 → 1,259 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <putchar.h> |
#include <print.h> |
#include <synch/spinlock.h> |
#include <arch/arg.h> |
#include <arch/asm.h> |
#include <arch.h> |
static char digits[] = "0123456789abcdef"; /**< Hexadecimal characters */ |
SPINLOCK_INITIALIZE(printflock); /**< printf spinlock */ |
/** Print NULL terminated string |
* |
* Print characters from str using putchar() until |
* \\0 character is reached. |
* |
* @param str Characters to print. |
* |
*/ |
static void print_str(const char *str) |
{ |
int i = 0; |
char c; |
while ((c = str[i++])) |
putchar(c); |
} |
/** Print hexadecimal digits |
* |
* Print fixed count of hexadecimal digits from |
* the number num. The digits are printed in |
* natural left-to-right order starting with |
* the width-th digit. |
* |
* @param num Number containing digits. |
* @param width Count of digits to print. |
* |
*/ |
static void print_fixed_hex(const __u64 num, const int width) |
{ |
int i; |
for (i = width*8 - 4; i >= 0; i -= 4) |
putchar(digits[(num>>i) & 0xf]); |
} |
/** Print number in given base |
* |
* Print significant digits of a number in given |
* base. |
* |
* @param num Number to print. |
* @param base Base to print the number in (should |
* be in range 2 .. 16). |
* |
*/ |
static void print_number(const __native num, const unsigned int base) |
{ |
int val = num; |
char d[sizeof(__native)*8+1]; /* this is good enough even for base == 2 */ |
int i = sizeof(__native)*8-1; |
do { |
d[i--] = digits[val % base]; |
} while (val /= base); |
d[sizeof(__native)*8] = 0; |
print_str(&d[i + 1]); |
} |
/** General formatted text print |
* |
* Print text formatted according the fmt parameter |
* and variant arguments. Each formatting directive |
* begins with \% (percentage) character and one of the |
* following character: |
* |
* \% Prints the percentage character. |
* |
* s The next variant argument is treated as char* |
* and printed as a NULL terminated string. |
* |
* c The next variant argument is treated as a single char. |
* |
* p The next variant argument is treated as a maximum |
* bit-width integer with respect to architecture |
* and printed in full hexadecimal width. |
* |
* P As with 'p', but '0x' is prefixed. |
* |
* q The next variant argument is treated as a 64b integer |
* and printed in full hexadecimal width. |
* |
* Q As with 'q', but '0x' is prefixed. |
* |
* l The next variant argument is treated as a 32b integer |
* and printed in full hexadecimal width. |
* |
* L As with 'l', but '0x' is prefixed. |
* |
* w The next variant argument is treated as a 16b integer |
* and printed in full hexadecimal width. |
* |
* W As with 'w', but '0x' is prefixed. |
* |
* b The next variant argument is treated as a 8b integer |
* and printed in full hexadecimal width. |
* |
* B As with 'b', but '0x' is prefixed. |
* |
* d The next variant argument is treated as integer |
* and printed in standard decimal format (only significant |
* digits). |
* |
* x The next variant argument is treated as integer |
* and printed in standard hexadecimal format (only significant |
* digits). |
* |
* X As with 'x', but '0x' is prefixed. |
* |
* All other characters from fmt except the formatting directives |
* are printed in verbatim. |
* |
* @param fmt Formatting NULL terminated string. |
*/ |
void printf(const char *fmt, ...) |
{ |
int irqpri, i = 0; |
va_list ap; |
char c; |
va_start(ap, fmt); |
irqpri = interrupts_disable(); |
spinlock_lock(&printflock); |
while ((c = fmt[i++])) { |
switch (c) { |
/* control character */ |
case '%': |
switch (c = fmt[i++]) { |
/* percentile itself */ |
case '%': |
break; |
/* |
* String and character conversions. |
*/ |
case 's': |
print_str(va_arg(ap, char_ptr)); |
goto loop; |
case 'c': |
c = (char) va_arg(ap, int); |
break; |
/* |
* Hexadecimal conversions with fixed width. |
*/ |
case 'P': |
print_str("0x"); |
case 'p': |
print_fixed_hex(va_arg(ap, __native), sizeof(__native)); |
goto loop; |
case 'Q': |
print_str("0x"); |
case 'q': |
print_fixed_hex(va_arg(ap, __u64), INT64); |
goto loop; |
case 'L': |
print_str("0x"); |
case 'l': |
print_fixed_hex(va_arg(ap, __native), INT32); |
goto loop; |
case 'W': |
print_str("0x"); |
case 'w': |
print_fixed_hex(va_arg(ap, __native), INT16); |
goto loop; |
case 'B': |
print_str("0x"); |
case 'b': |
print_fixed_hex(va_arg(ap, __native), INT8); |
goto loop; |
/* |
* Decimal and hexadecimal conversions. |
*/ |
case 'd': |
print_number(va_arg(ap, __native), 10); |
goto loop; |
case 'X': |
print_str("0x"); |
case 'x': |
print_number(va_arg(ap, __native), 16); |
goto loop; |
/* |
* Bad formatting. |
*/ |
default: |
goto out; |
} |
default: putchar(c); |
} |
loop: |
; |
} |
out: |
spinlock_unlock(&printflock); |
interrupts_restore(irqpri); |
va_end(ap); |
} |
/kernel/branches/falloc_bad/generic/src/debug/symtab.c |
---|
0,0 → 1,190 |
/* |
* Copyright (C) 2005 Ondrej Palkovsky |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <symtab.h> |
#include <typedefs.h> |
#include <arch/byteorder.h> |
#include <func.h> |
#include <print.h> |
/** Return entry that seems most likely to correspond to address |
* |
* Return entry that seems most likely to correspond |
* to address passed in the argument. |
* |
* @param addr Address. |
* |
* @return Pointer to respective symbol string on success, NULL otherwise. |
*/ |
char * get_symtab_entry(__native addr) |
{ |
count_t i; |
for (i=1;symbol_table[i].address_le;++i) { |
if (addr < __u64_le2host(symbol_table[i].address_le)) |
break; |
} |
if (addr >= __u64_le2host(symbol_table[i-1].address_le)) |
return symbol_table[i-1].symbol_name; |
return NULL; |
} |
/** Find symbols that match the parameter forward and print them |
* |
* @param name - search string |
* @param startpos - starting position, changes to found position |
* @return Pointer to the part of string that should be completed or NULL |
*/ |
static char * symtab_search_one(const char *name, int *startpos) |
{ |
int namelen = strlen(name); |
char *curname; |
int i,j; |
int colonoffset = -1; |
for (i=0;name[i];i++) |
if (name[i] == ':') { |
colonoffset = i; |
break; |
} |
for (i=*startpos;symbol_table[i].address_le;++i) { |
/* Find a ':' in name */ |
curname = symbol_table[i].symbol_name; |
for (j=0; curname[j] && curname[j] != ':'; j++) |
; |
if (!curname[j]) |
continue; |
j -= colonoffset; |
curname += j; |
if (strlen(curname) < namelen) |
continue; |
if (strncmp(curname, name, namelen) == 0) { |
*startpos = i; |
return curname+namelen; |
} |
} |
return NULL; |
} |
/** Return address that corresponds to the entry |
* |
* Search symbol table, and if there is one match, return it |
* |
* @param name Name of the symbol |
* @return 0 - Not found, -1 - Duplicate symbol, other - address of symbol |
*/ |
__address get_symbol_addr(const char *name) |
{ |
count_t found = 0; |
__address addr = NULL; |
char *hint; |
int i; |
i = 0; |
while ((hint=symtab_search_one(name, &i))) { |
if (!strlen(hint)) { |
addr = __u64_le2host(symbol_table[i].address_le); |
found++; |
} |
i++; |
} |
if (found > 1) |
return ((__address) -1); |
return addr; |
} |
/** Find symbols that match parameter and prints them */ |
void symtab_print_search(const char *name) |
{ |
int i; |
__address addr; |
char *realname; |
i = 0; |
while (symtab_search_one(name, &i)) { |
addr = __u64_le2host(symbol_table[i].address_le); |
realname = symbol_table[i].symbol_name; |
printf("0x%p: %s\n", addr, realname); |
i++; |
} |
} |
/** Symtab completion |
* |
* @param name - Search string, completes to symbol name |
* @returns - 0 - nothing found, 1 - success, >1 print duplicates |
*/ |
int symtab_compl(char *input) |
{ |
char output[MAX_SYMBOL_NAME+1]; |
int startpos = 0; |
char *foundtxt; |
int found = 0; |
int i; |
char *name = input; |
/* Allow completion of pointers */ |
if (name[0] == '*' || name[0] == '&') |
name++; |
/* Do not print everything */ |
if (!strlen(name)) |
return 0; |
output[0] = '\0'; |
while ((foundtxt = symtab_search_one(name, &startpos))) { |
startpos++; |
if (!found) |
strncpy(output, foundtxt, strlen(foundtxt)+1); |
else { |
for (i=0; output[i] && foundtxt[i] && output[i]==foundtxt[i]; i++) |
; |
output[i] = '\0'; |
} |
found++; |
} |
if (!found) |
return 0; |
if (found > 1 && !strlen(output)) { |
printf("\n"); |
startpos = 0; |
while ((foundtxt = symtab_search_one(name, &startpos))) { |
printf("%s\n", symbol_table[startpos].symbol_name); |
startpos++; |
} |
} |
strncpy(input, output, MAX_SYMBOL_NAME); |
return found; |
} |
/kernel/branches/falloc_bad/generic/src/interrupt/interrupt.c |
---|
0,0 → 1,135 |
/* |
* Copyright (C) 2005 Ondrej Palkovsky |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <interrupt.h> |
#include <debug.h> |
#include <console/kconsole.h> |
#include <console/console.h> |
#include <console/chardev.h> |
#include <console/cmd.h> |
#include <panic.h> |
#include <print.h> |
#include <symtab.h> |
static struct { |
const char *name; |
iroutine f; |
} exc_table[IVT_ITEMS]; |
SPINLOCK_INITIALIZE(exctbl_lock); |
/** Register exception handler |
* |
* @param n Exception number |
* @param name Description |
* @param f Exception handler |
*/ |
iroutine exc_register(int n, const char *name, iroutine f) |
{ |
ASSERT(n < IVT_ITEMS); |
iroutine old; |
spinlock_lock(&exctbl_lock); |
old = exc_table[n].f; |
exc_table[n].f = f; |
exc_table[n].name = name; |
spinlock_unlock(&exctbl_lock); |
return old; |
} |
/** Dispatch exception according to exception table |
* |
* Called directly from the assembler code. |
* CPU is interrupts_disable()'d. |
*/ |
void exc_dispatch(int n, void *stack) |
{ |
ASSERT(n < IVT_ITEMS); |
exc_table[n].f(n + IVT_FIRST, stack); |
} |
/** Default 'null' exception handler */ |
static void exc_undef(int n, void *stack) |
{ |
panic("Unhandled exception %d.", n); |
} |
/** kconsole cmd - print all exceptions */ |
static int exc_print_cmd(cmd_arg_t *argv) |
{ |
int i; |
char *symbol; |
spinlock_lock(&exctbl_lock); |
printf("Exc Description Handler\n"); |
for (i=0; i < IVT_ITEMS; i++) { |
symbol = get_symtab_entry((__native)exc_table[i].f); |
if (!symbol) |
symbol = "not found"; |
printf("%d %s 0x%p(%s)\n", i + IVT_FIRST, exc_table[i].name, |
exc_table[i].f,symbol); |
if (!((i+1) % 20)) { |
printf("Press any key to continue."); |
spinlock_unlock(&exctbl_lock); |
getc(stdin); |
spinlock_lock(&exctbl_lock); |
printf("\n"); |
} |
} |
spinlock_unlock(&exctbl_lock); |
return 1; |
} |
static cmd_info_t exc_info = { |
.name = "exc", |
.description = "Print exception table.", |
.func = exc_print_cmd, |
.help = NULL, |
.argc = 0, |
.argv = NULL |
}; |
/** Initialize generic exception handling support */ |
void exc_init(void) |
{ |
int i; |
for (i=0;i < IVT_ITEMS; i++) |
exc_register(i, "undef", exc_undef); |
cmd_initialize(&exc_info); |
if (!cmd_register(&exc_info)) |
panic("could not register command %s\n", exc_info.name); |
} |
/kernel/branches/falloc_bad/generic/src/lib/func.c |
---|
0,0 → 1,184 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <func.h> |
#include <print.h> |
#include <cpu.h> |
#include <arch/asm.h> |
#include <arch.h> |
#include <typedefs.h> |
#include <console/kconsole.h> |
atomic_t haltstate = {0}; /**< Halt flag */ |
/** Halt wrapper |
* |
* Set halt flag and halt the cpu. |
* |
*/ |
void halt() |
{ |
#ifdef CONFIG_DEBUG |
bool rundebugger = false; |
// TODO test_and_set not defined on all arches |
// if (!test_and_set(&haltstate)) |
if (!atomic_get(&haltstate)) { |
atomic_set(&haltstate, 1); |
rundebugger = true; |
} |
#else |
atomic_set(haltstate, 1); |
#endif |
interrupts_disable(); |
#ifdef CONFIG_DEBUG |
if (rundebugger) { |
printf("\n"); |
kconsole("panic"); /* Run kconsole as a last resort to user */ |
} |
#endif |
if (CPU) |
printf("cpu%d: halted\n", CPU->id); |
else |
printf("cpu: halted\n"); |
cpu_halt(); |
} |
/** Return number of characters in a string. |
* |
* @param str NULL terminated string. |
* |
* @return Number of characters in str. |
*/ |
size_t strlen(const char *str) |
{ |
int i; |
for (i = 0; str[i]; i++) |
; |
return i; |
} |
/** Compare two NULL terminated strings |
* |
* Do a char-by-char comparison of two NULL terminated strings. |
* The strings are considered equal iff they consist of the same |
* characters on the minimum of their lengths and specified maximal |
* length. |
* |
* @param src First string to compare. |
* @param dst Second string to compare. |
* @param len Maximal length for comparison. |
* |
* @return 0 if the strings are equal, -1 if first is smaller, 1 if second smaller. |
* |
*/ |
int strncmp(const char *src, const char *dst, size_t len) |
{ |
int i; |
i = 0; |
for (;*src && *dst && i < len;src++,dst++,i++) { |
if (*src < *dst) |
return -1; |
if (*src > *dst) |
return 1; |
} |
if (i == len || *src == *dst) |
return 0; |
if (!*src) |
return -1; |
return 1; |
} |
/** Copy NULL terminated string. |
* |
* Copy at most 'len' characters from string 'src' to 'dest'. |
* If 'src' is shorter than 'len', '\0' is inserted behind the |
* last copied character. |
* |
* @param src Source string. |
* @param dst Destination buffer. |
* @param len Size of destination buffer. |
*/ |
void strncpy(char *dest, const char *src, size_t len) |
{ |
int i; |
for (i = 0; i < len; i++) { |
if (!(dest[i] = src[i])) |
return; |
} |
dest[i-1] = '\0'; |
} |
/** Convert ascii representation to __native |
* |
* Supports 0x for hexa & 0 for octal notation. |
* Does not check for overflows, does not support negative numbers |
* |
* @param text Textual representation of number |
* @return Converted number or 0 if no valid number ofund |
*/ |
__native atoi(const char *text) |
{ |
int base = 10; |
__native result = 0; |
if (text[0] == '0' && text[1] == 'x') { |
base = 16; |
text += 2; |
} else if (text[0] == '0') |
base = 8; |
while (*text) { |
if (base != 16 && \ |
((*text >= 'A' && *text <= 'F' ) |
|| (*text >='a' && *text <='f'))) |
break; |
if (base == 8 && *text >='8') |
break; |
if (*text >= '0' && *text <= '9') { |
result *= base; |
result += *text - '0'; |
} else if (*text >= 'A' && *text <= 'F') { |
result *= base; |
result += *text - 'A' + 10; |
} else if (*text >= 'a' && *text <= 'f') { |
result *= base; |
result += *text - 'a' + 10; |
} else |
break; |
text++; |
} |
return result; |
} |
/kernel/branches/falloc_bad/generic/src/lib/memstr.c |
---|
0,0 → 1,90 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <memstr.h> |
#include <arch/types.h> |
/** Copy block of memory |
* |
* Copy cnt bytes from src address to dst address. |
* The copying is done byte-by-byte. The source |
* and destination memory areas cannot overlap. |
* |
* @param src Origin address to copy from. |
* @param dst Origin address to copy to. |
* @param cnt Number of bytes to copy. |
* |
*/ |
void *_memcpy(void * dst, const void *src, size_t cnt) |
{ |
int i; |
for (i=0; i<cnt; i++) |
*((__u8 *) (dst + i)) = *((__u8 *) (src + i)); |
return (char *)src; |
} |
/** Fill block of memory |
* |
* Fill cnt bytes at dst address with the value x. |
* The filling is done byte-by-byte. |
* |
* @param dst Origin address to fill. |
* @param cnt Number of bytes to fill. |
* @param x Value to fill. |
* |
*/ |
void _memsetb(__address dst, size_t cnt, __u8 x) |
{ |
int i; |
__u8 *p = (__u8 *) dst; |
for(i=0; i<cnt; i++) |
p[i] = x; |
} |
/** Fill block of memory |
* |
* Fill cnt words at dst address with the value x. |
* The filling is done word-by-word. |
* |
* @param dst Origin address to fill. |
* @param cnt Number of words to fill. |
* @param x Value to fill. |
* |
*/ |
void _memsetw(__address dst, size_t cnt, __u16 x) |
{ |
int i; |
__u16 *p = (__u16 *) dst; |
for(i=0; i<cnt; i++) |
p[i] = x; |
} |
/kernel/branches/falloc_bad/generic/src/lib/sort.c |
---|
0,0 → 1,194 |
/* |
* Copyright (C) 2005 Sergey Bondari |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <mm/heap.h> |
#include <memstr.h> |
#include <sort.h> |
#include <panic.h> |
#define EBUFSIZE 32 |
void _qsort(void * data, count_t n, size_t e_size, int (* cmp) (void * a, void * b), void *tmp, void *pivot); |
void _bubblesort(void * data, count_t n, size_t e_size, int (* cmp) (void * a, void * b), void *slot); |
/** Quicksort wrapper |
* |
* This is only a wrapper that takes care of memory allocations for storing |
* the pivot and temporary elements for generic quicksort algorithm. |
* |
* @param data Pointer to data to be sorted. |
* @param n Number of elements to be sorted. |
* @param e_size Size of one element. |
* @param cmp Comparator function. |
* |
*/ |
void qsort(void * data, count_t n, size_t e_size, int (* cmp) (void * a, void * b)) |
{ |
__u8 buf_tmp[EBUFSIZE]; |
__u8 buf_pivot[EBUFSIZE]; |
void * tmp = buf_tmp; |
void * pivot = buf_pivot; |
if (e_size > EBUFSIZE) { |
pivot = (void *) malloc(e_size); |
tmp = (void *) malloc(e_size); |
if (!tmp || !pivot) { |
panic("Cannot allocate memory\n"); |
} |
} |
_qsort(data, n, e_size, cmp, tmp, pivot); |
if (e_size > EBUFSIZE) { |
free(tmp); |
free(pivot); |
} |
} |
/** Quicksort |
* |
* Apply generic quicksort algorithm on supplied data, using pre-allocated buffers. |
* |
* @param data Pointer to data to be sorted. |
* @param n Number of elements to be sorted. |
* @param e_size Size of one element. |
* @param cmp Comparator function. |
* @param tmp Pointer to scratch memory buffer e_size bytes long. |
* @param pivot Pointer to scratch memory buffer e_size bytes long. |
* |
*/ |
void _qsort(void * data, count_t n, size_t e_size, int (* cmp) (void * a, void * b), void *tmp, void *pivot) |
{ |
if (n > 4) { |
int i = 0, j = n - 1; |
memcpy(pivot, data, e_size); |
while (1) { |
while ((cmp(data + i * e_size, pivot) < 0) && i < n) i++; |
while ((cmp(data + j * e_size, pivot) >=0) && j > 0) j--; |
if (i<j) { |
memcpy(tmp, data + i * e_size, e_size); |
memcpy(data + i * e_size, data + j * e_size, e_size); |
memcpy(data + j * e_size, tmp, e_size); |
} else { |
break; |
} |
} |
_qsort(data, j + 1, e_size, cmp, tmp, pivot); |
_qsort(data + (j + 1) * e_size, n - j - 1, e_size, cmp, tmp, pivot); |
} else { |
_bubblesort(data, n, e_size, cmp, tmp); |
} |
} |
/** Bubblesort wrapper |
* |
* This is only a wrapper that takes care of memory allocation for storing |
* the slot element for generic bubblesort algorithm. |
* |
* @param data Pointer to data to be sorted. |
* @param n Number of elements to be sorted. |
* @param e_size Size of one element. |
* @param cmp Comparator function. |
* |
*/ |
void bubblesort(void * data, count_t n, size_t e_size, int (* cmp) (void * a, void * b)) |
{ |
__u8 buf_slot[EBUFSIZE]; |
void * slot = buf_slot; |
if (e_size > EBUFSIZE) { |
slot = (void *) malloc(e_size); |
if (!slot) { |
panic("Cannot allocate memory\n"); |
} |
} |
_bubblesort(data, n, e_size, cmp, slot); |
if (e_size > EBUFSIZE) { |
free(slot); |
} |
} |
/** Bubblesort |
* |
* Apply generic bubblesort algorithm on supplied data, using pre-allocated buffer. |
* |
* @param data Pointer to data to be sorted. |
* @param n Number of elements to be sorted. |
* @param e_size Size of one element. |
* @param cmp Comparator function. |
* @param slot Pointer to scratch memory buffer e_size bytes long. |
* |
*/ |
void _bubblesort(void * data, count_t n, size_t e_size, int (* cmp) (void * a, void * b), void *slot) |
{ |
bool done = false; |
void * p; |
while (!done) { |
done = true; |
for (p = data; p < data + e_size * (n - 1); p = p + e_size) { |
if (cmp(p, p + e_size) == 1) { |
memcpy(slot, p, e_size); |
memcpy(p, p + e_size, e_size); |
memcpy(p + e_size, slot, e_size); |
done = false; |
} |
} |
} |
} |
/* |
* Comparator returns 1 if a > b, 0 if a == b, -1 if a < b |
*/ |
int int_cmp(void * a, void * b) |
{ |
return (* (int *) a > * (int*)b) ? 1 : (*(int *)a < * (int *)b) ? -1 : 0; |
} |
int __u8_cmp(void * a, void * b) |
{ |
return (* (__u8 *) a > * (__u8 *)b) ? 1 : (*(__u8 *)a < * (__u8 *)b) ? -1 : 0; |
} |
int __u16_cmp(void * a, void * b) |
{ |
return (* (__u16 *) a > * (__u16 *)b) ? 1 : (*(__u16 *)a < * (__u16 *)b) ? -1 : 0; |
} |
int __u32_cmp(void * a, void * b) |
{ |
return (* (__u32 *) a > * (__u32 *)b) ? 1 : (*(__u32 *)a < * (__u32 *)b) ? -1 : 0; |
} |
/kernel/branches/falloc_bad/generic/src/lib/list.c |
---|
0,0 → 1,80 |
/* |
* Copyright (C) 2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <list.h> |
/** Check for membership |
* |
* Check whether link is contained in the list head. |
* The membership is defined as pointer equivalence. |
* |
* @param link Item to look for. |
* @param head List to look in. |
* |
* @return true if link is contained in head, false otherwise. |
* |
*/ |
bool list_member(const link_t *link, const link_t *head) |
{ |
bool found = false; |
link_t *hlp = head->next; |
while (hlp != head) { |
if (hlp == link) { |
found = true; |
break; |
} |
hlp = hlp->next; |
} |
return found; |
} |
/** Concatenate two lists |
* |
* Concatenate lists head1 and head2, producing a single |
* list head1 containing items from both (in head1, head2 |
* order) and empty list head2. |
* |
* @param head1 First list and concatenated output |
* @param head2 Second list and empty output. |
* |
*/ |
void list_concat(link_t *head1, link_t *head2) |
{ |
if (list_empty(head2)) |
return; |
head2->next->prev = head1->prev; |
head2->prev->next = head1; |
head1->prev->next = head2->next; |
head1->prev = head2->prev; |
list_initialize(head2); |
} |
/kernel/branches/falloc_bad/generic/src/time/timeout.c |
---|
0,0 → 1,208 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <time/timeout.h> |
#include <typedefs.h> |
#include <arch/types.h> |
#include <config.h> |
#include <panic.h> |
#include <synch/spinlock.h> |
#include <func.h> |
#include <cpu.h> |
#include <print.h> |
#include <arch/asm.h> |
#include <arch.h> |
#include <print.h> |
/** Initialize timeouts |
* |
* Initialize kernel timeouts. |
* |
*/ |
void timeout_init(void) |
{ |
spinlock_initialize(&CPU->timeoutlock, "timeout_lock"); |
list_initialize(&CPU->timeout_active_head); |
} |
/** Reinitialize timeout |
* |
* Initialize all members except the lock. |
* |
* @param t Timeout to be initialized. |
* |
*/ |
void timeout_reinitialize(timeout_t *t) |
{ |
t->cpu = NULL; |
t->ticks = 0; |
t->handler = NULL; |
t->arg = NULL; |
link_initialize(&t->link); |
} |
/** Initialize timeout |
* |
* Initialize all members including the lock. |
* |
* @param t Timeout to be initialized. |
* |
*/ |
void timeout_initialize(timeout_t *t) |
{ |
spinlock_initialize(&t->lock, "timeout_t_lock"); |
timeout_reinitialize(t); |
} |
/** Register timeout |
* |
* Insert timeout handler f (with argument arg) |
* to timeout list and make it execute in |
* time microseconds (or slightly more). |
* |
* @param t Timeout structure. |
* @param time Number of usec in the future to execute |
* the handler. |
* @param f Timeout handler function. |
* @param arg Timeout handler argument. |
* |
*/ |
void timeout_register(timeout_t *t, __u64 time, timeout_handler_t f, void *arg) |
{ |
timeout_t *hlp = NULL; |
link_t *l, *m; |
ipl_t ipl; |
__u64 sum; |
ipl = interrupts_disable(); |
spinlock_lock(&CPU->timeoutlock); |
spinlock_lock(&t->lock); |
if (t->cpu) |
panic("t->cpu != 0"); |
t->cpu = CPU; |
t->ticks = us2ticks(time); |
t->handler = f; |
t->arg = arg; |
/* |
* Insert t into the active timeouts list according to t->ticks. |
*/ |
sum = 0; |
l = CPU->timeout_active_head.next; |
while (l != &CPU->timeout_active_head) { |
hlp = list_get_instance(l, timeout_t, link); |
spinlock_lock(&hlp->lock); |
if (t->ticks < sum + hlp->ticks) { |
spinlock_unlock(&hlp->lock); |
break; |
} |
sum += hlp->ticks; |
spinlock_unlock(&hlp->lock); |
l = l->next; |
} |
m = l->prev; |
list_prepend(&t->link, m); /* avoid using l->prev */ |
/* |
* Adjust t->ticks according to ticks accumulated in h's predecessors. |
*/ |
t->ticks -= sum; |
/* |
* Decrease ticks of t's immediate succesor by t->ticks. |
*/ |
if (l != &CPU->timeout_active_head) { |
spinlock_lock(&hlp->lock); |
hlp->ticks -= t->ticks; |
spinlock_unlock(&hlp->lock); |
} |
spinlock_unlock(&t->lock); |
spinlock_unlock(&CPU->timeoutlock); |
interrupts_restore(ipl); |
} |
/** Unregister timeout |
* |
* Remove timeout from timeout list. |
* |
* @param t Timeout to unregister. |
* |
* @return true on success, false on failure. |
*/ |
bool timeout_unregister(timeout_t *t) |
{ |
timeout_t *hlp; |
link_t *l; |
ipl_t ipl; |
grab_locks: |
ipl = interrupts_disable(); |
spinlock_lock(&t->lock); |
if (!t->cpu) { |
spinlock_unlock(&t->lock); |
interrupts_restore(ipl); |
return false; |
} |
if (!spinlock_trylock(&t->cpu->timeoutlock)) { |
spinlock_unlock(&t->lock); |
interrupts_restore(ipl); |
goto grab_locks; |
} |
/* |
* Now we know for sure that t hasn't been activated yet |
* and is lurking in t->cpu->timeout_active_head queue. |
*/ |
l = t->link.next; |
if (l != &t->cpu->timeout_active_head) { |
hlp = list_get_instance(l, timeout_t, link); |
spinlock_lock(&hlp->lock); |
hlp->ticks += t->ticks; |
spinlock_unlock(&hlp->lock); |
} |
list_remove(&t->link); |
spinlock_unlock(&t->cpu->timeoutlock); |
timeout_reinitialize(t); |
spinlock_unlock(&t->lock); |
interrupts_restore(ipl); |
return true; |
} |
/kernel/branches/falloc_bad/generic/src/time/clock.c |
---|
0,0 → 1,104 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <time/clock.h> |
#include <time/timeout.h> |
#include <arch/types.h> |
#include <config.h> |
#include <synch/spinlock.h> |
#include <synch/waitq.h> |
#include <func.h> |
#include <proc/scheduler.h> |
#include <cpu.h> |
#include <print.h> |
#include <arch.h> |
#include <list.h> |
#include <arch/atomic.h> |
#include <proc/thread.h> |
/** Clock routine |
* |
* Clock routine executed from clock interrupt handler |
* (assuming interrupts_disable()'d). Runs expired timeouts |
* and preemptive scheduling. |
* |
*/ |
void clock(void) |
{ |
link_t *l; |
timeout_t *h; |
timeout_handler_t f; |
void *arg; |
/* |
* To avoid lock ordering problems, |
* run all expired timeouts as you visit them. |
*/ |
spinlock_lock(&CPU->timeoutlock); |
while ((l = CPU->timeout_active_head.next) != &CPU->timeout_active_head) { |
h = list_get_instance(l, timeout_t, link); |
spinlock_lock(&h->lock); |
if (h->ticks-- != 0) { |
spinlock_unlock(&h->lock); |
break; |
} |
list_remove(l); |
f = h->handler; |
arg = h->arg; |
timeout_reinitialize(h); |
spinlock_unlock(&h->lock); |
spinlock_unlock(&CPU->timeoutlock); |
f(arg); |
spinlock_lock(&CPU->timeoutlock); |
} |
spinlock_unlock(&CPU->timeoutlock); |
/* |
* Do CPU usage accounting and find out whether to preempt THREAD. |
*/ |
if (THREAD) { |
__u64 ticks; |
spinlock_lock(&CPU->lock); |
CPU->needs_relink++; |
spinlock_unlock(&CPU->lock); |
spinlock_lock(&THREAD->lock); |
if ((ticks = THREAD->ticks)) |
THREAD->ticks--; |
spinlock_unlock(&THREAD->lock); |
if (!ticks && !PREEMPTION_DISABLED) { |
scheduler(); |
} |
} |
} |
/kernel/branches/falloc_bad/generic/src/time/delay.c |
---|
0,0 → 1,56 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <time/delay.h> |
#include <arch/types.h> |
#include <cpu.h> |
#include <arch/asm.h> |
#include <arch.h> |
/** Active delay |
* |
* Delay the execution for the given number |
* of microseconds (or slightly more). The delay |
* is implemented as CPU calibrated active loop. |
* |
* @param usec Number of microseconds to sleep. |
*/ |
void delay(__u32 usec) |
{ |
ipl_t ipl; |
/* |
* The delay loop is calibrated for each and every |
* CPU in the system. Therefore it is necessary to |
* call interrupts_disable() before calling the |
* asm_delay_loop(). |
*/ |
ipl = interrupts_disable(); |
asm_delay_loop(usec * CPU->delay_loop_const); |
interrupts_restore(ipl); |
} |
/kernel/branches/falloc_bad/generic/src/synch/rwlock.c |
---|
0,0 → 1,379 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
/** Reader/Writer locks |
* |
* A reader/writer lock can be held by multiple readers at a time. |
* Or it can be exclusively held by a sole writer at a time. |
*/ |
/* |
* These locks are not recursive. |
* Neither readers nor writers will suffer starvation. |
* |
* If there is a writer followed by a reader waiting for the rwlock |
* and the writer times out, all leading readers are automatically woken up |
* and allowed in. |
*/ |
/* |
* NOTE ON rwlock_holder_type |
* This field is set on an attempt to acquire the exclusive mutex |
* to the respective value depending whether the caller is a reader |
* or a writer. The field is examined only if the thread had been |
* previously blocked on the exclusive mutex. Thus it is save |
* to store the rwlock type in the thread structure, because |
* each thread can block on only one rwlock at a time. |
*/ |
#include <synch/rwlock.h> |
#include <synch/spinlock.h> |
#include <synch/mutex.h> |
#include <synch/waitq.h> |
#include <synch/synch.h> |
#include <list.h> |
#include <typedefs.h> |
#include <arch/asm.h> |
#include <arch.h> |
#include <proc/thread.h> |
#include <panic.h> |
#define ALLOW_ALL 0 |
#define ALLOW_READERS_ONLY 1 |
static void let_others_in(rwlock_t *rwl, int readers_only); |
static void release_spinlock(void *arg); |
/** Initialize reader/writer lock |
* |
* Initialize reader/writer lock. |
* |
* @param rwl Reader/Writer lock. |
*/ |
void rwlock_initialize(rwlock_t *rwl) { |
spinlock_initialize(&rwl->lock, "rwlock_t"); |
mutex_initialize(&rwl->exclusive); |
rwl->readers_in = 0; |
} |
/** Acquire reader/writer lock for reading |
* |
* Acquire reader/writer lock for reading. |
* Timeout and willingness to block may be specified. |
* |
* @param rwl Reader/Writer lock. |
* @param usec Timeout in microseconds. |
* @param trylock Switches between blocking and non-blocking mode. |
* |
* For exact description of possible combinations of |
* 'usec' and 'trylock', see comment for waitq_sleep_timeout(). |
* |
* @return See comment for waitq_sleep_timeout(). |
*/ |
int _rwlock_write_lock_timeout(rwlock_t *rwl, __u32 usec, int trylock) |
{ |
ipl_t ipl; |
int rc; |
ipl = interrupts_disable(); |
spinlock_lock(&THREAD->lock); |
THREAD->rwlock_holder_type = RWLOCK_WRITER; |
spinlock_unlock(&THREAD->lock); |
interrupts_restore(ipl); |
/* |
* Writers take the easy part. |
* They just need to acquire the exclusive mutex. |
*/ |
rc = _mutex_lock_timeout(&rwl->exclusive, usec, trylock); |
if (SYNCH_FAILED(rc)) { |
/* |
* Lock operation timed out. |
* The state of rwl is UNKNOWN at this point. |
* No claims about its holder can be made. |
*/ |
ipl = interrupts_disable(); |
spinlock_lock(&rwl->lock); |
/* |
* Now when rwl is locked, we can inspect it again. |
* If it is held by some readers already, we can let |
* readers from the head of the wait queue in. |
*/ |
if (rwl->readers_in) |
let_others_in(rwl, ALLOW_READERS_ONLY); |
spinlock_unlock(&rwl->lock); |
interrupts_restore(ipl); |
} |
return rc; |
} |
/** Acquire reader/writer lock for writing |
* |
* Acquire reader/writer lock for writing. |
* Timeout and willingness to block may be specified. |
* |
* @param rwl Reader/Writer lock. |
* @param usec Timeout in microseconds. |
* @param trylock Switches between blocking and non-blocking mode. |
* |
* For exact description of possible combinations of |
* 'usec' and 'trylock', see comment for waitq_sleep_timeout(). |
* |
* @return See comment for waitq_sleep_timeout(). |
*/ |
int _rwlock_read_lock_timeout(rwlock_t *rwl, __u32 usec, int trylock) |
{ |
int rc; |
ipl_t ipl; |
ipl = interrupts_disable(); |
spinlock_lock(&THREAD->lock); |
THREAD->rwlock_holder_type = RWLOCK_READER; |
spinlock_unlock(&THREAD->lock); |
spinlock_lock(&rwl->lock); |
/* |
* Find out whether we can get what we want without blocking. |
*/ |
rc = mutex_trylock(&rwl->exclusive); |
if (SYNCH_FAILED(rc)) { |
/* |
* 'exclusive' mutex is being held by someone else. |
* If the holder is a reader and there is no one |
* else waiting for it, we can enter the critical |
* section. |
*/ |
if (rwl->readers_in) { |
spinlock_lock(&rwl->exclusive.sem.wq.lock); |
if (list_empty(&rwl->exclusive.sem.wq.head)) { |
/* |
* We can enter. |
*/ |
spinlock_unlock(&rwl->exclusive.sem.wq.lock); |
goto shortcut; |
} |
spinlock_unlock(&rwl->exclusive.sem.wq.lock); |
} |
/* |
* In order to prevent a race condition when a reader |
* could block another reader at the head of the waitq, |
* we register a function to unlock rwl->lock |
* after this thread is put asleep. |
*/ |
#ifdef CONFIG_SMP |
thread_register_call_me(release_spinlock, &rwl->lock); |
#else |
thread_register_call_me(release_spinlock, NULL); |
#endif |
rc = _mutex_lock_timeout(&rwl->exclusive, usec, trylock); |
switch (rc) { |
case ESYNCH_WOULD_BLOCK: |
/* |
* release_spinlock() wasn't called |
*/ |
thread_register_call_me(NULL, NULL); |
spinlock_unlock(&rwl->lock); |
case ESYNCH_TIMEOUT: |
/* |
* The sleep timeouted. |
* We just restore interrupt priority level. |
*/ |
case ESYNCH_OK_BLOCKED: |
/* |
* We were woken with rwl->readers_in already incremented. |
* Note that this arrangement avoids race condition between |
* two concurrent readers. (Race is avoided if 'exclusive' is |
* locked at the same time as 'readers_in' is incremented. |
* Same time means both events happen atomically when |
* rwl->lock is held.) |
*/ |
interrupts_restore(ipl); |
break; |
case ESYNCH_OK_ATOMIC: |
panic("_mutex_lock_timeout()==ESYNCH_OK_ATOMIC\n"); |
break; |
default: |
panic("invalid ESYNCH\n"); |
break; |
} |
return rc; |
} |
shortcut: |
/* |
* We can increment readers_in only if we didn't go to sleep. |
* For sleepers, rwlock_let_others_in() will do the job. |
*/ |
rwl->readers_in++; |
spinlock_unlock(&rwl->lock); |
interrupts_restore(ipl); |
return ESYNCH_OK_ATOMIC; |
} |
/** Release reader/writer lock held by writer |
* |
* Release reader/writer lock held by writer. |
* Handoff reader/writer lock ownership directly |
* to waiting readers or a writer. |
* |
* @param rwl Reader/Writer lock. |
*/ |
void rwlock_write_unlock(rwlock_t *rwl) |
{ |
ipl_t ipl; |
ipl = interrupts_disable(); |
spinlock_lock(&rwl->lock); |
let_others_in(rwl, ALLOW_ALL); |
spinlock_unlock(&rwl->lock); |
interrupts_restore(ipl); |
} |
/** Release reader/writer lock held by reader |
* |
* Release reader/writer lock held by reader. |
* Handoff reader/writer lock ownership directly |
* to a waiting writer or don't do anything if more |
* readers poses the lock. |
* |
* @param rwl Reader/Writer lock. |
*/ |
void rwlock_read_unlock(rwlock_t *rwl) |
{ |
ipl_t ipl; |
ipl = interrupts_disable(); |
spinlock_lock(&rwl->lock); |
if (!--rwl->readers_in) |
let_others_in(rwl, ALLOW_ALL); |
spinlock_unlock(&rwl->lock); |
interrupts_restore(ipl); |
} |
/** Direct handoff of reader/writer lock ownership. |
* |
* Direct handoff of reader/writer lock ownership |
* to waiting readers or a writer. |
* |
* Must be called with rwl->lock locked. |
* Must be called with interrupts_disable()'d. |
* |
* @param rwl Reader/Writer lock. |
* @param readers_only See the description below. |
* |
* If readers_only is false: (unlock scenario) |
* Let the first sleeper on 'exclusive' mutex in, no matter |
* whether it is a reader or a writer. If there are more leading |
* readers in line, let each of them in. |
* |
* Otherwise: (timeout scenario) |
* Let all leading readers in. |
*/ |
void let_others_in(rwlock_t *rwl, int readers_only) |
{ |
rwlock_type_t type = RWLOCK_NONE; |
thread_t *t = NULL; |
bool one_more = true; |
spinlock_lock(&rwl->exclusive.sem.wq.lock); |
if (!list_empty(&rwl->exclusive.sem.wq.head)) |
t = list_get_instance(rwl->exclusive.sem.wq.head.next, thread_t, wq_link); |
do { |
if (t) { |
spinlock_lock(&t->lock); |
type = t->rwlock_holder_type; |
spinlock_unlock(&t->lock); |
} |
/* |
* If readers_only is true, we wake all leading readers |
* if and only if rwl is locked by another reader. |
* Assumption: readers_only ==> rwl->readers_in |
*/ |
if (readers_only && (type != RWLOCK_READER)) |
break; |
if (type == RWLOCK_READER) { |
/* |
* Waking up a reader. |
* We are responsible for incrementing rwl->readers_in for it. |
*/ |
rwl->readers_in++; |
} |
/* |
* Only the last iteration through this loop can increment |
* rwl->exclusive.sem.wq.missed_wakeup's. All preceeding |
* iterations will wake up a thread. |
*/ |
/* We call the internal version of waitq_wakeup, which |
* relies on the fact that the waitq is already locked. |
*/ |
_waitq_wakeup_unsafe(&rwl->exclusive.sem.wq, WAKEUP_FIRST); |
t = NULL; |
if (!list_empty(&rwl->exclusive.sem.wq.head)) { |
t = list_get_instance(rwl->exclusive.sem.wq.head.next, thread_t, wq_link); |
if (t) { |
spinlock_lock(&t->lock); |
if (t->rwlock_holder_type != RWLOCK_READER) |
one_more = false; |
spinlock_unlock(&t->lock); |
} |
} |
} while ((type == RWLOCK_READER) && t && one_more); |
spinlock_unlock(&rwl->exclusive.sem.wq.lock); |
} |
/** Release spinlock callback |
* |
* This is a callback function invoked from the scheduler. |
* The callback is registered in _rwlock_read_lock_timeout(). |
* |
* @param arg Spinlock. |
*/ |
void release_spinlock(void *arg) |
{ |
spinlock_unlock((spinlock_t *) arg); |
} |
/kernel/branches/falloc_bad/generic/src/synch/spinlock.c |
---|
0,0 → 1,165 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <synch/spinlock.h> |
#include <arch/atomic.h> |
#include <arch/barrier.h> |
#include <arch.h> |
#include <preemption.h> |
#include <print.h> |
#include <debug.h> |
#include <symtab.h> |
#ifdef CONFIG_SMP |
/** Initialize spinlock |
* |
* Initialize spinlock. |
* |
* @param sl Pointer to spinlock_t structure. |
*/ |
void spinlock_initialize(spinlock_t *sl, char *name) |
{ |
atomic_set(&sl->val, 0); |
#ifdef CONFIG_DEBUG_SPINLOCK |
sl->name = name; |
#endif |
} |
#ifdef CONFIG_DEBUG_SPINLOCK |
/** Lock spinlock |
* |
* Lock spinlock. |
* This version has limitted ability to report |
* possible occurence of deadlock. |
* |
* @param sl Pointer to spinlock_t structure. |
*/ |
void spinlock_lock(spinlock_t *sl) |
{ |
count_t i = 0; |
char *symbol; |
bool deadlock_reported = false; |
preemption_disable(); |
while (test_and_set(&sl->val)) { |
if (i++ > 300000) { |
printf("cpu%d: looping on spinlock %p:%s, caller=%p", |
CPU->id, sl, sl->name, CALLER); |
symbol = get_symtab_entry(CALLER); |
if (symbol) |
printf("(%s)", symbol); |
printf("\n"); |
i = 0; |
deadlock_reported = true; |
} |
} |
if (deadlock_reported) |
printf("cpu%d: not deadlocked\n", CPU->id); |
/* |
* Prevent critical section code from bleeding out this way up. |
*/ |
CS_ENTER_BARRIER(); |
} |
#else |
/** Lock spinlock |
* |
* Lock spinlock. |
* |
* @param sl Pointer to spinlock_t structure. |
*/ |
void spinlock_lock(spinlock_t *sl) |
{ |
preemption_disable(); |
/* |
* Each architecture has its own efficient/recommended |
* implementation of spinlock. |
*/ |
spinlock_arch(&sl->val); |
/* |
* Prevent critical section code from bleeding out this way up. |
*/ |
CS_ENTER_BARRIER(); |
} |
#endif |
/** Lock spinlock conditionally |
* |
* Lock spinlock conditionally. |
* If the spinlock is not available at the moment, |
* signal failure. |
* |
* @param sl Pointer to spinlock_t structure. |
* |
* @return Zero on failure, non-zero otherwise. |
*/ |
int spinlock_trylock(spinlock_t *sl) |
{ |
int rc; |
preemption_disable(); |
rc = !test_and_set(&sl->val); |
/* |
* Prevent critical section code from bleeding out this way up. |
*/ |
CS_ENTER_BARRIER(); |
if (!rc) |
preemption_enable(); |
return rc; |
} |
/** Unlock spinlock |
* |
* Unlock spinlock. |
* |
* @param sl Pointer to spinlock_t structure. |
*/ |
void spinlock_unlock(spinlock_t *sl) |
{ |
ASSERT(atomic_get(&sl->val) != 0); |
/* |
* Prevent critical section code from bleeding out this way down. |
*/ |
CS_LEAVE_BARRIER(); |
atomic_set(&sl->val,0); |
preemption_enable(); |
} |
#endif |
/kernel/branches/falloc_bad/generic/src/synch/waitq.c |
---|
0,0 → 1,280 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <synch/waitq.h> |
#include <synch/synch.h> |
#include <synch/spinlock.h> |
#include <proc/thread.h> |
#include <proc/scheduler.h> |
#include <arch/asm.h> |
#include <arch/types.h> |
#include <typedefs.h> |
#include <time/timeout.h> |
#include <arch.h> |
#include <context.h> |
#include <list.h> |
/** Initialize wait queue |
* |
* Initialize wait queue. |
* |
* @param wq Pointer to wait queue to be initialized. |
*/ |
void waitq_initialize(waitq_t *wq) |
{ |
spinlock_initialize(&wq->lock, "waitq_lock"); |
list_initialize(&wq->head); |
wq->missed_wakeups = 0; |
} |
/** Handle timeout during waitq_sleep_timeout() call |
* |
* This routine is called when waitq_sleep_timeout() timeouts. |
* Interrupts are disabled. |
* |
* It is supposed to try to remove 'its' thread from the wait queue; |
* it can eventually fail to achieve this goal when these two events |
* overlap. In that case it behaves just as though there was no |
* timeout at all. |
* |
* @param data Pointer to the thread that called waitq_sleep_timeout(). |
*/ |
void waitq_interrupted_sleep(void *data) |
{ |
thread_t *t = (thread_t *) data; |
waitq_t *wq; |
bool do_wakeup = false; |
spinlock_lock(&threads_lock); |
if (!list_member(&t->threads_link, &threads_head)) |
goto out; |
grab_locks: |
spinlock_lock(&t->lock); |
if ((wq = t->sleep_queue)) { /* assignment */ |
if (!spinlock_trylock(&wq->lock)) { |
spinlock_unlock(&t->lock); |
goto grab_locks; /* avoid deadlock */ |
} |
list_remove(&t->wq_link); |
t->saved_context = t->sleep_timeout_context; |
do_wakeup = true; |
spinlock_unlock(&wq->lock); |
t->sleep_queue = NULL; |
} |
t->timeout_pending = false; |
spinlock_unlock(&t->lock); |
if (do_wakeup) |
thread_ready(t); |
out: |
spinlock_unlock(&threads_lock); |
} |
/** Sleep until either wakeup or timeout occurs |
* |
* This is a sleep implementation which allows itself to be |
* interrupted from the sleep, restoring a failover context. |
* |
* Sleepers are organised in FIFO fashion in a structure called wait queue. |
* |
* This function is really basic in that other functions as waitq_sleep() |
* and all the *_timeout() functions use it. |
* |
* @param wq Pointer to wait queue. |
* @param usec Timeout in microseconds. |
* @param nonblocking Blocking vs. non-blocking operation mode switch. |
* |
* If usec is greater than zero, regardless of the value of nonblocking, |
* the call will not return until either timeout or wakeup comes. |
* |
* If usec is zero and nonblocking is zero (false), the call |
* will not return until wakeup comes. |
* |
* If usec is zero and nonblocking is non-zero (true), the call will |
* immediately return, reporting either success or failure. |
* |
* @return Returns one of: ESYNCH_WOULD_BLOCK, ESYNCH_TIMEOUT, |
* ESYNCH_OK_ATOMIC, ESYNCH_OK_BLOCKED. |
* |
* ESYNCH_WOULD_BLOCK means that the sleep failed because at the time |
* of the call there was no pending wakeup. |
* |
* ESYNCH_TIMEOUT means that the sleep timed out. |
* |
* ESYNCH_OK_ATOMIC means that the sleep succeeded and that there was |
* a pending wakeup at the time of the call. The caller was not put |
* asleep at all. |
* |
* ESYNCH_OK_BLOCKED means that the sleep succeeded; the full sleep was |
* attempted. |
*/ |
int waitq_sleep_timeout(waitq_t *wq, __u32 usec, int nonblocking) |
{ |
volatile ipl_t ipl; /* must be live after context_restore() */ |
restart: |
ipl = interrupts_disable(); |
/* |
* Busy waiting for a delayed timeout. |
* This is an important fix for the race condition between |
* a delayed timeout and a next call to waitq_sleep_timeout(). |
* Simply, the thread is not allowed to go to sleep if |
* there are timeouts in progress. |
*/ |
spinlock_lock(&THREAD->lock); |
if (THREAD->timeout_pending) { |
spinlock_unlock(&THREAD->lock); |
interrupts_restore(ipl); |
goto restart; |
} |
spinlock_unlock(&THREAD->lock); |
spinlock_lock(&wq->lock); |
/* checks whether to go to sleep at all */ |
if (wq->missed_wakeups) { |
wq->missed_wakeups--; |
spinlock_unlock(&wq->lock); |
interrupts_restore(ipl); |
return ESYNCH_OK_ATOMIC; |
} |
else { |
if (nonblocking && (usec == 0)) { |
/* return immediatelly instead of going to sleep */ |
spinlock_unlock(&wq->lock); |
interrupts_restore(ipl); |
return ESYNCH_WOULD_BLOCK; |
} |
} |
/* |
* Now we are firmly decided to go to sleep. |
*/ |
spinlock_lock(&THREAD->lock); |
if (usec) { |
/* We use the timeout variant. */ |
if (!context_save(&THREAD->sleep_timeout_context)) { |
/* |
* Short emulation of scheduler() return code. |
*/ |
before_thread_runs(); |
spinlock_unlock(&THREAD->lock); |
interrupts_restore(ipl); |
return ESYNCH_TIMEOUT; |
} |
THREAD->timeout_pending = true; |
timeout_register(&THREAD->sleep_timeout, (__u64) usec, waitq_interrupted_sleep, THREAD); |
} |
list_append(&THREAD->wq_link, &wq->head); |
/* |
* Suspend execution. |
*/ |
THREAD->state = Sleeping; |
THREAD->sleep_queue = wq; |
spinlock_unlock(&THREAD->lock); |
scheduler(); /* wq->lock is released in scheduler_separated_stack() */ |
interrupts_restore(ipl); |
return ESYNCH_OK_BLOCKED; |
} |
/** Wake up first thread sleeping in a wait queue |
* |
* Wake up first thread sleeping in a wait queue. |
* This is the SMP- and IRQ-safe wrapper meant for |
* general use. |
* |
* Besides its 'normal' wakeup operation, it attempts |
* to unregister possible timeout. |
* |
* @param wq Pointer to wait queue. |
* @param all If this is non-zero, all sleeping threads |
* will be woken up and missed count will be zeroed. |
*/ |
void waitq_wakeup(waitq_t *wq, bool all) |
{ |
ipl_t ipl; |
ipl = interrupts_disable(); |
spinlock_lock(&wq->lock); |
_waitq_wakeup_unsafe(wq, all); |
spinlock_unlock(&wq->lock); |
interrupts_restore(ipl); |
} |
/** Internal SMP- and IRQ-unsafe version of waitq_wakeup() |
* |
* This is the internal SMP- and IRQ-unsafe version |
* of waitq_wakeup(). It assumes wq->lock is already |
* locked and interrupts are already disabled. |
* |
* @param wq Pointer to wait queue. |
* @param all If this is non-zero, all sleeping threads |
* will be woken up and missed count will be zeroed. |
*/ |
void _waitq_wakeup_unsafe(waitq_t *wq, bool all) |
{ |
thread_t *t; |
loop: |
if (list_empty(&wq->head)) { |
wq->missed_wakeups++; |
if (all) |
wq->missed_wakeups = 0; |
return; |
} |
t = list_get_instance(wq->head.next, thread_t, wq_link); |
list_remove(&t->wq_link); |
spinlock_lock(&t->lock); |
if (t->timeout_pending && timeout_unregister(&t->sleep_timeout)) |
t->timeout_pending = false; |
t->sleep_queue = NULL; |
spinlock_unlock(&t->lock); |
thread_ready(t); |
if (all) |
goto loop; |
} |
/kernel/branches/falloc_bad/generic/src/synch/semaphore.c |
---|
0,0 → 1,86 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <synch/semaphore.h> |
#include <synch/waitq.h> |
#include <synch/spinlock.h> |
#include <synch/synch.h> |
#include <arch/asm.h> |
#include <arch.h> |
/** Initialize semaphore |
* |
* Initialize semaphore. |
* |
* @param s Semaphore. |
* @param val Maximal number of threads allowed to enter critical section. |
*/ |
void semaphore_initialize(semaphore_t *s, int val) |
{ |
ipl_t ipl; |
waitq_initialize(&s->wq); |
ipl = interrupts_disable(); |
spinlock_lock(&s->wq.lock); |
s->wq.missed_wakeups = val; |
spinlock_unlock(&s->wq.lock); |
interrupts_restore(ipl); |
} |
/** Semaphore down |
* |
* Semaphore down. |
* Conditional mode and mode with timeout can be requested. |
* |
* @param s Semaphore. |
* @param usec Timeout in microseconds. |
* @param trydown Switches between blocking and non-blocking mode. |
* |
* For exact description of possible combinations of |
* 'usec' and 'trydown', see comment for waitq_sleep_timeout(). |
* |
* @return See comment for waitq_sleep_timeout(). |
*/ |
int _semaphore_down_timeout(semaphore_t *s, __u32 usec, int trydown) |
{ |
return waitq_sleep_timeout(&s->wq, usec, trydown); |
} |
/** Semaphore up |
* |
* Semaphore up. |
* |
* @param s Semaphore. |
*/ |
void semaphore_up(semaphore_t *s) |
{ |
waitq_wakeup(&s->wq, WAKEUP_FIRST); |
} |
/kernel/branches/falloc_bad/generic/src/synch/mutex.c |
---|
0,0 → 1,72 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <synch/mutex.h> |
#include <synch/semaphore.h> |
#include <synch/synch.h> |
/** Initialize mutex |
* |
* Initialize mutex. |
* |
* @param mtx Mutex. |
*/ |
void mutex_initialize(mutex_t *mtx) |
{ |
semaphore_initialize(&mtx->sem, 1); |
} |
/** Acquire mutex |
* |
* Acquire mutex. |
* Timeout mode and non-blocking mode can be requested. |
* |
* @param mtx Mutex. |
* @param usec Timeout in microseconds. |
* @param trylock Switches between blocking and non-blocking mode. |
* |
* For exact description of possible combinations of |
* 'usec' and 'trylock', see comment for waitq_sleep_timeout(). |
* |
* @return See comment for waitq_sleep_timeout(). |
*/ |
int _mutex_lock_timeout(mutex_t *mtx, __u32 usec, int trylock) |
{ |
return _semaphore_down_timeout(&mtx->sem, usec, trylock); |
} |
/** Release mutex |
* |
* Release mutex. |
* |
* @param mtx Mutex. |
*/ |
void mutex_unlock(mutex_t *mtx) |
{ |
semaphore_up(&mtx->sem); |
} |
/kernel/branches/falloc_bad/generic/src/synch/condvar.c |
---|
0,0 → 1,91 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <synch/condvar.h> |
#include <synch/mutex.h> |
#include <synch/waitq.h> |
#include <synch/synch.h> |
/** Initialize condition variable |
* |
* Initialize condition variable. |
* |
* @param cv Condition variable. |
*/ |
void condvar_initialize(condvar_t *cv) |
{ |
waitq_initialize(&cv->wq); |
} |
/** Signal the condition has become true |
* |
* Signal the condition has become true |
* to the first waiting thread by waking it up. |
* |
* @param cv Condition variable. |
*/ |
void condvar_signal(condvar_t *cv) |
{ |
waitq_wakeup(&cv->wq, WAKEUP_FIRST); |
} |
/** Signal the condition has become true |
* |
* Signal the condition has become true |
* to all waiting threads by waking them up. |
* |
* @param cv Condition variable. |
*/ |
void condvar_broadcast(condvar_t *cv) |
{ |
waitq_wakeup(&cv->wq, WAKEUP_ALL); |
} |
/** Wait for the condition becoming true |
* |
* Wait for the condition becoming true. |
* |
* @param cv Condition variable. |
* @param mtx Mutex. |
* @param usec Timeout value in microseconds. |
* @param trywait Blocking versus non-blocking operation mode switch. |
* |
* For exact description of possible combinations of |
* 'usec' and 'trywait', see comment for waitq_sleep_timeout(). |
* |
* @return See comment for waitq_sleep_timeout(). |
*/ |
int _condvar_wait_timeout(condvar_t *cv, mutex_t *mtx, __u32 usec, int trywait) |
{ |
int rc; |
mutex_unlock(mtx); |
rc = waitq_sleep_timeout(&cv->wq, usec, trywait); |
mutex_lock(mtx); |
return rc; |
} |
/kernel/branches/falloc_bad/generic/src/smp/ipi.c |
---|
0,0 → 1,54 |
/* |
* Copyright (C) 2005 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifdef CONFIG_SMP |
#include <smp/ipi.h> |
#include <config.h> |
/** Broadcast IPI message |
* |
* Broadcast IPI message to all CPUs. |
* |
* @param ipi Message to broadcast. |
* |
*/ |
void ipi_broadcast(int ipi) |
{ |
/* |
* Provisions must be made to avoid sending IPI: |
* - before all CPU's were configured to accept the IPI |
* - if there is only one CPU but the kernel was compiled with CONFIG_SMP |
*/ |
if ((config.cpu_active > 1) && (config.cpu_active == config.cpu_count)) |
ipi_broadcast_arch(ipi); |
} |
#endif /* CONFIG_SMP */ |
/kernel/branches/falloc_bad/generic/src/preempt/preemption.c |
---|
0,0 → 1,48 |
/* |
* Copyright (C) 2005 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <preemption.h> |
#include <arch.h> |
#include <arch/asm.h> |
#include <arch/barrier.h> |
#include <debug.h> |
/** Increment preemption disabled counter. */ |
void preemption_disable(void) |
{ |
THE->preemption_disabled++; |
memory_barrier(); |
} |
/** Decrement preemption disabled counter. */ |
void preemption_enable(void) |
{ |
ASSERT(THE->preemption_disabled); |
memory_barrier(); |
THE->preemption_disabled--; |
} |
/kernel/branches/falloc_bad/generic/src/fb/font-8x16.c |
---|
0,0 → 1,4641 |
/* |
* Copyright (C) 2005 Martin Decky |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <fb/font-8x16.h> |
unsigned char fb_font[FONT_GLIPHS * FONT_SCANLINES] = { |
/* 0 0x00 '^@' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 1 0x01 '^A' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x7e, /* 01111110 */ |
0x81, /* 10000001 */ |
0xa5, /* 10100101 */ |
0x81, /* 10000001 */ |
0x81, /* 10000001 */ |
0xbd, /* 10111101 */ |
0x99, /* 10011001 */ |
0x81, /* 10000001 */ |
0x81, /* 10000001 */ |
0x7e, /* 01111110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 2 0x02 '^B' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x7e, /* 01111110 */ |
0xff, /* 11111111 */ |
0xdb, /* 11011011 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xc3, /* 11000011 */ |
0xe7, /* 11100111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0x7e, /* 01111110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 3 0x03 '^C' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x6c, /* 01101100 */ |
0xfe, /* 11111110 */ |
0xfe, /* 11111110 */ |
0xfe, /* 11111110 */ |
0xfe, /* 11111110 */ |
0x7c, /* 01111100 */ |
0x38, /* 00111000 */ |
0x10, /* 00010000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 4 0x04 '^D' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x10, /* 00010000 */ |
0x38, /* 00111000 */ |
0x7c, /* 01111100 */ |
0xfe, /* 11111110 */ |
0x7c, /* 01111100 */ |
0x38, /* 00111000 */ |
0x10, /* 00010000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 5 0x05 '^E' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x18, /* 00011000 */ |
0x3c, /* 00111100 */ |
0x3c, /* 00111100 */ |
0xe7, /* 11100111 */ |
0xe7, /* 11100111 */ |
0xe7, /* 11100111 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x3c, /* 00111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 6 0x06 '^F' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x18, /* 00011000 */ |
0x3c, /* 00111100 */ |
0x7e, /* 01111110 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0x7e, /* 01111110 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x3c, /* 00111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 7 0x07 '^G' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x18, /* 00011000 */ |
0x3c, /* 00111100 */ |
0x3c, /* 00111100 */ |
0x18, /* 00011000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 8 0x08 '^H' */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xe7, /* 11100111 */ |
0xc3, /* 11000011 */ |
0xc3, /* 11000011 */ |
0xe7, /* 11100111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
/* 9 0x09 '^I' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x3c, /* 00111100 */ |
0x66, /* 01100110 */ |
0x42, /* 01000010 */ |
0x42, /* 01000010 */ |
0x66, /* 01100110 */ |
0x3c, /* 00111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 10 0x0a '^J' */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xc3, /* 11000011 */ |
0x99, /* 10011001 */ |
0xbd, /* 10111101 */ |
0xbd, /* 10111101 */ |
0x99, /* 10011001 */ |
0xc3, /* 11000011 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
/* 11 0x0b '^K' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x1e, /* 00011110 */ |
0x0e, /* 00001110 */ |
0x1a, /* 00011010 */ |
0x32, /* 00110010 */ |
0x78, /* 01111000 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0x78, /* 01111000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 12 0x0c '^L' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x3c, /* 00111100 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x3c, /* 00111100 */ |
0x18, /* 00011000 */ |
0x7e, /* 01111110 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 13 0x0d '^M' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x3f, /* 00111111 */ |
0x33, /* 00110011 */ |
0x3f, /* 00111111 */ |
0x30, /* 00110000 */ |
0x30, /* 00110000 */ |
0x30, /* 00110000 */ |
0x30, /* 00110000 */ |
0x70, /* 01110000 */ |
0xf0, /* 11110000 */ |
0xe0, /* 11100000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 14 0x0e '^N' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x7f, /* 01111111 */ |
0x63, /* 01100011 */ |
0x7f, /* 01111111 */ |
0x63, /* 01100011 */ |
0x63, /* 01100011 */ |
0x63, /* 01100011 */ |
0x63, /* 01100011 */ |
0x67, /* 01100111 */ |
0xe7, /* 11100111 */ |
0xe6, /* 11100110 */ |
0xc0, /* 11000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 15 0x0f '^O' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0xdb, /* 11011011 */ |
0x3c, /* 00111100 */ |
0xe7, /* 11100111 */ |
0x3c, /* 00111100 */ |
0xdb, /* 11011011 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 16 0x10 '^P' */ |
0x00, /* 00000000 */ |
0x80, /* 10000000 */ |
0xc0, /* 11000000 */ |
0xe0, /* 11100000 */ |
0xf0, /* 11110000 */ |
0xf8, /* 11111000 */ |
0xfe, /* 11111110 */ |
0xf8, /* 11111000 */ |
0xf0, /* 11110000 */ |
0xe0, /* 11100000 */ |
0xc0, /* 11000000 */ |
0x80, /* 10000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 17 0x11 '^Q' */ |
0x00, /* 00000000 */ |
0x02, /* 00000010 */ |
0x06, /* 00000110 */ |
0x0e, /* 00001110 */ |
0x1e, /* 00011110 */ |
0x3e, /* 00111110 */ |
0xfe, /* 11111110 */ |
0x3e, /* 00111110 */ |
0x1e, /* 00011110 */ |
0x0e, /* 00001110 */ |
0x06, /* 00000110 */ |
0x02, /* 00000010 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 18 0x12 '^R' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x18, /* 00011000 */ |
0x3c, /* 00111100 */ |
0x7e, /* 01111110 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x7e, /* 01111110 */ |
0x3c, /* 00111100 */ |
0x18, /* 00011000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 19 0x13 '^S' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x00, /* 00000000 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 20 0x14 '^T' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x7f, /* 01111111 */ |
0xdb, /* 11011011 */ |
0xdb, /* 11011011 */ |
0xdb, /* 11011011 */ |
0x7b, /* 01111011 */ |
0x1b, /* 00011011 */ |
0x1b, /* 00011011 */ |
0x1b, /* 00011011 */ |
0x1b, /* 00011011 */ |
0x1b, /* 00011011 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 21 0x15 '^U' */ |
0x00, /* 00000000 */ |
0x7c, /* 01111100 */ |
0xc6, /* 11000110 */ |
0x60, /* 01100000 */ |
0x38, /* 00111000 */ |
0x6c, /* 01101100 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0x6c, /* 01101100 */ |
0x38, /* 00111000 */ |
0x0c, /* 00001100 */ |
0xc6, /* 11000110 */ |
0x7c, /* 01111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 22 0x16 '^V' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xfe, /* 11111110 */ |
0xfe, /* 11111110 */ |
0xfe, /* 11111110 */ |
0xfe, /* 11111110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 23 0x17 '^W' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x18, /* 00011000 */ |
0x3c, /* 00111100 */ |
0x7e, /* 01111110 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x7e, /* 01111110 */ |
0x3c, /* 00111100 */ |
0x18, /* 00011000 */ |
0x7e, /* 01111110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 24 0x18 '^X' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x18, /* 00011000 */ |
0x3c, /* 00111100 */ |
0x7e, /* 01111110 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 25 0x19 '^Y' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x7e, /* 01111110 */ |
0x3c, /* 00111100 */ |
0x18, /* 00011000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 26 0x1a '^Z' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x18, /* 00011000 */ |
0x0c, /* 00001100 */ |
0xfe, /* 11111110 */ |
0x0c, /* 00001100 */ |
0x18, /* 00011000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 27 0x1b '^[' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x30, /* 00110000 */ |
0x60, /* 01100000 */ |
0xfe, /* 11111110 */ |
0x60, /* 01100000 */ |
0x30, /* 00110000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 28 0x1c '^\' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xc0, /* 11000000 */ |
0xc0, /* 11000000 */ |
0xc0, /* 11000000 */ |
0xfe, /* 11111110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 29 0x1d '^]' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x28, /* 00101000 */ |
0x6c, /* 01101100 */ |
0xfe, /* 11111110 */ |
0x6c, /* 01101100 */ |
0x28, /* 00101000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 30 0x1e '^^' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x10, /* 00010000 */ |
0x38, /* 00111000 */ |
0x38, /* 00111000 */ |
0x7c, /* 01111100 */ |
0x7c, /* 01111100 */ |
0xfe, /* 11111110 */ |
0xfe, /* 11111110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 31 0x1f '^_' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xfe, /* 11111110 */ |
0xfe, /* 11111110 */ |
0x7c, /* 01111100 */ |
0x7c, /* 01111100 */ |
0x38, /* 00111000 */ |
0x38, /* 00111000 */ |
0x10, /* 00010000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 32 0x20 ' ' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 33 0x21 '!' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x18, /* 00011000 */ |
0x3c, /* 00111100 */ |
0x3c, /* 00111100 */ |
0x3c, /* 00111100 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x00, /* 00000000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 34 0x22 '"' */ |
0x00, /* 00000000 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x24, /* 00100100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 35 0x23 '#' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x6c, /* 01101100 */ |
0x6c, /* 01101100 */ |
0xfe, /* 11111110 */ |
0x6c, /* 01101100 */ |
0x6c, /* 01101100 */ |
0x6c, /* 01101100 */ |
0xfe, /* 11111110 */ |
0x6c, /* 01101100 */ |
0x6c, /* 01101100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 36 0x24 '$' */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x7c, /* 01111100 */ |
0xc6, /* 11000110 */ |
0xc2, /* 11000010 */ |
0xc0, /* 11000000 */ |
0x7c, /* 01111100 */ |
0x06, /* 00000110 */ |
0x06, /* 00000110 */ |
0x86, /* 10000110 */ |
0xc6, /* 11000110 */ |
0x7c, /* 01111100 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 37 0x25 '%' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xc2, /* 11000010 */ |
0xc6, /* 11000110 */ |
0x0c, /* 00001100 */ |
0x18, /* 00011000 */ |
0x30, /* 00110000 */ |
0x60, /* 01100000 */ |
0xc6, /* 11000110 */ |
0x86, /* 10000110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 38 0x26 '&' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x38, /* 00111000 */ |
0x6c, /* 01101100 */ |
0x6c, /* 01101100 */ |
0x38, /* 00111000 */ |
0x76, /* 01110110 */ |
0xdc, /* 11011100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0x76, /* 01110110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 39 0x27 ''' */ |
0x00, /* 00000000 */ |
0x30, /* 00110000 */ |
0x30, /* 00110000 */ |
0x30, /* 00110000 */ |
0x60, /* 01100000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 40 0x28 '(' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x0c, /* 00001100 */ |
0x18, /* 00011000 */ |
0x30, /* 00110000 */ |
0x30, /* 00110000 */ |
0x30, /* 00110000 */ |
0x30, /* 00110000 */ |
0x30, /* 00110000 */ |
0x30, /* 00110000 */ |
0x18, /* 00011000 */ |
0x0c, /* 00001100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 41 0x29 ')' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x30, /* 00110000 */ |
0x18, /* 00011000 */ |
0x0c, /* 00001100 */ |
0x0c, /* 00001100 */ |
0x0c, /* 00001100 */ |
0x0c, /* 00001100 */ |
0x0c, /* 00001100 */ |
0x0c, /* 00001100 */ |
0x18, /* 00011000 */ |
0x30, /* 00110000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 42 0x2a '*' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x66, /* 01100110 */ |
0x3c, /* 00111100 */ |
0xff, /* 11111111 */ |
0x3c, /* 00111100 */ |
0x66, /* 01100110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 43 0x2b '+' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x7e, /* 01111110 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 44 0x2c ',' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x30, /* 00110000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 45 0x2d '-' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xfe, /* 11111110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 46 0x2e '.' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 47 0x2f '/' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x02, /* 00000010 */ |
0x06, /* 00000110 */ |
0x0c, /* 00001100 */ |
0x18, /* 00011000 */ |
0x30, /* 00110000 */ |
0x60, /* 01100000 */ |
0xc0, /* 11000000 */ |
0x80, /* 10000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 48 0x30 '0' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x38, /* 00111000 */ |
0x6c, /* 01101100 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xd6, /* 11010110 */ |
0xd6, /* 11010110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0x6c, /* 01101100 */ |
0x38, /* 00111000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 49 0x31 '1' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x18, /* 00011000 */ |
0x38, /* 00111000 */ |
0x78, /* 01111000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x7e, /* 01111110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 50 0x32 '2' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x7c, /* 01111100 */ |
0xc6, /* 11000110 */ |
0x06, /* 00000110 */ |
0x0c, /* 00001100 */ |
0x18, /* 00011000 */ |
0x30, /* 00110000 */ |
0x60, /* 01100000 */ |
0xc0, /* 11000000 */ |
0xc6, /* 11000110 */ |
0xfe, /* 11111110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 51 0x33 '3' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x7c, /* 01111100 */ |
0xc6, /* 11000110 */ |
0x06, /* 00000110 */ |
0x06, /* 00000110 */ |
0x3c, /* 00111100 */ |
0x06, /* 00000110 */ |
0x06, /* 00000110 */ |
0x06, /* 00000110 */ |
0xc6, /* 11000110 */ |
0x7c, /* 01111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 52 0x34 '4' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x0c, /* 00001100 */ |
0x1c, /* 00011100 */ |
0x3c, /* 00111100 */ |
0x6c, /* 01101100 */ |
0xcc, /* 11001100 */ |
0xfe, /* 11111110 */ |
0x0c, /* 00001100 */ |
0x0c, /* 00001100 */ |
0x0c, /* 00001100 */ |
0x1e, /* 00011110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 53 0x35 '5' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xfe, /* 11111110 */ |
0xc0, /* 11000000 */ |
0xc0, /* 11000000 */ |
0xc0, /* 11000000 */ |
0xfc, /* 11111100 */ |
0x06, /* 00000110 */ |
0x06, /* 00000110 */ |
0x06, /* 00000110 */ |
0xc6, /* 11000110 */ |
0x7c, /* 01111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 54 0x36 '6' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x38, /* 00111000 */ |
0x60, /* 01100000 */ |
0xc0, /* 11000000 */ |
0xc0, /* 11000000 */ |
0xfc, /* 11111100 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0x7c, /* 01111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 55 0x37 '7' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xfe, /* 11111110 */ |
0xc6, /* 11000110 */ |
0x06, /* 00000110 */ |
0x06, /* 00000110 */ |
0x0c, /* 00001100 */ |
0x18, /* 00011000 */ |
0x30, /* 00110000 */ |
0x30, /* 00110000 */ |
0x30, /* 00110000 */ |
0x30, /* 00110000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 56 0x38 '8' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x7c, /* 01111100 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0x7c, /* 01111100 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0x7c, /* 01111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 57 0x39 '9' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x7c, /* 01111100 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0x7e, /* 01111110 */ |
0x06, /* 00000110 */ |
0x06, /* 00000110 */ |
0x06, /* 00000110 */ |
0x0c, /* 00001100 */ |
0x78, /* 01111000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 58 0x3a ':' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 59 0x3b ';' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x30, /* 00110000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 60 0x3c '<' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x06, /* 00000110 */ |
0x0c, /* 00001100 */ |
0x18, /* 00011000 */ |
0x30, /* 00110000 */ |
0x60, /* 01100000 */ |
0x30, /* 00110000 */ |
0x18, /* 00011000 */ |
0x0c, /* 00001100 */ |
0x06, /* 00000110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 61 0x3d '=' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x7e, /* 01111110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x7e, /* 01111110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 62 0x3e '>' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x60, /* 01100000 */ |
0x30, /* 00110000 */ |
0x18, /* 00011000 */ |
0x0c, /* 00001100 */ |
0x06, /* 00000110 */ |
0x0c, /* 00001100 */ |
0x18, /* 00011000 */ |
0x30, /* 00110000 */ |
0x60, /* 01100000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 63 0x3f '?' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x7c, /* 01111100 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0x0c, /* 00001100 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x00, /* 00000000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 64 0x40 '@' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x7c, /* 01111100 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xde, /* 11011110 */ |
0xde, /* 11011110 */ |
0xde, /* 11011110 */ |
0xdc, /* 11011100 */ |
0xc0, /* 11000000 */ |
0x7c, /* 01111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 65 0x41 'A' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x10, /* 00010000 */ |
0x38, /* 00111000 */ |
0x6c, /* 01101100 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xfe, /* 11111110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 66 0x42 'B' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xfc, /* 11111100 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x7c, /* 01111100 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0xfc, /* 11111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 67 0x43 'C' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x3c, /* 00111100 */ |
0x66, /* 01100110 */ |
0xc2, /* 11000010 */ |
0xc0, /* 11000000 */ |
0xc0, /* 11000000 */ |
0xc0, /* 11000000 */ |
0xc0, /* 11000000 */ |
0xc2, /* 11000010 */ |
0x66, /* 01100110 */ |
0x3c, /* 00111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 68 0x44 'D' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xf8, /* 11111000 */ |
0x6c, /* 01101100 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x6c, /* 01101100 */ |
0xf8, /* 11111000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 69 0x45 'E' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xfe, /* 11111110 */ |
0x66, /* 01100110 */ |
0x62, /* 01100010 */ |
0x68, /* 01101000 */ |
0x78, /* 01111000 */ |
0x68, /* 01101000 */ |
0x60, /* 01100000 */ |
0x62, /* 01100010 */ |
0x66, /* 01100110 */ |
0xfe, /* 11111110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 70 0x46 'F' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xfe, /* 11111110 */ |
0x66, /* 01100110 */ |
0x62, /* 01100010 */ |
0x68, /* 01101000 */ |
0x78, /* 01111000 */ |
0x68, /* 01101000 */ |
0x60, /* 01100000 */ |
0x60, /* 01100000 */ |
0x60, /* 01100000 */ |
0xf0, /* 11110000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 71 0x47 'G' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x3c, /* 00111100 */ |
0x66, /* 01100110 */ |
0xc2, /* 11000010 */ |
0xc0, /* 11000000 */ |
0xc0, /* 11000000 */ |
0xde, /* 11011110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0x66, /* 01100110 */ |
0x3a, /* 00111010 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 72 0x48 'H' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xfe, /* 11111110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 73 0x49 'I' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x3c, /* 00111100 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x3c, /* 00111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 74 0x4a 'J' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x1e, /* 00011110 */ |
0x0c, /* 00001100 */ |
0x0c, /* 00001100 */ |
0x0c, /* 00001100 */ |
0x0c, /* 00001100 */ |
0x0c, /* 00001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0x78, /* 01111000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 75 0x4b 'K' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xe6, /* 11100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x6c, /* 01101100 */ |
0x78, /* 01111000 */ |
0x78, /* 01111000 */ |
0x6c, /* 01101100 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0xe6, /* 11100110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 76 0x4c 'L' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xf0, /* 11110000 */ |
0x60, /* 01100000 */ |
0x60, /* 01100000 */ |
0x60, /* 01100000 */ |
0x60, /* 01100000 */ |
0x60, /* 01100000 */ |
0x60, /* 01100000 */ |
0x62, /* 01100010 */ |
0x66, /* 01100110 */ |
0xfe, /* 11111110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 77 0x4d 'M' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xc6, /* 11000110 */ |
0xee, /* 11101110 */ |
0xfe, /* 11111110 */ |
0xfe, /* 11111110 */ |
0xd6, /* 11010110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 78 0x4e 'N' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xc6, /* 11000110 */ |
0xe6, /* 11100110 */ |
0xf6, /* 11110110 */ |
0xfe, /* 11111110 */ |
0xde, /* 11011110 */ |
0xce, /* 11001110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 79 0x4f 'O' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x7c, /* 01111100 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0x7c, /* 01111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 80 0x50 'P' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xfc, /* 11111100 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x7c, /* 01111100 */ |
0x60, /* 01100000 */ |
0x60, /* 01100000 */ |
0x60, /* 01100000 */ |
0x60, /* 01100000 */ |
0xf0, /* 11110000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 81 0x51 'Q' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x7c, /* 01111100 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xd6, /* 11010110 */ |
0xde, /* 11011110 */ |
0x7c, /* 01111100 */ |
0x0c, /* 00001100 */ |
0x0e, /* 00001110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 82 0x52 'R' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xfc, /* 11111100 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x7c, /* 01111100 */ |
0x6c, /* 01101100 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0xe6, /* 11100110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 83 0x53 'S' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x7c, /* 01111100 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0x60, /* 01100000 */ |
0x38, /* 00111000 */ |
0x0c, /* 00001100 */ |
0x06, /* 00000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0x7c, /* 01111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 84 0x54 'T' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x7e, /* 01111110 */ |
0x7e, /* 01111110 */ |
0x5a, /* 01011010 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x3c, /* 00111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 85 0x55 'U' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0x7c, /* 01111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 86 0x56 'V' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0x6c, /* 01101100 */ |
0x38, /* 00111000 */ |
0x10, /* 00010000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 87 0x57 'W' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xd6, /* 11010110 */ |
0xd6, /* 11010110 */ |
0xd6, /* 11010110 */ |
0xfe, /* 11111110 */ |
0xee, /* 11101110 */ |
0x6c, /* 01101100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 88 0x58 'X' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0x6c, /* 01101100 */ |
0x7c, /* 01111100 */ |
0x38, /* 00111000 */ |
0x38, /* 00111000 */ |
0x7c, /* 01111100 */ |
0x6c, /* 01101100 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 89 0x59 'Y' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x3c, /* 00111100 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x3c, /* 00111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 90 0x5a 'Z' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xfe, /* 11111110 */ |
0xc6, /* 11000110 */ |
0x86, /* 10000110 */ |
0x0c, /* 00001100 */ |
0x18, /* 00011000 */ |
0x30, /* 00110000 */ |
0x60, /* 01100000 */ |
0xc2, /* 11000010 */ |
0xc6, /* 11000110 */ |
0xfe, /* 11111110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 91 0x5b '[' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x3c, /* 00111100 */ |
0x30, /* 00110000 */ |
0x30, /* 00110000 */ |
0x30, /* 00110000 */ |
0x30, /* 00110000 */ |
0x30, /* 00110000 */ |
0x30, /* 00110000 */ |
0x30, /* 00110000 */ |
0x30, /* 00110000 */ |
0x3c, /* 00111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 92 0x5c '\' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x80, /* 10000000 */ |
0xc0, /* 11000000 */ |
0xe0, /* 11100000 */ |
0x70, /* 01110000 */ |
0x38, /* 00111000 */ |
0x1c, /* 00011100 */ |
0x0e, /* 00001110 */ |
0x06, /* 00000110 */ |
0x02, /* 00000010 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 93 0x5d ']' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x3c, /* 00111100 */ |
0x0c, /* 00001100 */ |
0x0c, /* 00001100 */ |
0x0c, /* 00001100 */ |
0x0c, /* 00001100 */ |
0x0c, /* 00001100 */ |
0x0c, /* 00001100 */ |
0x0c, /* 00001100 */ |
0x0c, /* 00001100 */ |
0x3c, /* 00111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 94 0x5e '^' */ |
0x10, /* 00010000 */ |
0x38, /* 00111000 */ |
0x6c, /* 01101100 */ |
0xc6, /* 11000110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 95 0x5f '_' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xff, /* 11111111 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 96 0x60 '`' */ |
0x00, /* 00000000 */ |
0x30, /* 00110000 */ |
0x18, /* 00011000 */ |
0x0c, /* 00001100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 97 0x61 'a' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x78, /* 01111000 */ |
0x0c, /* 00001100 */ |
0x7c, /* 01111100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0x76, /* 01110110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 98 0x62 'b' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xe0, /* 11100000 */ |
0x60, /* 01100000 */ |
0x60, /* 01100000 */ |
0x78, /* 01111000 */ |
0x6c, /* 01101100 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x7c, /* 01111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 99 0x63 'c' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x7c, /* 01111100 */ |
0xc6, /* 11000110 */ |
0xc0, /* 11000000 */ |
0xc0, /* 11000000 */ |
0xc0, /* 11000000 */ |
0xc6, /* 11000110 */ |
0x7c, /* 01111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 100 0x64 'd' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x1c, /* 00011100 */ |
0x0c, /* 00001100 */ |
0x0c, /* 00001100 */ |
0x3c, /* 00111100 */ |
0x6c, /* 01101100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0x76, /* 01110110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 101 0x65 'e' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x7c, /* 01111100 */ |
0xc6, /* 11000110 */ |
0xfe, /* 11111110 */ |
0xc0, /* 11000000 */ |
0xc0, /* 11000000 */ |
0xc6, /* 11000110 */ |
0x7c, /* 01111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 102 0x66 'f' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x1c, /* 00011100 */ |
0x36, /* 00110110 */ |
0x32, /* 00110010 */ |
0x30, /* 00110000 */ |
0x78, /* 01111000 */ |
0x30, /* 00110000 */ |
0x30, /* 00110000 */ |
0x30, /* 00110000 */ |
0x30, /* 00110000 */ |
0x78, /* 01111000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 103 0x67 'g' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x76, /* 01110110 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0x7c, /* 01111100 */ |
0x0c, /* 00001100 */ |
0xcc, /* 11001100 */ |
0x78, /* 01111000 */ |
0x00, /* 00000000 */ |
/* 104 0x68 'h' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xe0, /* 11100000 */ |
0x60, /* 01100000 */ |
0x60, /* 01100000 */ |
0x6c, /* 01101100 */ |
0x76, /* 01110110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0xe6, /* 11100110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 105 0x69 'i' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x00, /* 00000000 */ |
0x38, /* 00111000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x3c, /* 00111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 106 0x6a 'j' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x06, /* 00000110 */ |
0x06, /* 00000110 */ |
0x00, /* 00000000 */ |
0x0e, /* 00001110 */ |
0x06, /* 00000110 */ |
0x06, /* 00000110 */ |
0x06, /* 00000110 */ |
0x06, /* 00000110 */ |
0x06, /* 00000110 */ |
0x06, /* 00000110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x3c, /* 00111100 */ |
0x00, /* 00000000 */ |
/* 107 0x6b 'k' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xe0, /* 11100000 */ |
0x60, /* 01100000 */ |
0x60, /* 01100000 */ |
0x66, /* 01100110 */ |
0x6c, /* 01101100 */ |
0x78, /* 01111000 */ |
0x78, /* 01111000 */ |
0x6c, /* 01101100 */ |
0x66, /* 01100110 */ |
0xe6, /* 11100110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 108 0x6c 'l' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x38, /* 00111000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x3c, /* 00111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 109 0x6d 'm' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xec, /* 11101100 */ |
0xfe, /* 11111110 */ |
0xd6, /* 11010110 */ |
0xd6, /* 11010110 */ |
0xd6, /* 11010110 */ |
0xd6, /* 11010110 */ |
0xc6, /* 11000110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 110 0x6e 'n' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xdc, /* 11011100 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 111 0x6f 'o' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x7c, /* 01111100 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0x7c, /* 01111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 112 0x70 'p' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xdc, /* 11011100 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x7c, /* 01111100 */ |
0x60, /* 01100000 */ |
0x60, /* 01100000 */ |
0xf0, /* 11110000 */ |
0x00, /* 00000000 */ |
/* 113 0x71 'q' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x76, /* 01110110 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0x7c, /* 01111100 */ |
0x0c, /* 00001100 */ |
0x0c, /* 00001100 */ |
0x1e, /* 00011110 */ |
0x00, /* 00000000 */ |
/* 114 0x72 'r' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xdc, /* 11011100 */ |
0x76, /* 01110110 */ |
0x66, /* 01100110 */ |
0x60, /* 01100000 */ |
0x60, /* 01100000 */ |
0x60, /* 01100000 */ |
0xf0, /* 11110000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 115 0x73 's' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x7c, /* 01111100 */ |
0xc6, /* 11000110 */ |
0x60, /* 01100000 */ |
0x38, /* 00111000 */ |
0x0c, /* 00001100 */ |
0xc6, /* 11000110 */ |
0x7c, /* 01111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 116 0x74 't' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x10, /* 00010000 */ |
0x30, /* 00110000 */ |
0x30, /* 00110000 */ |
0xfc, /* 11111100 */ |
0x30, /* 00110000 */ |
0x30, /* 00110000 */ |
0x30, /* 00110000 */ |
0x30, /* 00110000 */ |
0x36, /* 00110110 */ |
0x1c, /* 00011100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 117 0x75 'u' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0x76, /* 01110110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 118 0x76 'v' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0x6c, /* 01101100 */ |
0x38, /* 00111000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 119 0x77 'w' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xd6, /* 11010110 */ |
0xd6, /* 11010110 */ |
0xd6, /* 11010110 */ |
0xfe, /* 11111110 */ |
0x6c, /* 01101100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 120 0x78 'x' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xc6, /* 11000110 */ |
0x6c, /* 01101100 */ |
0x38, /* 00111000 */ |
0x38, /* 00111000 */ |
0x38, /* 00111000 */ |
0x6c, /* 01101100 */ |
0xc6, /* 11000110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 121 0x79 'y' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0x7e, /* 01111110 */ |
0x06, /* 00000110 */ |
0x0c, /* 00001100 */ |
0xf8, /* 11111000 */ |
0x00, /* 00000000 */ |
/* 122 0x7a 'z' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xfe, /* 11111110 */ |
0xcc, /* 11001100 */ |
0x18, /* 00011000 */ |
0x30, /* 00110000 */ |
0x60, /* 01100000 */ |
0xc6, /* 11000110 */ |
0xfe, /* 11111110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 123 0x7b '{' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x0e, /* 00001110 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x70, /* 01110000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x0e, /* 00001110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 124 0x7c '|' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 125 0x7d '}' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x70, /* 01110000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x0e, /* 00001110 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x70, /* 01110000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 126 0x7e '~' */ |
0x00, /* 00000000 */ |
0x76, /* 01110110 */ |
0xdc, /* 11011100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 127 0x7f '' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x10, /* 00010000 */ |
0x38, /* 00111000 */ |
0x6c, /* 01101100 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xfe, /* 11111110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 128 0x80 '€' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x3c, /* 00111100 */ |
0x66, /* 01100110 */ |
0xc2, /* 11000010 */ |
0xc0, /* 11000000 */ |
0xc0, /* 11000000 */ |
0xc0, /* 11000000 */ |
0xc0, /* 11000000 */ |
0xc2, /* 11000010 */ |
0x66, /* 01100110 */ |
0x3c, /* 00111100 */ |
0x18, /* 00011000 */ |
0x70, /* 01110000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 129 0x81 '' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xcc, /* 11001100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0x76, /* 01110110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 130 0x82 '‚' */ |
0x00, /* 00000000 */ |
0x0c, /* 00001100 */ |
0x18, /* 00011000 */ |
0x30, /* 00110000 */ |
0x00, /* 00000000 */ |
0x7c, /* 01111100 */ |
0xc6, /* 11000110 */ |
0xfe, /* 11111110 */ |
0xc0, /* 11000000 */ |
0xc0, /* 11000000 */ |
0xc6, /* 11000110 */ |
0x7c, /* 01111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 131 0x83 'ƒ' */ |
0x00, /* 00000000 */ |
0x10, /* 00010000 */ |
0x38, /* 00111000 */ |
0x6c, /* 01101100 */ |
0x00, /* 00000000 */ |
0x78, /* 01111000 */ |
0x0c, /* 00001100 */ |
0x7c, /* 01111100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0x76, /* 01110110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 132 0x84 '„' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xcc, /* 11001100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x78, /* 01111000 */ |
0x0c, /* 00001100 */ |
0x7c, /* 01111100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0x76, /* 01110110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 133 0x85 '…' */ |
0x00, /* 00000000 */ |
0x60, /* 01100000 */ |
0x30, /* 00110000 */ |
0x18, /* 00011000 */ |
0x00, /* 00000000 */ |
0x78, /* 01111000 */ |
0x0c, /* 00001100 */ |
0x7c, /* 01111100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0x76, /* 01110110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 134 0x86 '†' */ |
0x00, /* 00000000 */ |
0x38, /* 00111000 */ |
0x6c, /* 01101100 */ |
0x38, /* 00111000 */ |
0x00, /* 00000000 */ |
0x78, /* 01111000 */ |
0x0c, /* 00001100 */ |
0x7c, /* 01111100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0x76, /* 01110110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 135 0x87 '‡' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x7c, /* 01111100 */ |
0xc6, /* 11000110 */ |
0xc0, /* 11000000 */ |
0xc0, /* 11000000 */ |
0xc0, /* 11000000 */ |
0xc6, /* 11000110 */ |
0x7c, /* 01111100 */ |
0x18, /* 00011000 */ |
0x70, /* 01110000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 136 0x88 'ˆ' */ |
0x00, /* 00000000 */ |
0x10, /* 00010000 */ |
0x38, /* 00111000 */ |
0x6c, /* 01101100 */ |
0x00, /* 00000000 */ |
0x7c, /* 01111100 */ |
0xc6, /* 11000110 */ |
0xfe, /* 11111110 */ |
0xc0, /* 11000000 */ |
0xc0, /* 11000000 */ |
0xc6, /* 11000110 */ |
0x7c, /* 01111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 137 0x89 '‰' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xc6, /* 11000110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x7c, /* 01111100 */ |
0xc6, /* 11000110 */ |
0xfe, /* 11111110 */ |
0xc0, /* 11000000 */ |
0xc0, /* 11000000 */ |
0xc6, /* 11000110 */ |
0x7c, /* 01111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 138 0x8a 'Š' */ |
0x00, /* 00000000 */ |
0x60, /* 01100000 */ |
0x30, /* 00110000 */ |
0x18, /* 00011000 */ |
0x00, /* 00000000 */ |
0x7c, /* 01111100 */ |
0xc6, /* 11000110 */ |
0xfe, /* 11111110 */ |
0xc0, /* 11000000 */ |
0xc0, /* 11000000 */ |
0xc6, /* 11000110 */ |
0x7c, /* 01111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 139 0x8b '‹' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x66, /* 01100110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x38, /* 00111000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x3c, /* 00111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 140 0x8c 'Œ' */ |
0x00, /* 00000000 */ |
0x18, /* 00011000 */ |
0x3c, /* 00111100 */ |
0x66, /* 01100110 */ |
0x00, /* 00000000 */ |
0x38, /* 00111000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x3c, /* 00111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 141 0x8d '' */ |
0x00, /* 00000000 */ |
0x60, /* 01100000 */ |
0x30, /* 00110000 */ |
0x18, /* 00011000 */ |
0x00, /* 00000000 */ |
0x38, /* 00111000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x3c, /* 00111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 142 0x8e 'Ž' */ |
0x00, /* 00000000 */ |
0xc6, /* 11000110 */ |
0x00, /* 00000000 */ |
0x10, /* 00010000 */ |
0x38, /* 00111000 */ |
0x6c, /* 01101100 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xfe, /* 11111110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 143 0x8f '' */ |
0x38, /* 00111000 */ |
0x6c, /* 01101100 */ |
0x38, /* 00111000 */ |
0x10, /* 00010000 */ |
0x38, /* 00111000 */ |
0x6c, /* 01101100 */ |
0xc6, /* 11000110 */ |
0xfe, /* 11111110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 144 0x90 '' */ |
0x0c, /* 00001100 */ |
0x18, /* 00011000 */ |
0x00, /* 00000000 */ |
0xfe, /* 11111110 */ |
0x66, /* 01100110 */ |
0x62, /* 01100010 */ |
0x68, /* 01101000 */ |
0x78, /* 01111000 */ |
0x68, /* 01101000 */ |
0x62, /* 01100010 */ |
0x66, /* 01100110 */ |
0xfe, /* 11111110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 145 0x91 '‘' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xec, /* 11101100 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x7e, /* 01111110 */ |
0xd8, /* 11011000 */ |
0xd8, /* 11011000 */ |
0x6e, /* 01101110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 146 0x92 '’' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x3e, /* 00111110 */ |
0x6c, /* 01101100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xfe, /* 11111110 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xce, /* 11001110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 147 0x93 '“' */ |
0x00, /* 00000000 */ |
0x10, /* 00010000 */ |
0x38, /* 00111000 */ |
0x6c, /* 01101100 */ |
0x00, /* 00000000 */ |
0x7c, /* 01111100 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0x7c, /* 01111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 148 0x94 '”' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xc6, /* 11000110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x7c, /* 01111100 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0x7c, /* 01111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 149 0x95 '•' */ |
0x00, /* 00000000 */ |
0x60, /* 01100000 */ |
0x30, /* 00110000 */ |
0x18, /* 00011000 */ |
0x00, /* 00000000 */ |
0x7c, /* 01111100 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0x7c, /* 01111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 150 0x96 '–' */ |
0x00, /* 00000000 */ |
0x30, /* 00110000 */ |
0x78, /* 01111000 */ |
0xcc, /* 11001100 */ |
0x00, /* 00000000 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0x76, /* 01110110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 151 0x97 '—' */ |
0x00, /* 00000000 */ |
0x60, /* 01100000 */ |
0x30, /* 00110000 */ |
0x18, /* 00011000 */ |
0x00, /* 00000000 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0x76, /* 01110110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 152 0x98 '˜' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xc6, /* 11000110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0x7e, /* 01111110 */ |
0x06, /* 00000110 */ |
0x0c, /* 00001100 */ |
0x78, /* 01111000 */ |
0x00, /* 00000000 */ |
/* 153 0x99 '™' */ |
0x00, /* 00000000 */ |
0xc6, /* 11000110 */ |
0x00, /* 00000000 */ |
0x7c, /* 01111100 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0x7c, /* 01111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 154 0x9a 'š' */ |
0x00, /* 00000000 */ |
0xc6, /* 11000110 */ |
0x00, /* 00000000 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0x7c, /* 01111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 155 0x9b '›' */ |
0x00, /* 00000000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x7c, /* 01111100 */ |
0xc6, /* 11000110 */ |
0xc0, /* 11000000 */ |
0xc0, /* 11000000 */ |
0xc0, /* 11000000 */ |
0xc6, /* 11000110 */ |
0x7c, /* 01111100 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 156 0x9c 'œ' */ |
0x00, /* 00000000 */ |
0x38, /* 00111000 */ |
0x6c, /* 01101100 */ |
0x64, /* 01100100 */ |
0x60, /* 01100000 */ |
0xf0, /* 11110000 */ |
0x60, /* 01100000 */ |
0x60, /* 01100000 */ |
0x60, /* 01100000 */ |
0x60, /* 01100000 */ |
0xe6, /* 11100110 */ |
0xfc, /* 11111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 157 0x9d '' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x3c, /* 00111100 */ |
0x18, /* 00011000 */ |
0x7e, /* 01111110 */ |
0x18, /* 00011000 */ |
0x7e, /* 01111110 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 158 0x9e 'ž' */ |
0x00, /* 00000000 */ |
0xf8, /* 11111000 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xf8, /* 11111000 */ |
0xc4, /* 11000100 */ |
0xcc, /* 11001100 */ |
0xde, /* 11011110 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xc6, /* 11000110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 159 0x9f 'Ÿ' */ |
0x00, /* 00000000 */ |
0x0e, /* 00001110 */ |
0x1b, /* 00011011 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x7e, /* 01111110 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0xd8, /* 11011000 */ |
0x70, /* 01110000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 160 0xa0 ' ' */ |
0x00, /* 00000000 */ |
0x18, /* 00011000 */ |
0x30, /* 00110000 */ |
0x60, /* 01100000 */ |
0x00, /* 00000000 */ |
0x78, /* 01111000 */ |
0x0c, /* 00001100 */ |
0x7c, /* 01111100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0x76, /* 01110110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 161 0xa1 '¡' */ |
0x00, /* 00000000 */ |
0x0c, /* 00001100 */ |
0x18, /* 00011000 */ |
0x30, /* 00110000 */ |
0x00, /* 00000000 */ |
0x38, /* 00111000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x3c, /* 00111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 162 0xa2 '¢' */ |
0x00, /* 00000000 */ |
0x18, /* 00011000 */ |
0x30, /* 00110000 */ |
0x60, /* 01100000 */ |
0x00, /* 00000000 */ |
0x7c, /* 01111100 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0x7c, /* 01111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 163 0xa3 '£' */ |
0x00, /* 00000000 */ |
0x18, /* 00011000 */ |
0x30, /* 00110000 */ |
0x60, /* 01100000 */ |
0x00, /* 00000000 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0x76, /* 01110110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 164 0xa4 '¤' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x76, /* 01110110 */ |
0xdc, /* 11011100 */ |
0x00, /* 00000000 */ |
0xdc, /* 11011100 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 165 0xa5 '¥' */ |
0x76, /* 01110110 */ |
0xdc, /* 11011100 */ |
0x00, /* 00000000 */ |
0xc6, /* 11000110 */ |
0xe6, /* 11100110 */ |
0xf6, /* 11110110 */ |
0xfe, /* 11111110 */ |
0xde, /* 11011110 */ |
0xce, /* 11001110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 166 0xa6 '¦' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x3c, /* 00111100 */ |
0x6c, /* 01101100 */ |
0x6c, /* 01101100 */ |
0x3e, /* 00111110 */ |
0x00, /* 00000000 */ |
0x7e, /* 01111110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 167 0xa7 '§' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x38, /* 00111000 */ |
0x6c, /* 01101100 */ |
0x6c, /* 01101100 */ |
0x38, /* 00111000 */ |
0x00, /* 00000000 */ |
0x7c, /* 01111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 168 0xa8 '¨' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x30, /* 00110000 */ |
0x30, /* 00110000 */ |
0x00, /* 00000000 */ |
0x30, /* 00110000 */ |
0x30, /* 00110000 */ |
0x60, /* 01100000 */ |
0xc0, /* 11000000 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0x7c, /* 01111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 169 0xa9 '©' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xfe, /* 11111110 */ |
0xc0, /* 11000000 */ |
0xc0, /* 11000000 */ |
0xc0, /* 11000000 */ |
0xc0, /* 11000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 170 0xaa 'ª' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xfe, /* 11111110 */ |
0x06, /* 00000110 */ |
0x06, /* 00000110 */ |
0x06, /* 00000110 */ |
0x06, /* 00000110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 171 0xab '«' */ |
0x00, /* 00000000 */ |
0x60, /* 01100000 */ |
0xe0, /* 11100000 */ |
0x62, /* 01100010 */ |
0x66, /* 01100110 */ |
0x6c, /* 01101100 */ |
0x18, /* 00011000 */ |
0x30, /* 00110000 */ |
0x60, /* 01100000 */ |
0xdc, /* 11011100 */ |
0x86, /* 10000110 */ |
0x0c, /* 00001100 */ |
0x18, /* 00011000 */ |
0x3e, /* 00111110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 172 0xac '¬' */ |
0x00, /* 00000000 */ |
0x60, /* 01100000 */ |
0xe0, /* 11100000 */ |
0x62, /* 01100010 */ |
0x66, /* 01100110 */ |
0x6c, /* 01101100 */ |
0x18, /* 00011000 */ |
0x30, /* 00110000 */ |
0x66, /* 01100110 */ |
0xce, /* 11001110 */ |
0x9a, /* 10011010 */ |
0x3f, /* 00111111 */ |
0x06, /* 00000110 */ |
0x06, /* 00000110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 173 0xad '' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x00, /* 00000000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x3c, /* 00111100 */ |
0x3c, /* 00111100 */ |
0x3c, /* 00111100 */ |
0x18, /* 00011000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 174 0xae '®' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x36, /* 00110110 */ |
0x6c, /* 01101100 */ |
0xd8, /* 11011000 */ |
0x6c, /* 01101100 */ |
0x36, /* 00110110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 175 0xaf '¯' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xd8, /* 11011000 */ |
0x6c, /* 01101100 */ |
0x36, /* 00110110 */ |
0x6c, /* 01101100 */ |
0xd8, /* 11011000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 176 0xb0 '°' */ |
0x11, /* 00010001 */ |
0x44, /* 01000100 */ |
0x11, /* 00010001 */ |
0x44, /* 01000100 */ |
0x11, /* 00010001 */ |
0x44, /* 01000100 */ |
0x11, /* 00010001 */ |
0x44, /* 01000100 */ |
0x11, /* 00010001 */ |
0x44, /* 01000100 */ |
0x11, /* 00010001 */ |
0x44, /* 01000100 */ |
0x11, /* 00010001 */ |
0x44, /* 01000100 */ |
0x11, /* 00010001 */ |
0x44, /* 01000100 */ |
/* 177 0xb1 '±' */ |
0x55, /* 01010101 */ |
0xaa, /* 10101010 */ |
0x55, /* 01010101 */ |
0xaa, /* 10101010 */ |
0x55, /* 01010101 */ |
0xaa, /* 10101010 */ |
0x55, /* 01010101 */ |
0xaa, /* 10101010 */ |
0x55, /* 01010101 */ |
0xaa, /* 10101010 */ |
0x55, /* 01010101 */ |
0xaa, /* 10101010 */ |
0x55, /* 01010101 */ |
0xaa, /* 10101010 */ |
0x55, /* 01010101 */ |
0xaa, /* 10101010 */ |
/* 178 0xb2 '²' */ |
0xdd, /* 11011101 */ |
0x77, /* 01110111 */ |
0xdd, /* 11011101 */ |
0x77, /* 01110111 */ |
0xdd, /* 11011101 */ |
0x77, /* 01110111 */ |
0xdd, /* 11011101 */ |
0x77, /* 01110111 */ |
0xdd, /* 11011101 */ |
0x77, /* 01110111 */ |
0xdd, /* 11011101 */ |
0x77, /* 01110111 */ |
0xdd, /* 11011101 */ |
0x77, /* 01110111 */ |
0xdd, /* 11011101 */ |
0x77, /* 01110111 */ |
/* 179 0xb3 '³' */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
/* 180 0xb4 '´' */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0xf8, /* 11111000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
/* 181 0xb5 'µ' */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0xf8, /* 11111000 */ |
0x18, /* 00011000 */ |
0xf8, /* 11111000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
/* 182 0xb6 '¶' */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0xf6, /* 11110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
/* 183 0xb7 '·' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xfe, /* 11111110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
/* 184 0xb8 '¸' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xf8, /* 11111000 */ |
0x18, /* 00011000 */ |
0xf8, /* 11111000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
/* 185 0xb9 '¹' */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0xf6, /* 11110110 */ |
0x06, /* 00000110 */ |
0xf6, /* 11110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
/* 186 0xba 'º' */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
/* 187 0xbb '»' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xfe, /* 11111110 */ |
0x06, /* 00000110 */ |
0xf6, /* 11110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
/* 188 0xbc '¼' */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0xf6, /* 11110110 */ |
0x06, /* 00000110 */ |
0xfe, /* 11111110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 189 0xbd '½' */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0xfe, /* 11111110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 190 0xbe '¾' */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0xf8, /* 11111000 */ |
0x18, /* 00011000 */ |
0xf8, /* 11111000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 191 0xbf '¿' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xf8, /* 11111000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
/* 192 0xc0 'À' */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x1f, /* 00011111 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 193 0xc1 'Á' */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0xff, /* 11111111 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 194 0xc2 'Â' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xff, /* 11111111 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
/* 195 0xc3 'Ã' */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x1f, /* 00011111 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
/* 196 0xc4 'Ä' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xff, /* 11111111 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 197 0xc5 'Å' */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0xff, /* 11111111 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
/* 198 0xc6 'Æ' */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x1f, /* 00011111 */ |
0x18, /* 00011000 */ |
0x1f, /* 00011111 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
/* 199 0xc7 'Ç' */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x37, /* 00110111 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
/* 200 0xc8 'È' */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x37, /* 00110111 */ |
0x30, /* 00110000 */ |
0x3f, /* 00111111 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 201 0xc9 'É' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x3f, /* 00111111 */ |
0x30, /* 00110000 */ |
0x37, /* 00110111 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
/* 202 0xca 'Ê' */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0xf7, /* 11110111 */ |
0x00, /* 00000000 */ |
0xff, /* 11111111 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 203 0xcb 'Ë' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xff, /* 11111111 */ |
0x00, /* 00000000 */ |
0xf7, /* 11110111 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
/* 204 0xcc 'Ì' */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x37, /* 00110111 */ |
0x30, /* 00110000 */ |
0x37, /* 00110111 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
/* 205 0xcd 'Í' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xff, /* 11111111 */ |
0x00, /* 00000000 */ |
0xff, /* 11111111 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 206 0xce 'Î' */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0xf7, /* 11110111 */ |
0x00, /* 00000000 */ |
0xf7, /* 11110111 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
/* 207 0xcf 'Ï' */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0xff, /* 11111111 */ |
0x00, /* 00000000 */ |
0xff, /* 11111111 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 208 0xd0 'Ð' */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0xff, /* 11111111 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 209 0xd1 'Ñ' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xff, /* 11111111 */ |
0x00, /* 00000000 */ |
0xff, /* 11111111 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
/* 210 0xd2 'Ò' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xff, /* 11111111 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
/* 211 0xd3 'Ó' */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x3f, /* 00111111 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 212 0xd4 'Ô' */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x1f, /* 00011111 */ |
0x18, /* 00011000 */ |
0x1f, /* 00011111 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 213 0xd5 'Õ' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x1f, /* 00011111 */ |
0x18, /* 00011000 */ |
0x1f, /* 00011111 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
/* 214 0xd6 'Ö' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x3f, /* 00111111 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
/* 215 0xd7 '×' */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0xff, /* 11111111 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
/* 216 0xd8 'Ø' */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0xff, /* 11111111 */ |
0x18, /* 00011000 */ |
0xff, /* 11111111 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
/* 217 0xd9 'Ù' */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0xf8, /* 11111000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 218 0xda 'Ú' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x1f, /* 00011111 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
/* 219 0xdb 'Û' */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
/* 220 0xdc 'Ü' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
/* 221 0xdd 'Ý' */ |
0xf0, /* 11110000 */ |
0xf0, /* 11110000 */ |
0xf0, /* 11110000 */ |
0xf0, /* 11110000 */ |
0xf0, /* 11110000 */ |
0xf0, /* 11110000 */ |
0xf0, /* 11110000 */ |
0xf0, /* 11110000 */ |
0xf0, /* 11110000 */ |
0xf0, /* 11110000 */ |
0xf0, /* 11110000 */ |
0xf0, /* 11110000 */ |
0xf0, /* 11110000 */ |
0xf0, /* 11110000 */ |
0xf0, /* 11110000 */ |
0xf0, /* 11110000 */ |
/* 222 0xde 'Þ' */ |
0x0f, /* 00001111 */ |
0x0f, /* 00001111 */ |
0x0f, /* 00001111 */ |
0x0f, /* 00001111 */ |
0x0f, /* 00001111 */ |
0x0f, /* 00001111 */ |
0x0f, /* 00001111 */ |
0x0f, /* 00001111 */ |
0x0f, /* 00001111 */ |
0x0f, /* 00001111 */ |
0x0f, /* 00001111 */ |
0x0f, /* 00001111 */ |
0x0f, /* 00001111 */ |
0x0f, /* 00001111 */ |
0x0f, /* 00001111 */ |
0x0f, /* 00001111 */ |
/* 223 0xdf 'ß' */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0xff, /* 11111111 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 224 0xe0 'à' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x76, /* 01110110 */ |
0xdc, /* 11011100 */ |
0xd8, /* 11011000 */ |
0xd8, /* 11011000 */ |
0xd8, /* 11011000 */ |
0xdc, /* 11011100 */ |
0x76, /* 01110110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 225 0xe1 'á' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x78, /* 01111000 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xcc, /* 11001100 */ |
0xd8, /* 11011000 */ |
0xcc, /* 11001100 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xcc, /* 11001100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 226 0xe2 'â' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xfe, /* 11111110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc0, /* 11000000 */ |
0xc0, /* 11000000 */ |
0xc0, /* 11000000 */ |
0xc0, /* 11000000 */ |
0xc0, /* 11000000 */ |
0xc0, /* 11000000 */ |
0xc0, /* 11000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 227 0xe3 'ã' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xfe, /* 11111110 */ |
0x6c, /* 01101100 */ |
0x6c, /* 01101100 */ |
0x6c, /* 01101100 */ |
0x6c, /* 01101100 */ |
0x6c, /* 01101100 */ |
0x6c, /* 01101100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 228 0xe4 'ä' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xfe, /* 11111110 */ |
0xc6, /* 11000110 */ |
0x60, /* 01100000 */ |
0x30, /* 00110000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x30, /* 00110000 */ |
0x60, /* 01100000 */ |
0xc6, /* 11000110 */ |
0xfe, /* 11111110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 229 0xe5 'å' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x7e, /* 01111110 */ |
0xd8, /* 11011000 */ |
0xd8, /* 11011000 */ |
0xd8, /* 11011000 */ |
0xd8, /* 11011000 */ |
0xd8, /* 11011000 */ |
0x70, /* 01110000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 230 0xe6 'æ' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x7c, /* 01111100 */ |
0x60, /* 01100000 */ |
0x60, /* 01100000 */ |
0xc0, /* 11000000 */ |
0x00, /* 00000000 */ |
/* 231 0xe7 'ç' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x76, /* 01110110 */ |
0xdc, /* 11011100 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 232 0xe8 'è' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x7e, /* 01111110 */ |
0x18, /* 00011000 */ |
0x3c, /* 00111100 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x3c, /* 00111100 */ |
0x18, /* 00011000 */ |
0x7e, /* 01111110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 233 0xe9 'é' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x38, /* 00111000 */ |
0x6c, /* 01101100 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xfe, /* 11111110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0x6c, /* 01101100 */ |
0x38, /* 00111000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 234 0xea 'ê' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x38, /* 00111000 */ |
0x6c, /* 01101100 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0x6c, /* 01101100 */ |
0x6c, /* 01101100 */ |
0x6c, /* 01101100 */ |
0x6c, /* 01101100 */ |
0xee, /* 11101110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 235 0xeb 'ë' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x1e, /* 00011110 */ |
0x30, /* 00110000 */ |
0x18, /* 00011000 */ |
0x0c, /* 00001100 */ |
0x3e, /* 00111110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x66, /* 01100110 */ |
0x3c, /* 00111100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 236 0xec 'ì' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x7e, /* 01111110 */ |
0xdb, /* 11011011 */ |
0xdb, /* 11011011 */ |
0xdb, /* 11011011 */ |
0x7e, /* 01111110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 237 0xed 'í' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x03, /* 00000011 */ |
0x06, /* 00000110 */ |
0x7e, /* 01111110 */ |
0xdb, /* 11011011 */ |
0xdb, /* 11011011 */ |
0xf3, /* 11110011 */ |
0x7e, /* 01111110 */ |
0x60, /* 01100000 */ |
0xc0, /* 11000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 238 0xee 'î' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x1c, /* 00011100 */ |
0x30, /* 00110000 */ |
0x60, /* 01100000 */ |
0x60, /* 01100000 */ |
0x7c, /* 01111100 */ |
0x60, /* 01100000 */ |
0x60, /* 01100000 */ |
0x60, /* 01100000 */ |
0x30, /* 00110000 */ |
0x1c, /* 00011100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 239 0xef 'ï' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x7c, /* 01111100 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0xc6, /* 11000110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 240 0xf0 'ð' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xfe, /* 11111110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xfe, /* 11111110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0xfe, /* 11111110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 241 0xf1 'ñ' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x7e, /* 01111110 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x7e, /* 01111110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 242 0xf2 'ò' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x30, /* 00110000 */ |
0x18, /* 00011000 */ |
0x0c, /* 00001100 */ |
0x06, /* 00000110 */ |
0x0c, /* 00001100 */ |
0x18, /* 00011000 */ |
0x30, /* 00110000 */ |
0x00, /* 00000000 */ |
0x7e, /* 01111110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 243 0xf3 'ó' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x0c, /* 00001100 */ |
0x18, /* 00011000 */ |
0x30, /* 00110000 */ |
0x60, /* 01100000 */ |
0x30, /* 00110000 */ |
0x18, /* 00011000 */ |
0x0c, /* 00001100 */ |
0x00, /* 00000000 */ |
0x7e, /* 01111110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 244 0xf4 'ô' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x0e, /* 00001110 */ |
0x1b, /* 00011011 */ |
0x1b, /* 00011011 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
/* 245 0xf5 'õ' */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0xd8, /* 11011000 */ |
0xd8, /* 11011000 */ |
0xd8, /* 11011000 */ |
0x70, /* 01110000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 246 0xf6 'ö' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x18, /* 00011000 */ |
0x00, /* 00000000 */ |
0x7e, /* 01111110 */ |
0x00, /* 00000000 */ |
0x18, /* 00011000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 247 0xf7 '÷' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x76, /* 01110110 */ |
0xdc, /* 11011100 */ |
0x00, /* 00000000 */ |
0x76, /* 01110110 */ |
0xdc, /* 11011100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 248 0xf8 'ø' */ |
0x00, /* 00000000 */ |
0x38, /* 00111000 */ |
0x6c, /* 01101100 */ |
0x6c, /* 01101100 */ |
0x38, /* 00111000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 249 0xf9 'ù' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x18, /* 00011000 */ |
0x18, /* 00011000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 250 0xfa 'ú' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x18, /* 00011000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 251 0xfb 'û' */ |
0x00, /* 00000000 */ |
0x0f, /* 00001111 */ |
0x0c, /* 00001100 */ |
0x0c, /* 00001100 */ |
0x0c, /* 00001100 */ |
0x0c, /* 00001100 */ |
0x0c, /* 00001100 */ |
0xec, /* 11101100 */ |
0x6c, /* 01101100 */ |
0x6c, /* 01101100 */ |
0x3c, /* 00111100 */ |
0x1c, /* 00011100 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 252 0xfc 'ü' */ |
0x00, /* 00000000 */ |
0x6c, /* 01101100 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x36, /* 00110110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 253 0xfd 'ý' */ |
0x00, /* 00000000 */ |
0x3c, /* 00111100 */ |
0x66, /* 01100110 */ |
0x0c, /* 00001100 */ |
0x18, /* 00011000 */ |
0x32, /* 00110010 */ |
0x7e, /* 01111110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 254 0xfe 'þ' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x7e, /* 01111110 */ |
0x7e, /* 01111110 */ |
0x7e, /* 01111110 */ |
0x7e, /* 01111110 */ |
0x7e, /* 01111110 */ |
0x7e, /* 01111110 */ |
0x7e, /* 01111110 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
/* 255 0xff 'ÿ' */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
0x00, /* 00000000 */ |
}; |