-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsample.c
More file actions
38 lines (34 loc) · 819 Bytes
/
sample.c
File metadata and controls
38 lines (34 loc) · 819 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "external.h"
#include "sample.h"
#define PAYLOAD_PRIORITY 11
#define PAYLOAD_STACKSIZE 0x2000
/* Globals */
int __start(void)
{
printf("__start called\n");
int payload_handle;
char* payload_stack = malloc(PAYLOAD_STACKSIZE * sizeof(char));
static cyg_thread payload_thread;
int id = 0;
int res;
printf("calling cyg_thread_create\n");
cyg_thread_create(
PAYLOAD_PRIORITY,
&payload,
0,
"payload",
payload_stack,
PAYLOAD_STACKSIZE,
&payload_handle,
&payload_thread
);
printf("calling cyg_thread_resume\n");
cyg_thread_resume(payload_handle);
return 0;
}
int payload(void){
while(1){
printf("\n[+] I'm a sample thread, running in the background.\n");
sleep(5);
}
}