Basically rewrote the ports subsystem to use:

* its own heap allocator instead of cbuf - this makes cbuf superfluous, and I
  therefore removed it from the kernel. The heap is swappable, so lifts the
  kernel's resource usage a bit. In the future, the heap should grow as well;
  right now it should be at least as good as before.
* it no longer uses spinlocks, but just mutexes now for better scalability - it
  was not usable with interrupts turned off anyway (due to its semaphore usage).
* it no longer uses semaphores, but condition variables.
* Needed to move the port initialization to a later point, as swappable memory
  wasn't usable that early.
* All ports test are still passing, hopefully I didn't mess anything up :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33728 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2009-10-22 13:24:12 +00:00
parent 534a4df194
commit e8885f2097
5 changed files with 398 additions and 1664 deletions
-50
View File
@@ -1,50 +0,0 @@
/*
** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
** Distributed under the terms of the NewOS License.
*/
#ifndef _KERNEL_CBUF_H
#define _KERNEL_CBUF_H
#include <OS.h>
typedef struct cbuf cbuf;
#ifdef __cplusplus
extern "C" {
#endif
status_t cbuf_init(void);
cbuf *cbuf_get_chain(size_t len);
cbuf *cbuf_get_chain_noblock(size_t len);
void cbuf_free_chain_noblock(cbuf *buf);
void cbuf_free_chain(cbuf *buf);
size_t cbuf_get_length(cbuf *buf);
void *cbuf_get_ptr(cbuf *buf, size_t offset);
bool cbuf_is_contig_region(cbuf *buf, size_t start, size_t end);
status_t cbuf_memcpy_to_chain(cbuf *chain, size_t offset, const void *_src, size_t len);
status_t cbuf_memcpy_from_chain(void *dest, cbuf *chain, size_t offset, size_t len);
status_t cbuf_user_memcpy_to_chain(cbuf *chain, size_t offset, const void *_src, size_t len);
status_t cbuf_user_memcpy_from_chain(void *dest, cbuf *chain, size_t offset, size_t len);
uint16 cbuf_ones_cksum16(cbuf *chain, size_t offset, size_t len);
cbuf *cbuf_merge_chains(cbuf *chain1, cbuf *chain2);
cbuf *cbuf_duplicate_chain(cbuf *chain, size_t offset, size_t len);
status_t cbuf_truncate_head(cbuf *chain, size_t trunc_bytes);
status_t cbuf_truncate_tail(cbuf *chain, size_t trunc_bytes);
void cbuf_test(void);
// ToDo: to be removed...
#ifdef __cplusplus
}
#endif
#endif /* _KERNEL_CBUF_H */