本文整理汇总了C++中cons_init函数的典型用法代码示例。如果您正苦于以下问题:C++ cons_init函数的具体用法?C++ cons_init怎么用?C++ cons_init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cons_init函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: i386_init
void
i386_init(void)
{
extern char edata[], end[];
// Before doing anything else, complete the ELF loading process.
// Clear the uninitialized global data (BSS) section of our program.
// This ensures that all static/global variables start out zero.
memset(edata, 0, end - edata);
// Initialize the console.
// Can't call cprintf until after we do this!
cons_init();
cprintf("6828 decimal is %o octal!\n", 6828);
// Lab 2 memory management initialization functions
i386_detect_memory();
i386_vm_init();
page_init();
page_check();
// Lab 3 user environment initialization functions
env_init();
idt_init();
// Lab 4 multitasking initialization functions
pic_init();
kclock_init();
// Should always have an idle process as first one.
ENV_CREATE(user_idle);
// Start fs.
ENV_CREATE(fs_fs);
ENV_CREATE(user_icode);
#if defined(TEST)
// Don't touch -- used by grading script!
ENV_CREATE2(TEST, TESTSIZE)
#else
// Touch all you want.
// ENV_CREATE(user_icode);
// ENV_CREATE(user_pipereadeof);
// ENV_CREATE(user_pipewriteeof);
// ENV_CREATE(user_testpipe);
// ENV_CREATE(user_primespipe);
// ENV_CREATE(user_testpiperace);
// ENV_CREATE(user_testpiperace2);
// ENV_CREATE(user_testfdsharing);
#endif // TEST*
// Should not be necessary - drain keyboard because interrupt has given up.
kbd_intr();
// Schedule and run the first user environment!
sched_yield();
}
示例2: uart_init
void uart_init(uint8_t uart, __unused uint8_t interrupts)
{
/* no interrupts, only polling so far */
uart_reg_write(uart, IER, 0x00);
if (uart == CONS_UART_NR) {
cons_init();
} else {
sercomm_init();
uart_irq_enable(uart, UART_IRQ_RX_CHAR, 1);
}
uart_reg_write(uart, AUTOBAUD_EN, 0x00); /* disable AUTOBAUD */
uart_reg_write(uart, EFR, 0x10); /* Enhanced Features Register */
/* no XON/XOFF flow control, ENHANCED_EN, no auto-RTS/CTS */
uart_reg_write(uart, EFR, (1 << 4));
/* enable Tx/Rx FIFO, Tx trigger at 56 spaces, Rx trigger at 60 chars */
//FIXME check those FIFO settings
uart_reg_write(uart, IIR, FIFO_EN | RX_FIFO_CLEAR | TX_FIFO_CLEAR |
(3 << TX_FIFO_TRIG_SHIFT) | (1 << RX_FIFO_TRIG_SHIFT));
/* RBR interrupt only when TX FIFO and TX shift register are empty */
uart_reg_write(uart, SCR, (1 << 0));// | (1 << 3));
/* 8 bit, 1 stop bit, no parity, no break */
uart_reg_write(uart, LCR, 0x03);
uart_set_lcr7bit(uart, 0);
}
示例3: i386_init
void
i386_init(void)
{
extern char edata[], end[];
extern const uint32_t sctors[], ectors[];
const uint32_t *ctorva;
// Initialize the console.
// Can't call cprintf until after we do this!
cons_init();
// Then call any global constructors.
// This relies on linker script magic to define the 'sctors' and
// 'ectors' symbols; see kern/kernel.ld.
// Call after cons_init() so we can cprintf() if necessary.
for (ctorva = ectors; ctorva > sctors; )
((void(*)()) *--ctorva)();
cprintf("6828 decimal is %o octal!\n", 6828);
// Lab 2 memory management initialization functions
mem_init();
// Lab 2 interrupt and gate descriptor initialization functions
idt_init();
// Test IDT (lab 2 only)
__asm__ __volatile__("int3");
cprintf("Breakpoint succeeded!\n");
// Drop into the kernel monitor.
while (1)
monitor(NULL);
}
示例4: i386_init
void
i386_init(void)
{
extern char edata[], end[];
// Before doing anything else, complete the ELF loading process.
// Clear the uninitialized global data (BSS) section of our program.
// This ensures that all static/global variables start out zero.
memset(edata, 0, end - edata);
// Initialize the console.
// Can't call cprintf until after we do this!
cons_init();
cprintf("6828 decimal is %o octal!\n", 6828);
// Lab 2 memory management initialization functions
mem_init();
// Lab 3 user environment initialization functions
env_init();
trap_init();
#if defined(TEST)
// Don't touch -- used by grading script!
ENV_CREATE(TEST, ENV_TYPE_USER);
#else
// Touch all you want.
ENV_CREATE(user_hello, ENV_TYPE_USER);
#endif // TEST*
// We only have one user environment for now, so just run it.
env_run(&envs[0]);
}
示例5: i386_init
void
i386_init(void)
{
extern char edata[], end[];
// Before doing anything else, complete the ELF loading process.
// Clear the uninitialized global data (BSS) section of our program.
// This ensures that all static/global variables start out zero.
memset(edata, 0, end - edata);
// Initialize the console.
// Can't call cprintf until after we do this!
cons_init();
cprintf("6828 decimal is %o octal!\n", 6828);
// Lab 2 memory management initialization functions
i386_detect_memory();
i386_vm_init();
page_init();
page_check();
// Drop into the kernel monitor.
while (1)
monitor(NULL);
}
示例6: kern_init
int
kern_init(void) {
extern char edata[], end[];
memset(edata, 0, end - edata);
cons_init(); // init the console
const char *message = "(THU.CST) os is loading ...";
kprintf ("%s\n\n", message);
/* Only to initialize lcpu_count. */
mp_init ();
pmm_init(); // init physical memory management
pmm_init_ap ();
pic_init(); // init interrupt controller
vmm_init(); // init virtual memory management
sched_init(); // init scheduler
proc_init(); // init process table
sync_init(); // init sync struct
ide_init(); // init ide devices
swap_init(); // init swap
fs_init(); // init fs
clock_init(); // init clock interrupt
intr_enable(); // enable irq interrupt
cpu_idle(); // run idle process
}
示例7: i386_init
void
i386_init(void)
{
extern char edata[], end[];
// Lab1 only
char chnum1 = 0, chnum2 = 0, ntest[256] = {};
// Before doing anything else, complete the ELF loading process.
// Clear the uninitialized global data (BSS) section of our program.
// This ensures that all static/global variables start out zero.
memset(edata, 0, end - edata);
// Initialize the console.
// Can't call cprintf until after we do this!
cons_init();
cprintf("6828 decimal is %o octal!%n\n%n", 6828, &chnum1, &chnum2);
cprintf("pading space in the right to number 22: %-8d.\n", 22);
cprintf("chnum1: %d chnum2: %d\n", chnum1, chnum2);
cprintf("%n", NULL);
memset(ntest, 0xd, sizeof(ntest) - 1);
cprintf("%s%n", ntest, &chnum1);
cprintf("chnum1: %d\n", chnum1);
cprintf("show me the sign: %+d, %+d\n", 1024, -1024);
// Lab 2 memory management initialization functions
mem_init();
// Drop into the kernel monitor.
while (1)
monitor(NULL);
}
示例8: handle_keypress
static void handle_keypress(char c)
{
amr_t handler = c == 'G' ? __run_mon : __cons_add_char;
send_kernel_message(core_id(), handler, (long)&cons_buf, (long)c, 0,
KMSG_ROUTINE);
cons_init();
}
示例9: i386_init
void
i386_init(void)
{
extern char edata[], end[];
// Before doing anything else, complete the ELF loading process.
// Clear the uninitialized global data (BSS) section of our program.
// This ensures that all static/global variables start out zero.
memset(edata, 0, end - edata);
// Initialize the console.
// Can't call cprintf until after we do this!
cons_init();
// int x = 1, y = 3, z = 4;
// cprintf("x %d, y %x, z %d\n", x, y, z);
// unsigned int i = 0x00646c72;
// cprintf("H%x Wo%s\n", 57616, &i);
// cprintf("x=%d y=%d", 3, 4);
// cprintf("x=%d y=%d", 3);
cprintf("6828 decimal is %o octal!\n", 6828);
// Lab 2 memory management initialization functions
mem_init();
// Drop into the kernel monitor.
while (1)
monitor(NULL);
}
示例10: main
int main(void){
cli();
cons_init();
mm_init();
trap_init();
god_init();
}
示例11: main
int main( int argc, char* argv[] )
{
FILE* f = stdout;
if ( argc == 2 )
{ f = fopen(argv[1], "r");
if( f==NULL || ferror(f) )
{ printf("File didnt open or something.\n"); return -1;}
}
if ( argc > 2 )
{ printf("Note: anything more then first argument is ignored."); }
cons_init(1024);
printf( "Initiated.\n" );
printf("File %s opened.\n", argv[1]);
printf("Reading file.\n");
Obj obj=// read_obj(f);
Obj_Cons(read_cons(f));
printf("Printing next.\n");
Obj_print(obj, printing_print,NULL);
printf("\nClean up.\n");
Obj_exit(obj);
printf("\nClosing file, de-initiating.\n");
if( argc==2 ){ fclose(f); }
cons_exit();
}
示例12: main
/**
* The entry.
*/
int main(int argc, char *argv[], char *envp[])
{
if (ginfo->status == STATUS_DEBUG)
raise(SIGTRAP);
cons_init();
const char *message = "(THU.CST) os is loading ...";
kprintf("%s\n\n", message);
intr_init();
ide_init();
host_signal_init();
/* Only to initialize lcpu_count. */
mp_init();
pmm_init();
pmm_init_ap();
vmm_init();
sched_init();
proc_init();
swap_init();
fs_init();
sync_init();
umclock_init();
cpu_idle();
host_exit(SIGINT);
return 0;
}
示例13: kern_init
int __noreturn
kern_init(void) {
extern char edata[], end[];
memset(edata, 0, end - edata);
cons_init(); // init the console
const char *message = "(THU.CST) os is loading ...";
cprintf("%s\n\n", message);
print_kerninfo();
pmm_init(); // init physical memory management
pic_init(); // init interrupt controller
idt_init(); // init interrupt descriptor table
vmm_init(); // init virtual memory management
sched_init(); // init scheduler
proc_init(); // init process table
sync_init(); // init sync struct
ide_init(); // init ide devices
swap_init(); // init swap
fs_init(); // init fs
clock_init(); // init clock interrupt
intr_enable(); // enable irq interrupt
cpu_idle(); // run idle process
}
示例14: i386_init
void i386_init(void)
{
extern char edata[], end[];
/* before doing anything else, complete the ELF loading process;
clear the uninitialized global data (BSS) section of our program;
this ensures that all static/global variables start out zero */
memset(edata, 0, end - edata);
/* initialize the console; can't call cprintf until after we do this */
cons_init();
cprintf("\n*** Welcome to Jake, The Java Kernel! ***");
cprintf("\nCopyright (C) 2011. Enterprise Java Systems.\n\n");
/* test the stack backtrace function */
test_backtrace(5);
/* memory setup */
i386_detect_memory();
i386_vm_init();
/* drop into the kernel monitor */
while (1)
monitor(NULL);
}
示例15: i386_init
void i386_init(void)
{
extern char edata[], end[];
// Before doing anything else, complete the ELF loading process.
// Clear the uninitialized global data (BSS) section of our program.
// This ensures that all static/global variables start out zero.
memset(edata, 0, end - edata);
// Initialize the console.
// Can't call cprintf until after we do this!
cons_init();
cprintf("6828 decimal is %o octal!\n", 6828);
//check page_alloc() this is a test,not my code
check_page_alloc();
// Test the stack backtrace function (lab 1 only)
test_backtrace(5);
// Drop into the kernel monitor.
while (1)
monitor(NULL);
}