📄 kern_logstream.cxx
字号:
/* * Copyright (C) 2001, Jonathan S. Shapiro. * * This file is part of the EROS Operating System. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2, * or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *//* The LogStream is a consolidation of the various previous logging * mechanisms. */#include <kerninc/kernel.hxx>#include <kerninc/util.h>#include <kerninc/KernStream.hxx>#include <eros/i486/io.h>/* This class has a singleton instance! */struct LogStream: public KernStream { void Init(); void Put(uint8_t c);#ifdef OPTION_DDB uint8_t Get(); void SetDebugging(bool onoff); void EnableDebuggerInput();#endif};struct LogStream TheLogStream;KernStream* KernStream::LogStream = &TheLogStream;#define DIAG_BUF_PAGES 1ustatic char diagbuf[DIAG_BUF_PAGES * EROS_PAGE_SIZE];static char *const logbuf = diagbuf;static char *nextin = diagbuf;#if 0/* Eventually to be used for user-level extraction of log output. */static char *nextout = diagbuf;#endifstatic char *const logtop = diagbuf + (DIAG_BUF_PAGES * EROS_PAGE_SIZE);voidLogStream::Init(){}voidLogStream::Put(uint8_t c){ if ((unsigned)(nextin - logbuf) > (DIAG_BUF_PAGES * EROS_PAGE_SIZE)) halt('p'); if (nextin == logtop) nextin = logbuf; *nextin++ = c;}#ifdef OPTION_DDBuint8_tLogStream::Get(){ fatal("LogStream::Get() should never be called!\n"); return 0;}voidLogStream::SetDebugging(bool onOff){ fatal("LogStream::SetDebugging() should never be called!\n");}voidLogStream::EnableDebuggerInput(){ fatal("LogStream::EnableDebuggerInput() should never be called!\n");}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -