Commit fa453a62 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus-3.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml

Pull UML changes from Richard Weinberger:
 "Mostly bug fixes and cleanups"

* 'for-linus-3.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml: (35 commits)
  um: Update defconfig
  um: Switch to large mcmodel on x86_64
  MTD: Relax dependencies
  um: Wire CONFIG_GENERIC_IO up
  um: Serve io_remap_pfn_range()
  Introduce CONFIG_GENERIC_IO
  um: allow SUBARCH=x86
  um: most of the SUBARCH uses can be killed
  um: deadlock in line_write_interrupt()
  um: don't bother trying to rebuild CHECKFLAGS for USER_OBJS
  um: use the right ifdef around exports in user_syms.c
  um: a bunch of headers can be killed by using generic-y
  um: ptrace-generic.h doesn't need user.h
  um: kill HOST_TASK_PID
  um: remove pointless include of asm/fixmap.h from asm/pgtable.h
  um: asm-offsets.h might as well come from underlying arch...
  um: merge processor_{32,64}.h a bit...
  um: switch close_chan() to struct line
  um: race fix: initialize delayed_work *before* registering IRQ
  um: line->have_irq is never checked...
  ...
parents 30eebb54 3463ff44
...@@ -9,6 +9,7 @@ config UML ...@@ -9,6 +9,7 @@ config UML
select HAVE_GENERIC_HARDIRQS select HAVE_GENERIC_HARDIRQS
select GENERIC_IRQ_SHOW select GENERIC_IRQ_SHOW
select GENERIC_CPU_DEVICES select GENERIC_CPU_DEVICES
select GENERIC_IO
config MMU config MMU
bool bool
......
...@@ -28,6 +28,7 @@ ifeq ($(SUBARCH),i386) ...@@ -28,6 +28,7 @@ ifeq ($(SUBARCH),i386)
endif endif
ifeq ($(SUBARCH),x86_64) ifeq ($(SUBARCH),x86_64)
HEADER_ARCH := x86 HEADER_ARCH := x86
KBUILD_CFLAGS += -mcmodel=large
endif endif
HOST_DIR := arch/$(HEADER_ARCH) HOST_DIR := arch/$(HEADER_ARCH)
...@@ -50,7 +51,7 @@ KBUILD_CPPFLAGS += -I$(srctree)/$(HOST_DIR)/um ...@@ -50,7 +51,7 @@ KBUILD_CPPFLAGS += -I$(srctree)/$(HOST_DIR)/um
# #
# These apply to USER_CFLAGS to. # These apply to USER_CFLAGS to.
KBUILD_CFLAGS += $(CFLAGS) $(CFLAGS-y) -D__arch_um__ -DSUBARCH=\"$(SUBARCH)\" \ KBUILD_CFLAGS += $(CFLAGS) $(CFLAGS-y) -D__arch_um__ \
$(ARCH_INCLUDE) $(MODE_INCLUDE) -Dvmap=kernel_vmap \ $(ARCH_INCLUDE) $(MODE_INCLUDE) -Dvmap=kernel_vmap \
-Din6addr_loopback=kernel_in6addr_loopback \ -Din6addr_loopback=kernel_in6addr_loopback \
-Din6addr_any=kernel_in6addr_any -Dstrrchr=kernel_strrchr -Din6addr_any=kernel_in6addr_any -Dstrrchr=kernel_strrchr
...@@ -99,7 +100,7 @@ KBUILD_KCONFIG := $(HOST_DIR)/um/Kconfig ...@@ -99,7 +100,7 @@ KBUILD_KCONFIG := $(HOST_DIR)/um/Kconfig
archheaders: archheaders:
$(Q)$(MAKE) -C '$(srctree)' KBUILD_SRC= \ $(Q)$(MAKE) -C '$(srctree)' KBUILD_SRC= \
ARCH=$(SUBARCH) O='$(objtree)' archheaders ARCH=$(HEADER_ARCH) O='$(objtree)' archheaders
archprepare: include/generated/user_constants.h archprepare: include/generated/user_constants.h
......
This diff is collapsed.
...@@ -27,24 +27,24 @@ struct chan { ...@@ -27,24 +27,24 @@ struct chan {
void *data; void *data;
}; };
extern void chan_interrupt(struct list_head *chans, struct delayed_work *task, extern void chan_interrupt(struct line *line,
struct tty_struct *tty, int irq); struct tty_struct *tty, int irq);
extern int parse_chan_pair(char *str, struct line *line, int device, extern int parse_chan_pair(char *str, struct line *line, int device,
const struct chan_opts *opts, char **error_out); const struct chan_opts *opts, char **error_out);
extern int write_chan(struct list_head *chans, const char *buf, int len, extern int write_chan(struct chan *chan, const char *buf, int len,
int write_irq); int write_irq);
extern int console_write_chan(struct list_head *chans, const char *buf, extern int console_write_chan(struct chan *chan, const char *buf,
int len); int len);
extern int console_open_chan(struct line *line, struct console *co); extern int console_open_chan(struct line *line, struct console *co);
extern void deactivate_chan(struct list_head *chans, int irq); extern void deactivate_chan(struct chan *chan, int irq);
extern void reactivate_chan(struct list_head *chans, int irq); extern void reactivate_chan(struct chan *chan, int irq);
extern void chan_enable_winch(struct list_head *chans, struct tty_struct *tty); extern void chan_enable_winch(struct chan *chan, struct tty_struct *tty);
extern int enable_chan(struct line *line); extern int enable_chan(struct line *line);
extern void close_chan(struct list_head *chans, int delay_free_irq); extern void close_chan(struct line *line);
extern int chan_window_size(struct list_head *chans, extern int chan_window_size(struct line *line,
unsigned short *rows_out, unsigned short *rows_out,
unsigned short *cols_out); unsigned short *cols_out);
extern int chan_config_string(struct list_head *chans, char *str, int size, extern int chan_config_string(struct line *line, char *str, int size,
char **error_out); char **error_out);
#endif #endif
...@@ -140,18 +140,18 @@ static int open_chan(struct list_head *chans) ...@@ -140,18 +140,18 @@ static int open_chan(struct list_head *chans)
return err; return err;
} }
void chan_enable_winch(struct list_head *chans, struct tty_struct *tty) void chan_enable_winch(struct chan *chan, struct tty_struct *tty)
{ {
struct list_head *ele; if (chan && chan->primary && chan->ops->winch)
struct chan *chan; register_winch(chan->fd, tty);
}
list_for_each(ele, chans) { static void line_timer_cb(struct work_struct *work)
chan = list_entry(ele, struct chan, list); {
if (chan->primary && chan->output && chan->ops->winch) { struct line *line = container_of(work, struct line, task.work);
register_winch(chan->fd, tty);
return; if (!line->throttled)
} chan_interrupt(line, line->tty, line->driver->read_irq);
}
} }
int enable_chan(struct line *line) int enable_chan(struct line *line)
...@@ -160,6 +160,8 @@ int enable_chan(struct line *line) ...@@ -160,6 +160,8 @@ int enable_chan(struct line *line)
struct chan *chan; struct chan *chan;
int err; int err;
INIT_DELAYED_WORK(&line->task, line_timer_cb);
list_for_each(ele, &line->chan_list) { list_for_each(ele, &line->chan_list) {
chan = list_entry(ele, struct chan, list); chan = list_entry(ele, struct chan, list);
err = open_one_chan(chan); err = open_one_chan(chan);
...@@ -183,7 +185,7 @@ int enable_chan(struct line *line) ...@@ -183,7 +185,7 @@ int enable_chan(struct line *line)
return 0; return 0;
out_close: out_close:
close_chan(&line->chan_list, 0); close_chan(line);
return err; return err;
} }
...@@ -244,7 +246,7 @@ static void close_one_chan(struct chan *chan, int delay_free_irq) ...@@ -244,7 +246,7 @@ static void close_one_chan(struct chan *chan, int delay_free_irq)
chan->fd = -1; chan->fd = -1;
} }
void close_chan(struct list_head *chans, int delay_free_irq) void close_chan(struct line *line)
{ {
struct chan *chan; struct chan *chan;
...@@ -253,77 +255,50 @@ void close_chan(struct list_head *chans, int delay_free_irq) ...@@ -253,77 +255,50 @@ void close_chan(struct list_head *chans, int delay_free_irq)
* state. Then, the first one opened will have the original state, * state. Then, the first one opened will have the original state,
* so it must be the last closed. * so it must be the last closed.
*/ */
list_for_each_entry_reverse(chan, chans, list) { list_for_each_entry_reverse(chan, &line->chan_list, list) {
close_one_chan(chan, delay_free_irq); close_one_chan(chan, 0);
} }
} }
void deactivate_chan(struct list_head *chans, int irq) void deactivate_chan(struct chan *chan, int irq)
{ {
struct list_head *ele; if (chan && chan->enabled)
deactivate_fd(chan->fd, irq);
struct chan *chan;
list_for_each(ele, chans) {
chan = list_entry(ele, struct chan, list);
if (chan->enabled && chan->input)
deactivate_fd(chan->fd, irq);
}
} }
void reactivate_chan(struct list_head *chans, int irq) void reactivate_chan(struct chan *chan, int irq)
{ {
struct list_head *ele; if (chan && chan->enabled)
struct chan *chan; reactivate_fd(chan->fd, irq);
list_for_each(ele, chans) {
chan = list_entry(ele, struct chan, list);
if (chan->enabled && chan->input)
reactivate_fd(chan->fd, irq);
}
} }
int write_chan(struct list_head *chans, const char *buf, int len, int write_chan(struct chan *chan, const char *buf, int len,
int write_irq) int write_irq)
{ {
struct list_head *ele;
struct chan *chan = NULL;
int n, ret = 0; int n, ret = 0;
if (len == 0) if (len == 0 || !chan || !chan->ops->write)
return 0; return 0;
list_for_each(ele, chans) { n = chan->ops->write(chan->fd, buf, len, chan->data);
chan = list_entry(ele, struct chan, list); if (chan->primary) {
if (!chan->output || (chan->ops->write == NULL)) ret = n;
continue; if ((ret == -EAGAIN) || ((ret >= 0) && (ret < len)))
reactivate_fd(chan->fd, write_irq);
n = chan->ops->write(chan->fd, buf, len, chan->data);
if (chan->primary) {
ret = n;
if ((ret == -EAGAIN) || ((ret >= 0) && (ret < len)))
reactivate_fd(chan->fd, write_irq);
}
} }
return ret; return ret;
} }
int console_write_chan(struct list_head *chans, const char *buf, int len) int console_write_chan(struct chan *chan, const char *buf, int len)
{ {
struct list_head *ele;
struct chan *chan;
int n, ret = 0; int n, ret = 0;
list_for_each(ele, chans) { if (!chan || !chan->ops->console_write)
chan = list_entry(ele, struct chan, list); return 0;
if (!chan->output || (chan->ops->console_write == NULL))
continue;
n = chan->ops->console_write(chan->fd, buf, len); n = chan->ops->console_write(chan->fd, buf, len);
if (chan->primary) if (chan->primary)
ret = n; ret = n;
}
return ret; return ret;
} }
...@@ -340,20 +315,24 @@ int console_open_chan(struct line *line, struct console *co) ...@@ -340,20 +315,24 @@ int console_open_chan(struct line *line, struct console *co)
return 0; return 0;
} }
int chan_window_size(struct list_head *chans, unsigned short *rows_out, int chan_window_size(struct line *line, unsigned short *rows_out,
unsigned short *cols_out) unsigned short *cols_out)
{ {
struct list_head *ele;
struct chan *chan; struct chan *chan;
list_for_each(ele, chans) { chan = line->chan_in;
chan = list_entry(ele, struct chan, list); if (chan && chan->primary) {
if (chan->primary) { if (chan->ops->window_size == NULL)
if (chan->ops->window_size == NULL) return 0;
return 0; return chan->ops->window_size(chan->fd, chan->data,
return chan->ops->window_size(chan->fd, chan->data, rows_out, cols_out);
rows_out, cols_out); }
} chan = line->chan_out;
if (chan && chan->primary) {
if (chan->ops->window_size == NULL)
return 0;
return chan->ops->window_size(chan->fd, chan->data,
rows_out, cols_out);
} }
return 0; return 0;
} }
...@@ -429,21 +408,15 @@ static int chan_pair_config_string(struct chan *in, struct chan *out, ...@@ -429,21 +408,15 @@ static int chan_pair_config_string(struct chan *in, struct chan *out,
return n; return n;
} }
int chan_config_string(struct list_head *chans, char *str, int size, int chan_config_string(struct line *line, char *str, int size,
char **error_out) char **error_out)
{ {
struct list_head *ele; struct chan *in = line->chan_in, *out = line->chan_out;
struct chan *chan, *in = NULL, *out = NULL;
list_for_each(ele, chans) { if (in && !in->primary)
chan = list_entry(ele, struct chan, list); in = NULL;
if (!chan->primary) if (out && !out->primary)
continue; out = NULL;
if (chan->input)
in = chan;
if (chan->output)
out = chan;
}
return chan_pair_config_string(in, out, str, size, error_out); return chan_pair_config_string(in, out, str, size, error_out);
} }
...@@ -547,10 +520,14 @@ int parse_chan_pair(char *str, struct line *line, int device, ...@@ -547,10 +520,14 @@ int parse_chan_pair(char *str, struct line *line, int device,
char *in, *out; char *in, *out;
if (!list_empty(chans)) { if (!list_empty(chans)) {
line->chan_in = line->chan_out = NULL;
free_chan(chans); free_chan(chans);
INIT_LIST_HEAD(chans); INIT_LIST_HEAD(chans);
} }
if (!str)
return 0;
out = strchr(str, ','); out = strchr(str, ',');
if (out != NULL) { if (out != NULL) {
in = str; in = str;
...@@ -562,6 +539,7 @@ int parse_chan_pair(char *str, struct line *line, int device, ...@@ -562,6 +539,7 @@ int parse_chan_pair(char *str, struct line *line, int device,
new->input = 1; new->input = 1;
list_add(&new->list, chans); list_add(&new->list, chans);
line->chan_in = new;
new = parse_chan(line, out, device, opts, error_out); new = parse_chan(line, out, device, opts, error_out);
if (new == NULL) if (new == NULL)
...@@ -569,6 +547,7 @@ int parse_chan_pair(char *str, struct line *line, int device, ...@@ -569,6 +547,7 @@ int parse_chan_pair(char *str, struct line *line, int device,
list_add(&new->list, chans); list_add(&new->list, chans);
new->output = 1; new->output = 1;
line->chan_out = new;
} }
else { else {
new = parse_chan(line, str, device, opts, error_out); new = parse_chan(line, str, device, opts, error_out);
...@@ -578,43 +557,42 @@ int parse_chan_pair(char *str, struct line *line, int device, ...@@ -578,43 +557,42 @@ int parse_chan_pair(char *str, struct line *line, int device,
list_add(&new->list, chans); list_add(&new->list, chans);
new->input = 1; new->input = 1;
new->output = 1; new->output = 1;
line->chan_in = line->chan_out = new;
} }
return 0; return 0;
} }
void chan_interrupt(struct list_head *chans, struct delayed_work *task, void chan_interrupt(struct line *line, struct tty_struct *tty, int irq)
struct tty_struct *tty, int irq)
{ {
struct list_head *ele, *next; struct chan *chan = line->chan_in;
struct chan *chan;
int err; int err;
char c; char c;
list_for_each_safe(ele, next, chans) { if (!chan || !chan->ops->read)
chan = list_entry(ele, struct chan, list); goto out;
if (!chan->input || (chan->ops->read == NULL))
continue; do {
do { if (tty && !tty_buffer_request_room(tty, 1)) {
if (tty && !tty_buffer_request_room(tty, 1)) { schedule_delayed_work(&line->task, 1);
schedule_delayed_work(task, 1); goto out;
goto out;
}
err = chan->ops->read(chan->fd, &c, chan->data);
if (err > 0)
tty_receive_char(tty, c);
} while (err > 0);
if (err == 0)
reactivate_fd(chan->fd, irq);
if (err == -EIO) {
if (chan->primary) {
if (tty != NULL)
tty_hangup(tty);
close_chan(chans, 1);
return;
}
else close_one_chan(chan, 1);
} }
err = chan->ops->read(chan->fd, &c, chan->data);
if (err > 0)
tty_receive_char(tty, c);
} while (err > 0);
if (err == 0)
reactivate_fd(chan->fd, irq);
if (err == -EIO) {
if (chan->primary) {
if (tty != NULL)
tty_hangup(tty);
if (line->chan_out != chan)
close_one_chan(line->chan_out, 1);
}
close_one_chan(chan, 1);
if (chan->primary)
return;
} }
out: out:
if (tty) if (tty)
......
...@@ -14,8 +14,6 @@ struct chan_opts { ...@@ -14,8 +14,6 @@ struct chan_opts {
const int raw; const int raw;
}; };
enum chan_init_pri { INIT_STATIC, INIT_ALL, INIT_ONE };
struct chan_ops { struct chan_ops {
char *type; char *type;
void *(*init)(char *, int, const struct chan_opts *); void *(*init)(char *, int, const struct chan_opts *);
......
This diff is collapsed.
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include "chan_user.h" #include "chan_user.h"
#include "mconsole_kern.h" #include "mconsole_kern.h"
/* There's only one modifiable field in this - .mc.list */ /* There's only two modifiable fields in this - .mc.list and .driver */
struct line_driver { struct line_driver {
const char *name; const char *name;
const char *device_name; const char *device_name;
...@@ -28,17 +28,18 @@ struct line_driver { ...@@ -28,17 +28,18 @@ struct line_driver {
const int write_irq; const int write_irq;
const char *write_irq_name; const char *write_irq_name;
struct mc_device mc; struct mc_device mc;
struct tty_driver *driver;
}; };
struct line { struct line {
struct tty_struct *tty; struct tty_struct *tty;
spinlock_t count_lock; struct mutex count_lock;
unsigned long count; unsigned long count;
int valid; int valid;
char *init_str; char *init_str;
int init_pri;
struct list_head chan_list; struct list_head chan_list;
struct chan *chan_in, *chan_out;
/*This lock is actually, mostly, local to*/ /*This lock is actually, mostly, local to*/
spinlock_t lock; spinlock_t lock;
...@@ -55,21 +56,12 @@ struct line { ...@@ -55,21 +56,12 @@ struct line {
int sigio; int sigio;
struct delayed_work task; struct delayed_work task;
const struct line_driver *driver; const struct line_driver *driver;
int have_irq;
}; };
#define LINE_INIT(str, d) \
{ .count_lock = __SPIN_LOCK_UNLOCKED((str).count_lock), \
.init_str = str, \
.init_pri = INIT_STATIC, \
.valid = 1, \
.lock = __SPIN_LOCK_UNLOCKED((str).lock), \
.driver = d }
extern void line_close(struct tty_struct *tty, struct file * filp); extern void line_close(struct tty_struct *tty, struct file * filp);
extern int line_open(struct line *lines, struct tty_struct *tty); extern int line_open(struct line *lines, struct tty_struct *tty);
extern int line_setup(struct line *lines, unsigned int sizeof_lines, extern int line_setup(char **conf, unsigned nlines, char **def,
char *init, char **error_out); char *init, char *name);
extern int line_write(struct tty_struct *tty, const unsigned char *buf, extern int line_write(struct tty_struct *tty, const unsigned char *buf,
int len); int len);
extern int line_put_char(struct tty_struct *tty, unsigned char ch); extern int line_put_char(struct tty_struct *tty, unsigned char ch);
...@@ -87,10 +79,11 @@ extern char *add_xterm_umid(char *base); ...@@ -87,10 +79,11 @@ extern char *add_xterm_umid(char *base);
extern int line_setup_irq(int fd, int input, int output, struct line *line, extern int line_setup_irq(int fd, int input, int output, struct line *line,
void *data); void *data);
extern void line_close_chan(struct line *line); extern void line_close_chan(struct line *line);
extern struct tty_driver *register_lines(struct line_driver *line_driver, extern int register_lines(struct line_driver *line_driver,
const struct tty_operations *driver, const struct tty_operations *driver,
struct line *lines, int nlines); struct line *lines, int nlines);
extern void lines_init(struct line *lines, int nlines, struct chan_opts *opts); extern int setup_one_line(struct line *lines, int n, char *init,
const struct chan_opts *opts, char **error_out);
extern void close_lines(struct line *lines, int nlines); extern void close_lines(struct line *lines, int nlines);
extern int line_config(struct line *lines, unsigned int sizeof_lines, extern int line_config(struct line *lines, unsigned int sizeof_lines,
......
...@@ -773,7 +773,7 @@ static int __init mconsole_init(void) ...@@ -773,7 +773,7 @@ static int __init mconsole_init(void)
register_reboot_notifier(&reboot_notifier); register_reboot_notifier(&reboot_notifier);
err = um_request_irq(MCONSOLE_IRQ, sock, IRQ_READ, mconsole_interrupt, err = um_request_irq(MCONSOLE_IRQ, sock, IRQ_READ, mconsole_interrupt,
IRQF_DISABLED | IRQF_SHARED | IRQF_SAMPLE_RANDOM, IRQF_SHARED | IRQF_SAMPLE_RANDOM,
"mconsole", (void *)sock); "mconsole", (void *)sock);
if (err) { if (err) {
printk(KERN_ERR "Failed to get IRQ for management console\n"); printk(KERN_ERR "Failed to get IRQ for management console\n");
......
...@@ -161,7 +161,7 @@ static int uml_net_open(struct net_device *dev) ...@@ -161,7 +161,7 @@ static int uml_net_open(struct net_device *dev)
} }
err = um_request_irq(dev->irq, lp->fd, IRQ_READ, uml_net_interrupt, err = um_request_irq(dev->irq, lp->fd, IRQ_READ, uml_net_interrupt,
IRQF_DISABLED | IRQF_SHARED, dev->name, dev); IRQF_SHARED, dev->name, dev);
if (err != 0) { if (err != 0) {
printk(KERN_ERR "uml_net_open: failed to get irq(%d)\n", err); printk(KERN_ERR "uml_net_open: failed to get irq(%d)\n", err);
err = -ENETUNREACH; err = -ENETUNREACH;
......
...@@ -100,7 +100,7 @@ static int port_accept(struct port_list *port) ...@@ -100,7 +100,7 @@ static int port_accept(struct port_list *port)
.port = port }); .port = port });
if (um_request_irq(TELNETD_IRQ, socket[0], IRQ_READ, pipe_interrupt, if (um_request_irq(TELNETD_IRQ, socket[0], IRQ_READ, pipe_interrupt,
IRQF_DISABLED | IRQF_SHARED | IRQF_SAMPLE_RANDOM, IRQF_SHARED | IRQF_SAMPLE_RANDOM,
"telnetd", conn)) { "telnetd", conn)) {
printk(KERN_ERR "port_accept : failed to get IRQ for " printk(KERN_ERR "port_accept : failed to get IRQ for "
"telnetd\n"); "telnetd\n");
...@@ -184,7 +184,7 @@ void *port_data(int port_num) ...@@ -184,7 +184,7 @@ void *port_data(int port_num)
} }
if (um_request_irq(ACCEPT_IRQ, fd, IRQ_READ, port_interrupt, if (um_request_irq(ACCEPT_IRQ, fd, IRQ_READ, port_interrupt,
IRQF_DISABLED | IRQF_SHARED | IRQF_SAMPLE_RANDOM, IRQF_SHARED | IRQF_SAMPLE_RANDOM,
"port", port)) { "port", port)) {
printk(KERN_ERR "Failed to get IRQ for port %d\n", port_num); printk(KERN_ERR "Failed to get IRQ for port %d\n", port_num);
goto out_close; goto out_close;
......
...@@ -131,7 +131,7 @@ static int __init rng_init (void) ...@@ -131,7 +131,7 @@ static int __init rng_init (void)
random_fd = err; random_fd = err;
err = um_request_irq(RANDOM_IRQ, random_fd, IRQ_READ, random_interrupt, err = um_request_irq(RANDOM_IRQ, random_fd, IRQ_READ, random_interrupt,
IRQF_DISABLED | IRQF_SAMPLE_RANDOM, "random", IRQF_SAMPLE_RANDOM, "random",
NULL); NULL);
if (err) if (err)
goto err_out_cleanup_hw; goto err_out_cleanup_hw;
......
...@@ -20,12 +20,6 @@ ...@@ -20,12 +20,6 @@
static const int ssl_version = 1; static const int ssl_version = 1;
/* Referenced only by tty_driver below - presumably it's locked correctly
* by the tty driver.
*/
static struct tty_driver *ssl_driver;
#define NR_PORTS 64 #define NR_PORTS 64
static void ssl_announce(char *dev_name, int dev) static void ssl_announce(char *dev_name, int dev)
...@@ -71,8 +65,9 @@ static struct line_driver driver = { ...@@ -71,8 +65,9 @@ static struct line_driver driver = {
/* The array is initialized by line_init, at initcall time. The /* The array is initialized by line_init, at initcall time. The
* elements are locked individually as needed. * elements are locked individually as needed.
*/ */
static struct line serial_lines[NR_PORTS] = static char *conf[NR_PORTS];
{ [0 ... NR_PORTS - 1] = LINE_INIT(CONFIG_SSL_CHAN, &driver) }; static char *def_conf = CONFIG_SSL_CHAN;
static struct line serial_lines[NR_PORTS];
static int ssl_config(char *str, char **error_out) static int ssl_config(char *str, char **error_out)
{ {
...@@ -156,14 +151,14 @@ static void ssl_console_write(struct console *c, const char *string, ...@@ -156,14 +151,14 @@ static void ssl_console_write(struct console *c, const char *string,
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&line->lock, flags); spin_lock_irqsave(&line->lock, flags);
console_write_chan(&line->chan_list, string, len); console_write_chan(line->chan_out, string, len);
spin_unlock_irqrestore(&line->lock, flags); spin_unlock_irqrestore(&line->lock, flags);
} }
static struct tty_driver *ssl_console_device(struct console *c, int *index) static struct tty_driver *ssl_console_device(struct console *c, int *index)
{ {
*index = c->index; *index = c->index;
return ssl_driver; return driver.driver;
} }
static int ssl_console_setup(struct console *co, char *options) static int ssl_console_setup(struct console *co, char *options)
...@@ -186,17 +181,30 @@ static struct console ssl_cons = { ...@@ -186,17 +181,30 @@ static struct console ssl_cons = {
static int ssl_init(void) static int ssl_init(void)
{ {
char *new_title; char *new_title;
int err;
int i;
printk(KERN_INFO "Initializing software serial port version %d\n", printk(KERN_INFO "Initializing software serial port version %d\n",
ssl_version); ssl_version);
ssl_driver = register_lines(&driver, &ssl_ops, serial_lines,
err = register_lines(&driver, &ssl_ops, serial_lines,
ARRAY_SIZE(serial_lines)); ARRAY_SIZE(serial_lines));
if (err)
return err;
new_title = add_xterm_umid(opts.xterm_title); new_title = add_xterm_umid(opts.xterm_title);
if (new_title != NULL) if (new_title != NULL)
opts.xterm_title = new_title; opts.xterm_title = new_title;
lines_init(serial_lines, ARRAY_SIZE(serial_lines), &opts); for (i = 0; i < NR_PORTS; i++) {
char *error;
char *s = conf[i];
if (!s)
s = def_conf;
if (setup_one_line(serial_lines, i, s, &opts, &error))
printk(KERN_ERR "setup_one_line failed for "
"device %d : %s\n", i, error);
}
ssl_init_done = 1; ssl_init_done = 1;
register_console(&ssl_cons); register_console(&ssl_cons);
...@@ -214,14 +222,7 @@ __uml_exitcall(ssl_exit); ...@@ -214,14 +222,7 @@ __uml_exitcall(ssl_exit);
static int ssl_chan_setup(char *str) static int ssl_chan_setup(char *str)
{ {
char *error; line_setup(conf, NR_PORTS, &def_conf, str, "serial line");
int ret;
ret = line_setup(serial_lines, ARRAY_SIZE(serial_lines), str, &error);
if(ret < 0)
printk(KERN_ERR "Failed to set up serial line with "
"configuration string \"%s\" : %s\n", str, error);
return 1; return 1;
} }
......
...@@ -27,12 +27,6 @@ ...@@ -27,12 +27,6 @@
#define MAX_TTYS (16) #define MAX_TTYS (16)
/* Referenced only by tty_driver below - presumably it's locked correctly
* by the tty driver.
*/
static struct tty_driver *console_driver;
static void stdio_announce(char *dev_name, int dev) static void stdio_announce(char *dev_name, int dev)
{ {
printk(KERN_INFO "Virtual console %d assigned device '%s'\n", dev, printk(KERN_INFO "Virtual console %d assigned device '%s'\n", dev,
...@@ -76,9 +70,9 @@ static struct line_driver driver = { ...@@ -76,9 +70,9 @@ static struct line_driver driver = {
/* The array is initialized by line_init, at initcall time. The /* The array is initialized by line_init, at initcall time. The
* elements are locked individually as needed. * elements are locked individually as needed.
*/ */
static struct line vts[MAX_TTYS] = { LINE_INIT(CONFIG_CON_ZERO_CHAN, &driver), static char *vt_conf[MAX_TTYS];
[ 1 ... MAX_TTYS - 1 ] = static char *def_conf;
LINE_INIT(CONFIG_CON_CHAN, &driver) }; static struct line vts[MAX_TTYS];
static int con_config(char *str, char **error_out) static int con_config(char *str, char **error_out)
{ {
...@@ -130,14 +124,14 @@ static void uml_console_write(struct console *console, const char *string, ...@@ -130,14 +124,14 @@ static void uml_console_write(struct console *console, const char *string,
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&line->lock, flags); spin_lock_irqsave(&line->lock, flags);
console_write_chan(&line->chan_list, string, len); console_write_chan(line->chan_out, string, len);
spin_unlock_irqrestore(&line->lock, flags); spin_unlock_irqrestore(&line->lock, flags);
} }
static struct tty_driver *uml_console_device(struct console *c, int *index) static struct tty_driver *uml_console_device(struct console *c, int *index)
{ {
*index = c->index; *index = c->index;
return console_driver; return driver.driver;
} }
static int uml_console_setup(struct console *co, char *options) static int uml_console_setup(struct console *co, char *options)
...@@ -160,18 +154,31 @@ static struct console stdiocons = { ...@@ -160,18 +154,31 @@ static struct console stdiocons = {
static int stdio_init(void) static int stdio_init(void)
{ {
char *new_title; char *new_title;
int err;
int i;
console_driver = register_lines(&driver, &console_ops, vts, err = register_lines(&driver, &console_ops, vts,
ARRAY_SIZE(vts)); ARRAY_SIZE(vts));
if (console_driver == NULL) if (err)
return -1; return err;
printk(KERN_INFO "Initialized stdio console driver\n"); printk(KERN_INFO "Initialized stdio console driver\n");
new_title = add_xterm_umid(opts.xterm_title); new_title = add_xterm_umid(opts.xterm_title);
if(new_title != NULL) if(new_title != NULL)
opts.xterm_title = new_title; opts.xterm_title = new_title;
lines_init(vts, ARRAY_SIZE(vts), &opts); for (i = 0; i < MAX_TTYS; i++) {
char *error;
char *s = vt_conf[i];
if (!s)
s = def_conf;
if (!s)
s = i ? CONFIG_CON_CHAN : CONFIG_CON_ZERO_CHAN;
if (setup_one_line(vts, i, s, &opts, &error))
printk(KERN_ERR "setup_one_line failed for "
"device %d : %s\n", i, error);
}
con_init_done = 1; con_init_done = 1;
register_console(&stdiocons); register_console(&stdiocons);
...@@ -189,14 +196,7 @@ __uml_exitcall(console_exit); ...@@ -189,14 +196,7 @@ __uml_exitcall(console_exit);
static int console_chan_setup(char *str) static int console_chan_setup(char *str)
{ {
char *error; line_setup(vt_conf, MAX_TTYS, &def_conf, str, "console");
int ret;
ret = line_setup(vts, ARRAY_SIZE(vts), str, &error);
if(ret < 0)
printk(KERN_ERR "Failed to set up console with "
"configuration string \"%s\" : %s\n", str, error);
return 1; return 1;
} }
__setup("con", console_chan_setup); __setup("con", console_chan_setup);
......
...@@ -19,40 +19,26 @@ ...@@ -19,40 +19,26 @@
#define UBD_SHIFT 4 #define UBD_SHIFT 4
#include "linux/kernel.h" #include <linux/module.h>
#include "linux/module.h" #include <linux/init.h>
#include "linux/blkdev.h" #include <linux/blkdev.h>
#include "linux/ata.h" #include <linux/ata.h>
#include "linux/hdreg.h" #include <linux/hdreg.h>
#include "linux/init.h" #include <linux/cdrom.h>
#include "linux/cdrom.h" #include <linux/proc_fs.h>
#include "linux/proc_fs.h" #include <linux/seq_file.h>
#include "linux/seq_file.h" #include <linux/ctype.h>
#include "linux/ctype.h" #include <linux/slab.h>
#include "linux/capability.h" #include <linux/vmalloc.h>
#include "linux/mm.h" #include <linux/platform_device.h>
#include "linux/slab.h" #include <linux/scatterlist.h>
#include "linux/vmalloc.h" #include <asm/tlbflush.h>
#include "linux/mutex.h"
#include "linux/blkpg.h"
#include "linux/genhd.h"
#include "linux/spinlock.h"
#include "linux/platform_device.h"
#include "linux/scatterlist.h"
#include "asm/segment.h"
#include "asm/uaccess.h"
#include "asm/irq.h"
#include "asm/types.h"
#include "asm/tlbflush.h"
#include "mem_user.h"
#include "kern_util.h" #include "kern_util.h"
#include "mconsole_kern.h" #include "mconsole_kern.h"
#include "init.h" #include "init.h"
#include "irq_user.h"
#include "irq_kern.h" #include "irq_kern.h"
#include "ubd_user.h" #include "ubd.h"
#include "os.h" #include "os.h"
#include "mem.h"
#include "cow.h" #include "cow.h"
enum ubd_req { UBD_READ, UBD_WRITE }; enum ubd_req { UBD_READ, UBD_WRITE };
...@@ -1115,7 +1101,7 @@ static int __init ubd_driver_init(void){ ...@@ -1115,7 +1101,7 @@ static int __init ubd_driver_init(void){
return 0; return 0;
} }
err = um_request_irq(UBD_IRQ, thread_fd, IRQ_READ, ubd_intr, err = um_request_irq(UBD_IRQ, thread_fd, IRQ_READ, ubd_intr,
IRQF_DISABLED, "ubd", ubd_devs); 0, "ubd", ubd_devs);
if(err != 0) if(err != 0)
printk(KERN_ERR "um_request_irq failed - errno = %d\n", -err); printk(KERN_ERR "um_request_irq failed - errno = %d\n", -err);
return 0; return 0;
......
...@@ -15,14 +15,12 @@ ...@@ -15,14 +15,12 @@
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <sys/param.h> #include <sys/param.h>
#include "asm/types.h"
#include "ubd_user.h"
#include "os.h"
#include "cow.h"
#include <endian.h> #include <endian.h>
#include <byteswap.h> #include <byteswap.h>
#include "ubd.h"
#include "os.h"
void ignore_sigwinch_sig(void) void ignore_sigwinch_sig(void)
{ {
signal(SIGWINCH, SIG_IGN); signal(SIGWINCH, SIG_IGN);
......
...@@ -50,7 +50,7 @@ int xterm_fd(int socket, int *pid_out) ...@@ -50,7 +50,7 @@ int xterm_fd(int socket, int *pid_out)
init_completion(&data->ready); init_completion(&data->ready);
err = um_request_irq(XTERM_IRQ, socket, IRQ_READ, xterm_interrupt, err = um_request_irq(XTERM_IRQ, socket, IRQ_READ, xterm_interrupt,
IRQF_DISABLED | IRQF_SHARED | IRQF_SAMPLE_RANDOM, IRQF_SHARED | IRQF_SAMPLE_RANDOM,
"xterm", data); "xterm", data);
if (err) { if (err) {
printk(KERN_ERR "xterm_fd : failed to get IRQ for xterm, " printk(KERN_ERR "xterm_fd : failed to get IRQ for xterm, "
......
generic-y += bug.h cputime.h device.h emergency-restart.h futex.h hardirq.h generic-y += bug.h cputime.h device.h emergency-restart.h futex.h hardirq.h
generic-y += hw_irq.h irq_regs.h kdebug.h percpu.h sections.h topology.h xor.h generic-y += hw_irq.h irq_regs.h kdebug.h percpu.h sections.h topology.h xor.h
generic-y += ftrace.h generic-y += ftrace.h pci.h io.h param.h delay.h mutex.h current.h
#include <generated/asm-offsets.h>
#ifndef __UM_AUXVEC_H
#define __UM_AUXVEC_H
#endif
/*
* Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
* Licensed under the GPL
*/
#ifndef __UM_CURRENT_H
#define __UM_CURRENT_H
#include "linux/thread_info.h"
#define current (current_thread_info()->task)
#endif
#ifndef __UM_DELAY_H
#define __UM_DELAY_H
/* Undefined on purpose */
extern void __bad_udelay(void);
extern void __bad_ndelay(void);
extern void __udelay(unsigned long usecs);
extern void __ndelay(unsigned long usecs);
extern void __delay(unsigned long loops);
#define udelay(n) ((__builtin_constant_p(n) && (n) > 20000) ? \
__bad_udelay() : __udelay(n))
#define ndelay(n) ((__builtin_constant_p(n) && (n) > 20000) ? \
__bad_ndelay() : __ndelay(n))
#endif
#ifndef __UM_IO_H
#define __UM_IO_H
#include "asm/page.h"
#define IO_SPACE_LIMIT 0xdeadbeef /* Sure hope nothing uses this */
static inline int inb(unsigned long i) { return(0); }
static inline void outb(char c, unsigned long i) { }
/*
* Change virtual addresses to physical addresses and vv.
* These are pretty trivial
*/
static inline unsigned long virt_to_phys(volatile void * address)
{
return __pa((void *) address);
}
static inline void * phys_to_virt(unsigned long address)
{
return __va(address);
}
/*
* Convert a physical pointer to a virtual kernel pointer for /dev/mem
* access
*/
#define xlate_dev_mem_ptr(p) __va(p)
/*
* Convert a virtual cached pointer to an uncached pointer
*/
#define xlate_dev_kmem_ptr(p) p
static inline void writeb(unsigned char b, volatile void __iomem *addr)
{
*(volatile unsigned char __force *) addr = b;
}
static inline void writew(unsigned short b, volatile void __iomem *addr)
{
*(volatile unsigned short __force *) addr = b;
}
static inline void writel(unsigned int b, volatile void __iomem *addr)
{
*(volatile unsigned int __force *) addr = b;
}
static inline void writeq(unsigned int b, volatile void __iomem *addr)
{
*(volatile unsigned long long __force *) addr = b;
}
#define __raw_writeb writeb
#define __raw_writew writew
#define __raw_writel writel
#define __raw_writeq writeq
#endif
/*
* Pull in the generic implementation for the mutex fastpath.
*
* TODO: implement optimized primitives instead, or leave the generic
* implementation in place, or pick the atomic_xchg() based generic
* implementation. (see asm-generic/mutex-xchg.h for details)
*/
#include <asm-generic/mutex-dec.h>
#ifndef _UM_PARAM_H
#define _UM_PARAM_H
#define EXEC_PAGESIZE 4096
#ifndef NOGROUP
#define NOGROUP (-1)
#endif
#define MAXHOSTNAMELEN 64 /* max length of hostname */
#ifdef __KERNEL__
#define HZ CONFIG_HZ
#define USER_HZ 100 /* .. some user interfaces are in "ticks" */
#define CLOCKS_PER_SEC (USER_HZ) /* frequency at which times() counts */
#else
#define HZ 100
#endif
#endif
#ifndef __UM_PCI_H
#define __UM_PCI_H
#define PCI_DMA_BUS_IS_PHYS (1)
#endif
...@@ -8,8 +8,7 @@ ...@@ -8,8 +8,7 @@
#ifndef __UM_PGALLOC_H #ifndef __UM_PGALLOC_H
#define __UM_PGALLOC_H #define __UM_PGALLOC_H
#include "linux/mm.h" #include <linux/mm.h>
#include "asm/fixmap.h"
#define pmd_populate_kernel(mm, pmd, pte) \ #define pmd_populate_kernel(mm, pmd, pte) \
set_pmd(pmd, __pmd(_PAGE_TABLE + (unsigned long) __pa(pte))) set_pmd(pmd, __pmd(_PAGE_TABLE + (unsigned long) __pa(pte)))
......
...@@ -69,6 +69,8 @@ extern unsigned long end_iomem; ...@@ -69,6 +69,8 @@ extern unsigned long end_iomem;
#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED) #define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED)
#define PAGE_KERNEL_EXEC __pgprot(__PAGE_KERNEL_EXEC) #define PAGE_KERNEL_EXEC __pgprot(__PAGE_KERNEL_EXEC)
#define io_remap_pfn_range remap_pfn_range
/* /*
* The i386 can't do page protection for execute, and considers that the same * The i386 can't do page protection for execute, and considers that the same
* are read. * are read.
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#include <asm/ptrace-abi.h> #include <asm/ptrace-abi.h>
#include <asm/user.h>
#include "sysdep/ptrace.h" #include "sysdep/ptrace.h"
struct pt_regs { struct pt_regs {
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
DEFINE(KERNEL_MADV_REMOVE, MADV_REMOVE); DEFINE(KERNEL_MADV_REMOVE, MADV_REMOVE);
OFFSET(HOST_TASK_PID, task_struct, pid);
DEFINE(UM_KERN_PAGE_SIZE, PAGE_SIZE); DEFINE(UM_KERN_PAGE_SIZE, PAGE_SIZE);
DEFINE(UM_KERN_PAGE_MASK, PAGE_MASK); DEFINE(UM_KERN_PAGE_MASK, PAGE_MASK);
DEFINE(UM_KERN_PAGE_SHIFT, PAGE_SHIFT); DEFINE(UM_KERN_PAGE_SHIFT, PAGE_SHIFT);
......
...@@ -48,7 +48,7 @@ extern void do_uml_exitcalls(void); ...@@ -48,7 +48,7 @@ extern void do_uml_exitcalls(void);
* GFP_ATOMIC. * GFP_ATOMIC.
*/ */
extern int __cant_sleep(void); extern int __cant_sleep(void);
extern void *get_current(void); extern int get_current_pid(void);
extern int copy_from_user_proc(void *to, void *from, int size); extern int copy_from_user_proc(void *to, void *from, int size);
extern int cpu(void); extern int cpu(void);
extern char *uml_strdup(const char *string); extern char *uml_strdup(const char *string);
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# Licensed under the GPL # Licensed under the GPL
# #
CPPFLAGS_vmlinux.lds := -U$(SUBARCH) -DSTART=$(LDS_START) \ CPPFLAGS_vmlinux.lds := -DSTART=$(LDS_START) \
-DELF_ARCH=$(LDS_ELF_ARCH) \ -DELF_ARCH=$(LDS_ELF_ARCH) \
-DELF_FORMAT=$(LDS_ELF_FORMAT) -DELF_FORMAT=$(LDS_ELF_FORMAT)
extra-y := vmlinux.lds extra-y := vmlinux.lds
......
...@@ -126,9 +126,9 @@ void exit_thread(void) ...@@ -126,9 +126,9 @@ void exit_thread(void)
{ {
} }
void *get_current(void) int get_current_pid(void)
{ {
return current; return task_pid_nr(current);
} }
/* /*
......
...@@ -25,7 +25,7 @@ int write_sigio_irq(int fd) ...@@ -25,7 +25,7 @@ int write_sigio_irq(int fd)
int err; int err;
err = um_request_irq(SIGIO_WRITE_IRQ, fd, IRQ_READ, sigio_interrupt, err = um_request_irq(SIGIO_WRITE_IRQ, fd, IRQ_READ, sigio_interrupt,
IRQF_DISABLED|IRQF_SAMPLE_RANDOM, "write sigio", IRQF_SAMPLE_RANDOM, "write sigio",
NULL); NULL);
if (err) { if (err) {
printk(KERN_ERR "write_sigio_irq : um_request_irq failed, " printk(KERN_ERR "write_sigio_irq : um_request_irq failed, "
......
...@@ -82,7 +82,7 @@ static void __init setup_itimer(void) ...@@ -82,7 +82,7 @@ static void __init setup_itimer(void)
{ {
int err; int err;
err = request_irq(TIMER_IRQ, um_timer, IRQF_DISABLED, "timer", NULL); err = request_irq(TIMER_IRQ, um_timer, 0, "timer", NULL);
if (err != 0) if (err != 0)
printk(KERN_ERR "register_timer : request_irq failed - " printk(KERN_ERR "register_timer : request_irq failed - "
"errno = %d\n", -err); "errno = %d\n", -err);
......
...@@ -13,8 +13,6 @@ USER_OBJS := $(user-objs-y) aio.o elf_aux.o execvp.o file.o helper.o irq.o \ ...@@ -13,8 +13,6 @@ USER_OBJS := $(user-objs-y) aio.o elf_aux.o execvp.o file.o helper.o irq.o \
main.o mem.o process.o registers.o sigio.o signal.o start_up.o time.o \ main.o mem.o process.o registers.o sigio.o signal.o start_up.o time.o \
tty.o umid.o util.o tty.o umid.o util.o
CFLAGS_user_syms.o += -DSUBARCH_$(SUBARCH)
HAVE_AIO_ABI := $(shell [ -r /usr/include/linux/aio_abi.h ] && \ HAVE_AIO_ABI := $(shell [ -r /usr/include/linux/aio_abi.h ] && \
echo -DHAVE_AIO_ABI ) echo -DHAVE_AIO_ABI )
CFLAGS_aio.o += $(HAVE_AIO_ABI) CFLAGS_aio.o += $(HAVE_AIO_ABI)
......
...@@ -45,7 +45,7 @@ EXPORT_SYMBOL(readdir64); ...@@ -45,7 +45,7 @@ EXPORT_SYMBOL(readdir64);
extern void truncate64(void) __attribute__((weak)); extern void truncate64(void) __attribute__((weak));
EXPORT_SYMBOL(truncate64); EXPORT_SYMBOL(truncate64);
#ifdef SUBARCH_i386 #ifdef CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA
EXPORT_SYMBOL(vsyscall_ehdr); EXPORT_SYMBOL(vsyscall_ehdr);
EXPORT_SYMBOL(vsyscall_end); EXPORT_SYMBOL(vsyscall_end);
#endif #endif
......
...@@ -9,8 +9,6 @@ USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file)) ...@@ -9,8 +9,6 @@ USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file))
$(USER_OBJS:.o=.%): \ $(USER_OBJS:.o=.%): \
c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) -include user.h $(CFLAGS_$(basetarget).o) c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) -include user.h $(CFLAGS_$(basetarget).o)
$(USER_OBJS) : CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ \
-Dunix -D__unix__ -D__$(SUBARCH)__ $(CF)
# These are like USER_OBJS but filter USER_CFLAGS through unprofile instead of # These are like USER_OBJS but filter USER_CFLAGS through unprofile instead of
# using it directly. # using it directly.
...@@ -18,8 +16,9 @@ UNPROFILE_OBJS := $(foreach file,$(UNPROFILE_OBJS),$(obj)/$(file)) ...@@ -18,8 +16,9 @@ UNPROFILE_OBJS := $(foreach file,$(UNPROFILE_OBJS),$(obj)/$(file))
$(UNPROFILE_OBJS:.o=.%): \ $(UNPROFILE_OBJS:.o=.%): \
c_flags = -Wp,-MD,$(depfile) $(call unprofile,$(USER_CFLAGS)) $(CFLAGS_$(basetarget).o) c_flags = -Wp,-MD,$(depfile) $(call unprofile,$(USER_CFLAGS)) $(CFLAGS_$(basetarget).o)
$(UNPROFILE_OBJS) : CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ \
-Dunix -D__unix__ -D__$(SUBARCH)__ $(CF) $(USER_OBJS) $(UNPROFILE_OBJS): \
CHECKFLAGS := $(patsubst $(NOSTDINC_FLAGS),,$(CHECKFLAGS))
# The stubs can't try to call mcount or update basic block data # The stubs can't try to call mcount or update basic block data
define unprofile define unprofile
......
...@@ -8,15 +8,11 @@ ELF_ARCH := i386 ...@@ -8,15 +8,11 @@ ELF_ARCH := i386
ELF_FORMAT := elf32-i386 ELF_FORMAT := elf32-i386
CHECKFLAGS += -D__i386__ CHECKFLAGS += -D__i386__
ifeq ("$(origin SUBARCH)", "command line")
ifneq ("$(shell uname -m | sed -e s/i.86/i386/)", "$(SUBARCH)")
KBUILD_CFLAGS += $(call cc-option,-m32) KBUILD_CFLAGS += $(call cc-option,-m32)
KBUILD_AFLAGS += $(call cc-option,-m32) KBUILD_AFLAGS += $(call cc-option,-m32)
LINK-y += $(call cc-option,-m32) LINK-y += $(call cc-option,-m32)
export LDFLAGS export LDFLAGS
endif
endif
# First of all, tune CFLAGS for the specific CPU. This actually sets cflags-y. # First of all, tune CFLAGS for the specific CPU. This actually sets cflags-y.
include $(srctree)/arch/x86/Makefile_32.cpu include $(srctree)/arch/x86/Makefile_32.cpu
......
...@@ -15,8 +15,8 @@ config UML_X86 ...@@ -15,8 +15,8 @@ config UML_X86
select GENERIC_FIND_FIRST_BIT select GENERIC_FIND_FIRST_BIT
config 64BIT config 64BIT
bool bool "64-bit kernel" if SUBARCH = "x86"
default SUBARCH = "x86_64" default SUBARCH != "i386"
config X86_32 config X86_32
def_bool !64BIT def_bool !64BIT
......
...@@ -17,6 +17,16 @@ ...@@ -17,6 +17,16 @@
#define ARCH_IS_STACKGROW(address) \ #define ARCH_IS_STACKGROW(address) \
(address + 65536 + 32 * sizeof(unsigned long) >= UPT_SP(&current->thread.regs.regs)) (address + 65536 + 32 * sizeof(unsigned long) >= UPT_SP(&current->thread.regs.regs))
#include <asm/user.h>
/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */
static inline void rep_nop(void)
{
__asm__ __volatile__("rep;nop": : :"memory");
}
#define cpu_relax() rep_nop()
#include <asm/processor-generic.h> #include <asm/processor-generic.h>
#endif #endif
...@@ -45,16 +45,6 @@ static inline void arch_copy_thread(struct arch_thread *from, ...@@ -45,16 +45,6 @@ static inline void arch_copy_thread(struct arch_thread *from,
memcpy(&to->tls_array, &from->tls_array, sizeof(from->tls_array)); memcpy(&to->tls_array, &from->tls_array, sizeof(from->tls_array));
} }
#include <asm/user.h>
/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */
static inline void rep_nop(void)
{
__asm__ __volatile__("rep;nop": : :"memory");
}
#define cpu_relax() rep_nop()
/* /*
* Default implementation of macro that returns current * Default implementation of macro that returns current
* instruction pointer ("program counter"). Stolen * instruction pointer ("program counter"). Stolen
......
...@@ -14,14 +14,6 @@ struct arch_thread { ...@@ -14,14 +14,6 @@ struct arch_thread {
struct faultinfo faultinfo; struct faultinfo faultinfo;
}; };
/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */
static inline void rep_nop(void)
{
__asm__ __volatile__("rep;nop": : :"memory");
}
#define cpu_relax() rep_nop()
#define INIT_ARCH_THREAD { .debugregs = { [ 0 ... 7 ] = 0 }, \ #define INIT_ARCH_THREAD { .debugregs = { [ 0 ... 7 ] = 0 }, \
.debugregs_seq = 0, \ .debugregs_seq = 0, \
.fs = 0, \ .fs = 0, \
...@@ -37,8 +29,6 @@ static inline void arch_copy_thread(struct arch_thread *from, ...@@ -37,8 +29,6 @@ static inline void arch_copy_thread(struct arch_thread *from,
to->fs = from->fs; to->fs = from->fs;
} }
#include <asm/user.h>
#define current_text_addr() \ #define current_text_addr() \
({ void *pc; __asm__("movq $1f,%0\n1:":"=g" (pc)); pc; }) ({ void *pc; __asm__("movq $1f,%0\n1:":"=g" (pc)); pc; })
......
...@@ -13,8 +13,6 @@ ...@@ -13,8 +13,6 @@
static int host_has_cmov = 1; static int host_has_cmov = 1;
static jmp_buf cmov_test_return; static jmp_buf cmov_test_return;
#define TASK_PID(task) *((int *) &(((char *) (task))[HOST_TASK_PID]))
static void cmov_sigill_test_handler(int sig) static void cmov_sigill_test_handler(int sig)
{ {
host_has_cmov = 0; host_has_cmov = 0;
...@@ -51,7 +49,7 @@ void arch_examine_signal(int sig, struct uml_pt_regs *regs) ...@@ -51,7 +49,7 @@ void arch_examine_signal(int sig, struct uml_pt_regs *regs)
* This is testing for a cmov (0x0f 0x4x) instruction causing a * This is testing for a cmov (0x0f 0x4x) instruction causing a
* SIGILL in init. * SIGILL in init.
*/ */
if ((sig != SIGILL) || (TASK_PID(get_current()) != 1)) if ((sig != SIGILL) || (get_current_pid() != 1))
return; return;
if (copy_from_user_proc(tmp, (void *) UPT_IP(regs), 2)) { if (copy_from_user_proc(tmp, (void *) UPT_IP(regs), 2)) {
......
menuconfig MTD menuconfig MTD
tristate "Memory Technology Device (MTD) support" tristate "Memory Technology Device (MTD) support"
depends on HAS_IOMEM depends on GENERIC_IO
help help
Memory Technology Devices are flash, RAM and similar chips, often Memory Technology Devices are flash, RAM and similar chips, often
used for solid state file systems on embedded devices. This option used for solid state file systems on embedded devices. This option
......
menu "Self-contained MTD device drivers" menu "Self-contained MTD device drivers"
depends on MTD!=n depends on MTD!=n
depends on HAS_IOMEM
config MTD_PMC551 config MTD_PMC551
tristate "Ramix PMC551 PCI Mezzanine RAM card support" tristate "Ramix PMC551 PCI Mezzanine RAM card support"
......
menu "Mapping drivers for chip access" menu "Mapping drivers for chip access"
depends on MTD!=n depends on MTD!=n
depends on HAS_IOMEM
config MTD_COMPLEX_MAPPINGS config MTD_COMPLEX_MAPPINGS
bool "Support non-linear mappings of flash chips" bool "Support non-linear mappings of flash chips"
......
...@@ -246,6 +246,7 @@ config MTD_NAND_BCM_UMI_HWCS ...@@ -246,6 +246,7 @@ config MTD_NAND_BCM_UMI_HWCS
config MTD_NAND_DISKONCHIP config MTD_NAND_DISKONCHIP
tristate "DiskOnChip 2000, Millennium and Millennium Plus (NAND reimplementation) (EXPERIMENTAL)" tristate "DiskOnChip 2000, Millennium and Millennium Plus (NAND reimplementation) (EXPERIMENTAL)"
depends on EXPERIMENTAL depends on EXPERIMENTAL
depends on HAS_IOMEM
select REED_SOLOMON select REED_SOLOMON
select REED_SOLOMON_DEC16 select REED_SOLOMON_DEC16
help help
...@@ -431,6 +432,7 @@ config MTD_NAND_GPMI_NAND ...@@ -431,6 +432,7 @@ config MTD_NAND_GPMI_NAND
config MTD_NAND_PLATFORM config MTD_NAND_PLATFORM
tristate "Support for generic platform NAND driver" tristate "Support for generic platform NAND driver"
depends on HAS_IOMEM
help help
This implements a generic NAND driver for on-SOC platform This implements a generic NAND driver for on-SOC platform
devices. You will need to provide platform-specific functions devices. You will need to provide platform-specific functions
......
menuconfig MTD_ONENAND menuconfig MTD_ONENAND
tristate "OneNAND Device Support" tristate "OneNAND Device Support"
depends on MTD depends on MTD
depends on HAS_IOMEM
help help
This enables support for accessing all type of OneNAND flash This enables support for accessing all type of OneNAND flash
devices. For further information see devices. For further information see
......
...@@ -67,7 +67,8 @@ extern int access_file(char *path, int r, int w, int x); ...@@ -67,7 +67,8 @@ extern int access_file(char *path, int r, int w, int x);
extern int open_file(char *path, int r, int w, int append); extern int open_file(char *path, int r, int w, int append);
extern void *open_dir(char *path, int *err_out); extern void *open_dir(char *path, int *err_out);
extern char *read_dir(void *stream, unsigned long long *pos, extern char *read_dir(void *stream, unsigned long long *pos,
unsigned long long *ino_out, int *len_out); unsigned long long *ino_out, int *len_out,
unsigned int *type_out);
extern void close_file(void *stream); extern void close_file(void *stream);
extern int replace_file(int oldfd, int fd); extern int replace_file(int oldfd, int fd);
extern void close_dir(void *stream); extern void close_dir(void *stream);
......
...@@ -283,6 +283,7 @@ int hostfs_readdir(struct file *file, void *ent, filldir_t filldir) ...@@ -283,6 +283,7 @@ int hostfs_readdir(struct file *file, void *ent, filldir_t filldir)
char *name; char *name;
unsigned long long next, ino; unsigned long long next, ino;
int error, len; int error, len;
unsigned int type;
name = dentry_name(file->f_path.dentry); name = dentry_name(file->f_path.dentry);
if (name == NULL) if (name == NULL)
...@@ -292,9 +293,9 @@ int hostfs_readdir(struct file *file, void *ent, filldir_t filldir) ...@@ -292,9 +293,9 @@ int hostfs_readdir(struct file *file, void *ent, filldir_t filldir)
if (dir == NULL) if (dir == NULL)
return -error; return -error;
next = file->f_pos; next = file->f_pos;
while ((name = read_dir(dir, &next, &ino, &len)) != NULL) { while ((name = read_dir(dir, &next, &ino, &len, &type)) != NULL) {
error = (*filldir)(ent, name, len, file->f_pos, error = (*filldir)(ent, name, len, file->f_pos,
ino, DT_UNKNOWN); ino, type);
if (error) break; if (error) break;
file->f_pos = next; file->f_pos = next;
} }
......
...@@ -98,7 +98,8 @@ void *open_dir(char *path, int *err_out) ...@@ -98,7 +98,8 @@ void *open_dir(char *path, int *err_out)
} }
char *read_dir(void *stream, unsigned long long *pos, char *read_dir(void *stream, unsigned long long *pos,
unsigned long long *ino_out, int *len_out) unsigned long long *ino_out, int *len_out,
unsigned int *type_out)
{ {
DIR *dir = stream; DIR *dir = stream;
struct dirent *ent; struct dirent *ent;
...@@ -109,6 +110,7 @@ char *read_dir(void *stream, unsigned long long *pos, ...@@ -109,6 +110,7 @@ char *read_dir(void *stream, unsigned long long *pos,
return NULL; return NULL;
*len_out = strlen(ent->d_name); *len_out = strlen(ent->d_name);
*ino_out = ent->d_ino; *ino_out = ent->d_ino;
*type_out = ent->d_type;
*pos = telldir(dir); *pos = telldir(dir);
return ent->d_name; return ent->d_name;
} }
......
...@@ -29,6 +29,10 @@ config GENERIC_IOMAP ...@@ -29,6 +29,10 @@ config GENERIC_IOMAP
bool bool
select GENERIC_PCI_IOMAP select GENERIC_PCI_IOMAP
config GENERIC_IO
boolean
default n
config CRC_CCITT config CRC_CCITT
tristate "CRC-CCITT functions" tristate "CRC-CCITT functions"
help help
...@@ -277,6 +281,7 @@ config BTREE ...@@ -277,6 +281,7 @@ config BTREE
config HAS_IOMEM config HAS_IOMEM
boolean boolean
depends on !NO_IOMEM depends on !NO_IOMEM
select GENERIC_IO
default y default y
config HAS_IOPORT config HAS_IOPORT
......
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