Rev 607 | Rev 1104 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 607 | Rev 631 | ||
---|---|---|---|
Line 34... | Line 34... | ||
34 | #include <arch/types.h> |
34 | #include <arch/types.h> |
35 | #include <typedefs.h> |
35 | #include <typedefs.h> |
36 | #include <arch.h> |
36 | #include <arch.h> |
37 | #include <func.h> |
37 | #include <func.h> |
38 | #include <print.h> |
38 | #include <print.h> |
- | 39 | #include <arch/atomic.h> |
|
39 | 40 | ||
40 | /** Standard input character device. */ |
41 | /** Standard input character device. */ |
41 | chardev_t *stdin = NULL; |
42 | chardev_t *stdin = NULL; |
42 | chardev_t *stdout = NULL; |
43 | chardev_t *stdout = NULL; |
43 | 44 | ||
Line 50... | Line 51... | ||
50 | __u8 _getc(chardev_t *chardev) |
51 | __u8 _getc(chardev_t *chardev) |
51 | { |
52 | { |
52 | __u8 ch; |
53 | __u8 ch; |
53 | ipl_t ipl; |
54 | ipl_t ipl; |
54 | 55 | ||
55 | if (haltstate) { |
56 | if (atomic_get(&haltstate)) { |
56 | /* If we are here, we are hopefully on the processor, that |
57 | /* If we are here, we are hopefully on the processor, that |
57 | * issued the 'halt' command, so proceed to read the character |
58 | * issued the 'halt' command, so proceed to read the character |
58 | * directly from input |
59 | * directly from input |
59 | */ |
60 | */ |
60 | if (chardev->op->read) |
61 | if (chardev->op->read) |
61 | return chardev->op->read(chardev); |
62 | return chardev->op->read(chardev); |
62 | /* no other way of interacting with user, halt */ |
63 | /* no other way of interacting with user, halt */ |
- | 64 | if (CPU) |
|
- | 65 | printf("cpu%d: ", CPU->id); |
|
- | 66 | else |
|
- | 67 | printf("cpu: "); |
|
63 | printf("cpu: halted - no kconsole\n"); |
68 | printf("halted - no kconsole\n"); |
64 | cpu_halt(); |
69 | cpu_halt(); |
65 | } |
70 | } |
66 | 71 | ||
67 | waitq_sleep(&chardev->wq); |
72 | waitq_sleep(&chardev->wq); |
68 | ipl = interrupts_disable(); |
73 | ipl = interrupts_disable(); |