-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from plos-clan/new-mtask
New mtask
- Loading branch information
Showing
100 changed files
with
1,336 additions
and
1,394 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
add_binary(pf) | ||
target_link_libraries(pf misc) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// This code is released under the MIT License | ||
|
||
#include <libc-base.h> | ||
#include <sys.h> | ||
|
||
int main(int argc, char **argv) { | ||
mem_set(0x114514, 1); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// Generated by macro 'mkheader'. | ||
// This file is automatically generated, please do not modify it. | ||
#pragma once | ||
#include "data-structure/list.hpp" | ||
#include "data-structure/queue.hpp" | ||
#include "data-structure/rbtree.hpp" | ||
#include "data-structure/ordered-set/list.hpp" | ||
#include "data-structure/ordered-set/queue.hpp" | ||
#include "data-structure/sorted-map/rbtree.hpp" |
2 changes: 1 addition & 1 deletion
2
include/data-structure/event.h → include/data-structure/atomic/event.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#pragma once | ||
#include "base.h" | ||
#include "../base.h" | ||
|
||
#pragma GCC system_header | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
include/data-structure/queue-mt.h → include/data-structure/atomic/queue-mt.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#pragma once | ||
#include "base.h" | ||
#include "../base.h" | ||
|
||
#pragma GCC system_header | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#pragma once | ||
#include <define.h> | ||
|
||
#ifdef __cplusplus | ||
# error "内核不允许使用 C++" | ||
#endif | ||
|
||
// 未完成 | ||
|
||
typedef struct kqueue { | ||
void **buffer; | ||
size_t head; | ||
size_t tail; | ||
size_t capacity; | ||
size_t size; | ||
} *kqueue_t; | ||
|
||
finline void kqueue_init(kqueue_t queue, void **buffer, size_t capacity) { | ||
queue->buffer = buffer; | ||
queue->head = 0; | ||
queue->tail = 0; | ||
queue->capacity = capacity; | ||
atom_store(&queue->size, 0); | ||
} | ||
|
||
finline bool kqueue_enqueue(kqueue_t queue, void *item) { | ||
size_t size = atom_load(&queue->size); | ||
if (size == queue->capacity) { | ||
return false; // Queue is full | ||
} | ||
queue->buffer[queue->tail] = item; | ||
queue->tail = (queue->tail + 1) % queue->capacity; | ||
atom_add(&queue->size, 1); | ||
return true; | ||
} | ||
|
||
finline bool kqueue_dequeue(kqueue_t queue, void **item) { | ||
size_t size = atomic_load(&queue->size); | ||
if (size == 0) { | ||
return false; // Queue is empty | ||
} | ||
*item = queue->buffer[queue->head]; | ||
queue->head = (queue->head + 1) % queue->capacity; | ||
atom_sub(&queue->size, 1); | ||
return true; | ||
} | ||
|
||
finline size_t kqueue_size(kqueue_t queue) { | ||
return atom_load(&queue->size); | ||
} |
2 changes: 1 addition & 1 deletion
2
include/data-structure/slist-strptr.h → ...data-structure/ordered-map/slist-strptr.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#pragma once | ||
#include "base.h" | ||
#include "../base.h" | ||
|
||
#pragma GCC system_header | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
include/data-structure/array-list.h → ...e/data-structure/ordered-set/array-list.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#pragma once | ||
#include "base.h" | ||
#include "../base.h" | ||
|
||
#pragma GCC system_header | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
include/data-structure/bitmap.h → include/data-structure/ordered-set/bitmap.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#pragma once | ||
#include "base.h" | ||
#include "../base.h" | ||
|
||
#pragma GCC system_header | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
include/data-structure/circular-buffer.h → ...a-structure/ordered-set/circular-buffer.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#pragma once | ||
#include "base.h" | ||
#include "../base.h" | ||
|
||
#pragma GCC system_header | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
include/data-structure/circular-queue.h → ...ta-structure/ordered-set/circular-queue.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#pragma once | ||
#include "base.h" | ||
#include "../base.h" | ||
|
||
#pragma GCC system_header | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
include/data-structure/list.h → include/data-structure/ordered-set/list.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#pragma once | ||
#include "base.h" | ||
#include "../base.h" | ||
|
||
#pragma GCC system_header | ||
|
||
|
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
include/data-structure/mbitstream.h → ...e/data-structure/ordered-set/mbitstream.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#pragma once | ||
#include "base.h" | ||
#include "../base.h" | ||
|
||
#pragma GCC system_header | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
include/data-structure/mstream.h → include/data-structure/ordered-set/mstream.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#pragma once | ||
#include "base.h" | ||
#include "../base.h" | ||
|
||
#pragma GCC system_header | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
include/data-structure/queue.h → include/data-structure/ordered-set/queue.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#pragma once | ||
#include "base.h" | ||
#include "../base.h" | ||
|
||
#pragma GCC system_header | ||
|
||
|
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
include/data-structure/sized-event.h- → ...data-structure/ordered-set/sized-event.h-
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
include/data-structure/slist.h → include/data-structure/ordered-set/slist.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#pragma once | ||
#include "base.h" | ||
#include "../base.h" | ||
|
||
#pragma GCC system_header | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
include/data-structure/rbtree.h → include/data-structure/sorted-map/rbtree.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#pragma once | ||
#include "base.h" | ||
#include "../base.h" | ||
|
||
#pragma GCC system_header | ||
|
||
|
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
include/data-structure/trie.h → include/data-structure/sorted-map/trie.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#pragma once | ||
#include "base.h" | ||
#include "../base.h" | ||
|
||
#pragma GCC system_header | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.