Skip to content

Commit d3bd9a2

Browse files
committed
wutnewlib: implement new unified threading syscalls (replaces wutstdc++)
1 parent 6cd63fe commit d3bd9a2

16 files changed

Lines changed: 294 additions & 924 deletions

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ TARGET := wut
1616
SOURCES := cafe \
1717
libraries/wutcrt \
1818
libraries/wutnewlib \
19-
libraries/wutstdc++ \
2019
libraries/wutmalloc \
2120
libraries/wutdevoptab \
2221
libraries/wutsocket \

libraries/wutcrt/wut_crt.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,13 @@
22
void
33
__init_wut_newlib();
44
void
5-
__init_wut_stdcpp();
6-
void
75
__init_wut_devoptab();
86
void __attribute__((weak))
97
__init_wut_socket();
108

119
void
1210
__fini_wut_newlib();
1311
void
14-
__fini_wut_stdcpp();
15-
void
1612
__fini_wut_devoptab();
1713
void __attribute__((weak))
1814
__fini_wut_socket();
@@ -21,7 +17,6 @@ void __attribute__((weak))
2117
__init_wut()
2218
{
2319
__init_wut_newlib();
24-
__init_wut_stdcpp();
2520
__init_wut_devoptab();
2621
if (&__init_wut_socket) __init_wut_socket();
2722
}
@@ -31,6 +26,5 @@ __fini_wut()
3126
{
3227
if (&__fini_wut_socket) __fini_wut_socket();
3328
__fini_wut_devoptab();
34-
__fini_wut_stdcpp();
3529
__fini_wut_newlib();
3630
}

libraries/wutcrt/wut_preinit.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
void
44
__init_wut_sbrk_heap(MEMHeapHandle heapHandle);
55
void
6-
__init_wut_malloc_lock();
6+
__init_wut_thread();
77
void
88
__init_wut_defaultheap();
99

@@ -13,6 +13,6 @@ __preinit_user(MEMHeapHandle *mem1,
1313
MEMHeapHandle *mem2)
1414
{
1515
__init_wut_sbrk_heap(*mem2);
16-
__init_wut_malloc_lock();
16+
__init_wut_thread();
1717
__init_wut_defaultheap();
1818
}

libraries/wutnewlib/wut_lock.c

Lines changed: 0 additions & 80 deletions
This file was deleted.

libraries/wutnewlib/wut_malloc_lock.c

Lines changed: 0 additions & 23 deletions
This file was deleted.

libraries/wutnewlib/wut_newlib.c

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -71,65 +71,6 @@ _sbrk_r(struct _reent *ptr, ptrdiff_t incr)
7171
return __wut_sbrk_r(ptr, incr);
7272
}
7373

74-
void
75-
__syscall_lock_init(int *lock)
76-
{
77-
__wut_lock_init(lock, 0);
78-
}
79-
80-
void
81-
__syscall_lock_acquire(int *lock)
82-
{
83-
__wut_lock_acquire(lock);
84-
}
85-
86-
void
87-
__syscall_lock_release(int *lock)
88-
{
89-
__wut_lock_release(lock);
90-
}
91-
92-
void
93-
__syscall_lock_close(int *lock)
94-
{
95-
__wut_lock_close(lock);
96-
}
97-
void
98-
__syscall_lock_init_recursive(_LOCK_T *lock)
99-
{
100-
__wut_lock_init(lock, 1);
101-
}
102-
103-
void
104-
__syscall_lock_acquire_recursive(int *lock)
105-
{
106-
__wut_lock_acquire(lock);
107-
}
108-
109-
void
110-
__syscall_lock_release_recursive(int *lock)
111-
{
112-
__wut_lock_release(lock);
113-
}
114-
115-
void
116-
__syscall_lock_close_recursive(int *lock)
117-
{
118-
__wut_lock_close(lock);
119-
}
120-
121-
void
122-
__syscall_malloc_lock(struct _reent *ptr)
123-
{
124-
return __wut_malloc_lock(ptr);
125-
}
126-
127-
void
128-
__syscall_malloc_unlock(struct _reent *ptr)
129-
{
130-
return __wut_malloc_unlock(ptr);
131-
}
132-
13374
struct _reent *
13475
__syscall_getreent(void)
13576
{

libraries/wutnewlib/wut_newlib.h

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,14 @@
66
#include <sys/reent.h>
77
#include <sys/time.h>
88

9+
#define __WUT_MAX_KEYS (128)
10+
#define __WUT_STACK_SIZE (128 * 1024)
11+
12+
#define __WUT_KEY_THREAD_SPECIFIC_ID WUT_THREAD_SPECIFIC_0
13+
914
void *
1015
__wut_sbrk_r(struct _reent *r, ptrdiff_t incr);
1116
int
12-
__wut_lock_init(int *lock, int recursive);
13-
int
14-
__wut_lock_close(int *lock);
15-
int
16-
__wut_lock_acquire(int *lock);
17-
int
18-
__wut_lock_release(int *lock);
19-
void
20-
__wut_malloc_lock(struct _reent *r);
21-
void
22-
__wut_malloc_unlock(struct _reent *r);
23-
int
2417
__wut_gettod_r(struct _reent *ptr, struct timeval *tp, struct timezone *tz);
2518
int
2619
__wut_clock_gettime(clockid_t clock_id, struct timespec *tp);

0 commit comments

Comments
 (0)