Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
75e7f93c
提交
75e7f93c
12月 26, 2011
创建
作者:
Silas Boyd-Wickizer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Implement SYS_LIGHTWEIGHT_PROT, and use LWIP_COMPAT_MUTEX
上级
440a6621
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
37 行增加
和
37 行删除
+37
-37
sys_arch.h
net/arch/sys_arch.h
+2
-15
lwipopts.h
net/lwipopts.h
+2
-1
sys_arch.c
net/sys_arch.c
+33
-21
没有找到文件。
net/arch/sys_arch.h
浏览文件 @
75e7f93c
...
@@ -6,6 +6,8 @@
...
@@ -6,6 +6,8 @@
typedef
struct
proc
*
sys_thread_t
;
typedef
struct
proc
*
sys_thread_t
;
typedef
u64
sys_prot_t
;
typedef
struct
sys_mbox
{
typedef
struct
sys_mbox
{
#define MBOXSLOTS 32
#define MBOXSLOTS 32
struct
spinlock
s
;
struct
spinlock
s
;
...
@@ -21,21 +23,6 @@ typedef struct sys_sem {
...
@@ -21,21 +23,6 @@ typedef struct sys_sem {
u8
count
;
u8
count
;
}
sys_sem_t
;
}
sys_sem_t
;
typedef
struct
sys_mutex
{
struct
spinlock
s
;
}
sys_mutex_t
;
#define SYS_MBOX_NULL (-1)
#define SYS_SEM_NULL (-1)
void
lwip_core_lock
(
void
);
void
lwip_core_unlock
(
void
);
void
lwip_core_init
(
void
);
#define SYS_ARCH_DECL_PROTECT(lev)
#define SYS_ARCH_PROTECT(lev)
#define SYS_ARCH_UNPROTECT(lev)
#define SYS_ARCH_NOWAIT 0xfffffffe
#define SYS_ARCH_NOWAIT 0xfffffffe
#endif
#endif
net/lwipopts.h
浏览文件 @
75e7f93c
...
@@ -5,7 +5,8 @@
...
@@ -5,7 +5,8 @@
#define LWIP_STATS_DISPLAY 0
#define LWIP_STATS_DISPLAY 0
#define LWIP_DHCP 1
#define LWIP_DHCP 1
#define LWIP_COMPAT_SOCKETS 0
#define LWIP_COMPAT_SOCKETS 0
//#define SYS_LIGHTWEIGHT_PROT 1
#define LWIP_COMPAT_MUTEX 1
#define SYS_LIGHTWEIGHT_PROT 1
#define LWIP_PROVIDE_ERRNO 1
#define LWIP_PROVIDE_ERRNO 1
#define MEM_ALIGNMENT 4
#define MEM_ALIGNMENT 4
...
...
net/sys_arch.c
浏览文件 @
75e7f93c
...
@@ -4,9 +4,16 @@
...
@@ -4,9 +4,16 @@
#include "queue.h"
#include "queue.h"
#include "kernel.h"
#include "kernel.h"
#include "proc.h"
#include "proc.h"
#include "cpu.h"
#define DIE panic(__func__)
#define DIE panic(__func__)
static
struct
{
struct
spinlock
lk
;
struct
cpu
*
cpu
;
u64
depth
;
}
lwprot
;
//
//
// mbox
// mbox
//
//
...
@@ -129,31 +136,36 @@ sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout)
...
@@ -129,31 +136,36 @@ sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout)
}
}
//
//
//
mutex
//
protect
//
//
err_t
sys_prot_t
sys_mutex_new
(
sys_mutex_t
*
mutex
)
sys_arch_protect
(
void
)
{
{
initlock
(
&
mutex
->
s
,
"lwIP mutex"
);
sys_prot_t
r
;
return
ERR_OK
;
}
pushcli
();
if
(
lwprot
.
cpu
==
mycpu
())
void
r
=
lwprot
.
depth
++
;
sys_mutex_lock
(
sys_mutex_t
*
mutex
)
else
{
{
acquire
(
&
lwprot
.
lk
);
DIE
;
r
=
lwprot
.
depth
++
;
}
lwprot
.
cpu
=
mycpu
();
}
popcli
();
void
return
r
;
sys_mutex_unlock
(
sys_mutex_t
*
mutex
)
{
DIE
;
}
}
void
void
sys_mutex_free
(
sys_mutex_t
*
mutex
)
sys_arch_unprotect
(
sys_prot_t
pval
)
{
{
DIE
;
if
(
lwprot
.
cpu
!=
mycpu
()
||
lwprot
.
depth
==
0
)
panic
(
"sys_arch_unprotect"
);
lwprot
.
depth
--
;
if
(
lwprot
.
depth
==
0
)
{
lwprot
.
cpu
=
NULL
;
release
(
&
lwprot
.
lk
);
}
}
}
//
//
...
@@ -184,6 +196,6 @@ sys_thread_new(const char *name, lwip_thread_fn thread, void *arg,
...
@@ -184,6 +196,6 @@ sys_thread_new(const char *name, lwip_thread_fn thread, void *arg,
void
void
sys_init
(
void
)
sys_init
(
void
)
{
{
initlock
(
&
lwprot
.
lk
,
"lwIP lwprot"
);
}
}
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论