New repo setup
This commit is contained in:
6
test/entry.s
Normal file
6
test/entry.s
Normal file
@@ -0,0 +1,6 @@
|
||||
.section ".text"
|
||||
|
||||
.global _start
|
||||
_start:
|
||||
bl main
|
||||
b _start
|
||||
43
test/linker.ld
Normal file
43
test/linker.ld
Normal file
@@ -0,0 +1,43 @@
|
||||
ENTRY(_start)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
. = 0x200000;
|
||||
|
||||
__begin = .;
|
||||
|
||||
__text_start = .;
|
||||
.text :
|
||||
{
|
||||
*(.text)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
__text_end = .;
|
||||
|
||||
__rodata_start = .;
|
||||
.rodata :
|
||||
{
|
||||
*(.rodata)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
__rodata_end = .;
|
||||
|
||||
__data_start = .;
|
||||
.data :
|
||||
{
|
||||
*(.data)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
__data_end = .;
|
||||
|
||||
__bss_start = .;
|
||||
.bss :
|
||||
{
|
||||
bss = .;
|
||||
*(.bss)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
__bss_end = .;
|
||||
__bss_size = __bss_end - __bss_start;
|
||||
__end = .;
|
||||
}
|
||||
32
test/main.c
Normal file
32
test/main.c
Normal file
@@ -0,0 +1,32 @@
|
||||
#include <stdint.h>
|
||||
#include "sys/syscall.h"
|
||||
|
||||
void trampoline()
|
||||
{
|
||||
sigret();
|
||||
}
|
||||
|
||||
void handler(void *userdata)
|
||||
{
|
||||
printk("Handler called.\n");
|
||||
}
|
||||
|
||||
void thread(void *data)
|
||||
{
|
||||
printk("Thread 2\n");
|
||||
terminate();
|
||||
}
|
||||
|
||||
int main(int argc, char **argv, char **envp)
|
||||
{
|
||||
printk("Process start: ");
|
||||
printk(argv[0]);
|
||||
printk("\n");
|
||||
mmap((void *)0, 0x10000, 1);
|
||||
sigaction(17, handler, trampoline, (void *)0);
|
||||
while (1)
|
||||
{
|
||||
clone(thread, (void *)0x10000, 0, 0);
|
||||
sigwait();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user