if serial output is enabled in the boot monitor, on the first serial line,

enable serial debug output in the kernel too.
This commit is contained in:
Ben Gras 2008-12-19 13:21:42 +00:00
parent 7fdc181d5f
commit b740ff055f
4 changed files with 24 additions and 4 deletions

View File

@ -48,6 +48,8 @@ char version[]= "2.20";
#define arraylimit(a) ((a) + arraysize(a)) #define arraylimit(a) ((a) + arraysize(a))
#define between(a, c, z) ((unsigned) ((c) - (a)) <= ((z) - (a))) #define between(a, c, z) ((unsigned) ((c) - (a)) <= ((z) - (a)))
int serial_line = -1;
u16_t vid_port; /* Video i/o port. */ u16_t vid_port; /* Video i/o port. */
u32_t vid_mem_base; /* Video memory base address. */ u32_t vid_mem_base; /* Video memory base address. */
u32_t vid_mem_size; /* Video memory size. */ u32_t vid_mem_size; /* Video memory size. */
@ -1389,13 +1391,14 @@ void boot_device(char *devname)
void ctty(char *line) void ctty(char *line)
{ {
if (line == nil) { if (line == nil) {
serial_init(-1); serial_line = -1;
} else } else if (between('0', line[0], '3') && line[1] == 0) {
if (between('0', line[0], '3') && line[1] == 0) { serial_line = line[0] - '0';
serial_init(line[0] - '0');
} else { } else {
printf("Bad serial line number: %s\n", line); printf("Bad serial line number: %s\n", line);
return;
} }
serial_init(serial_line);
} }
#else /* DOS */ #else /* DOS */

View File

@ -29,6 +29,7 @@
static int block_size = 0; static int block_size = 0;
extern int serial_line;
extern u16_t vid_port; /* Video i/o port. */ extern u16_t vid_port; /* Video i/o port. */
extern u32_t vid_mem_base; /* Video memory base address. */ extern u32_t vid_mem_base; /* Video memory base address. */
extern u32_t vid_mem_size; /* Video memory size. */ extern u32_t vid_mem_size; /* Video memory size. */
@ -748,6 +749,14 @@ void bootminix(void)
if ((image= select_image(b_value("image"))) == nil) return; if ((image= select_image(b_value("image"))) == nil) return;
if(serial_line >= 0) {
char linename[2];
linename[0] = serial_line + '0';
linename[1] = '\0';
b_setvar(E_VAR, SERVARNAME, linename);
printf("set %s to %s\n", SERVARNAME, linename);
}
exec_image(image); exec_image(image);
switch (errno) { switch (errno) {
@ -763,6 +772,9 @@ void bootminix(void)
/* No error or error already reported. */; /* No error or error already reported. */;
} }
free(image); free(image);
if(serial_line >= 0)
b_unset(SERVARNAME);
} }
/* /*

View File

@ -131,6 +131,8 @@
#define NO_ZONE ((zone_t) 0) /* absence of a zone number */ #define NO_ZONE ((zone_t) 0) /* absence of a zone number */
#define NO_DEV ((dev_t) 0) /* absence of a device numb */ #define NO_DEV ((dev_t) 0) /* absence of a device numb */
#define SERVARNAME "cttyline"
/* Bits for the system property flags in boot image processes. */ /* Bits for the system property flags in boot image processes. */
#define PREEMPTIBLE 0x02 /* kernel tasks are not preemptible */ #define PREEMPTIBLE 0x02 /* kernel tasks are not preemptible */
#define BILLABLE 0x04 /* some processes are not billable */ #define BILLABLE 0x04 /* some processes are not billable */

View File

@ -71,6 +71,9 @@ U16_t parmoff, parmsize; /* boot parameters offset and length */
system_hz = atoi(value); system_hz = atoi(value);
if(!value || system_hz < 2 || system_hz > 50000) /* sanity check */ if(!value || system_hz < 2 || system_hz > 50000) /* sanity check */
system_hz = DEFAULT_HZ; system_hz = DEFAULT_HZ;
value = get_value(params_buffer, "cttyline");
if(value && atoi(value) == 0)
do_serial_debug=1;
/* Return to assembler code to switch to protected mode (if 286), /* Return to assembler code to switch to protected mode (if 286),
* reload selectors and call main(). * reload selectors and call main().