Commit 9da60c1b authored by Vikram Narayanan's avatar Vikram Narayanan

merge/v4.8/lcd/test_mods: Fix compilation issues

Also remove pmfs from build
Signed-off-by: Vikram Narayanan's avatarVikram Narayanan <vikram186@gmail.com>
parent e4a727ad
......@@ -495,7 +495,7 @@ fail1:
void cpucache_init(void);
static void __init_refok kmalloc_init(void)
static void __ref kmalloc_init(void)
{
kmem_cache_init();
kmem_cache_init_late();
......
......@@ -20,7 +20,7 @@ obj-m += async/
obj-m += create_klcd/
obj-m += glue_example/
obj-m += string_example/
obj-m += pmfs/
#obj-m += pmfs/
obj-m += bug/
obj-m += async_rpc/
obj-m += llvm_example/
......
/**
* boot.c - non-isolated kernel module, does setup
*
*/
#include <lcd_config/pre_hook.h>
#include <liblcd/liblcd.h>
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <lcd_config/post_hook.h>
static int boot_main(void)
{
int ret;
struct lcd_create_ctx *ctx;
cptr_t lcd;
/*
* Enter lcd mode
*/
ret = lcd_enter();
if (ret) {
LIBLCD_ERR("enter");
goto fail1;
}
/*
* Create a new lcd
*/
ret = lcd_create_module_lcd(LCD_DIR("bug/lcd"),
"lcd_test_mod_bug_lcd",
&lcd,
&ctx);
if (ret) {
LIBLCD_ERR("create module lcd");
goto fail2;
}
/*
* Run it
*/
ret = lcd_run(lcd);
if (ret) {
LIBLCD_ERR("run lcd");
goto fail3;
}
/*
* Wait for 4 seconds
*/
msleep(4000);
/*
* Tear everything down
*/
ret = 0;
goto out;
out:
fail3:
lcd_cap_delete(lcd);
lcd_destroy_create_ctx(ctx);
fail2:
lcd_exit(0);
fail1:
return ret;
}
static int boot_init(void)
{
int ret;
LCD_MAIN({
ret = boot_main();
});
return ret;
}
static void boot_exit(void)
{
/* nothing to do */
}
module_init(boot_init);
module_exit(boot_exit);
/*
* LCD BUG() and oops test. This LCD crashes to generate a
* kernel oops.
*
* This code *must* be compiled with optimizations turned off, or
* else it won't do what we want.
*/
#include <lcd_config/pre_hook.h>
#include <linux/jiffies.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <liblcd/liblcd.h>
#include <lcd_config/post_hook.h>
void foo5(void) {
unsigned char stack_array [] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1, 2, 3, 4};
register long rax asm ("rax");
register long rbx asm ("rbx");
register long rcx asm ("rcx");
register long rdx asm ("rdx");
register long rdi asm ("rdi");
register long rsi asm ("rsi");
register long r8 asm ("r8");
register long r9 asm ("r9");
register long r10 asm ("r10");
register long r11 asm ("r11");
register long r12 asm ("r12");
register long r13 asm ("r13");
register long r14 asm ("r14");
register long r15 asm ("r15");
rax = 1;
rbx = 2;
rcx = 3;
rdx = 4;
rsi = 5;
rdi = 6;
r8 = 7;
r9 = 8;
r10 = 9;
r11 = 0xa;
r12 = 0xb;
r13 = 0xc;
r14 = 0xd;
r15 = 0xe;
jiffies_to_clock_t(100000);
rax = stack_array[0];
return;
};
void foo4 (void) {
foo5();
return;
}
void foo3 (void) {
foo4();
return;
}
void foo2 (void) {
foo3();
return;
}
void foo1 (void) {
foo2();
return;
}
static int __noreturn test_init(void)
{
int r;
r = lcd_enter();
if (r)
goto fail1;
foo1();
fail1:
lcd_exit(r);
}
static int __test_init(void)
{
int ret;
LCD_MAIN({
ret = test_init();
});
return ret;
}
/*
* make module loader happy (so we can unload). we don't actually call
* this before unloading the lcd (yet)
*/
static void __exit test_exit(void)
{
return;
}
module_init(__test_init);
module_exit(test_exit);
......@@ -13,6 +13,7 @@
/* COMPILER: This is always included. */
#include <liblcd/sync_ipc_poll.h>
#include <linux/module.h>
/* COMPILER: This always goes after all includes */
#include <lcd_config/post_hook.h>
......
......@@ -13,6 +13,8 @@
/* COMPILER: This is always included. */
#include <liblcd/sync_ipc_poll.h>
#include <linux/module.h>
/* COMPILER: This is always included after all includes. */
#include <lcd_config/post_hook.h>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment