Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 35704
b: refs/heads/master
c: 537ae94
h: refs/heads/master
v: v3
  • Loading branch information
Jeff Dike authored and Linus Torvalds committed Sep 26, 2006
1 parent ccf1057 commit 5ac6747
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4b84c69b5f6c08a540e3683f1360a6cdef2806c7
refs/heads/master: 537ae946e808d0f22d660f7a3500832fe0c07d14
4 changes: 3 additions & 1 deletion trunk/arch/um/include/os.h
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,11 @@ extern int setjmp_wrapper(void (*proc)(void *, void *), ...);

extern void switch_timers(int to_real);
extern void idle_sleep(int secs);
extern int set_interval(int is_virtual);
#ifdef CONFIG_MODE_TT
extern void enable_timer(void);
#endif
extern void disable_timer(void);
extern void user_time_init(void);
extern void uml_idle_timer(void);
extern unsigned long long os_nsecs(void);

Expand Down
7 changes: 5 additions & 2 deletions trunk/arch/um/kernel/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,15 @@ static void register_timer(void)

err = request_irq(TIMER_IRQ, um_timer, IRQF_DISABLED, "timer", NULL);
if(err != 0)
printk(KERN_ERR "timer_init : request_irq failed - "
printk(KERN_ERR "register_timer : request_irq failed - "
"errno = %d\n", -err);

timer_irq_inited = 1;

user_time_init();
err = set_interval(1);
if(err != 0)
printk(KERN_ERR "register_timer : set_interval failed - "
"errno = %d\n", -err);
}

extern void (*late_time_init)(void);
Expand Down
6 changes: 5 additions & 1 deletion trunk/arch/um/os-Linux/skas/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,15 @@ extern int __syscall_stub_start;
static int userspace_tramp(void *stack)
{
void *addr;
int err;

ptrace(PTRACE_TRACEME, 0, 0, 0);

init_new_thread_signals();
enable_timer();
err = set_interval(1);
if(err)
panic("userspace_tramp - setting timer failed, errno = %d\n",
err);

if(!proc_mm){
/* This has a pte, but it can't be mapped in with the usual
Expand Down
18 changes: 9 additions & 9 deletions trunk/arch/um/os-Linux/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,25 @@
#include "kern_constants.h"
#include "os.h"

static void set_interval(int timer_type)
int set_interval(int is_virtual)
{
int usec = 1000000/hz();
int timer_type = is_virtual ? ITIMER_VIRTUAL : ITIMER_REAL;
struct itimerval interval = ((struct itimerval) { { 0, usec },
{ 0, usec } });

if(setitimer(timer_type, &interval, NULL) == -1)
panic("setitimer failed - errno = %d\n", errno);
return -errno;

return 0;
}

#ifdef CONFIG_MODE_TT
void enable_timer(void)
{
set_interval(ITIMER_VIRTUAL);
set_interval(1);
}
#endif

void disable_timer(void)
{
Expand Down Expand Up @@ -74,7 +79,7 @@ void uml_idle_timer(void)

set_handler(SIGALRM, (__sighandler_t) alarm_handler,
SA_RESTART, SIGUSR1, SIGIO, SIGWINCH, SIGVTALRM, -1);
set_interval(ITIMER_REAL);
set_interval(0);
}
#endif

Expand All @@ -94,8 +99,3 @@ void idle_sleep(int secs)
ts.tv_nsec = 0;
nanosleep(&ts, NULL);
}

void user_time_init(void)
{
set_interval(ITIMER_VIRTUAL);
}

0 comments on commit 5ac6747

Please sign in to comment.