Commit 552bd976 authored by Anton Burtsev's avatar Anton Burtsev Committed by Vikram Narayanan

ioctl interface to LCD

parent c5748e0c
...@@ -2240,7 +2240,7 @@ int lcd_run(struct lcd *lcd) { ...@@ -2240,7 +2240,7 @@ int lcd_run(struct lcd *lcd) {
EXPORT_SYMBOL(lcd_run); EXPORT_SYMBOL(lcd_run);
int setup_vmlinux(struct lcd *lcd, char *file) { int lcd_setup_vmlinux(struct lcd *lcd, char *file) {
int ret; int ret;
u64 elf_entry; u64 elf_entry;
......
...@@ -92,6 +92,7 @@ void lcd_vmx_exit(void); ...@@ -92,6 +92,7 @@ void lcd_vmx_exit(void);
int lcd_init_module(void __user * umod, unsigned long len, const char __user * uargs); int lcd_init_module(void __user * umod, unsigned long len, const char __user * uargs);
//int lcd_load_module(struct load_info *info, const char __user *uargs, int flags); //int lcd_load_module(struct load_info *info, const char __user *uargs, int flags);
int lcd_setup_vmlinux(struct lcd *lcd, char *file);
int lcd_load_vmlinux(const char* kfile, struct lcd *lcd, u64 *elf_entry); int lcd_load_vmlinux(const char* kfile, struct lcd *lcd, u64 *elf_entry);
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#define LCD_LOAD_PV_KERNEL _IOR(LCD_MINOR, 0x01, struct lcd_pv_kernel_config) #define LCD_LOAD_PV_KERNEL _IOR(LCD_MINOR, 0x01, struct lcd_pv_kernel_config)
struct lcd_pv_kernel_config { struct lcd_pv_kernel_config {
char file[PATH_MAX]; char *file;
__u64 length;
} __attribute__((packed)); } __attribute__((packed));
...@@ -3759,7 +3759,7 @@ static int load_module(struct load_info *info, const char __user *uargs, ...@@ -3759,7 +3759,7 @@ static int load_module(struct load_info *info, const char __user *uargs,
static int load_lcd(struct load_info *info, const char __user *uargs, static int load_lcd(struct load_info *info, const char __user *uargs,
int flags) int flags)
{ {
struct lcd * lcd; struct lcd * lcd;
struct module *mod; struct module *mod;
long err; long err;
...@@ -3865,7 +3865,6 @@ static int load_lcd(struct load_info *info, const char __user *uargs, ...@@ -3865,7 +3865,6 @@ static int load_lcd(struct load_info *info, const char __user *uargs,
lcd_move_module(lcd, mod); lcd_move_module(lcd, mod);
lcd_run(lcd); lcd_run(lcd);
return 0; return 0;
// return do_init_module(mod);
bug_cleanup: bug_cleanup:
/* module_bug_cleanup needs module_mutex protection */ /* module_bug_cleanup needs module_mutex protection */
......
...@@ -24,20 +24,41 @@ static long lcd_dev_ioctl(struct file *filp, ...@@ -24,20 +24,41 @@ static long lcd_dev_ioctl(struct file *filp,
unsigned int ioctl, unsigned long arg) unsigned int ioctl, unsigned long arg)
{ {
long r = -EINVAL; long r = -EINVAL;
struct lcd_pv_kernel_config conf;
switch (ioctl) { switch (ioctl) {
case LCD_LOAD_PV_KERNEL: case LCD_LOAD_PV_KERNEL:
//r = copy_from_user(&conf, (int __user *) arg, {
// sizeof(struct lcd_pv_kernel_config)); int error;
//if (r) { struct lcd *lcd;
// r = -EIO; struct filename *filename;
// goto out; struct lcd_pv_kernel_config conf;
//}
r = copy_from_user(&conf, (int __user *) arg,
sizeof(conf));
if (r) {
r = -EIO;
goto out;
}
/* create LCD with a PV Linux kernel */ /* create LCD with a PV Linux kernel */
lcd = lcd_create();
if (!lcd) {
r = -ENOMEM;
goto out;
}
filename = getname((const char __user *) conf.file);
error = PTR_ERR(filename);
if (IS_ERR(filename))
goto out;
lcd_setup_vmlinux(lcd, filename->name);
putname(filename);
lcd_run(lcd);
break; break;
}
default: default:
return -ENOTTY; return -ENOTTY;
} }
......
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