/branches/network/kernel/generic/include/byteorder.h |
---|
26,7 → 26,7 |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
/** @addtogroup generic |
/** @addtogroup generic |
* @{ |
*/ |
/** @file |
35,47 → 35,47 |
#ifndef KERN_BYTEORDER_H_ |
#define KERN_BYTEORDER_H_ |
#include <arch/byteorder.h> |
#include <arch/types.h> |
#if !(defined(ARCH_IS_BIG_ENDIAN) ^ defined(ARCH_IS_LITTLE_ENDIAN)) |
#error The architecture must be either big-endian or little-endian. |
#if !(defined(__BE__) ^ defined(__LE__)) |
#error The architecture must be either big-endian or little-endian. |
#endif |
#ifdef ARCH_IS_BIG_ENDIAN |
#ifdef __BE__ |
#define uint16_t_le2host(n) uint16_t_byteorder_swap(n) |
#define uint32_t_le2host(n) uint32_t_byteorder_swap(n) |
#define uint64_t_le2host(n) uint64_t_byteorder_swap(n) |
#define uint16_t_le2host(n) (uint16_t_byteorder_swap(n)) |
#define uint32_t_le2host(n) (uint32_t_byteorder_swap(n)) |
#define uint64_t_le2host(n) (uint64_t_byteorder_swap(n)) |
#define uint16_t_be2host(n) (n) |
#define uint32_t_be2host(n) (n) |
#define uint64_t_be2host(n) (n) |
#define uint16_t_be2host(n) (n) |
#define uint32_t_be2host(n) (n) |
#define uint64_t_be2host(n) (n) |
#define host2uint16_t_le(n) uint16_t_byteorder_swap(n) |
#define host2uint32_t_le(n) uint32_t_byteorder_swap(n) |
#define host2uint64_t_le(n) uint64_t_byteorder_swap(n) |
#define host2uint16_t_le(n) (uint16_t_byteorder_swap(n)) |
#define host2uint32_t_le(n) (uint32_t_byteorder_swap(n)) |
#define host2uint64_t_le(n) (uint64_t_byteorder_swap(n)) |
#define host2uint16_t_be(n) (n) |
#define host2uint32_t_be(n) (n) |
#define host2uint64_t_be(n) (n) |
#define host2uint16_t_be(n) (n) |
#define host2uint32_t_be(n) (n) |
#define host2uint64_t_be(n) (n) |
#else |
#define uint16_t_le2host(n) (n) |
#define uint32_t_le2host(n) (n) |
#define uint64_t_le2host(n) (n) |
#define uint16_t_le2host(n) (n) |
#define uint32_t_le2host(n) (n) |
#define uint64_t_le2host(n) (n) |
#define uint16_t_be2host(n) uint16_t_byteorder_swap(n) |
#define uint32_t_be2host(n) uint32_t_byteorder_swap(n) |
#define uint64_t_be2host(n) uint64_t_byteorder_swap(n) |
#define uint16_t_be2host(n) (uint16_t_byteorder_swap(n)) |
#define uint32_t_be2host(n) (uint32_t_byteorder_swap(n)) |
#define uint64_t_be2host(n) (uint64_t_byteorder_swap(n)) |
#define host2uint16_t_le(n) (n) |
#define host2uint32_t_le(n) (n) |
#define host2uint64_t_le(n) (n) |
#define host2uint16_t_le(n) (n) |
#define host2uint32_t_le(n) (n) |
#define host2uint64_t_le(n) (n) |
#define host2uint16_t_be(n) uint16_t_byteorder_swap(n) |
#define host2uint32_t_be(n) uint32_t_byteorder_swap(n) |
#define host2uint64_t_be(n) uint64_t_byteorder_swap(n) |
#define host2uint16_t_be(n) (uint16_t_byteorder_swap(n)) |
#define host2uint32_t_be(n) (uint32_t_byteorder_swap(n)) |
#define host2uint64_t_be(n) (uint64_t_byteorder_swap(n)) |
#endif |
/branches/network/kernel/generic/include/symtab.h |
---|
48,7 → 48,7 |
extern char *symtab_fmt_name_lookup(unative_t addr); |
extern int symtab_addr_lookup(const char *name, uintptr_t *addr); |
extern void symtab_print_search(const char *name); |
extern int symtab_compl(char *input, count_t size); |
extern int symtab_compl(char *input, size_t size); |
#ifdef CONFIG_SYMTAB |
/branches/network/kernel/generic/include/config.h |
---|
50,7 → 50,7 |
} init_task_t; |
typedef struct { |
count_t cnt; |
size_t cnt; |
init_task_t tasks[CONFIG_INIT_TASKS]; |
} init_t; |
65,8 → 65,8 |
} ballocs_t; |
typedef struct { |
count_t cpu_count; /**< Number of processors detected. */ |
volatile count_t cpu_active; /**< Number of processors that are up and running. */ |
size_t cpu_count; /**< Number of processors detected. */ |
volatile size_t cpu_active; /**< Number of processors that are up and running. */ |
uintptr_t base; |
size_t kernel_size; /**< Size of memory in bytes taken by kernel and stack */ |
/branches/network/kernel/generic/include/string.h |
---|
57,8 → 57,6 |
#define U_CURSOR 0x2588 |
#define U_BOM 0xfeff |
/**< No size limit constant */ |
#define STR_NO_LIMIT ((size_t) -1) |
71,20 → 69,20 |
extern size_t str_size(const char *str); |
extern size_t wstr_size(const wchar_t *str); |
extern size_t str_lsize(const char *str, count_t max_len); |
extern size_t wstr_lsize(const wchar_t *str, count_t max_len); |
extern size_t str_lsize(const char *str, size_t max_len); |
extern size_t wstr_lsize(const wchar_t *str, size_t max_len); |
extern count_t str_length(const char *str); |
extern count_t wstr_length(const wchar_t *wstr); |
extern size_t str_length(const char *str); |
extern size_t wstr_length(const wchar_t *wstr); |
extern count_t str_nlength(const char *str, size_t size); |
extern count_t wstr_nlength(const wchar_t *str, size_t size); |
extern size_t str_nlength(const char *str, size_t size); |
extern size_t wstr_nlength(const wchar_t *str, size_t size); |
extern bool ascii_check(wchar_t ch); |
extern bool chr_check(wchar_t ch); |
extern int str_cmp(const char *s1, const char *s2); |
extern int str_lcmp(const char *s1, const char *s2, count_t max_len); |
extern int str_lcmp(const char *s1, const char *s2, size_t max_len); |
extern void str_cpy(char *dest, size_t size, const char *src); |
extern void str_ncpy(char *dest, size_t size, const char *src, size_t n); |
92,8 → 90,8 |
extern const char *str_chr(const char *str, wchar_t ch); |
extern bool wstr_linsert(wchar_t *str, wchar_t ch, count_t pos, count_t max_pos); |
extern bool wstr_remove(wchar_t *str, count_t pos); |
extern bool wstr_linsert(wchar_t *str, wchar_t ch, size_t pos, size_t max_pos); |
extern bool wstr_remove(wchar_t *str, size_t pos); |
#endif |
/branches/network/kernel/generic/include/proc/scheduler.h |
---|
47,7 → 47,7 |
typedef struct { |
SPINLOCK_DECLARE(lock); |
link_t rq_head; /**< List of ready threads. */ |
count_t n; /**< Number of threads in rq_ready. */ |
size_t n; /**< Number of threads in rq_ready. */ |
} runq_t; |
extern atomic_t nrdy; |
/branches/network/kernel/generic/include/cpu.h |
---|
51,18 → 51,18 |
SPINLOCK_DECLARE(lock); |
tlb_shootdown_msg_t tlb_messages[TLB_MESSAGE_QUEUE_LEN]; |
count_t tlb_messages_count; |
size_t tlb_messages_count; |
context_t saved_context; |
atomic_t nrdy; |
runq_t rq[RQ_COUNT]; |
volatile count_t needs_relink; |
volatile size_t needs_relink; |
SPINLOCK_DECLARE(timeoutlock); |
link_t timeout_active_head; |
count_t missed_clock_ticks; /**< When system clock loses a tick, it is recorded here |
size_t missed_clock_ticks; /**< When system clock loses a tick, it is recorded here |
so that clock() can react. This variable is |
CPU-local and can be only accessed when interrupts |
are disabled. */ |
/branches/network/kernel/generic/include/synch/futex.h |
---|
49,7 → 49,7 |
/** Futex hash table link. */ |
link_t ht_link; |
/** Number of tasks that reference this futex. */ |
count_t refcount; |
size_t refcount; |
} futex_t; |
extern void futex_init(void); |
/branches/network/kernel/generic/include/synch/rwlock.h |
---|
53,7 → 53,7 |
*/ |
mutex_t exclusive; |
/** Number of readers in critical section. */ |
count_t readers_in; |
size_t readers_in; |
} rwlock_t; |
#define rwlock_write_lock(rwl) \ |
/branches/network/kernel/generic/include/synch/spinlock.h |
---|
107,7 → 107,7 |
extern int printf(const char *, ...); |
#define DEADLOCK_THRESHOLD 100000000 |
#define DEADLOCK_PROBE_INIT(pname) count_t pname = 0 |
#define DEADLOCK_PROBE_INIT(pname) size_t pname = 0 |
#define DEADLOCK_PROBE(pname, value) \ |
if ((pname)++ > (value)) { \ |
(pname) = 0; \ |
/branches/network/kernel/generic/include/ddi/irq.h |
---|
104,7 → 104,7 |
/** Top-half pseudocode. */ |
irq_code_t *code; |
/** Counter. */ |
count_t counter; |
size_t counter; |
/** |
* Link between IRQs that are notifying the same answerbox. The list is |
* protected by the answerbox irq_lock. |
162,7 → 162,7 |
SPINLOCK_EXTERN(irq_uspace_hash_table_lock); |
extern hash_table_t irq_uspace_hash_table; |
extern void irq_init(count_t, count_t); |
extern void irq_init(size_t, size_t); |
extern void irq_initialize(irq_t *); |
extern void irq_register(irq_t *); |
extern irq_t *irq_dispatch_and_lock(inr_t); |
/branches/network/kernel/generic/include/console/chardev.h |
---|
57,11 → 57,11 |
/** Protects everything below. */ |
SPINLOCK_DECLARE(lock); |
wchar_t buffer[INDEV_BUFLEN]; |
count_t counter; |
size_t counter; |
/** Implementation of indev operations. */ |
indev_operations_t *op; |
index_t index; |
size_t index; |
void *data; |
} indev_t; |
/branches/network/kernel/generic/include/console/kconsole.h |
---|
77,7 → 77,7 |
/** Function implementing the command. */ |
int (* func)(cmd_arg_t *); |
/** Number of arguments. */ |
count_t argc; |
size_t argc; |
/** Argument vector. */ |
cmd_arg_t *argv; |
/** Function for printing detailed help. */ |
/branches/network/kernel/generic/include/console/console.h |
---|
49,7 → 49,7 |
extern void klog_update(void); |
extern wchar_t getc(indev_t *indev); |
extern count_t gets(indev_t *indev, char *buf, size_t buflen); |
extern size_t gets(indev_t *indev, char *buf, size_t buflen); |
extern unative_t sys_klog(int fd, const void *buf, size_t size); |
extern void grab_console(void); |
/branches/network/kernel/generic/include/arch.h |
---|
56,7 → 56,7 |
* the base address of the stack. |
*/ |
typedef struct { |
count_t preemption_disabled; /**< Preemption disabled counter. */ |
size_t preemption_disabled; /**< Preemption disabled counter. */ |
thread_t *thread; /**< Current thread. */ |
task_t *task; /**< Current task. */ |
cpu_t *cpu; /**< Executing cpu. */ |
/branches/network/kernel/generic/include/adt/hash_table.h |
---|
47,7 → 47,7 |
* |
* @return Index into hash table. |
*/ |
index_t (* hash)(unative_t key[]); |
size_t (* hash)(unative_t key[]); |
/** Hash table item comparison function. |
* |
56,7 → 56,7 |
* |
* @return true if the keys match, false otherwise. |
*/ |
bool (*compare)(unative_t key[], count_t keys, link_t *item); |
bool (*compare)(unative_t key[], size_t keys, link_t *item); |
/** Hash table item removal callback. |
* |
68,8 → 68,8 |
/** Hash table structure. */ |
typedef struct { |
link_t *entry; |
count_t entries; |
count_t max_keys; |
size_t entries; |
size_t max_keys; |
hash_table_operations_t *op; |
} hash_table_t; |
76,11 → 76,11 |
#define hash_table_get_instance(item, type, member) \ |
list_get_instance((item), type, member) |
extern void hash_table_create(hash_table_t *h, count_t m, count_t max_keys, |
extern void hash_table_create(hash_table_t *h, size_t m, size_t max_keys, |
hash_table_operations_t *op); |
extern void hash_table_insert(hash_table_t *h, unative_t key[], link_t *item); |
extern link_t *hash_table_find(hash_table_t *h, unative_t key[]); |
extern void hash_table_remove(hash_table_t *h, unative_t key[], count_t keys); |
extern void hash_table_remove(hash_table_t *h, unative_t key[], size_t keys); |
#endif |
/branches/network/kernel/generic/include/adt/bitmap.h |
---|
41,18 → 41,19 |
typedef struct { |
uint8_t *map; |
count_t bits; |
size_t bits; |
} bitmap_t; |
extern void bitmap_initialize(bitmap_t *bitmap, uint8_t *map, count_t bits); |
extern void bitmap_set_range(bitmap_t *bitmap, index_t start, count_t bits); |
extern void bitmap_clear_range(bitmap_t *bitmap, index_t start, count_t bits); |
extern void bitmap_copy(bitmap_t *dst, bitmap_t *src, count_t bits); |
extern void bitmap_initialize(bitmap_t *bitmap, uint8_t *map, size_t bits); |
extern void bitmap_set_range(bitmap_t *bitmap, size_t start, size_t bits); |
extern void bitmap_clear_range(bitmap_t *bitmap, size_t start, size_t bits); |
extern void bitmap_copy(bitmap_t *dst, bitmap_t *src, size_t bits); |
static inline int bitmap_get(bitmap_t *bitmap,index_t bit) |
static inline int bitmap_get(bitmap_t *bitmap, size_t bit) |
{ |
if(bit >= bitmap->bits) |
return 0; |
return !! ((bitmap->map)[bit/8] & (1 << (bit & 7))); |
} |
/branches/network/kernel/generic/include/adt/btree.h |
---|
46,7 → 46,7 |
/** B-tree node structure. */ |
typedef struct btree_node { |
/** Number of keys. */ |
count_t keys; |
size_t keys; |
/** |
* Keys. We currently support only single keys. Additional room for one |
/branches/network/kernel/generic/include/adt/fifo.h |
---|
59,9 → 59,9 |
#define FIFO_INITIALIZE_STATIC(name, t, itms) \ |
struct { \ |
t fifo[(itms)]; \ |
count_t items; \ |
index_t head; \ |
index_t tail; \ |
size_t items; \ |
size_t head; \ |
size_t tail; \ |
} name = { \ |
.items = (itms), \ |
.head = 0, \ |
80,9 → 80,9 |
#define FIFO_INITIALIZE_DYNAMIC(name, t, itms) \ |
struct { \ |
t *fifo; \ |
count_t items; \ |
index_t head; \ |
index_t tail; \ |
size_t items; \ |
size_t head; \ |
size_t tail; \ |
} name = { \ |
.fifo = NULL, \ |
.items = (itms), \ |
/branches/network/kernel/generic/include/mm/frame.h |
---|
80,7 → 80,7 |
#define FRAME_TO_ZONE_FLAGS(frame_flags) 0 |
typedef struct { |
count_t refcount; /**< Tracking of shared frames */ |
size_t refcount; /**< Tracking of shared frames */ |
uint8_t buddy_order; /**< Buddy system block order */ |
link_t buddy_link; /**< Link to the next free block inside |
one order */ |
90,10 → 90,10 |
typedef struct { |
pfn_t base; /**< Frame_no of the first frame |
in the frames array */ |
count_t count; /**< Size of zone */ |
count_t free_count; /**< Number of free frame_t |
size_t count; /**< Size of zone */ |
size_t free_count; /**< Number of free frame_t |
structures */ |
count_t busy_count; /**< Number of busy frame_t |
size_t busy_count; /**< Number of busy frame_t |
structures */ |
zone_flags_t flags; /**< Type of the zone */ |
108,7 → 108,7 |
*/ |
typedef struct { |
SPINLOCK_DECLARE(lock); |
count_t count; |
size_t count; |
zone_t info[ZONES_MAX]; |
} zones_t; |
124,14 → 124,14 |
return (pfn_t) (addr >> FRAME_WIDTH); |
} |
static inline count_t SIZE2FRAMES(size_t size) |
static inline size_t SIZE2FRAMES(size_t size) |
{ |
if (!size) |
return 0; |
return (count_t) ((size - 1) >> FRAME_WIDTH) + 1; |
return (size_t) ((size - 1) >> FRAME_WIDTH) + 1; |
} |
static inline size_t FRAMES2SIZE(count_t frames) |
static inline size_t FRAMES2SIZE(size_t frames) |
{ |
return (size_t) (frames << FRAME_WIDTH); |
} |
156,17 → 156,17 |
frame_alloc_generic(order, flags, NULL) |
extern void frame_init(void); |
extern void *frame_alloc_generic(uint8_t, frame_flags_t, count_t *); |
extern void *frame_alloc_generic(uint8_t, frame_flags_t, size_t *); |
extern void frame_free(uintptr_t); |
extern void frame_reference_add(pfn_t); |
extern count_t find_zone(pfn_t frame, count_t count, count_t hint); |
extern count_t zone_create(pfn_t, count_t, pfn_t, zone_flags_t); |
extern void *frame_get_parent(pfn_t, count_t); |
extern void frame_set_parent(pfn_t, void *, count_t); |
extern void frame_mark_unavailable(pfn_t, count_t); |
extern uintptr_t zone_conf_size(count_t); |
extern bool zone_merge(count_t, count_t); |
extern size_t find_zone(pfn_t frame, size_t count, size_t hint); |
extern size_t zone_create(pfn_t, size_t, pfn_t, zone_flags_t); |
extern void *frame_get_parent(pfn_t, size_t); |
extern void frame_set_parent(pfn_t, void *, size_t); |
extern void frame_mark_unavailable(pfn_t, size_t); |
extern uintptr_t zone_conf_size(size_t); |
extern bool zone_merge(size_t, size_t); |
extern void zone_merge_all(void); |
extern uint64_t zone_total_size(void); |
174,7 → 174,7 |
* Console functions |
*/ |
extern void zone_print_list(void); |
extern void zone_print_one(count_t); |
extern void zone_print_one(size_t); |
#endif |
/branches/network/kernel/generic/include/mm/slab.h |
---|
72,8 → 72,8 |
typedef struct { |
link_t link; |
count_t busy; /**< Count of full slots in magazine */ |
count_t size; /**< Number of slots in magazine */ |
size_t busy; /**< Count of full slots in magazine */ |
size_t size; /**< Number of slots in magazine */ |
void *objs[]; /**< Slots in magazine */ |
} slab_magazine_t; |
128,7 → 128,7 |
extern void * slab_alloc(slab_cache_t *, int); |
extern void slab_free(slab_cache_t *, void *); |
extern count_t slab_reclaim(int); |
extern size_t slab_reclaim(int); |
/* slab subsytem initialization */ |
extern void slab_cache_init(void); |
/branches/network/kernel/generic/include/mm/tlb.h |
---|
61,7 → 61,7 |
tlb_invalidate_type_t type; /**< Message type. */ |
asid_t asid; /**< Address space identifier. */ |
uintptr_t page; /**< Page address. */ |
count_t count; /**< Number of pages to invalidate. */ |
size_t count; /**< Number of pages to invalidate. */ |
} tlb_shootdown_msg_t; |
extern void tlb_init(void); |
68,7 → 68,7 |
#ifdef CONFIG_SMP |
extern void tlb_shootdown_start(tlb_invalidate_type_t type, asid_t asid, |
uintptr_t page, count_t count); |
uintptr_t page, size_t count); |
extern void tlb_shootdown_finalize(void); |
extern void tlb_shootdown_ipi_recv(void); |
#else |
84,7 → 84,7 |
extern void tlb_invalidate_all(void); |
extern void tlb_invalidate_asid(asid_t asid); |
extern void tlb_invalidate_pages(asid_t asid, uintptr_t page, count_t cnt); |
extern void tlb_invalidate_pages(asid_t asid, uintptr_t page, size_t cnt); |
#endif |
/** @} |
/branches/network/kernel/generic/include/mm/as.h |
---|
94,7 → 94,7 |
* Number of processors on wich is this address space active. |
* Protected by asidlock. |
*/ |
count_t cpu_refcount; |
size_t cpu_refcount; |
/** |
* Address space identifier. |
* Constant on architectures that do not support ASIDs. |
132,7 → 132,7 |
/** This lock must be acquired only when the as_area lock is held. */ |
mutex_t lock; |
/** This structure can be deallocated if refcount drops to 0. */ |
count_t refcount; |
size_t refcount; |
/** |
* B+tree containing complete map of anonymous pages of the shared area. |
*/ |
156,7 → 156,7 |
}; |
struct { /**< phys_backend members */ |
uintptr_t base; |
count_t frames; |
size_t frames; |
}; |
} mem_backend_data_t; |
175,7 → 175,7 |
/** Attributes related to the address space area itself. */ |
int attributes; |
/** Size of this area in multiples of PAGE_SIZE. */ |
count_t pages; |
size_t pages; |
/** Base address of this area. */ |
uintptr_t base; |
/** Map of used space. */ |
225,8 → 225,8 |
extern int as_area_get_flags(as_area_t *area); |
extern bool as_area_check_access(as_area_t *area, pf_access_t access); |
extern size_t as_area_get_size(uintptr_t base); |
extern int used_space_insert(as_area_t *a, uintptr_t page, count_t count); |
extern int used_space_remove(as_area_t *a, uintptr_t page, count_t count); |
extern int used_space_insert(as_area_t *a, uintptr_t page, size_t count); |
extern int used_space_remove(as_area_t *a, uintptr_t page, size_t count); |
/* Interface to be implemented by architectures. */ |
/branches/network/kernel/generic/include/macros.h |
---|
83,6 → 83,13 |
#define STRING(arg) STRING_ARG(arg) |
#define STRING_ARG(arg) #arg |
#define LOWER32(arg) ((arg) & 0xffffffff) |
#define UPPER32(arg) (((arg) >> 32) & 0xffffffff) |
#define MERGE_LOUP32(lo, up) \ |
((((uint64_t) (lo)) & 0xffffffff) \ |
| ((((uint64_t) (up)) & 0xffffffff) << 32)) |
/** Pseudorandom generator |
* |
* A pretty standard linear congruential pseudorandom |
/branches/network/kernel/generic/include/ipc/ipc.h |
---|
111,6 → 111,25 |
/* System-specific methods - only through special syscalls |
* These methods have special behaviour |
*/ |
/** Clone connection. |
* |
* The calling task clones one of its phones for the callee. |
* |
* - ARG1 - The caller sets ARG1 to the phone of the cloned connection. |
* - The callee gets the new phone from ARG1. |
* - on answer, the callee acknowledges the new connection by sending EOK back |
* or the kernel closes it |
*/ |
#define IPC_M_CONNECTION_CLONE 1 |
/** Protocol for CONNECT - ME |
* |
* Through this call, the recipient learns about the new cloned connection. |
* |
* - ARG5 - the kernel sets ARG5 to contain the hash of the used phone |
* - on asnwer, the callee acknowledges the new connection by sending EOK back |
* or the kernel closes it |
*/ |
#define IPC_M_CONNECT_ME 2 |
/** Protocol for CONNECT - TO - ME |
* |
* Calling process asks the callee to create a callback connection, |
127,7 → 146,7 |
* - the allocated phoneid is passed to userspace |
* (on the receiving side) as ARG5 of the call. |
*/ |
#define IPC_M_CONNECT_TO_ME 1 |
#define IPC_M_CONNECT_TO_ME 3 |
/** Protocol for CONNECT - ME - TO |
* |
* Calling process asks the callee to create for him a new connection. |
145,11 → 164,11 |
* - recepient may forward message. |
* |
*/ |
#define IPC_M_CONNECT_ME_TO 2 |
#define IPC_M_CONNECT_ME_TO 4 |
/** This message is sent to answerbox when the phone |
* is hung up |
*/ |
#define IPC_M_PHONE_HUNGUP 3 |
#define IPC_M_PHONE_HUNGUP 5 |
/** Send as_area over IPC. |
* - ARG1 - source as_area base address |
159,7 → 178,7 |
* on answer, the recipient must set: |
* - ARG1 - dst as_area base adress |
*/ |
#define IPC_M_SHARE_OUT 4 |
#define IPC_M_SHARE_OUT 6 |
/** Receive as_area over IPC. |
* - ARG1 - destination as_area base address |
171,7 → 190,7 |
* - ARG1 - source as_area base address |
* - ARG2 - flags that will be used for sharing |
*/ |
#define IPC_M_SHARE_IN 5 |
#define IPC_M_SHARE_IN 7 |
/** Send data to another address space over IPC. |
* - ARG1 - source address space virtual address |
182,7 → 201,7 |
* - ARG1 - final destination address space virtual address |
* - ARG2 - final size of data to be copied |
*/ |
#define IPC_M_DATA_WRITE 6 |
#define IPC_M_DATA_WRITE 8 |
/** Receive data from another address space over IPC. |
* - ARG1 - destination virtual address in the source address space |
193,13 → 212,13 |
* - ARG1 - source virtual address in the destination address space |
* - ARG2 - final size of data to be copied |
*/ |
#define IPC_M_DATA_READ 7 |
#define IPC_M_DATA_READ 9 |
/** Debug the recipient. |
* - ARG1 - specifies the debug method (from udebug_method_t) |
* - other arguments are specific to the debug method |
*/ |
#define IPC_M_DEBUG_ALL 8 |
#define IPC_M_DEBUG_ALL 10 |
/* Well-known methods */ |
#define IPC_M_LAST_SYSTEM 511 |
/branches/network/kernel/generic/include/ipc/event.h |
---|
49,7 → 49,7 |
/** Method to be used for the notification. */ |
unative_t method; |
/** Counter. */ |
count_t counter; |
size_t counter; |
} event_t; |
extern void event_init(void); |
/branches/network/kernel/generic/include/ipc/ipcrsc.h |
---|
35,8 → 35,11 |
#ifndef KERN_IPCRSC_H_ |
#define KERN_IPCRSC_H_ |
#include <proc/task.h> |
#include <ipc/ipc.h> |
extern call_t * get_call(unative_t callid); |
extern int phone_alloc(void); |
extern int phone_alloc(task_t *t); |
extern void phone_connect(int phoneid, answerbox_t *box); |
extern void phone_dealloc(int phoneid); |
/branches/network/kernel/generic/include/ipc/event_types.h |
---|
38,9 → 38,15 |
typedef enum event_type { |
EVENT_KLOG = 0, |
EVENT_KCONSOLE, |
EVENT_WAIT, |
EVENT_END |
} event_type_t; |
typedef enum wait_type { |
TASK_CREATE = 0, |
TASK_DESTROY |
} wait_type_t; |
#endif |
/** @} |
/branches/network/kernel/generic/include/sort.h |
---|
40,8 → 40,8 |
/* |
* 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)); |
extern void bubblesort(void * data, size_t n, size_t e_size, int (* cmp) (void * a, void * b)); |
extern void qsort(void * data, size_t n, size_t e_size, int (* cmp) (void * a, void * b)); |
/* |
* default sorting comparators |
/branches/network/kernel/generic/src/main/kinit.c |
---|
127,7 → 127,7 |
} |
if (config.cpu_count > 1) { |
count_t i; |
size_t i; |
/* |
* For each CPU, create its load balancing thread. |
140,7 → 140,7 |
spinlock_unlock(&thread->lock); |
thread_ready(thread); |
} else |
printf("Unable to create kcpulb thread for cpu" PRIc "\n", i); |
printf("Unable to create kcpulb thread for cpu" PRIs "\n", i); |
} |
} |
#endif /* CONFIG_SMP */ |
168,12 → 168,12 |
/* |
* Create user tasks, load RAM disk images. |
*/ |
count_t i; |
size_t i; |
program_t programs[CONFIG_INIT_TASKS]; |
for (i = 0; i < init.cnt; i++) { |
if (init.tasks[i].addr % FRAME_SIZE) { |
printf("init[%" PRIc "].addr is not frame aligned\n", i); |
printf("init[%" PRIs "].addr is not frame aligned\n", i); |
continue; |
} |
213,7 → 213,7 |
int rd = init_rd((rd_header_t *) init.tasks[i].addr, init.tasks[i].size); |
if (rd != RE_OK) |
printf("Init binary %" PRIc " not used (error %d)\n", i, rd); |
printf("Init binary %" PRIs " not used (error %d)\n", i, rd); |
} |
} |
/branches/network/kernel/generic/src/main/main.c |
---|
153,7 → 153,7 |
config.stack_base = config.base + config.kernel_size; |
/* Avoid placing stack on top of init */ |
count_t i; |
size_t i; |
for (i = 0; i < init.cnt; i++) { |
if (PA_overlaps(config.stack_base, config.stack_size, |
init.tasks[i].addr, init.tasks[i].size)) |
233,7 → 233,7 |
/* Slab must be initialized after we know the number of processors. */ |
LOG_EXEC(slab_enable_cpucache()); |
printf("Detected %" PRIc " CPU(s), %" PRIu64" MiB free memory\n", |
printf("Detected %" PRIs " CPU(s), %" PRIu64" MiB free memory\n", |
config.cpu_count, SIZE2MB(zone_total_size())); |
LOG_EXEC(cpu_init()); |
247,13 → 247,13 |
LOG_EXEC(futex_init()); |
if (init.cnt > 0) { |
count_t i; |
size_t i; |
for (i = 0; i < init.cnt; i++) |
LOG("init[%" PRIc "].addr=%#" PRIp ", init[%" PRIc |
"].size=%#" PRIs "\n", i, init.tasks[i].addr, i, |
LOG("init[%" PRIs "].addr=%#" PRIp ", init[%" PRIs |
"].size=%#" PRIs, i, init.tasks[i].addr, i, |
init.tasks[i].size); |
} else |
printf("No init binaries found\n"); |
printf("No init binaries found.\n"); |
LOG_EXEC(ipc_init()); |
LOG_EXEC(event_init()); |
/branches/network/kernel/generic/src/synch/spinlock.c |
---|
75,7 → 75,7 |
#ifdef CONFIG_DEBUG_SPINLOCK |
void spinlock_lock_debug(spinlock_t *sl) |
{ |
count_t i = 0; |
size_t i = 0; |
bool deadlock_reported = false; |
preemption_disable(); |
/branches/network/kernel/generic/src/synch/waitq.c |
---|
415,7 → 415,7 |
void _waitq_wakeup_unsafe(waitq_t *wq, wakeup_mode_t mode) |
{ |
thread_t *t; |
count_t count = 0; |
size_t count = 0; |
loop: |
if (list_empty(&wq->head)) { |
/branches/network/kernel/generic/src/synch/futex.c |
---|
59,8 → 59,8 |
static void futex_initialize(futex_t *futex); |
static futex_t *futex_find(uintptr_t paddr); |
static index_t futex_ht_hash(unative_t *key); |
static bool futex_ht_compare(unative_t *key, count_t keys, link_t *item); |
static size_t futex_ht_hash(unative_t *key); |
static bool futex_ht_compare(unative_t *key, size_t keys, link_t *item); |
static void futex_ht_remove_callback(link_t *item); |
/** |
288,9 → 288,9 |
* |
* @return Index into futex hash table. |
*/ |
index_t futex_ht_hash(unative_t *key) |
size_t futex_ht_hash(unative_t *key) |
{ |
return *key & (FUTEX_HT_SIZE-1); |
return (*key & (FUTEX_HT_SIZE - 1)); |
} |
/** Compare futex hash table item with a key. |
300,7 → 300,7 |
* |
* @return True if the item matches the key. False otherwise. |
*/ |
bool futex_ht_compare(unative_t *key, count_t keys, link_t *item) |
bool futex_ht_compare(unative_t *key, size_t keys, link_t *item) |
{ |
futex_t *futex; |
/branches/network/kernel/generic/src/debug/symtab.c |
---|
55,7 → 55,7 |
int symtab_name_lookup(unative_t addr, char **name) |
{ |
#ifdef CONFIG_SYMTAB |
count_t i; |
size_t i; |
for (i = 1; symbol_table[i].address_le; i++) { |
if (addr < uint64_t_le2host(symbol_table[i].address_le)) |
112,11 → 112,11 |
* @return Pointer to the part of string that should be completed or NULL. |
* |
*/ |
static const char *symtab_search_one(const char *name, count_t *startpos) |
static const char *symtab_search_one(const char *name, size_t *startpos) |
{ |
count_t namelen = str_length(name); |
size_t namelen = str_length(name); |
count_t pos; |
size_t pos; |
for (pos = *startpos; symbol_table[pos].address_le; pos++) { |
const char *curname = symbol_table[pos].symbol_name; |
153,8 → 153,8 |
int symtab_addr_lookup(const char *name, uintptr_t *addr) |
{ |
#ifdef CONFIG_SYMTAB |
count_t found = 0; |
count_t pos = 0; |
size_t found = 0; |
size_t pos = 0; |
const char *hint; |
while ((hint = symtab_search_one(name, &pos))) { |
182,7 → 182,7 |
void symtab_print_search(const char *name) |
{ |
#ifdef CONFIG_SYMTAB |
count_t pos = 0; |
size_t pos = 0; |
while (symtab_search_one(name, &pos)) { |
uintptr_t addr = uint64_t_le2host(symbol_table[pos].address_le); |
char *realname = symbol_table[pos].symbol_name; |
203,7 → 203,7 |
* @return 0 - nothing found, 1 - success, >1 print duplicates |
* |
*/ |
int symtab_compl(char *input, count_t size) |
int symtab_compl(char *input, size_t size) |
{ |
#ifdef CONFIG_SYMTAB |
const char *name = input; |
216,8 → 216,8 |
if (str_length(name) == 0) |
return 0; |
count_t found = 0; |
count_t pos = 0; |
size_t found = 0; |
size_t pos = 0; |
const char *hint; |
char output[MAX_SYMBOL_NAME]; |
/branches/network/kernel/generic/src/time/clock.c |
---|
134,7 → 134,7 |
timeout_t *h; |
timeout_handler_t f; |
void *arg; |
count_t missed_clock_ticks = CPU->missed_clock_ticks; |
size_t missed_clock_ticks = CPU->missed_clock_ticks; |
unsigned int i; |
/* |
/branches/network/kernel/generic/src/ddi/ddi.c |
---|
97,7 → 97,7 |
* creating address space area. |
* |
*/ |
static int ddi_physmem_map(uintptr_t pf, uintptr_t vp, count_t pages, int flags) |
static int ddi_physmem_map(uintptr_t pf, uintptr_t vp, size_t pages, int flags) |
{ |
ASSERT(TASK); |
ASSERT((pf % FRAME_SIZE) == 0); |
118,9 → 118,9 |
/* Find the zone of the physical memory */ |
spinlock_lock(&zones.lock); |
count_t znum = find_zone(ADDR2PFN(pf), pages, 0); |
size_t znum = find_zone(ADDR2PFN(pf), pages, 0); |
if (znum == (count_t) -1) { |
if (znum == (size_t) -1) { |
/* Frames not found in any zones |
* -> assume it is hardware device and allow mapping |
*/ |
242,7 → 242,7 |
{ |
return (unative_t) ddi_physmem_map(ALIGN_DOWN((uintptr_t) phys_base, |
FRAME_SIZE), ALIGN_DOWN((uintptr_t) virt_base, PAGE_SIZE), |
(count_t) pages, (int) flags); |
(size_t) pages, (int) flags); |
} |
/** Wrapper for SYS_ENABLE_IOSPACE syscall. |
/branches/network/kernel/generic/src/ddi/irq.c |
---|
99,8 → 99,8 |
* Hash table operations for cases when we know that |
* there will be collisions between different keys. |
*/ |
static index_t irq_ht_hash(unative_t *key); |
static bool irq_ht_compare(unative_t *key, count_t keys, link_t *item); |
static size_t irq_ht_hash(unative_t *key); |
static bool irq_ht_compare(unative_t *key, size_t keys, link_t *item); |
static void irq_ht_remove(link_t *item); |
static hash_table_operations_t irq_ht_ops = { |
115,8 → 115,8 |
* However, there might be still collisions among |
* elements with single key (sharing of one IRQ). |
*/ |
static index_t irq_lin_hash(unative_t *key); |
static bool irq_lin_compare(unative_t *key, count_t keys, link_t *item); |
static size_t irq_lin_hash(unative_t *key); |
static bool irq_lin_compare(unative_t *key, size_t keys, link_t *item); |
static void irq_lin_remove(link_t *item); |
static hash_table_operations_t irq_lin_ops = { |
126,7 → 126,7 |
}; |
/** Number of buckets in either of the hash tables. */ |
static count_t buckets; |
static size_t buckets; |
/** Initialize IRQ subsystem. |
* |
133,7 → 133,7 |
* @param inrs Numbers of unique IRQ numbers or INRs. |
* @param chains Number of chains in the hash table. |
*/ |
void irq_init(count_t inrs, count_t chains) |
void irq_init(size_t inrs, size_t chains) |
{ |
buckets = chains; |
/* |
298,7 → 298,7 |
* |
* @return Index into the hash table. |
*/ |
index_t irq_ht_hash(unative_t key[]) |
size_t irq_ht_hash(unative_t key[]) |
{ |
inr_t inr = (inr_t) key[KEY_INR]; |
return inr % buckets; |
324,7 → 324,7 |
* |
* @return True on match or false otherwise. |
*/ |
bool irq_ht_compare(unative_t key[], count_t keys, link_t *item) |
bool irq_ht_compare(unative_t key[], size_t keys, link_t *item) |
{ |
irq_t *irq = hash_table_get_instance(item, irq_t, link); |
inr_t inr = (inr_t) key[KEY_INR]; |
371,7 → 371,7 |
* |
* @return Index into the hash table. |
*/ |
index_t irq_lin_hash(unative_t key[]) |
size_t irq_lin_hash(unative_t key[]) |
{ |
inr_t inr = (inr_t) key[KEY_INR]; |
return inr; |
397,7 → 397,7 |
* |
* @return True on match or false otherwise. |
*/ |
bool irq_lin_compare(unative_t key[], count_t keys, link_t *item) |
bool irq_lin_compare(unative_t key[], size_t keys, link_t *item) |
{ |
irq_t *irq = list_get_instance(item, irq_t, link); |
devno_t devno = (devno_t) key[KEY_DEVNO]; |
/branches/network/kernel/generic/src/console/console.c |
---|
61,7 → 61,7 |
/** Kernel log initialized */ |
static bool klog_inited = false; |
/** First kernel log characters */ |
static index_t klog_start = 0; |
static size_t klog_start = 0; |
/** Number of valid kernel log characters */ |
static size_t klog_len = 0; |
/** Number of stored (not printed) kernel log characters */ |
170,10 → 170,10 |
* @return Number of characters read. |
* |
*/ |
count_t gets(indev_t *indev, char *buf, size_t buflen) |
size_t gets(indev_t *indev, char *buf, size_t buflen) |
{ |
size_t offset = 0; |
count_t count = 0; |
size_t count = 0; |
buf[offset] = 0; |
wchar_t ch; |
226,7 → 226,7 |
if ((klog_stored > 0) && (stdout) && (stdout->op->write)) { |
/* Print charaters stored in kernel log */ |
index_t i; |
size_t i; |
for (i = klog_len - klog_stored; i < klog_len; i++) |
stdout->op->write(stdout, klog[(klog_start + i) % KLOG_LENGTH], silent); |
klog_stored = 0; |
/branches/network/kernel/generic/src/console/cmd.c |
---|
513,7 → 513,7 |
spinlock_lock(&cmd_lock); |
link_t *cur; |
count_t len = 0; |
size_t len = 0; |
for (cur = cmd_head.next; cur != &cmd_head; cur = cur->next) { |
cmd_info_t *hlp; |
hlp = list_get_instance(cur, cmd_info_t, link); |
651,7 → 651,7 |
* call the function. |
*/ |
count_t i; |
size_t i; |
for (i = 0; i < config.cpu_count; i++) { |
if (!cpus[i].active) |
continue; |
970,7 → 970,7 |
*/ |
int cmd_tests(cmd_arg_t *argv) |
{ |
count_t len = 0; |
size_t len = 0; |
test_t *test; |
for (test = tests; test->name != NULL; test++) { |
if (str_length(test->name) > len) |
/branches/network/kernel/generic/src/console/kconsole.c |
---|
86,7 → 86,7 |
LIST_INITIALIZE(cmd_head); /**< Command list. */ |
static wchar_t history[KCONSOLE_HISTORY][MAX_CMDLINE] = {}; |
static count_t history_pos = 0; |
static size_t history_pos = 0; |
/** Initialize kconsole data structures |
* |
159,9 → 159,9 |
} |
/** Print count times a character */ |
static void print_cc(wchar_t ch, count_t count) |
static void print_cc(wchar_t ch, size_t count) |
{ |
count_t i; |
size_t i; |
for (i = 0; i < count; i++) |
putchar(ch); |
} |
169,7 → 169,7 |
/** Try to find a command beginning with prefix */ |
static const char *cmdtab_search_one(const char *name, link_t **startpos) |
{ |
count_t namelen = str_length(name); |
size_t namelen = str_length(name); |
spinlock_lock(&cmd_lock); |
205,7 → 205,7 |
{ |
const char *name = input; |
count_t found = 0; |
size_t found = 0; |
link_t *pos = NULL; |
const char *hint; |
char output[MAX_CMDLINE]; |
240,7 → 240,7 |
{ |
printf("%s> ", prompt); |
count_t position = 0; |
size_t position = 0; |
wchar_t *current = history[history_pos]; |
current[0] = 0; |
280,7 → 280,7 |
/* Find the beginning of the word |
and copy it to tmp */ |
count_t beg; |
size_t beg; |
for (beg = position - 1; (beg > 0) && (!isspace(current[beg])); |
beg--); |
313,7 → 313,7 |
/* We have a hint */ |
size_t off = 0; |
count_t i = 0; |
size_t i = 0; |
while ((ch = str_decode(tmp, &off, STR_NO_LIMIT)) != 0) { |
if (!wstr_linsert(current, ch, position + i, MAX_CMDLINE)) |
break; |
542,7 → 542,7 |
if (str_lcmp(hlp->name, cmdline + start, |
max(str_length(hlp->name), |
str_nlength(cmdline + start, (count_t) (end - start) - 1))) == 0) { |
str_nlength(cmdline + start, (size_t) (end - start) - 1))) == 0) { |
cmd = hlp; |
break; |
} |
568,7 → 568,7 |
*/ |
bool error = false; |
count_t i; |
size_t i; |
for (i = 0; i < cmd->argc; i++) { |
start = end; |
if (!parse_argument(cmdline, size, &start, &end)) { |
659,7 → 659,7 |
while (true) { |
wchar_t *tmp = clever_readline((char *) prompt, stdin); |
count_t len = wstr_length(tmp); |
size_t len = wstr_length(tmp); |
if (!len) |
continue; |
/branches/network/kernel/generic/src/printf/vprintf.c |
---|
46,7 → 46,7 |
static int vprintf_str_write(const char *str, size_t size, void *data) |
{ |
size_t offset = 0; |
count_t chars = 0; |
size_t chars = 0; |
while (offset < size) { |
putchar(str_decode(str, &offset, size)); |
59,7 → 59,7 |
static int vprintf_wstr_write(const wchar_t *str, size_t size, void *data) |
{ |
size_t offset = 0; |
count_t chars = 0; |
size_t chars = 0; |
while (offset < size) { |
putchar(str[chars]); |
73,7 → 73,7 |
int puts(const char *str) |
{ |
size_t offset = 0; |
count_t chars = 0; |
size_t chars = 0; |
wchar_t uc; |
while ((uc = str_decode(str, &offset, STR_NO_LIMIT)) != 0) { |
/branches/network/kernel/generic/src/printf/vsnprintf.c |
---|
82,7 → 82,7 |
* with the trailing zero => print only a part |
* of string |
*/ |
index_t index = 0; |
size_t index = 0; |
while (index < size) { |
wchar_t uc = str_decode(str, &index, size); |
130,7 → 130,7 |
*/ |
static int vsnprintf_wstr_write(const wchar_t *str, size_t size, vsnprintf_data_t *data) |
{ |
index_t index = 0; |
size_t index = 0; |
while (index < (size / sizeof(wchar_t))) { |
size_t left = data->size - data->len; |
/branches/network/kernel/generic/src/printf/printf_core.c |
---|
174,7 → 174,7 |
*/ |
static int print_char(const char ch, int width, uint32_t flags, printf_spec_t *ps) |
{ |
count_t counter = 0; |
size_t counter = 0; |
if (!(flags & __PRINTF_FLAG_LEFTALIGNED)) { |
while (--width > 0) { |
/* |
212,7 → 212,7 |
*/ |
static int print_wchar(const wchar_t ch, int width, uint32_t flags, printf_spec_t *ps) |
{ |
count_t counter = 0; |
size_t counter = 0; |
if (!(flags & __PRINTF_FLAG_LEFTALIGNED)) { |
while (--width > 0) { |
/* |
255,12 → 255,12 |
return printf_putstr(nullstr, ps); |
/* Print leading spaces. */ |
count_t strw = str_length(str); |
size_t strw = str_length(str); |
if (precision == 0) |
precision = strw; |
/* Left padding */ |
count_t counter = 0; |
size_t counter = 0; |
width -= precision; |
if (!(flags & __PRINTF_FLAG_LEFTALIGNED)) { |
while (width-- > 0) { |
302,9 → 302,6 |
if (str == NULL) |
return printf_putstr(nullstr, ps); |
if (*str == U_BOM) |
str++; |
/* Print leading spaces. */ |
size_t strw = wstr_length(str); |
if (precision == 0) |
311,7 → 308,7 |
precision = strw; |
/* Left padding */ |
count_t counter = 0; |
size_t counter = 0; |
width -= precision; |
if (!(flags & __PRINTF_FLAG_LEFTALIGNED)) { |
while (width-- > 0) { |
433,7 → 430,7 |
} |
width -= precision + size - number_size; |
count_t counter = 0; |
size_t counter = 0; |
if (!(flags & __PRINTF_FLAG_LEFTALIGNED)) { |
while (width-- > 0) { |
596,7 → 593,7 |
size_t nxt = 0; /* Index of the next character from fmt */ |
size_t j = 0; /* Index to the first not printed nonformating character */ |
count_t counter = 0; /* Number of characters printed */ |
size_t counter = 0; /* Number of characters printed */ |
int retval; /* Return values from nested functions */ |
while (true) { |
/branches/network/kernel/generic/src/proc/scheduler.c |
---|
708,7 → 708,7 |
continue; |
spinlock_lock(&cpus[cpu].lock); |
printf("cpu%u: address=%p, nrdy=%ld, needs_relink=%" PRIc "\n", |
printf("cpu%u: address=%p, nrdy=%ld, needs_relink=%" PRIs "\n", |
cpus[cpu].id, &cpus[cpu], atomic_get(&cpus[cpu].nrdy), |
cpus[cpu].needs_relink); |
/branches/network/kernel/generic/src/proc/task.c |
---|
54,6 → 54,8 |
#include <func.h> |
#include <string.h> |
#include <syscall/copy.h> |
#include <macros.h> |
#include <ipc/event.h> |
/** Spinlock protecting the tasks_tree AVL tree. */ |
SPINLOCK_INITIALIZE(tasks_lock); |
196,7 → 198,14 |
avltree_insert(&tasks_tree, &ta->tasks_tree_node); |
spinlock_unlock(&tasks_lock); |
interrupts_restore(ipl); |
/* |
* Notify about task creation. |
*/ |
if (event_is_subscribed(EVENT_WAIT)) |
event_notify_3(EVENT_WAIT, TASK_CREATE, LOWER32(ta->taskid), |
UPPER32(ta->taskid)); |
return ta; |
} |
229,6 → 238,13 |
if (atomic_predec(&t->as->refcount) == 0) |
as_destroy(t->as); |
/* |
* Notify about task destruction. |
*/ |
if (event_is_subscribed(EVENT_WAIT)) |
event_notify_3(EVENT_WAIT, TASK_DESTROY, LOWER32(t->taskid), |
UPPER32(t->taskid)); |
free(t); |
TASK = NULL; |
} |
/branches/network/kernel/generic/src/proc/program.c |
---|
133,7 → 133,7 |
/* Register image as the program loader */ |
ASSERT(program_loader == NULL); |
program_loader = image_addr; |
printf("Registered program loader at 0x%" PRIp "\n", |
LOG("Registered program loader at 0x%" PRIp "\n", |
image_addr); |
return EOK; |
} |
/branches/network/kernel/generic/src/lib/string.c |
---|
62,10 → 62,10 |
* the NULL-terminator), size_t |
* |
* [wide] string length number of CHARACTERS in a [wide] string (excluding |
* the NULL-terminator), count_t |
* the NULL-terminator), size_t |
* |
* [wide] string width number of display cells on a monospace display taken |
* by a [wide] string, count_t |
* by a [wide] string, size_t |
* |
* |
* Overview of string metrics:@n |
75,10 → 75,10 |
* size n size_t number of BYTES in a string (excluding the |
* NULL-terminator) |
* |
* length l count_t number of CHARACTERS in a string (excluding the |
* length l size_t number of CHARACTERS in a string (excluding the |
* null terminator) |
* |
* width w count_t number of display cells on a monospace display |
* width w size_t number of display cells on a monospace display |
* taken by a string |
* |
* |
97,7 → 97,7 |
* |
* pointer (char *, wchar_t *) |
* byte offset (size_t) |
* character index (count_t) |
* character index (size_t) |
* |
*/ |
309,9 → 309,9 |
* @return Number of bytes used by the characters. |
* |
*/ |
size_t str_lsize(const char *str, count_t max_len) |
size_t str_lsize(const char *str, size_t max_len) |
{ |
count_t len = 0; |
size_t len = 0; |
size_t offset = 0; |
while (len < max_len) { |
337,7 → 337,7 |
* @return Number of bytes used by the wide characters. |
* |
*/ |
size_t wstr_lsize(const wchar_t *str, count_t max_len) |
size_t wstr_lsize(const wchar_t *str, size_t max_len) |
{ |
return (wstr_nlength(str, max_len * sizeof(wchar_t)) * sizeof(wchar_t)); |
} |
349,9 → 349,9 |
* @return Number of characters in string. |
* |
*/ |
count_t str_length(const char *str) |
size_t str_length(const char *str) |
{ |
count_t len = 0; |
size_t len = 0; |
size_t offset = 0; |
while (str_decode(str, &offset, STR_NO_LIMIT) != 0) |
367,9 → 367,9 |
* @return Number of characters in @a str. |
* |
*/ |
count_t wstr_length(const wchar_t *wstr) |
size_t wstr_length(const wchar_t *wstr) |
{ |
count_t len = 0; |
size_t len = 0; |
while (*wstr++ != 0) |
len++; |
385,9 → 385,9 |
* @return Number of characters in string. |
* |
*/ |
count_t str_nlength(const char *str, size_t size) |
size_t str_nlength(const char *str, size_t size) |
{ |
count_t len = 0; |
size_t len = 0; |
size_t offset = 0; |
while (str_decode(str, &offset, size) != 0) |
404,11 → 404,11 |
* @return Number of characters in string. |
* |
*/ |
count_t wstr_nlength(const wchar_t *str, size_t size) |
size_t wstr_nlength(const wchar_t *str, size_t size) |
{ |
count_t len = 0; |
count_t limit = ALIGN_DOWN(size, sizeof(wchar_t)); |
count_t offset = 0; |
size_t len = 0; |
size_t limit = ALIGN_DOWN(size, sizeof(wchar_t)); |
size_t offset = 0; |
while ((offset < limit) && (*str++ != 0)) { |
len++; |
496,7 → 496,7 |
* 1 if second smaller. |
* |
*/ |
int str_lcmp(const char *s1, const char *s2, count_t max_len) |
int str_lcmp(const char *s1, const char *s2, size_t max_len) |
{ |
wchar_t c1 = 0; |
wchar_t c2 = 0; |
504,7 → 504,7 |
size_t off1 = 0; |
size_t off2 = 0; |
count_t len = 0; |
size_t len = 0; |
while (true) { |
if (len >= max_len) |
615,7 → 615,7 |
return; |
wchar_t ch; |
count_t src_idx = 0; |
size_t src_idx = 0; |
size_t dst_off = 0; |
while ((ch = src[src_idx++]) != 0) { |
666,14 → 666,14 |
* is out of bounds. |
* |
*/ |
bool wstr_linsert(wchar_t *str, wchar_t ch, count_t pos, count_t max_pos) |
bool wstr_linsert(wchar_t *str, wchar_t ch, size_t pos, size_t max_pos) |
{ |
count_t len = wstr_length(str); |
size_t len = wstr_length(str); |
if ((pos > len) || (pos + 1 > max_pos)) |
return false; |
count_t i; |
size_t i; |
for (i = len; i + 1 > pos; i--) |
str[i + 1] = str[i]; |
694,14 → 694,14 |
* is out of bounds. |
* |
*/ |
bool wstr_remove(wchar_t *str, count_t pos) |
bool wstr_remove(wchar_t *str, size_t pos) |
{ |
count_t len = wstr_length(str); |
size_t len = wstr_length(str); |
if (pos >= len) |
return false; |
count_t i; |
size_t i; |
for (i = pos + 1; i <= len; i++) |
str[i - 1] = str[i]; |
/branches/network/kernel/generic/src/lib/sort.c |
---|
45,8 → 45,8 |
#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); |
void _qsort(void * data, size_t n, size_t e_size, int (* cmp) (void * a, void * b), void *tmp, void *pivot); |
void _bubblesort(void * data, size_t n, size_t e_size, int (* cmp) (void * a, void * b), void *slot); |
/** Quicksort wrapper |
* |
61,7 → 61,7 |
* @param cmp Comparator function. |
* |
*/ |
void qsort(void * data, count_t n, size_t e_size, int (* cmp) (void * a, void * b)) |
void qsort(void * data, size_t n, size_t e_size, int (* cmp) (void * a, void * b)) |
{ |
uint8_t buf_tmp[EBUFSIZE]; |
uint8_t buf_pivot[EBUFSIZE]; |
93,7 → 93,7 |
* @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) |
void _qsort(void * data, size_t n, size_t e_size, int (* cmp) (void * a, void * b), void *tmp, void *pivot) |
{ |
if (n > 4) { |
unsigned int i = 0, j = n - 1; |
133,7 → 133,7 |
* @param cmp Comparator function. |
* |
*/ |
void bubblesort(void * data, count_t n, size_t e_size, int (* cmp) (void * a, void * b)) |
void bubblesort(void * data, size_t n, size_t e_size, int (* cmp) (void * a, void * b)) |
{ |
uint8_t buf_slot[EBUFSIZE]; |
void * slot = buf_slot; |
160,7 → 160,7 |
* @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) |
void _bubblesort(void * data, size_t n, size_t e_size, int (* cmp) (void * a, void * b), void *slot) |
{ |
bool done = false; |
void * p; |
/branches/network/kernel/generic/src/adt/btree.c |
---|
63,9 → 63,9 |
static void node_remove_key_and_rsubtree(btree_node_t *node, btree_key_t key); |
static btree_node_t *node_split(btree_node_t *node, btree_key_t key, void *value, btree_node_t *rsubtree, btree_key_t *median); |
static btree_node_t *node_combine(btree_node_t *node); |
static index_t find_key_by_subtree(btree_node_t *node, btree_node_t *subtree, bool right); |
static void rotate_from_right(btree_node_t *lnode, btree_node_t *rnode, index_t idx); |
static void rotate_from_left(btree_node_t *lnode, btree_node_t *rnode, index_t idx); |
static size_t find_key_by_subtree(btree_node_t *node, btree_node_t *subtree, bool right); |
static void rotate_from_right(btree_node_t *lnode, btree_node_t *rnode, size_t idx); |
static void rotate_from_left(btree_node_t *lnode, btree_node_t *rnode, size_t idx); |
static bool try_insert_by_rotation_to_left(btree_node_t *node, btree_key_t key, void *value, btree_node_t *rsubtree); |
static bool try_insert_by_rotation_to_right(btree_node_t *node, btree_key_t key, void *value, btree_node_t *rsubtree); |
static bool try_rotation_from_left(btree_node_t *rnode); |
137,7 → 137,7 |
*/ |
void btree_destroy_subtree(btree_node_t *root) |
{ |
count_t i; |
size_t i; |
if (root->keys) { |
for (i = 0; i < root->keys + 1; i++) { |
269,7 → 269,7 |
} |
if (node->keys > FILL_FACTOR) { |
count_t i; |
size_t i; |
/* |
* The key can be immediatelly removed. |
285,7 → 285,7 |
} |
} else { |
index_t idx; |
size_t idx; |
btree_node_t *rnode, *parent; |
/* |
335,7 → 335,7 |
continue; |
} else { |
void *val; |
count_t i; |
size_t i; |
/* |
* Now if the key is smaller than cur->key[i] |
442,11 → 442,11 |
*/ |
void node_insert_key_and_lsubtree(btree_node_t *node, btree_key_t key, void *value, btree_node_t *lsubtree) |
{ |
count_t i; |
size_t i; |
for (i = 0; i < node->keys; i++) { |
if (key < node->key[i]) { |
count_t j; |
size_t j; |
for (j = node->keys; j > i; j--) { |
node->key[j] = node->key[j - 1]; |
478,11 → 478,11 |
*/ |
void node_insert_key_and_rsubtree(btree_node_t *node, btree_key_t key, void *value, btree_node_t *rsubtree) |
{ |
count_t i; |
size_t i; |
for (i = 0; i < node->keys; i++) { |
if (key < node->key[i]) { |
count_t j; |
size_t j; |
for (j = node->keys; j > i; j--) { |
node->key[j] = node->key[j - 1]; |
510,7 → 510,7 |
*/ |
void node_remove_key_and_lsubtree(btree_node_t *node, btree_key_t key) |
{ |
count_t i, j; |
size_t i, j; |
for (i = 0; i < node->keys; i++) { |
if (key == node->key[i]) { |
538,7 → 538,7 |
*/ |
void node_remove_key_and_rsubtree(btree_node_t *node, btree_key_t key) |
{ |
count_t i, j; |
size_t i, j; |
for (i = 0; i < node->keys; i++) { |
if (key == node->key[i]) { |
576,7 → 576,7 |
btree_node_t *node_split(btree_node_t *node, btree_key_t key, void *value, btree_node_t *rsubtree, btree_key_t *median) |
{ |
btree_node_t *rnode; |
count_t i, j; |
size_t i, j; |
ASSERT(median); |
ASSERT(node->keys == BTREE_MAX_KEYS); |
603,7 → 603,7 |
* Copy big keys, values and subtree pointers to the new right sibling. |
* If this is an index node, do not copy the median. |
*/ |
i = (count_t) INDEX_NODE(node); |
i = (size_t) INDEX_NODE(node); |
for (i += MEDIAN_HIGH_INDEX(node), j = 0; i < node->keys; i++, j++) { |
rnode->key[j] = node->key[i]; |
rnode->value[j] = node->value[i]; |
636,9 → 636,9 |
*/ |
btree_node_t *node_combine(btree_node_t *node) |
{ |
index_t idx; |
size_t idx; |
btree_node_t *rnode; |
count_t i; |
size_t i; |
ASSERT(!ROOT_NODE(node)); |
685,9 → 685,9 |
* |
* @return Index of the key associated with the subtree. |
*/ |
index_t find_key_by_subtree(btree_node_t *node, btree_node_t *subtree, bool right) |
size_t find_key_by_subtree(btree_node_t *node, btree_node_t *subtree, bool right) |
{ |
count_t i; |
size_t i; |
for (i = 0; i < node->keys + 1; i++) { |
if (subtree == node->subtree[i]) |
706,7 → 706,7 |
* @param rnode Right sibling. |
* @param idx Index of the parent node key that is taking part in the rotation. |
*/ |
void rotate_from_left(btree_node_t *lnode, btree_node_t *rnode, index_t idx) |
void rotate_from_left(btree_node_t *lnode, btree_node_t *rnode, size_t idx) |
{ |
btree_key_t key; |
743,7 → 743,7 |
* @param rnode Right sibling. |
* @param idx Index of the parent node key that is taking part in the rotation. |
*/ |
void rotate_from_right(btree_node_t *lnode, btree_node_t *rnode, index_t idx) |
void rotate_from_right(btree_node_t *lnode, btree_node_t *rnode, size_t idx) |
{ |
btree_key_t key; |
786,7 → 786,7 |
*/ |
bool try_insert_by_rotation_to_left(btree_node_t *node, btree_key_t inskey, void *insvalue, btree_node_t *rsubtree) |
{ |
index_t idx; |
size_t idx; |
btree_node_t *lnode; |
/* |
833,7 → 833,7 |
*/ |
bool try_insert_by_rotation_to_right(btree_node_t *node, btree_key_t inskey, void *insvalue, btree_node_t *rsubtree) |
{ |
index_t idx; |
size_t idx; |
btree_node_t *rnode; |
/* |
872,7 → 872,7 |
*/ |
bool try_rotation_from_left(btree_node_t *rnode) |
{ |
index_t idx; |
size_t idx; |
btree_node_t *lnode; |
/* |
907,7 → 907,7 |
*/ |
bool try_rotation_from_right(btree_node_t *lnode) |
{ |
index_t idx; |
size_t idx; |
btree_node_t *rnode; |
/* |
940,7 → 940,7 |
*/ |
void btree_print(btree_t *t) |
{ |
count_t i; |
size_t i; |
int depth = t->root->depth; |
link_t head, *cur; |
/branches/network/kernel/generic/src/adt/hash_table.c |
---|
51,9 → 51,9 |
* @param max_keys Maximal number of keys needed to identify an item. |
* @param op Hash table operations structure. |
*/ |
void hash_table_create(hash_table_t *h, count_t m, count_t max_keys, hash_table_operations_t *op) |
void hash_table_create(hash_table_t *h, size_t m, size_t max_keys, hash_table_operations_t *op) |
{ |
index_t i; |
size_t i; |
ASSERT(h); |
ASSERT(op); |
83,7 → 83,7 |
*/ |
void hash_table_insert(hash_table_t *h, unative_t key[], link_t *item) |
{ |
index_t chain; |
size_t chain; |
ASSERT(item); |
ASSERT(h); |
107,7 → 107,7 |
link_t *hash_table_find(hash_table_t *h, unative_t key[]) |
{ |
link_t *cur; |
index_t chain; |
size_t chain; |
ASSERT(h); |
ASSERT(h->op); |
137,9 → 137,9 |
* @param key Array of keys that will be compared against items of the hash table. |
* @param keys Number of keys in the key array. |
*/ |
void hash_table_remove(hash_table_t *h, unative_t key[], count_t keys) |
void hash_table_remove(hash_table_t *h, unative_t key[], size_t keys) |
{ |
index_t chain; |
size_t chain; |
link_t *cur; |
ASSERT(h); |
/branches/network/kernel/generic/src/adt/bitmap.c |
---|
54,7 → 54,7 |
* @param map Address of the memory used to hold the map. |
* @param bits Number of bits stored in bitmap. |
*/ |
void bitmap_initialize(bitmap_t *bitmap, uint8_t *map, count_t bits) |
void bitmap_initialize(bitmap_t *bitmap, uint8_t *map, size_t bits) |
{ |
bitmap->map = map; |
bitmap->bits = bits; |
66,13 → 66,13 |
* @param start Starting bit. |
* @param bits Number of bits to set. |
*/ |
void bitmap_set_range(bitmap_t *bitmap, index_t start, count_t bits) |
void bitmap_set_range(bitmap_t *bitmap, size_t start, size_t bits) |
{ |
index_t i=0; |
index_t aligned_start; |
count_t lub; /* leading unaligned bits */ |
count_t amb; /* aligned middle bits */ |
count_t tab; /* trailing aligned bits */ |
size_t i = 0; |
size_t aligned_start; |
size_t lub; /* leading unaligned bits */ |
size_t amb; /* aligned middle bits */ |
size_t tab; /* trailing aligned bits */ |
ASSERT(start + bits <= bitmap->bits); |
116,13 → 116,13 |
* @param start Starting bit. |
* @param bits Number of bits to clear. |
*/ |
void bitmap_clear_range(bitmap_t *bitmap, index_t start, count_t bits) |
void bitmap_clear_range(bitmap_t *bitmap, size_t start, size_t bits) |
{ |
index_t i=0; |
index_t aligned_start; |
count_t lub; /* leading unaligned bits */ |
count_t amb; /* aligned middle bits */ |
count_t tab; /* trailing aligned bits */ |
size_t i = 0; |
size_t aligned_start; |
size_t lub; /* leading unaligned bits */ |
size_t amb; /* aligned middle bits */ |
size_t tab; /* trailing aligned bits */ |
ASSERT(start + bits <= bitmap->bits); |
168,9 → 168,9 |
* @param src Source bitmap. |
* @param bits Number of bits to copy. |
*/ |
void bitmap_copy(bitmap_t *dst, bitmap_t *src, count_t bits) |
void bitmap_copy(bitmap_t *dst, bitmap_t *src, size_t bits) |
{ |
index_t i; |
size_t i; |
ASSERT(bits <= dst->bits); |
ASSERT(bits <= src->bits); |
/branches/network/kernel/generic/src/mm/slab.c |
---|
156,8 → 156,8 |
slab_cache_t *cache; /**< Pointer to parent cache. */ |
link_t link; /**< List of full/partial slabs. */ |
void *start; /**< Start address of first available item. */ |
count_t available; /**< Count of available items in this slab. */ |
index_t nextavail; /**< The index of next available item. */ |
size_t available; /**< Count of available items in this slab. */ |
size_t nextavail; /**< The index of next available item. */ |
} slab_t; |
#ifdef CONFIG_DEBUG |
177,7 → 177,7 |
slab_t *slab; |
size_t fsize; |
unsigned int i; |
count_t zone = 0; |
size_t zone = 0; |
data = frame_alloc_generic(cache->order, FRAME_KA | flags, &zone); |
if (!data) { |
215,7 → 215,7 |
* |
* @return number of freed frames |
*/ |
static count_t slab_space_free(slab_cache_t *cache, slab_t *slab) |
static size_t slab_space_free(slab_cache_t *cache, slab_t *slab) |
{ |
frame_free(KA2PA(slab->start)); |
if (! (cache->flags & SLAB_CACHE_SLINSIDE)) |
243,7 → 243,7 |
* |
* @return Number of freed pages |
*/ |
static count_t slab_obj_destroy(slab_cache_t *cache, void *obj, slab_t *slab) |
static size_t slab_obj_destroy(slab_cache_t *cache, void *obj, slab_t *slab) |
{ |
int freed = 0; |
371,10 → 371,10 |
* |
* @return Number of freed pages |
*/ |
static count_t magazine_destroy(slab_cache_t *cache, slab_magazine_t *mag) |
static size_t magazine_destroy(slab_cache_t *cache, slab_magazine_t *mag) |
{ |
unsigned int i; |
count_t frames = 0; |
size_t frames = 0; |
for (i = 0; i < mag->busy; i++) { |
frames += slab_obj_destroy(cache, mag->objs[i], NULL); |
649,11 → 649,11 |
* @param flags If contains SLAB_RECLAIM_ALL, do aggressive freeing |
* @return Number of freed pages |
*/ |
static count_t _slab_reclaim(slab_cache_t *cache, int flags) |
static size_t _slab_reclaim(slab_cache_t *cache, int flags) |
{ |
unsigned int i; |
slab_magazine_t *mag; |
count_t frames = 0; |
size_t frames = 0; |
int magcount; |
if (cache->flags & SLAB_CACHE_NOMAGAZINE) |
771,11 → 771,11 |
} |
/* Go through all caches and reclaim what is possible */ |
count_t slab_reclaim(int flags) |
size_t slab_reclaim(int flags) |
{ |
slab_cache_t *cache; |
link_t *cur; |
count_t frames = 0; |
size_t frames = 0; |
spinlock_lock(&slab_cache_lock); |
/branches/network/kernel/generic/src/mm/tlb.c |
---|
79,7 → 79,7 |
* @param count Number of pages, if required by type. |
*/ |
void tlb_shootdown_start(tlb_invalidate_type_t type, asid_t asid, |
uintptr_t page, count_t count) |
uintptr_t page, size_t count) |
{ |
unsigned int i; |
108,7 → 108,7 |
/* |
* Enqueue the message. |
*/ |
index_t idx = cpu->tlb_messages_count++; |
size_t idx = cpu->tlb_messages_count++; |
cpu->tlb_messages[idx].type = type; |
cpu->tlb_messages[idx].asid = asid; |
cpu->tlb_messages[idx].page = page; |
143,7 → 143,7 |
tlb_invalidate_type_t type; |
asid_t asid; |
uintptr_t page; |
count_t count; |
size_t count; |
unsigned int i; |
ASSERT(CPU); |
/branches/network/kernel/generic/src/mm/backend_anon.c |
---|
195,7 → 195,7 |
node = list_get_instance(cur, btree_node_t, leaf_link); |
for (i = 0; i < node->keys; i++) { |
uintptr_t base = node->key[i]; |
count_t count = (count_t) node->value[i]; |
size_t count = (size_t) node->value[i]; |
unsigned int j; |
for (j = 0; j < count; j++) { |
/branches/network/kernel/generic/src/mm/as.c |
---|
418,8 → 418,8 |
btree_node_t, leaf_link); |
if ((cond = (bool) node->keys)) { |
uintptr_t b = node->key[node->keys - 1]; |
count_t c = |
(count_t) node->value[node->keys - 1]; |
size_t c = |
(size_t) node->value[node->keys - 1]; |
unsigned int i = 0; |
if (overlaps(b, c * PAGE_SIZE, area->base, |
555,10 → 555,10 |
node = list_get_instance(cur, btree_node_t, leaf_link); |
for (i = 0; i < node->keys; i++) { |
uintptr_t b = node->key[i]; |
count_t j; |
size_t j; |
pte_t *pte; |
for (j = 0; j < (count_t) node->value[i]; j++) { |
for (j = 0; j < (size_t) node->value[i]; j++) { |
page_table_lock(as, false); |
pte = page_mapping_find(as, b + j * PAGE_SIZE); |
ASSERT(pte && PTE_VALID(pte) && |
788,8 → 788,8 |
ipl_t ipl; |
int page_flags; |
uintptr_t *old_frame; |
index_t frame_idx; |
count_t used_pages; |
size_t frame_idx; |
size_t used_pages; |
/* Flags for the new memory mapping */ |
page_flags = area_flags_to_page_flags(flags); |
827,7 → 827,7 |
node = list_get_instance(cur, btree_node_t, leaf_link); |
for (i = 0; i < node->keys; i++) { |
used_pages += (count_t) node->value[i]; |
used_pages += (size_t) node->value[i]; |
} |
} |
853,10 → 853,10 |
node = list_get_instance(cur, btree_node_t, leaf_link); |
for (i = 0; i < node->keys; i++) { |
uintptr_t b = node->key[i]; |
count_t j; |
size_t j; |
pte_t *pte; |
for (j = 0; j < (count_t) node->value[i]; j++) { |
for (j = 0; j < (size_t) node->value[i]; j++) { |
page_table_lock(as, false); |
pte = page_mapping_find(as, b + j * PAGE_SIZE); |
ASSERT(pte && PTE_VALID(pte) && |
903,9 → 903,9 |
node = list_get_instance(cur, btree_node_t, leaf_link); |
for (i = 0; i < node->keys; i++) { |
uintptr_t b = node->key[i]; |
count_t j; |
size_t j; |
for (j = 0; j < (count_t) node->value[i]; j++) { |
for (j = 0; j < (size_t) node->value[i]; j++) { |
page_table_lock(as, false); |
/* Insert the new mapping */ |
1397,16 → 1397,16 |
* |
* @return Zero on failure and non-zero on success. |
*/ |
int used_space_insert(as_area_t *a, uintptr_t page, count_t count) |
int used_space_insert(as_area_t *a, uintptr_t page, size_t count) |
{ |
btree_node_t *leaf, *node; |
count_t pages; |
size_t pages; |
unsigned int i; |
ASSERT(page == ALIGN_DOWN(page, PAGE_SIZE)); |
ASSERT(count); |
pages = (count_t) btree_search(&a->used_space, page, &leaf); |
pages = (size_t) btree_search(&a->used_space, page, &leaf); |
if (pages) { |
/* |
* We hit the beginning of some used space. |
1423,8 → 1423,8 |
if (node) { |
uintptr_t left_pg = node->key[node->keys - 1]; |
uintptr_t right_pg = leaf->key[0]; |
count_t left_cnt = (count_t) node->value[node->keys - 1]; |
count_t right_cnt = (count_t) leaf->value[0]; |
size_t left_cnt = (size_t) node->value[node->keys - 1]; |
size_t right_cnt = (size_t) leaf->value[0]; |
/* |
* Examine the possibility that the interval fits |
1478,7 → 1478,7 |
} |
} else if (page < leaf->key[0]) { |
uintptr_t right_pg = leaf->key[0]; |
count_t right_cnt = (count_t) leaf->value[0]; |
size_t right_cnt = (size_t) leaf->value[0]; |
/* |
* Investigate the border case in which the left neighbour does |
1513,8 → 1513,8 |
if (node) { |
uintptr_t left_pg = leaf->key[leaf->keys - 1]; |
uintptr_t right_pg = node->key[0]; |
count_t left_cnt = (count_t) leaf->value[leaf->keys - 1]; |
count_t right_cnt = (count_t) node->value[0]; |
size_t left_cnt = (size_t) leaf->value[leaf->keys - 1]; |
size_t right_cnt = (size_t) node->value[0]; |
/* |
* Examine the possibility that the interval fits |
1568,7 → 1568,7 |
} |
} else if (page >= leaf->key[leaf->keys - 1]) { |
uintptr_t left_pg = leaf->key[leaf->keys - 1]; |
count_t left_cnt = (count_t) leaf->value[leaf->keys - 1]; |
size_t left_cnt = (size_t) leaf->value[leaf->keys - 1]; |
/* |
* Investigate the border case in which the right neighbour |
1606,8 → 1606,8 |
if (page < leaf->key[i]) { |
uintptr_t left_pg = leaf->key[i - 1]; |
uintptr_t right_pg = leaf->key[i]; |
count_t left_cnt = (count_t) leaf->value[i - 1]; |
count_t right_cnt = (count_t) leaf->value[i]; |
size_t left_cnt = (size_t) leaf->value[i - 1]; |
size_t right_cnt = (size_t) leaf->value[i]; |
/* |
* The interval fits between left_pg and right_pg. |
1665,7 → 1665,7 |
} |
} |
panic("Inconsistency detected while adding %" PRIc " pages of used " |
panic("Inconsistency detected while adding %" PRIs " pages of used " |
"space at %p.", count, page); |
} |
1679,16 → 1679,16 |
* |
* @return Zero on failure and non-zero on success. |
*/ |
int used_space_remove(as_area_t *a, uintptr_t page, count_t count) |
int used_space_remove(as_area_t *a, uintptr_t page, size_t count) |
{ |
btree_node_t *leaf, *node; |
count_t pages; |
size_t pages; |
unsigned int i; |
ASSERT(page == ALIGN_DOWN(page, PAGE_SIZE)); |
ASSERT(count); |
pages = (count_t) btree_search(&a->used_space, page, &leaf); |
pages = (size_t) btree_search(&a->used_space, page, &leaf); |
if (pages) { |
/* |
* We are lucky, page is the beginning of some interval. |
1717,7 → 1717,7 |
node = btree_leaf_node_left_neighbour(&a->used_space, leaf); |
if (node && page < leaf->key[0]) { |
uintptr_t left_pg = node->key[node->keys - 1]; |
count_t left_cnt = (count_t) node->value[node->keys - 1]; |
size_t left_cnt = (size_t) node->value[node->keys - 1]; |
if (overlaps(left_pg, left_cnt * PAGE_SIZE, page, |
count * PAGE_SIZE)) { |
1733,7 → 1733,7 |
return 1; |
} else if (page + count * PAGE_SIZE < |
left_pg + left_cnt*PAGE_SIZE) { |
count_t new_cnt; |
size_t new_cnt; |
/* |
* The interval is contained in the rightmost |
1757,7 → 1757,7 |
if (page > leaf->key[leaf->keys - 1]) { |
uintptr_t left_pg = leaf->key[leaf->keys - 1]; |
count_t left_cnt = (count_t) leaf->value[leaf->keys - 1]; |
size_t left_cnt = (size_t) leaf->value[leaf->keys - 1]; |
if (overlaps(left_pg, left_cnt * PAGE_SIZE, page, |
count * PAGE_SIZE)) { |
1772,7 → 1772,7 |
return 1; |
} else if (page + count * PAGE_SIZE < left_pg + |
left_cnt * PAGE_SIZE) { |
count_t new_cnt; |
size_t new_cnt; |
/* |
* The interval is contained in the rightmost |
1799,7 → 1799,7 |
for (i = 1; i < leaf->keys - 1; i++) { |
if (page < leaf->key[i]) { |
uintptr_t left_pg = leaf->key[i - 1]; |
count_t left_cnt = (count_t) leaf->value[i - 1]; |
size_t left_cnt = (size_t) leaf->value[i - 1]; |
/* |
* Now the interval is between intervals corresponding |
1819,7 → 1819,7 |
return 1; |
} else if (page + count * PAGE_SIZE < |
left_pg + left_cnt * PAGE_SIZE) { |
count_t new_cnt; |
size_t new_cnt; |
/* |
* The interval is contained in the |
1844,7 → 1844,7 |
} |
error: |
panic("Inconsistency detected while removing %" PRIc " pages of used " |
panic("Inconsistency detected while removing %" PRIs " pages of used " |
"space from %p.", count, page); |
} |
1943,7 → 1943,7 |
as_area_t *area = node->value[i]; |
mutex_lock(&area->lock); |
printf("as_area: %p, base=%p, pages=%" PRIc |
printf("as_area: %p, base=%p, pages=%" PRIs |
" (%p - %p)\n", area, area->base, area->pages, |
area->base, area->base + FRAMES2SIZE(area->pages)); |
mutex_unlock(&area->lock); |
/branches/network/kernel/generic/src/mm/frame.c |
---|
67,29 → 67,29 |
*/ |
mutex_t mem_avail_mtx; |
condvar_t mem_avail_cv; |
count_t mem_avail_req = 0; /**< Number of frames requested. */ |
count_t mem_avail_gen = 0; /**< Generation counter. */ |
size_t mem_avail_req = 0; /**< Number of frames requested. */ |
size_t mem_avail_gen = 0; /**< Generation counter. */ |
/********************/ |
/* Helper functions */ |
/********************/ |
static inline index_t frame_index(zone_t *zone, frame_t *frame) |
static inline size_t frame_index(zone_t *zone, frame_t *frame) |
{ |
return (index_t) (frame - zone->frames); |
return (size_t) (frame - zone->frames); |
} |
static inline index_t frame_index_abs(zone_t *zone, frame_t *frame) |
static inline size_t frame_index_abs(zone_t *zone, frame_t *frame) |
{ |
return (index_t) (frame - zone->frames) + zone->base; |
return (size_t) (frame - zone->frames) + zone->base; |
} |
static inline bool frame_index_valid(zone_t *zone, index_t index) |
static inline bool frame_index_valid(zone_t *zone, size_t index) |
{ |
return (index < zone->count); |
} |
static inline index_t make_frame_index(zone_t *zone, frame_t *frame) |
static inline size_t make_frame_index(zone_t *zone, frame_t *frame) |
{ |
return (frame - zone->frames); |
} |
120,20 → 120,20 |
* @return Zone number on success, -1 on error. |
* |
*/ |
static count_t zones_insert_zone(pfn_t base, count_t count) |
static size_t zones_insert_zone(pfn_t base, size_t count) |
{ |
if (zones.count + 1 == ZONES_MAX) { |
printf("Maximum zone count %u exceeded!\n", ZONES_MAX); |
return (count_t) -1; |
return (size_t) -1; |
} |
count_t i; |
size_t i; |
for (i = 0; i < zones.count; i++) { |
/* Check for overlap */ |
if (overlaps(base, count, |
zones.info[i].base, zones.info[i].count)) { |
printf("Zones overlap!\n"); |
return (count_t) -1; |
return (size_t) -1; |
} |
if (base < zones.info[i].base) |
break; |
140,7 → 140,7 |
} |
/* Move other zones up */ |
count_t j; |
size_t j; |
for (j = zones.count; j > i; j--) { |
zones.info[j] = zones.info[j - 1]; |
zones.info[j].buddy_system->data = |
161,10 → 161,10 |
* |
*/ |
#ifdef CONFIG_DEBUG |
static count_t total_frames_free(void) |
static size_t total_frames_free(void) |
{ |
count_t total = 0; |
count_t i; |
size_t total = 0; |
size_t i; |
for (i = 0; i < zones.count; i++) |
total += zones.info[i].free_count; |
184,12 → 184,12 |
* @return Zone index or -1 if not found. |
* |
*/ |
count_t find_zone(pfn_t frame, count_t count, count_t hint) |
size_t find_zone(pfn_t frame, size_t count, size_t hint) |
{ |
if (hint >= zones.count) |
hint = 0; |
count_t i = hint; |
size_t i = hint; |
do { |
if ((zones.info[i].base <= frame) |
&& (zones.info[i].base + zones.info[i].count >= frame + count)) |
200,7 → 200,7 |
i = 0; |
} while (i != hint); |
return (count_t) -1; |
return (size_t) -1; |
} |
/** @return True if zone can allocate specified order */ |
220,12 → 220,12 |
* @param hind Preferred zone. |
* |
*/ |
static count_t find_free_zone(uint8_t order, zone_flags_t flags, count_t hint) |
static size_t find_free_zone(uint8_t order, zone_flags_t flags, size_t hint) |
{ |
if (hint >= zones.count) |
hint = 0; |
count_t i = hint; |
size_t i = hint; |
do { |
/* |
* Check whether the zone meets the search criteria. |
243,7 → 243,7 |
i = 0; |
} while (i != hint); |
return (count_t) -1; |
return (size_t) -1; |
} |
/**************************/ |
265,7 → 265,7 |
frame_t *frame = list_get_instance(child, frame_t, buddy_link); |
zone_t *zone = (zone_t *) buddy->data; |
index_t index = frame_index(zone, frame); |
size_t index = frame_index(zone, frame); |
do { |
if (zone->frames[index].buddy_order != order) |
return &zone->frames[index].buddy_link; |
291,7 → 291,7 |
bool is_left = IS_BUDDY_LEFT_BLOCK_ABS(zone, frame); |
index_t index; |
size_t index; |
if (is_left) { |
index = (frame_index(zone, frame)) + |
(1 << frame->buddy_order); |
446,7 → 446,7 |
* @param frame_idx Frame index relative to zone. |
* |
*/ |
static void zone_frame_free(zone_t *zone, index_t frame_idx) |
static void zone_frame_free(zone_t *zone, size_t frame_idx) |
{ |
ASSERT(zone_flags_available(zone->flags)); |
467,7 → 467,7 |
} |
/** Return frame from zone. */ |
static frame_t *zone_get_frame(zone_t *zone, index_t frame_idx) |
static frame_t *zone_get_frame(zone_t *zone, size_t frame_idx) |
{ |
ASSERT(frame_idx < zone->count); |
return &zone->frames[frame_idx]; |
474,7 → 474,7 |
} |
/** Mark frame in zone unavailable to allocation. */ |
static void zone_mark_unavailable(zone_t *zone, index_t frame_idx) |
static void zone_mark_unavailable(zone_t *zone, size_t frame_idx) |
{ |
ASSERT(zone_flags_available(zone->flags)); |
503,7 → 503,7 |
* @param buddy Merged zone buddy. |
* |
*/ |
static void zone_merge_internal(count_t z1, count_t z2, zone_t *old_z1, buddy_system_t *buddy) |
static void zone_merge_internal(size_t z1, size_t z2, zone_t *old_z1, buddy_system_t *buddy) |
{ |
ASSERT(zone_flags_available(zones.info[z1].flags)); |
ASSERT(zone_flags_available(zones.info[z2].flags)); |
529,7 → 529,7 |
+ buddy_conf_size(order)); |
/* This marks all frames busy */ |
count_t i; |
size_t i; |
for (i = 0; i < zones.info[z1].count; i++) |
frame_initialize(&zones.info[z1].frames[i]); |
599,11 → 599,11 |
* @param count Old zone frame count. |
* |
*/ |
static void return_config_frames(count_t znum, pfn_t pfn, count_t count) |
static void return_config_frames(size_t znum, pfn_t pfn, size_t count) |
{ |
ASSERT(zone_flags_available(zones.info[znum].flags)); |
count_t cframes = SIZE2FRAMES(zone_conf_size(count)); |
size_t cframes = SIZE2FRAMES(zone_conf_size(count)); |
if ((pfn < zones.info[znum].base) |
|| (pfn >= zones.info[znum].base + zones.info[znum].count)) |
614,7 → 614,7 |
frame = &zones.info[znum].frames[pfn - zones.info[znum].base]; |
ASSERT(!frame->buddy_order); |
count_t i; |
size_t i; |
for (i = 0; i < cframes; i++) { |
zones.info[znum].busy_count++; |
zone_frame_free(&zones.info[znum], |
634,17 → 634,17 |
* @param count Allocated frames in block. |
* |
*/ |
static void zone_reduce_region(count_t znum, pfn_t frame_idx, count_t count) |
static void zone_reduce_region(size_t znum, pfn_t frame_idx, size_t count) |
{ |
ASSERT(zone_flags_available(zones.info[znum].flags)); |
ASSERT(frame_idx + count < zones.info[znum].count); |
uint8_t order = zones.info[znum].frames[frame_idx].buddy_order; |
ASSERT((count_t) (1 << order) >= count); |
ASSERT((size_t) (1 << order) >= count); |
/* Reduce all blocks to order 0 */ |
count_t i; |
for (i = 0; i < (count_t) (1 << order); i++) { |
size_t i; |
for (i = 0; i < (size_t) (1 << order); i++) { |
frame_t *frame = &zones.info[znum].frames[i + frame_idx]; |
frame->buddy_order = 0; |
if (!frame->refcount) |
653,7 → 653,7 |
} |
/* Free unneeded frames */ |
for (i = count; i < (count_t) (1 << order); i++) |
for (i = count; i < (size_t) (1 << order); i++) |
zone_frame_free(&zones.info[znum], i + frame_idx); |
} |
670,7 → 670,7 |
* The function uses |
* |
*/ |
bool zone_merge(count_t z1, count_t z2) |
bool zone_merge(size_t z1, size_t z2) |
{ |
ipl_t ipl = interrupts_disable(); |
spinlock_lock(&zones.lock); |
733,7 → 733,7 |
zones.info[z2].count); |
/* Move zones down */ |
count_t i; |
size_t i; |
for (i = z2 + 1; i < zones.count; i++) { |
zones.info[i - 1] = zones.info[i]; |
zones.info[i - 1].buddy_system->data = |
758,7 → 758,7 |
*/ |
void zone_merge_all(void) |
{ |
count_t i = 0; |
size_t i = 0; |
while (i < zones.count) { |
if (!zone_merge(i, i + 1)) |
i++; |
776,7 → 776,7 |
* @return Initialized zone. |
* |
*/ |
static void zone_construct(zone_t *zone, buddy_system_t *buddy, pfn_t start, count_t count, zone_flags_t flags) |
static void zone_construct(zone_t *zone, buddy_system_t *buddy, pfn_t start, size_t count, zone_flags_t flags) |
{ |
zone->base = start; |
zone->count = count; |
799,7 → 799,7 |
zone->frames = (frame_t *) ((uint8_t *) zone->buddy_system + |
buddy_conf_size(order)); |
count_t i; |
size_t i; |
for (i = 0; i < count; i++) |
frame_initialize(&zone->frames[i]); |
819,7 → 819,7 |
* @return Size of zone configuration info (in bytes). |
* |
*/ |
uintptr_t zone_conf_size(count_t count) |
uintptr_t zone_conf_size(size_t count) |
{ |
return (count * sizeof(frame_t) + buddy_conf_size(fnzb(count))); |
} |
840,7 → 840,7 |
* @return Zone number or -1 on error. |
* |
*/ |
count_t zone_create(pfn_t start, count_t count, pfn_t confframe, zone_flags_t flags) |
size_t zone_create(pfn_t start, size_t count, pfn_t confframe, zone_flags_t flags) |
{ |
ipl_t ipl = interrupts_disable(); |
spinlock_lock(&zones.lock); |
855,7 → 855,7 |
/* If confframe is supposed to be inside our zone, then make sure |
* it does not span kernel & init |
*/ |
count_t confcount = SIZE2FRAMES(zone_conf_size(count)); |
size_t confcount = SIZE2FRAMES(zone_conf_size(count)); |
if ((confframe >= start) && (confframe < start + count)) { |
for (; confframe < start + count; confframe++) { |
uintptr_t addr = PFN2ADDR(confframe); |
868,7 → 868,7 |
continue; |
bool overlap = false; |
count_t i; |
size_t i; |
for (i = 0; i < init.cnt; i++) |
if (overlaps(addr, PFN2ADDR(confcount), |
KA2PA(init.tasks[i].addr), |
886,11 → 886,11 |
panic("Cannot find configuration data for zone."); |
} |
count_t znum = zones_insert_zone(start, count); |
if (znum == (count_t) -1) { |
size_t znum = zones_insert_zone(start, count); |
if (znum == (size_t) -1) { |
spinlock_unlock(&zones.lock); |
interrupts_restore(ipl); |
return (count_t) -1; |
return (size_t) -1; |
} |
buddy_system_t *buddy = (buddy_system_t *) PA2KA(PFN2ADDR(confframe)); |
898,7 → 898,7 |
/* If confdata in zone, mark as unavailable */ |
if ((confframe >= start) && (confframe < start + count)) { |
count_t i; |
size_t i; |
for (i = confframe; i < confframe + confcount; i++) |
zone_mark_unavailable(&zones.info[znum], |
i - zones.info[znum].base); |
911,11 → 911,11 |
} |
/* Non-available zone */ |
count_t znum = zones_insert_zone(start, count); |
if (znum == (count_t) -1) { |
size_t znum = zones_insert_zone(start, count); |
if (znum == (size_t) -1) { |
spinlock_unlock(&zones.lock); |
interrupts_restore(ipl); |
return (count_t) -1; |
return (size_t) -1; |
} |
zone_construct(&zones.info[znum], NULL, start, count, flags); |
930,14 → 930,14 |
/*******************/ |
/** Set parent of frame. */ |
void frame_set_parent(pfn_t pfn, void *data, count_t hint) |
void frame_set_parent(pfn_t pfn, void *data, size_t hint) |
{ |
ipl_t ipl = interrupts_disable(); |
spinlock_lock(&zones.lock); |
count_t znum = find_zone(pfn, 1, hint); |
size_t znum = find_zone(pfn, 1, hint); |
ASSERT(znum != (count_t) -1); |
ASSERT(znum != (size_t) -1); |
zone_get_frame(&zones.info[znum], |
pfn - zones.info[znum].base)->parent = data; |
946,14 → 946,14 |
interrupts_restore(ipl); |
} |
void *frame_get_parent(pfn_t pfn, count_t hint) |
void *frame_get_parent(pfn_t pfn, size_t hint) |
{ |
ipl_t ipl = interrupts_disable(); |
spinlock_lock(&zones.lock); |
count_t znum = find_zone(pfn, 1, hint); |
size_t znum = find_zone(pfn, 1, hint); |
ASSERT(znum != (count_t) -1); |
ASSERT(znum != (size_t) -1); |
void *res = zone_get_frame(&zones.info[znum], |
pfn - zones.info[znum].base)->parent; |
973,11 → 973,11 |
* @return Physical address of the allocated frame. |
* |
*/ |
void *frame_alloc_generic(uint8_t order, frame_flags_t flags, count_t *pzone) |
void *frame_alloc_generic(uint8_t order, frame_flags_t flags, size_t *pzone) |
{ |
count_t size = ((count_t) 1) << order; |
size_t size = ((size_t) 1) << order; |
ipl_t ipl; |
count_t hint = pzone ? (*pzone) : 0; |
size_t hint = pzone ? (*pzone) : 0; |
loop: |
ipl = interrupts_disable(); |
986,16 → 986,16 |
/* |
* First, find suitable frame zone. |
*/ |
count_t znum = find_free_zone(order, |
size_t znum = find_free_zone(order, |
FRAME_TO_ZONE_FLAGS(flags), hint); |
/* If no memory, reclaim some slab memory, |
if it does not help, reclaim all */ |
if ((znum == (count_t) -1) && (!(flags & FRAME_NO_RECLAIM))) { |
if ((znum == (size_t) -1) && (!(flags & FRAME_NO_RECLAIM))) { |
spinlock_unlock(&zones.lock); |
interrupts_restore(ipl); |
count_t freed = slab_reclaim(0); |
size_t freed = slab_reclaim(0); |
ipl = interrupts_disable(); |
spinlock_lock(&zones.lock); |
1004,7 → 1004,7 |
znum = find_free_zone(order, |
FRAME_TO_ZONE_FLAGS(flags), hint); |
if (znum == (count_t) -1) { |
if (znum == (size_t) -1) { |
spinlock_unlock(&zones.lock); |
interrupts_restore(ipl); |
1019,7 → 1019,7 |
} |
} |
if (znum == (count_t) -1) { |
if (znum == (size_t) -1) { |
if (flags & FRAME_ATOMIC) { |
spinlock_unlock(&zones.lock); |
interrupts_restore(ipl); |
1027,7 → 1027,7 |
} |
#ifdef CONFIG_DEBUG |
count_t avail = total_frames_free(); |
size_t avail = total_frames_free(); |
#endif |
spinlock_unlock(&zones.lock); |
1038,8 → 1038,8 |
*/ |
#ifdef CONFIG_DEBUG |
printf("Thread %" PRIu64 " waiting for %" PRIc " frames, " |
"%" PRIc " available.\n", THREAD->tid, size, avail); |
printf("Thread %" PRIu64 " waiting for %" PRIs " frames, " |
"%" PRIs " available.\n", THREAD->tid, size, avail); |
#endif |
mutex_lock(&mem_avail_mtx); |
1048,7 → 1048,7 |
mem_avail_req = min(mem_avail_req, size); |
else |
mem_avail_req = size; |
count_t gen = mem_avail_gen; |
size_t gen = mem_avail_gen; |
while (gen == mem_avail_gen) |
condvar_wait(&mem_avail_cv, &mem_avail_mtx); |
1095,9 → 1095,9 |
* First, find host frame zone for addr. |
*/ |
pfn_t pfn = ADDR2PFN(frame); |
count_t znum = find_zone(pfn, 1, NULL); |
size_t znum = find_zone(pfn, 1, NULL); |
ASSERT(znum != (count_t) -1); |
ASSERT(znum != (size_t) -1); |
zone_frame_free(&zones.info[znum], pfn - zones.info[znum].base); |
1134,9 → 1134,9 |
/* |
* First, find host frame zone for addr. |
*/ |
count_t znum = find_zone(pfn, 1, NULL); |
size_t znum = find_zone(pfn, 1, NULL); |
ASSERT(znum != (count_t) -1); |
ASSERT(znum != (size_t) -1); |
zones.info[znum].frames[pfn - zones.info[znum].base].refcount++; |
1145,15 → 1145,15 |
} |
/** Mark given range unavailable in frame zones. */ |
void frame_mark_unavailable(pfn_t start, count_t count) |
void frame_mark_unavailable(pfn_t start, size_t count) |
{ |
ipl_t ipl = interrupts_disable(); |
spinlock_lock(&zones.lock); |
count_t i; |
size_t i; |
for (i = 0; i < count; i++) { |
count_t znum = find_zone(start + i, 1, 0); |
if (znum == (count_t) -1) /* PFN not found */ |
size_t znum = find_zone(start + i, 1, 0); |
if (znum == (size_t) -1) /* PFN not found */ |
continue; |
zone_mark_unavailable(&zones.info[znum], |
1182,7 → 1182,7 |
frame_mark_unavailable(ADDR2PFN(KA2PA(config.stack_base)), |
SIZE2FRAMES(config.stack_size)); |
count_t i; |
size_t i; |
for (i = 0; i < init.cnt; i++) { |
pfn_t pfn = ADDR2PFN(KA2PA(init.tasks[i].addr)); |
frame_mark_unavailable(pfn, |
1207,7 → 1207,7 |
spinlock_lock(&zones.lock); |
uint64_t total = 0; |
count_t i; |
size_t i; |
for (i = 0; i < zones.count; i++) |
total += (uint64_t) FRAMES2SIZE(zones.info[i].count); |
1241,7 → 1241,7 |
* the listing). |
*/ |
count_t i; |
size_t i; |
for (i = 0;; i++) { |
ipl_t ipl = interrupts_disable(); |
spinlock_lock(&zones.lock); |
1253,10 → 1253,10 |
} |
uintptr_t base = PFN2ADDR(zones.info[i].base); |
count_t count = zones.info[i].count; |
size_t count = zones.info[i].count; |
zone_flags_t flags = zones.info[i].flags; |
count_t free_count = zones.info[i].free_count; |
count_t busy_count = zones.info[i].busy_count; |
size_t free_count = zones.info[i].free_count; |
size_t busy_count = zones.info[i].busy_count; |
spinlock_unlock(&zones.lock); |
interrupts_restore(ipl); |
1263,7 → 1263,7 |
bool available = zone_flags_available(flags); |
printf("%-2" PRIc, i); |
printf("%-2" PRIs, i); |
#ifdef __32_BITS__ |
printf(" %10p", base); |
1273,13 → 1273,13 |
printf(" %18p", base); |
#endif |
printf(" %12" PRIc " %c%c%c ", count, |
printf(" %12" PRIs " %c%c%c ", count, |
available ? 'A' : ' ', |
(flags & ZONE_RESERVED) ? 'R' : ' ', |
(flags & ZONE_FIRMWARE) ? 'F' : ' '); |
if (available) |
printf("%12" PRIc " %12" PRIc, |
printf("%12" PRIs " %12" PRIs, |
free_count, busy_count); |
printf("\n"); |
1291,13 → 1291,13 |
* @param num Zone base address or zone number. |
* |
*/ |
void zone_print_one(count_t num) |
void zone_print_one(size_t num) |
{ |
ipl_t ipl = interrupts_disable(); |
spinlock_lock(&zones.lock); |
count_t znum = (count_t) -1; |
size_t znum = (size_t) -1; |
count_t i; |
size_t i; |
for (i = 0; i < zones.count; i++) { |
if ((i == num) || (PFN2ADDR(zones.info[i].base) == num)) { |
znum = i; |
1305,7 → 1305,7 |
} |
} |
if (znum == (count_t) -1) { |
if (znum == (size_t) -1) { |
spinlock_unlock(&zones.lock); |
interrupts_restore(ipl); |
printf("Zone not found.\n"); |
1314,9 → 1314,9 |
uintptr_t base = PFN2ADDR(zones.info[i].base); |
zone_flags_t flags = zones.info[i].flags; |
count_t count = zones.info[i].count; |
count_t free_count = zones.info[i].free_count; |
count_t busy_count = zones.info[i].busy_count; |
size_t count = zones.info[i].count; |
size_t free_count = zones.info[i].free_count; |
size_t busy_count = zones.info[i].busy_count; |
spinlock_unlock(&zones.lock); |
interrupts_restore(ipl); |
1323,9 → 1323,9 |
bool available = zone_flags_available(flags); |
printf("Zone number: %" PRIc "\n", znum); |
printf("Zone number: %" PRIs "\n", znum); |
printf("Zone base address: %p\n", base); |
printf("Zone size: %" PRIc " frames (%" PRIs " KiB)\n", count, |
printf("Zone size: %" PRIs " frames (%" PRIs " KiB)\n", count, |
SIZE2KB(FRAMES2SIZE(count))); |
printf("Zone flags: %c%c%c\n", |
available ? 'A' : ' ', |
1333,9 → 1333,9 |
(flags & ZONE_FIRMWARE) ? 'F' : ' '); |
if (available) { |
printf("Allocated space: %" PRIc " frames (%" PRIs " KiB)\n", |
printf("Allocated space: %" PRIs " frames (%" PRIs " KiB)\n", |
busy_count, SIZE2KB(FRAMES2SIZE(busy_count))); |
printf("Available space: %" PRIc " frames (%" PRIs " KiB)\n", |
printf("Available space: %" PRIs " frames (%" PRIs " KiB)\n", |
free_count, SIZE2KB(FRAMES2SIZE(free_count))); |
} |
} |
/branches/network/kernel/generic/src/mm/backend_elf.c |
---|
82,7 → 82,7 |
elf_segment_header_t *entry = area->backend_data.segment; |
btree_node_t *leaf; |
uintptr_t base, frame, page, start_anon; |
index_t i; |
size_t i; |
bool dirty = false; |
if (!as_area_check_access(area, access)) |
234,7 → 234,7 |
elf_header_t *elf = area->backend_data.elf; |
elf_segment_header_t *entry = area->backend_data.segment; |
uintptr_t base, start_anon; |
index_t i; |
size_t i; |
ASSERT((page >= ALIGN_DOWN(entry->p_vaddr, PAGE_SIZE)) && |
(page < entry->p_vaddr + entry->p_memsz)); |
304,7 → 304,7 |
for (i = 0; i < node->keys; i++) { |
uintptr_t base = node->key[i]; |
count_t count = (count_t) node->value[i]; |
size_t count = (size_t) node->value[i]; |
unsigned int j; |
/* |
/branches/network/kernel/generic/src/syscall/syscall.c |
---|
59,9 → 59,19 |
unative_t a4, unative_t a5, unative_t a6, unative_t id) |
{ |
unative_t rc; |
#ifdef CONFIG_UDEBUG |
bool debug; |
/* |
* Early check for undebugged tasks. We do not lock anything as this |
* test need not be precise in either way. |
*/ |
debug = THREAD->udebug.active; |
#ifdef CONFIG_UDEBUG |
udebug_syscall_event(a1, a2, a3, a4, a5, a6, id, 0, false); |
if (debug) { |
udebug_syscall_event(a1, a2, a3, a4, a5, a6, id, 0, false); |
} |
#endif |
if (id < SYSCALL_END) { |
76,14 → 86,17 |
thread_exit(); |
#ifdef CONFIG_UDEBUG |
udebug_syscall_event(a1, a2, a3, a4, a5, a6, id, rc, true); |
if (debug) { |
udebug_syscall_event(a1, a2, a3, a4, a5, a6, id, rc, true); |
/* |
* Stopping point needed for tasks that only invoke non-blocking |
* system calls. |
*/ |
udebug_stoppable_begin(); |
udebug_stoppable_end(); |
/* |
* Stopping point needed for tasks that only invoke |
* non-blocking system calls. Not needed if the task |
* is not being debugged (it cannot block here). |
*/ |
udebug_stoppable_begin(); |
udebug_stoppable_end(); |
} |
#endif |
return rc; |
/branches/network/kernel/generic/src/ipc/event.c |
---|
64,8 → 64,8 |
} |
} |
static int |
event_subscribe(event_type_t evno, unative_t method, answerbox_t *answerbox) |
static int event_subscribe(event_type_t evno, unative_t method, |
answerbox_t *answerbox) |
{ |
if (evno >= EVENT_END) |
return ELIMIT; |
122,8 → 122,7 |
} |
} |
void |
event_notify(event_type_t evno, unative_t a1, unative_t a2, unative_t a3, |
void event_notify(event_type_t evno, unative_t a1, unative_t a2, unative_t a3, |
unative_t a4, unative_t a5) |
{ |
ASSERT(evno < EVENT_END); |
/branches/network/kernel/generic/src/ipc/ipcrsc.c |
---|
160,27 → 160,29 |
return result; |
} |
/** Allocate new phone slot in the current TASK structure. |
/** Allocate new phone slot in the specified task. |
* |
* @param t Task for which to allocate a new phone. |
* |
* @return New phone handle or -1 if the phone handle limit is |
* exceeded. |
*/ |
int phone_alloc(void) |
int phone_alloc(task_t *t) |
{ |
int i; |
spinlock_lock(&TASK->lock); |
spinlock_lock(&t->lock); |
for (i = 0; i < IPC_MAX_PHONES; i++) { |
if (TASK->phones[i].state == IPC_PHONE_HUNGUP && |
atomic_get(&TASK->phones[i].active_calls) == 0) |
TASK->phones[i].state = IPC_PHONE_FREE; |
if (t->phones[i].state == IPC_PHONE_HUNGUP && |
atomic_get(&t->phones[i].active_calls) == 0) |
t->phones[i].state = IPC_PHONE_FREE; |
if (TASK->phones[i].state == IPC_PHONE_FREE) { |
TASK->phones[i].state = IPC_PHONE_CONNECTING; |
if (t->phones[i].state == IPC_PHONE_FREE) { |
t->phones[i].state = IPC_PHONE_CONNECTING; |
break; |
} |
} |
spinlock_unlock(&TASK->lock); |
spinlock_unlock(&t->lock); |
if (i == IPC_MAX_PHONES) |
return -1; |
/branches/network/kernel/generic/src/ipc/kbox.c |
---|
84,10 → 84,10 |
interrupts_restore(ipl); |
if (have_kb_thread) { |
LOG("join kb.thread..\n"); |
LOG("Join kb.thread."); |
thread_join(TASK->kb.thread); |
thread_detach(TASK->kb.thread); |
LOG("join done\n"); |
LOG("...join done."); |
TASK->kb.thread = NULL; |
} |
108,12 → 108,10 |
{ |
ipl_t ipl; |
LOG("kbox_proc_phone_hungup()\n"); |
/* Was it our debugger, who hung up? */ |
if (call->sender == TASK->udebug.debugger) { |
/* Terminate debugging session (if any). */ |
LOG("kbox: terminate debug session\n"); |
LOG("Terminate debugging session."); |
ipl = interrupts_disable(); |
spinlock_lock(&TASK->lock); |
udebug_task_cleanup(TASK); |
120,10 → 118,10 |
spinlock_unlock(&TASK->lock); |
interrupts_restore(ipl); |
} else { |
LOG("kbox: was not debugger\n"); |
LOG("Was not debugger."); |
} |
LOG("kbox: continue with hangup message\n"); |
LOG("Continue with hangup message."); |
IPC_SET_RETVAL(call->data, 0); |
ipc_answer(&TASK->kb.box, call); |
145,7 → 143,7 |
} |
mutex_unlock(&TASK->kb.cleanup_lock); |
LOG("phone list is empty\n"); |
LOG("Phone list is empty."); |
*last = true; |
} else { |
*last = false; |
169,7 → 167,7 |
bool done; |
(void)arg; |
LOG("kbox_thread_proc()\n"); |
LOG("Starting."); |
done = false; |
while (!done) { |
201,7 → 199,7 |
} |
} |
LOG("kbox: finished\n"); |
LOG("Exiting."); |
} |
250,7 → 248,7 |
return EINVAL; |
} |
newphid = phone_alloc(); |
newphid = phone_alloc(TASK); |
if (newphid < 0) { |
mutex_unlock(&ta->kb.cleanup_lock); |
return ELIMIT; |
/branches/network/kernel/generic/src/ipc/sysipc.c |
---|
93,6 → 93,8 |
static inline int method_is_forwardable(unative_t method) |
{ |
switch (method) { |
case IPC_M_CONNECTION_CLONE: |
case IPC_M_CONNECT_ME: |
case IPC_M_PHONE_HUNGUP: |
/* This message is meant only for the original recipient. */ |
return 0; |
140,6 → 142,8 |
static inline int answer_need_old(call_t *call) |
{ |
switch (IPC_GET_METHOD(call->data)) { |
case IPC_M_CONNECTION_CLONE: |
case IPC_M_CONNECT_ME: |
case IPC_M_CONNECT_TO_ME: |
case IPC_M_CONNECT_ME_TO: |
case IPC_M_SHARE_OUT: |
182,9 → 186,48 |
if (!olddata) |
return 0; |
if (IPC_GET_METHOD(*olddata) == IPC_M_CONNECT_TO_ME) { |
if (IPC_GET_METHOD(*olddata) == IPC_M_CONNECTION_CLONE) { |
phoneid = IPC_GET_ARG1(*olddata); |
phone_t *phone = &TASK->phones[phoneid]; |
if (IPC_GET_RETVAL(answer->data) != EOK) { |
/* |
* The recipient of the cloned phone rejected the offer. |
* In this case, the connection was established at the |
* request time and therefore we need to slam the phone. |
* We don't merely hangup as that would result in |
* sending IPC_M_HUNGUP to the third party on the |
* other side of the cloned phone. |
*/ |
mutex_lock(&phone->lock); |
if (phone->state == IPC_PHONE_CONNECTED) { |
spinlock_lock(&phone->callee->lock); |
list_remove(&phone->link); |
phone->state = IPC_PHONE_SLAMMED; |
spinlock_unlock(&phone->callee->lock); |
} |
mutex_unlock(&phone->lock); |
} |
} else if (IPC_GET_METHOD(*olddata) == IPC_M_CONNECT_ME) { |
phone_t *phone = (phone_t *)IPC_GET_ARG5(*olddata); |
if (IPC_GET_RETVAL(answer->data) != EOK) { |
/* |
* The other party on the cloned phoned rejected our |
* request for connection on the protocol level. |
* We need to break the connection without sending |
* IPC_M_HUNGUP back. |
*/ |
mutex_lock(&phone->lock); |
if (phone->state == IPC_PHONE_CONNECTED) { |
spinlock_lock(&phone->callee->lock); |
list_remove(&phone->link); |
phone->state = IPC_PHONE_SLAMMED; |
spinlock_unlock(&phone->callee->lock); |
} |
mutex_unlock(&phone->lock); |
} |
} else if (IPC_GET_METHOD(*olddata) == IPC_M_CONNECT_TO_ME) { |
phoneid = IPC_GET_ARG5(*olddata); |
if (IPC_GET_RETVAL(answer->data)) { |
if (IPC_GET_RETVAL(answer->data) != EOK) { |
/* The connection was not accepted */ |
phone_dealloc(phoneid); |
} else { |
196,7 → 239,7 |
} |
} else if (IPC_GET_METHOD(*olddata) == IPC_M_CONNECT_ME_TO) { |
/* If the users accepted call, connect */ |
if (!IPC_GET_RETVAL(answer->data)) { |
if (IPC_GET_RETVAL(answer->data) == EOK) { |
ipc_phone_connect((phone_t *) IPC_GET_ARG5(*olddata), |
&TASK->answerbox); |
} |
293,6 → 336,26 |
return 0; |
} |
static void phones_lock(phone_t *p1, phone_t *p2) |
{ |
if (p1 < p2) { |
mutex_lock(&p1->lock); |
mutex_lock(&p2->lock); |
} else if (p1 > p2) { |
mutex_lock(&p2->lock); |
mutex_lock(&p1->lock); |
} else { |
mutex_lock(&p1->lock); |
} |
} |
static void phones_unlock(phone_t *p1, phone_t *p2) |
{ |
mutex_unlock(&p1->lock); |
if (p1 != p2) |
mutex_unlock(&p2->lock); |
} |
/** Called before the request is sent. |
* |
* @param call Call structure with the request. |
308,8 → 371,39 |
int rc; |
switch (IPC_GET_METHOD(call->data)) { |
case IPC_M_CONNECTION_CLONE: { |
phone_t *cloned_phone; |
GET_CHECK_PHONE(cloned_phone, IPC_GET_ARG1(call->data), |
return ENOENT); |
phones_lock(cloned_phone, phone); |
if ((cloned_phone->state != IPC_PHONE_CONNECTED) || |
phone->state != IPC_PHONE_CONNECTED) { |
phones_unlock(cloned_phone, phone); |
return EINVAL; |
} |
/* |
* We can be pretty sure now that both tasks exist and we are |
* connected to them. As we continue to hold the phone locks, |
* we are effectively preventing them from finishing their |
* potential cleanup. |
*/ |
newphid = phone_alloc(phone->callee->task); |
if (newphid < 0) { |
phones_unlock(cloned_phone, phone); |
return ELIMIT; |
} |
ipc_phone_connect(&phone->callee->task->phones[newphid], |
cloned_phone->callee); |
phones_unlock(cloned_phone, phone); |
/* Set the new phone for the callee. */ |
IPC_SET_ARG1(call->data, newphid); |
break; |
} |
case IPC_M_CONNECT_ME: |
IPC_SET_ARG5(call->data, (unative_t) phone); |
break; |
case IPC_M_CONNECT_ME_TO: |
newphid = phone_alloc(); |
newphid = phone_alloc(TASK); |
if (newphid < 0) |
return ELIMIT; |
/* Set arg5 for server */ |
399,7 → 493,7 |
int phoneid; |
if (IPC_GET_METHOD(call->data) == IPC_M_CONNECT_TO_ME) { |
phoneid = phone_alloc(); |
phoneid = phone_alloc(TASK); |
if (phoneid < 0) { /* Failed to allocate phone */ |
IPC_SET_RETVAL(call->data, ELIMIT); |
ipc_answer(box, call); |
/branches/network/kernel/generic/src/ipc/ipc.c |
---|
328,12 → 328,10 |
list_remove(&phone->link); |
spinlock_unlock(&box->lock); |
if (phone->state != IPC_PHONE_SLAMMED) { |
call = ipc_call_alloc(0); |
IPC_SET_METHOD(call->data, IPC_M_PHONE_HUNGUP); |
call->flags |= IPC_CALL_DISCARD_ANSWER; |
_ipc_call(phone, box, call); |
} |
call = ipc_call_alloc(0); |
IPC_SET_METHOD(call->data, IPC_M_PHONE_HUNGUP); |
call->flags |= IPC_CALL_DISCARD_ANSWER; |
_ipc_call(phone, box, call); |
} |
phone->state = IPC_PHONE_HUNGUP; |
/branches/network/kernel/generic/src/udebug/udebug.c |
---|
98,27 → 98,6 |
waitq_sleep_finish(wq, rc, ipl); |
} |
/** Do a preliminary check that a debugging session is in progress. |
* |
* This only requires the THREAD->udebug.lock mutex (and not TASK->udebug.lock |
* mutex). For an undebugged task, this will never block (while there could be |
* collisions by different threads on the TASK mutex), thus improving SMP |
* perormance for undebugged tasks. |
* |
* @return True if the thread was in a debugging session when the function |
* checked, false otherwise. |
*/ |
static bool udebug_thread_precheck(void) |
{ |
bool res; |
mutex_lock(&THREAD->udebug.lock); |
res = THREAD->udebug.active; |
mutex_unlock(&THREAD->udebug.lock); |
return res; |
} |
/** Start of stoppable section. |
* |
* A stoppable section is a section of code where if the thread can be stoped. In other words, |
137,11 → 116,6 |
ASSERT(THREAD); |
ASSERT(TASK); |
/* Early check for undebugged tasks */ |
if (!udebug_thread_precheck()) { |
return; |
} |
mutex_lock(&TASK->udebug.lock); |
nsc = --TASK->udebug.not_stoppable_count; |
202,11 → 176,6 |
*/ |
void udebug_stoppable_end(void) |
{ |
/* Early check for undebugged tasks */ |
if (!udebug_thread_precheck()) { |
return; |
} |
restart: |
mutex_lock(&TASK->udebug.lock); |
mutex_lock(&THREAD->udebug.lock); |
255,11 → 224,6 |
etype = end_variant ? UDEBUG_EVENT_SYSCALL_E : UDEBUG_EVENT_SYSCALL_B; |
/* Early check for undebugged tasks */ |
if (!udebug_thread_precheck()) { |
return; |
} |
mutex_lock(&TASK->udebug.lock); |
mutex_lock(&THREAD->udebug.lock); |
271,7 → 235,7 |
return; |
} |
//printf("udebug_syscall_event\n"); |
/* Fill in the GO response. */ |
call = THREAD->udebug.go_call; |
THREAD->udebug.go_call = NULL; |
279,7 → 243,6 |
IPC_SET_ARG1(call->data, etype); |
IPC_SET_ARG2(call->data, id); |
IPC_SET_ARG3(call->data, rc); |
//printf("udebug_syscall_event/ipc_answer\n"); |
THREAD->udebug.syscall_args[0] = a1; |
THREAD->udebug.syscall_args[1] = a2; |
329,21 → 292,19 |
thread_attach(t, ta); |
LOG("udebug_thread_b_event\n"); |
LOG("- check state\n"); |
LOG("Check state"); |
/* Must only generate events when in debugging session */ |
if (THREAD->udebug.active != true) { |
LOG("- udebug.active: %s, udebug.go: %s\n", |
THREAD->udebug.active ? "yes(+)" : "no(-)", |
THREAD->udebug.go ? "yes(-)" : "no(+)"); |
LOG("udebug.active: %s, udebug.go: %s", |
THREAD->udebug.active ? "Yes(+)" : "No", |
THREAD->udebug.go ? "Yes(-)" : "No"); |
mutex_unlock(&THREAD->udebug.lock); |
mutex_unlock(&TASK->udebug.lock); |
return; |
} |
LOG("- trigger event\n"); |
LOG("Trigger event"); |
call = THREAD->udebug.go_call; |
THREAD->udebug.go_call = NULL; |
IPC_SET_RETVAL(call->data, 0); |
363,7 → 324,7 |
mutex_unlock(&THREAD->udebug.lock); |
mutex_unlock(&TASK->udebug.lock); |
LOG("- sleep\n"); |
LOG("Wait for Go"); |
udebug_wait_for_go(&THREAD->udebug.go_wq); |
} |
379,21 → 340,19 |
mutex_lock(&TASK->udebug.lock); |
mutex_lock(&THREAD->udebug.lock); |
LOG("udebug_thread_e_event\n"); |
LOG("- check state\n"); |
LOG("Check state"); |
/* Must only generate events when in debugging session. */ |
if (THREAD->udebug.active != true) { |
/* printf("- udebug.active: %s, udebug.go: %s\n", |
THREAD->udebug.active ? "yes(+)" : "no(-)", |
THREAD->udebug.go ? "yes(-)" : "no(+)");*/ |
LOG("udebug.active: %s, udebug.go: %s", |
THREAD->udebug.active ? "Yes" : "No", |
THREAD->udebug.go ? "Yes" : "No"); |
mutex_unlock(&THREAD->udebug.lock); |
mutex_unlock(&TASK->udebug.lock); |
return; |
} |
LOG("- trigger event\n"); |
LOG("Trigger event"); |
call = THREAD->udebug.go_call; |
THREAD->udebug.go_call = NULL; |
IPC_SET_RETVAL(call->data, 0); |
432,15 → 391,13 |
int flags; |
ipl_t ipl; |
LOG("udebug_task_cleanup()\n"); |
LOG("task %" PRIu64 "\n", ta->taskid); |
if (ta->udebug.dt_state != UDEBUG_TS_BEGINNING && |
ta->udebug.dt_state != UDEBUG_TS_ACTIVE) { |
LOG("udebug_task_cleanup(): task not being debugged\n"); |
return EINVAL; |
} |
LOG("Task %" PRIu64, ta->taskid); |
/* Finish debugging of all userspace threads */ |
for (cur = ta->th_head.next; cur != &ta->th_head; cur = cur->next) { |
t = list_get_instance(cur, thread_t, th_link); |
470,7 → 427,7 |
t->udebug.go = false; |
/* Answer GO call */ |
LOG("answer GO call with EVENT_FINISHED\n"); |
LOG("Answer GO call with EVENT_FINISHED."); |
IPC_SET_RETVAL(t->udebug.go_call->data, 0); |
IPC_SET_ARG1(t->udebug.go_call->data, |
UDEBUG_EVENT_FINISHED); |
/branches/network/kernel/generic/src/udebug/udebug_ops.c |
---|
181,15 → 181,11 |
thread_t *t; |
link_t *cur; |
LOG("udebug_begin()\n"); |
LOG("Debugging task %llu", TASK->taskid); |
mutex_lock(&TASK->udebug.lock); |
LOG("debugging task %llu\n", TASK->taskid); |
if (TASK->udebug.dt_state != UDEBUG_TS_INACTIVE) { |
mutex_unlock(&TASK->udebug.lock); |
LOG("udebug_begin(): busy error\n"); |
return EBUSY; |
} |
217,10 → 213,6 |
} |
mutex_unlock(&TASK->udebug.lock); |
LOG("udebug_begin() done (%s)\n", |
reply ? "reply" : "stoppability wait"); |
return reply; |
} |
233,13 → 225,10 |
{ |
int rc; |
LOG("udebug_end()\n"); |
LOG("Task %" PRIu64, TASK->taskid); |
mutex_lock(&TASK->udebug.lock); |
LOG("task %" PRIu64 "\n", TASK->taskid); |
rc = udebug_task_cleanup(TASK); |
mutex_unlock(&TASK->udebug.lock); |
return rc; |
254,19 → 243,16 |
*/ |
int udebug_set_evmask(udebug_evmask_t mask) |
{ |
LOG("udebug_set_mask()\n"); |
LOG("mask = 0x%x", mask); |
mutex_lock(&TASK->udebug.lock); |
if (TASK->udebug.dt_state != UDEBUG_TS_ACTIVE) { |
mutex_unlock(&TASK->udebug.lock); |
LOG("udebug_set_mask(): not active debuging session\n"); |
return EINVAL; |
} |
TASK->udebug.evmask = mask; |
mutex_unlock(&TASK->udebug.lock); |
return 0; |
317,7 → 303,7 |
{ |
int rc; |
LOG("udebug_stop()\n"); |
LOG("udebug_stop()"); |
/* |
* On success, this will lock t->udebug.lock. Note that this makes sure |
340,7 → 326,6 |
/* |
* Answer GO call. |
*/ |
LOG("udebug_stop - answering go call\n"); |
/* Make sure nobody takes this call away from us. */ |
call = t->udebug.go_call; |
348,7 → 333,6 |
IPC_SET_RETVAL(call->data, 0); |
IPC_SET_ARG1(call->data, UDEBUG_EVENT_STOP); |
LOG("udebug_stop/ipc_answer\n"); |
THREAD->udebug.cur_event = UDEBUG_EVENT_STOP; |
358,7 → 342,6 |
ipc_answer(&TASK->answerbox, call); |
mutex_unlock(&TASK->udebug.lock); |
LOG("udebog_stop/done\n"); |
return 0; |
} |
392,7 → 375,7 |
int flags; |
size_t max_ids; |
LOG("udebug_thread_read()\n"); |
LOG("udebug_thread_read()"); |
/* Allocate a buffer to hold thread IDs */ |
id_buffer = malloc(buf_size, 0); |