mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-29 21:14:27 +01:00
baremetal: build userland/ programs using baremetal path property instead of symlinks
Otherwise I'll go crazy with symlink action.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#include <lkmc/m5ops.h>
|
||||
|
||||
.global mystart
|
||||
mystart:
|
||||
.global lkmc_start
|
||||
lkmc_start:
|
||||
LKMC_M5OPS_EXIT_ASM
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#semihosting */
|
||||
|
||||
.global mystart
|
||||
mystart:
|
||||
.global lkmc_start
|
||||
lkmc_start:
|
||||
mov x1, 0x26
|
||||
movk x1, 2, lsl 16
|
||||
ldr x2, =semihost_args
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
.global mystart
|
||||
mystart:
|
||||
.global lkmc_start
|
||||
lkmc_start:
|
||||
mov r0, #0; mov r1, #0; .inst 0xEE000110 | (0x21 << 16);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
.global mystart
|
||||
mystart:
|
||||
.global lkmc_start
|
||||
lkmc_start:
|
||||
mov r0, #0x18
|
||||
ldr r1, =#0x20026
|
||||
svc 0x00123456
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
../../lkmc/c/add.c
|
||||
@@ -1 +0,0 @@
|
||||
../../lkmc/c/add.py
|
||||
@@ -1 +0,0 @@
|
||||
../../lkmc/c/assert_fail.c
|
||||
@@ -1 +0,0 @@
|
||||
../../lkmc/c/hello.c
|
||||
@@ -1 +0,0 @@
|
||||
../../lkmc/c/infinite_loop.c
|
||||
@@ -1 +0,0 @@
|
||||
../../lkmc/c/stderr.c
|
||||
@@ -1,7 +0,0 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#magic-failure-string */
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(void) {
|
||||
exit(0);
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#magic-failure-string */
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(void) {
|
||||
exit(1);
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <lkmc.h>
|
||||
|
||||
.global mystart
|
||||
mystart:
|
||||
.global lkmc_start
|
||||
lkmc_start:
|
||||
/* = NEON setup */
|
||||
mov x1, #(0x3 << 20)
|
||||
msr cpacr_el1, x1
|
||||
@@ -20,6 +20,7 @@ mystart:
|
||||
bl on_exit
|
||||
|
||||
/* Run main. */
|
||||
mov x0, 0
|
||||
bl main
|
||||
|
||||
/* If main returns, exit. */
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <lkmc.h>
|
||||
|
||||
.global mystart
|
||||
mystart:
|
||||
.global lkmc_start
|
||||
lkmc_start:
|
||||
/* Prepare the stack for main, mandatory for C code. */
|
||||
ldr sp, =stack_top
|
||||
|
||||
@@ -10,6 +10,7 @@ mystart:
|
||||
bl on_exit
|
||||
|
||||
/* Run main. */
|
||||
mov r0, 0
|
||||
bl main
|
||||
|
||||
/* If main returns, exit. */
|
||||
|
||||
@@ -5,6 +5,13 @@
|
||||
#include <lkmc.h>
|
||||
#include <lkmc/m5ops.h>
|
||||
|
||||
void lkmc_baremetal_on_exit_callback(int status, void *arg) {
|
||||
(void)arg;
|
||||
if (status != 0) {
|
||||
printf("lkmc_exit_status_%d\n", status);
|
||||
}
|
||||
}
|
||||
|
||||
enum {
|
||||
UART_FR_RXFE = 0x10,
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
ENTRY(mystart)
|
||||
ENTRY(lkmc_start)
|
||||
SECTIONS
|
||||
{
|
||||
.text : {
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
/* Test out of memory. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(void) {
|
||||
char *ptr = NULL;
|
||||
size_t alloc_size = 1;
|
||||
while (1) {
|
||||
ptr = realloc(ptr, alloc_size);
|
||||
if (ptr == NULL) {
|
||||
puts("out of memory");
|
||||
break;
|
||||
} else {
|
||||
alloc_size <<= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
int main(void) { return 0; }
|
||||
@@ -1,2 +0,0 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#magic-failure-string */
|
||||
int main(void) { return 1; }
|
||||
@@ -1,2 +0,0 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#magic-failure-string */
|
||||
int main(void) { return 2; }
|
||||
Reference in New Issue
Block a user