arch/powerpc/xmon/nonstdio.c
Source file repositories/reference/linux-study-clean/arch/powerpc/xmon/nonstdio.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/xmon/nonstdio.c- Extension
.c- Size
- 3152 bytes
- Lines
- 189
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
Dependency Surface
linux/string.hasm/udbg.hasm/time.hnonstdio.h
Detected Declarations
function xmon_start_paginationfunction xmon_end_paginationfunction xmon_set_pagination_lppfunction xmon_readcharfunction xmon_writefunction xmon_putcharfunction xmon_getcharfunction xmon_printffunction xmon_puts
Annotated Snippet
while (paginating && (q = strchr(p, '\n'))) {
rv += udbg_write(p, q - p + 1);
p = q + 1;
paginate_pos++;
if (paginate_pos >= paginate_lpp) {
udbg_write(msg, strlen(msg));
switch (xmon_readchar()) {
case 'a':
paginating = false;
break;
case 'q':
paginate_skipping = true;
break;
default:
/* nothing */
break;
}
paginate_pos = 0;
udbg_write("\r\n", 2);
if (paginate_skipping)
return nb;
}
}
}
return rv + udbg_write(p, nb - (p - ptr));
}
int xmon_putchar(int c)
{
char ch = c;
if (c == '\n')
xmon_putchar('\r');
return xmon_write(&ch, 1) == 1? c: -1;
}
static char line[256];
static char *lineptr;
static int lineleft;
static int xmon_getchar(void)
{
int c;
if (lineleft == 0) {
lineptr = line;
for (;;) {
c = xmon_readchar();
if (c == -1 || c == 4)
break;
if (c == '\r' || c == '\n') {
*lineptr++ = '\n';
xmon_putchar('\n');
break;
}
switch (c) {
case 0177:
case '\b':
if (lineptr > line) {
xmon_putchar('\b');
xmon_putchar(' ');
xmon_putchar('\b');
--lineptr;
}
break;
case 'U' & 0x1F:
while (lineptr > line) {
xmon_putchar('\b');
xmon_putchar(' ');
xmon_putchar('\b');
--lineptr;
}
break;
default:
if (lineptr >= &line[sizeof(line) - 1])
xmon_putchar('\a');
else {
xmon_putchar(c);
*lineptr++ = c;
}
}
}
lineleft = lineptr - line;
lineptr = line;
}
Annotation
- Immediate include surface: `linux/string.h`, `asm/udbg.h`, `asm/time.h`, `nonstdio.h`.
- Detected declarations: `function xmon_start_pagination`, `function xmon_end_pagination`, `function xmon_set_pagination_lpp`, `function xmon_readchar`, `function xmon_write`, `function xmon_putchar`, `function xmon_getchar`, `function xmon_printf`, `function xmon_puts`.
- Atlas domain: Architecture Layer / arch/powerpc.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.