Author: Anonymous Language: diff
Description: No description Timestamp: 2010-09-06 03:51:26 -0400
View raw paste Reply
  1. From 35deed8c7c86493b4025a73777fb6d8fe0b818ab Mon Sep 17 00:00:00 2001
  2. From: Eduard Burtescu <eddy_me08@yahoo.com>
  3. Date: Mon, 6 Sep 2010 10:49:58 +0300
  4. Subject: [PATCH] That's about everything related to the bug...
  5.  
  6. ---
  7. src/modules/system/TUI/Console.cc           |    6 -
  8.  src/modules/system/TUI/Console.h            |    3 -
  9.  src/modules/system/TUI/TuiSyscallManager.cc |  169 +--------------------------
  10.  src/modules/system/TUI/TuiSyscallManager.h  |   37 ++----
  11.  src/modules/system/TUI/tuiSyscallNumbers.h  |   32 +----
  12.  src/subsys/native/include/input/Input.h     |    8 +-
  13.  src/subsys/native/user/input/Input.cc       |   22 ++++-
  14.  src/subsys/pedigree-c/pedigree-syscalls.cc  |   25 ++++-
  15.  src/subsys/pedigree-c/pedigree-syscalls.h   |    2 +-
  16.  src/subsys/posix/system-syscalls.cc         |   25 +----
  17.  src/user/applications/TUI/Font.cc           |   32 +++---
  18.  src/user/applications/TUI/Png.cc            |   28 ++---
  19.  src/user/applications/TUI/Terminal.cc       |   14 +-
  20.  src/user/applications/TUI/environment.cc    |   92 +--------------
  21.  src/user/applications/TUI/environment.h     |    9 --
  22.  src/user/applications/TUI/main.cc           |   48 +++-----
  23.  16 files changed, 121 insertions(+), 431 deletions(-)
  24.  
  25. diff --git a/src/modules/system/TUI/Console.cc b/src/modules/system/TUI/Console.cc
  26. index 5bec562..bee4ffc 100644
  27. --- a/src/modules/system/TUI/Console.cc
  28. +++ b/src/modules/system/TUI/Console.cc
  29. @@ -100,7 +100,6 @@ size_t UserConsole::nextRequest(size_t responseToLast, char *buffer, size_t *sz,
  30.          // and it was just freed by us if it was async).
  31.          m_pReq = 0;
  32.      }
  33. -
  34.      m_RequestQueueMutex.release();
  35.  
  36.      // Sleep on the queue length semaphore - wake when there's something to do.
  37. @@ -171,11 +170,6 @@ size_t UserConsole::nextRequest(size_t responseToLast, char *buffer, size_t *sz,
  38.              delete [] reinterpret_cast<uint8_t*>(m_pReq->p4);
  39.          }
  40.      }
  41. -    else if (command == TUI_CHAR_RECV || command == TUI_MODE_CHANGED)
  42. -    {
  43. -        memcpy(buffer, reinterpret_cast<uint8_t*>(&m_pReq->p3), 8);
  44. -        *sz = 8;
  45. -    }
  46.  
  47.      return command;
  48.  }
  49. diff --git a/src/modules/system/TUI/Console.h b/src/modules/system/TUI/Console.h
  50. index c0f32eb..b786ccc 100644
  51. --- a/src/modules/system/TUI/Console.h
  52. +++ b/src/modules/system/TUI/Console.h
  53. @@ -18,9 +18,6 @@
  54.  
  55.  #include <console/Console.h>
  56.  
  57. -#define TUI_MODE_CHANGED 98
  58. -#define TUI_CHAR_RECV 99
  59. -
  60.  class UserConsole : public RequestQueue
  61.  {
  62.  public:
  63. diff --git a/src/modules/system/TUI/TuiSyscallManager.cc b/src/modules/system/TUI/TuiSyscallManager.cc
  64. index 657a9ac..a981251 100644
  65. --- a/src/modules/system/TUI/TuiSyscallManager.cc
  66. +++ b/src/modules/system/TUI/TuiSyscallManager.cc
  67. @@ -35,83 +35,9 @@ UserConsole *g_UserConsole = 0;
  68.  size_t g_UserConsoleId = 0;
  69.  TuiSyscallManager g_TuiSyscallManager;
  70.  
  71. -extern Display *g_pDisplay;
  72. -extern Display::ScreenMode g_ScreenMode;
  73. -
  74. -/// \todo Key presses should go to the TUI immediately, rather than going onto
  75. -///       the request queue and waiting for it to complete a write to the
  76. -///       screen. At the moment things like CTRL-C are not handled until after
  77. -///       a write is complete, which is usually alright, but can cause CTRL-C
  78. -///       to appear to simply not work at all.
  79. -void callback(InputManager::InputNotification &note)
  80. -{
  81. -    if(note.type != InputManager::Key)
  82. -        return; // Ignore any non-keyboard input
  83. -
  84. -    if (!g_UserConsole)
  85. -    {
  86. -        WARNING("Key called with no console");
  87. -        return;
  88. -    }
  89. -
  90. -    // Ensure this is sent with highest priority (0).
  91. -    g_UserConsole->addAsyncRequest(0, TUI_CHAR_RECV, g_UserConsoleId, note.data.key.key);
  92. -    ConsoleManager::instance().getConsoleFile(g_UserConsole)->dataIsReady();
  93. -}
  94. -
  95. -void pedigree_event_return()
  96. -{
  97. -    // Return to the old code
  98. -    Processor::information().getScheduler().eventHandlerReturned();
  99. -
  100. -    FATAL("event_return: should never get here");
  101. -}
  102. -
  103. -void pedigree_input_register_callback(uintptr_t func)
  104. -{
  105. -    InputManager::instance().installCallback(InputManager::Key,
  106. -                                             reinterpret_cast<void (*)(InputManager::InputNotification&)>(func),
  107. -                                             Processor::information().getCurrentThread());
  108. -}
  109. -
  110. -extern "C" void tuiModeChangedCallback()
  111. -{
  112. -    if (!g_UserConsole)
  113. -    {
  114. -        WARNING("Mode changed called with no console");
  115. -        return;
  116. -    }
  117. -
  118. -    /// \todo Multiple displays.
  119. -    Config::Result *pResult = Config::instance().query("SELECT width,height FROM displays d, 'display-modes' m WHERE m.mode_id=d.mode_id");
  120. -    if (!pResult->succeeded() || !pResult->rows())
  121. -    {
  122. -        FATAL("Uh oh...");
  123. -    }
  124. -    uint64_t width  = static_cast<uint64_t> (pResult->getNum(0, "width"));
  125. -    uint64_t height = static_cast<uint64_t> (pResult->getNum(0, "height"));
  126. -    uint64_t a = (height<<32)|width;
  127. -    NOTICE("width: " << Hex << width << ", height: " << height << ", a: " << a);
  128. -    delete pResult;
  129. -
  130. -    g_UserConsole->addAsyncRequest(0, TUI_MODE_CHANGED, g_UserConsoleId, a);
  131. -}
  132. -
  133. -TuiSyscallManager::TuiSyscallManager() :
  134. -    m_pDisplay(0)
  135. -{
  136. -}
  137. -
  138. -TuiSyscallManager::~TuiSyscallManager()
  139. -{
  140. -}
  141. -
  142.  void TuiSyscallManager::initialise()
  143.  {
  144. -    m_pDisplay = g_pDisplay;
  145. -
  146.      SyscallManager::instance().registerSyscallHandler(TUI, this);
  147. -    // InputManager::instance().installCallback(InputManager::Key, callback);
  148.  }
  149.  
  150.  uintptr_t TuiSyscallManager::call(uintptr_t function, uintptr_t p1, uintptr_t p2, uintptr_t p3, uintptr_t p4, uintptr_t p5)
  151. @@ -133,28 +59,12 @@ uintptr_t TuiSyscallManager::syscall(SyscallState &state)
  152.      uintptr_t p5 = state.getSyscallParameter(4);
  153.  
  154.      static uintptr_t currBuff = 0;
  155. +    //NOTICE("TUI SYSCALL ");// << state.getSyscallNumber() << " " << p1 << " " << p2 << " " << p3 << " " << p4 << " " << p5);
  156.  
  157.      switch (state.getSyscallNumber())
  158.      {
  159.          case TUI_NEXT_REQUEST:
  160.              return g_UserConsole->nextRequest(p1, reinterpret_cast<char*>(p2), reinterpret_cast<size_t*>(p3), p4, reinterpret_cast<size_t*>(p5));
  161. -        case TUI_LOG:
  162. -        {
  163. -            // This is the solution to a bug - if the address in p1 traps (because of demand loading),
  164. -            // it MUST trap before we get the log spinlock, else other things will
  165. -            // want to write to it and deadlock.
  166. -            static char buf[1024];
  167. -            strncpy(buf, reinterpret_cast<char*>(p1), 1023);
  168. -            buf[1023] = '\0';
  169. -            NOTICE("TUI: " << buf);
  170. -            return 0;
  171. -        }
  172. -        case TUI_GETFB:
  173. -        {
  174. -            Display::ScreenMode *sm = reinterpret_cast<Display::ScreenMode*>(p1);
  175. -            *sm = g_ScreenMode;
  176. -            return 0;
  177. -        }
  178.          case TUI_REQUEST_PENDING:
  179.          {
  180.              if (!g_UserConsole)
  181. @@ -200,77 +110,6 @@ uintptr_t TuiSyscallManager::syscall(SyscallState &state)
  182.              g_UserConsole = g_Consoles[p1];
  183.              break;
  184.          }
  185. -        case TUI_VID_NEW_BUFFER:
  186. -        {
  187. -            if (!m_pDisplay) return 0;
  188. -            NOTICE("Getting new buffer.");
  189. -            return reinterpret_cast<uintptr_t> (m_pDisplay->newBuffer());
  190. -        }
  191. -        case TUI_VID_SET_BUFFER:
  192. -        {
  193. -            vid_req_t *pReq = reinterpret_cast<vid_req_t*>(p1);
  194. -            if (!m_pDisplay) return 0;
  195. -
  196. -            currBuff = p1;
  197. -            m_pDisplay->setCurrentBuffer(reinterpret_cast<Display::rgb_t*>(p1));
  198. -            break;
  199. -        }
  200. -        case TUI_VID_UPDATE_BUFFER:
  201. -        {
  202. -            if (!m_pDisplay) return 0;
  203. -            vid_req_t *pReq = reinterpret_cast<vid_req_t*>(p1);
  204. -
  205. -            if(currBuff && (reinterpret_cast<uintptr_t>(pReq->buffer) != currBuff))
  206. -            {
  207. -                WARNING("updateBuffer called on a buffer which is not currently active");
  208. -            }
  209. -            else
  210. -            {
  211. -                m_pDisplay->updateBuffer(reinterpret_cast<Display::rgb_t*>(pReq->buffer), pReq->x, pReq->y, pReq->x2,
  212. -                                         pReq->y2);
  213. -            }
  214. -            break;
  215. -        }
  216. -        case TUI_VID_KILL_BUFFER:
  217. -        {
  218. -            if (!m_pDisplay) return 0;
  219. -
  220. -            m_pDisplay->killBuffer(reinterpret_cast<Display::rgb_t*>(p1));
  221. -            break;
  222. -        }
  223. -        case TUI_VID_BIT_BLIT:
  224. -        {
  225. -            if (!m_pDisplay) return 0;
  226. -
  227. -            vid_req_t *pReq = reinterpret_cast<vid_req_t*>(p1);
  228. -
  229. -            if(currBuff && (reinterpret_cast<uintptr_t>(pReq->buffer) != currBuff))
  230. -            {
  231. -                WARNING("bitBlit called on a buffer which is not currently active");
  232. -            }
  233. -            else
  234. -            {
  235. -                m_pDisplay->bitBlit(reinterpret_cast<Display::rgb_t*>(pReq->buffer), pReq->x, pReq->y, pReq->x2,
  236. -                                    pReq->y2, pReq->w, pReq->h);
  237. -            }
  238. -            break;
  239. -        }
  240. -        case TUI_VID_FILL_RECT:
  241. -        {
  242. -            if (!m_pDisplay) return 0;
  243. -
  244. -            vid_req_t *pReq = reinterpret_cast<vid_req_t*>(p1);
  245. -
  246. -            m_pDisplay->fillRectangle(reinterpret_cast<Display::rgb_t*>(pReq->buffer), pReq->x, pReq->y, pReq->w,
  247. -                                      pReq->h, *reinterpret_cast<Display::rgb_t*>(pReq->c));
  248. -            break;
  249. -        }
  250. -        case TUI_EVENT_RETURNED:
  251. -            pedigree_event_return();
  252. -            break;
  253. -        case TUI_INPUT_REGISTER_CALLBACK:
  254. -            pedigree_input_register_callback(static_cast<uintptr_t>(p1));
  255. -            break;
  256.          case TUI_STOP_REQUEST_QUEUE:
  257.              g_UserConsole->stopCurrentBlock();
  258.              break;
  259. @@ -288,8 +127,4 @@ static void destroy()
  260.  {
  261.  }
  262.  
  263. -#ifdef X86_COMMON
  264. -MODULE_INFO("TUI", &init, &destroy, "console", "vbe");
  265. -#else
  266. -MODULE_INFO("TUI", &init, &destroy, "console");
  267. -#endif
  268. +MODULE_INFO("TUI", &init, &destroy, "console", "gfx-deps");
  269. diff --git a/src/modules/system/TUI/TuiSyscallManager.h b/src/modules/system/TUI/TuiSyscallManager.h
  270. index 7030ae4..00be858 100644
  271. --- a/src/modules/system/TUI/TuiSyscallManager.h
  272. +++ b/src/modules/system/TUI/TuiSyscallManager.h
  273. @@ -18,38 +18,23 @@
  274.  
  275.  #include <processor/types.h>
  276.  #include <processor/SyscallHandler.h>
  277. -#include <processor/PhysicalMemoryManager.h>
  278. -#include <processor/MemoryRegion.h>
  279. -#include <machine/Display.h>
  280.  
  281.  class TuiSyscallManager : public SyscallHandler
  282.  {
  283. -public:
  284. -    void initialise();
  285. +    public:
  286. +        /// The constructor
  287. +        TuiSyscallManager() {}
  288. +        /// The destructor
  289. +        virtual ~TuiSyscallManager() {}
  290.  
  291. -    /** Calls a syscall. */
  292. -    uintptr_t call(uintptr_t function, uintptr_t p1=0, uintptr_t p2=0, uintptr_t p3=0, uintptr_t p4=0, uintptr_t p5=0);
  293. +        /// Initialise the TUI syscall manager
  294. +        void initialise();
  295.  
  296. -    /** Called when a syscall arrives. */
  297. -    virtual uintptr_t syscall(SyscallState &state);
  298. +        /// Calls a syscall
  299. +        uintptr_t call(uintptr_t function, uintptr_t p1=0, uintptr_t p2=0, uintptr_t p3=0, uintptr_t p4=0, uintptr_t p5=0);
  300.  
  301. -    /** The constructor */
  302. -    TuiSyscallManager();
  303. -    /** The destructor */
  304. -    virtual ~TuiSyscallManager();
  305. -
  306. -    // Called by video drivers to inform us that a mode change has taken place.
  307. -    void modeChanged(Display *pDisplay, Display::ScreenMode mode, uintptr_t pFramebuffer, size_t pFbSize);
  308. -
  309. -private:
  310. -    /** The copy-constructor
  311. -     *\note Not implemented (singleton) */
  312. -    TuiSyscallManager(const TuiSyscallManager &);
  313. -    /** The copy-constructor
  314. -     *\note Not implemented (singleton) */
  315. -    TuiSyscallManager &operator = (const TuiSyscallManager &);
  316. -
  317. -    Display *m_pDisplay;
  318. +        /// Called when a syscall arrives
  319. +        virtual uintptr_t syscall(SyscallState &state);
  320.  };
  321.  
  322.  #endif
  323. diff --git a/src/modules/system/TUI/tuiSyscallNumbers.h b/src/modules/system/TUI/tuiSyscallNumbers.h
  324. index a0ea360..a34b23d 100644
  325. --- a/src/modules/system/TUI/tuiSyscallNumbers.h
  326. +++ b/src/modules/system/TUI/tuiSyscallNumbers.h
  327. @@ -17,31 +17,13 @@
  328.  #ifndef SYSCALL_NUMBERS_H
  329.  #define SYSCALL_NUMBERS_H
  330.  
  331. -struct vid_req_t
  332. -{
  333. -    struct rgb_t *buffer;
  334. -    size_t x, y, x2, y2, w, h;
  335. -    struct rgb_t *c;
  336. -};
  337. +#define TUI_NEXT_REQUEST            1
  338. +#define TUI_REQUEST_PENDING         2
  339. +#define TUI_RESPOND_TO_PENDING      3
  340. +#define TUI_STOP_REQUEST_QUEUE      4
  341.  
  342. -#define TUI_NEXT_REQUEST       1
  343. -#define TUI_LOG                2
  344. -#define TUI_GETFB              3
  345. -#define TUI_REQUEST_PENDING    4
  346. -#define TUI_RESPOND_TO_PENDING 5
  347. -#define TUI_CREATE_CONSOLE     6
  348. -#define TUI_SET_CTTY           7
  349. -#define TUI_SET_CURRENT_CONSOLE 8
  350. -
  351. -#define TUI_VID_NEW_BUFFER     9
  352. -#define TUI_VID_SET_BUFFER     10
  353. -#define TUI_VID_UPDATE_BUFFER  11
  354. -#define TUI_VID_KILL_BUFFER    12
  355. -#define TUI_VID_BIT_BLIT       13
  356. -#define TUI_VID_FILL_RECT      14
  357. -
  358. -#define TUI_EVENT_RETURNED             15
  359. -#define TUI_INPUT_REGISTER_CALLBACK    16
  360. -#define TUI_STOP_REQUEST_QUEUE 17
  361. +#define TUI_CREATE_CONSOLE          5
  362. +#define TUI_SET_CTTY                6
  363. +#define TUI_SET_CURRENT_CONSOLE     7
  364.  
  365.  #endif
  366. diff --git a/src/subsys/native/include/input/Input.h b/src/subsys/native/include/input/Input.h
  367. index 9228ad4..066ecf5 100755
  368. --- a/src/subsys/native/include/input/Input.h
  369. +++ b/src/subsys/native/include/input/Input.h
  370. @@ -13,8 +13,8 @@
  371.   * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  372.   * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  373.   */
  374. -#ifndef _INPUT_MANAGER_H
  375. -#define _INPUT_MANAGER_H
  376. +#ifndef _INPUT_H
  377. +#define _INPUT_H
  378.  
  379.  #include <types.h>
  380.  
  381. @@ -26,7 +26,7 @@ namespace Input
  382.      const int Joystick = 4;
  383.      const int RawKey = 8;
  384.      const int Unknown = 255;
  385. -
  386. +
  387.      typedef int CallbackType;
  388.  
  389.      /// Structure containing notification to the remote application
  390. @@ -55,7 +55,7 @@ namespace Input
  391.                  /// HID scancode for the key (most generic type of scancode,
  392.                  /// and easy to build translation tables for)
  393.                  uint8_t scancode;
  394. -
  395. +
  396.                  /// Whether this is a keyUp event or not.
  397.                  bool keyUp;
  398.              } rawkey;
  399. diff --git a/src/subsys/native/user/input/Input.cc b/src/subsys/native/user/input/Input.cc
  400. index e02a794..4e8b653 100755
  401. --- a/src/subsys/native/user/input/Input.cc
  402. +++ b/src/subsys/native/user/input/Input.cc
  403. @@ -15,6 +15,7 @@
  404.   */
  405.  #include <input/Input.h>
  406.  #include <pedigree-c/pedigree-syscalls.h>
  407. +#include <stdio.h>
  408.  
  409.  using namespace Input;
  410.  
  411. @@ -42,5 +43,24 @@ void Input::removeCallback(callback_t cb)
  412.  
  413.  void Input::loadKeymapFromFile(const char *path)
  414.  {
  415. -    /// \todo Implement
  416. +    // Load the file in to a buffer.
  417. +    FILE *pFile = fopen(path, "r");
  418. +    if (!pFile)
  419. +    {
  420. +        fprintf(stderr, "Input::loadKeymapFromFile: Error opening file `%s'.\n", path);
  421. +        return;
  422. +    }
  423. +
  424. +    // Get the length of the file
  425. +    fseek(pFile, 0, SEEK_END);
  426. +    size_t nLength = ftell(pFile);
  427. +    fseek(pFile, 0, SEEK_SET);
  428. +
  429. +    // Read the file
  430. +    uint8_t *pBuffer = new uint8_t [nLength];
  431. +    fread(pBuffer, 1, nLength, pFile);
  432. +    fclose(pFile);
  433. +
  434. +    if(pedigree_load_keymap((char*)pBuffer, nLength))
  435. +        fprintf(stderr, "Input::loadKeymapFromFile: Error loading keymap\n");
  436.  }
  437. diff --git a/src/subsys/pedigree-c/pedigree-syscalls.cc b/src/subsys/pedigree-c/pedigree-syscalls.cc
  438. index 854f435..cbbd704 100644
  439. --- a/src/subsys/pedigree-c/pedigree-syscalls.cc
  440. +++ b/src/subsys/pedigree-c/pedigree-syscalls.cc
  441. @@ -23,6 +23,7 @@
  442.  #include <syscallError.h>
  443.  
  444.  #include <machine/InputManager.h>
  445. +#include <machine/KeymapManager.h>
  446.  
  447.  #include <graphics/Graphics.h>
  448.  #include <graphics/GraphicsService.h>
  449. @@ -209,7 +210,7 @@ void pedigree_module_load(char *_file)
  450.      // Map the module in the memory
  451.      uintptr_t buffer;
  452.      MemoryMappedFile *pMmFile = MemoryMappedFileManager::instance().map(file, buffer);
  453. -    KernelElf::instance().loadModule(reinterpret_cast<uint8_t *>(buffer), file->getSize(), true);
  454. +    KernelElf::instance().loadModule(reinterpret_cast<uint8_t*>(buffer), file->getSize(), true);
  455.      MemoryMappedFileManager::instance().unmap(pMmFile);
  456.  }
  457.  
  458. @@ -254,6 +255,28 @@ void pedigree_input_remove_callback(void *p)
  459.          Processor::information().getCurrentThread());
  460.  }
  461.  
  462. +int pedigree_load_keymap(char *buf, size_t len)
  463. +{
  464. +    // File format:  0    Sparse tree offset
  465. +    //               4    Data tree offset
  466. +    //               ...  Sparse tree & data tree.
  467. +
  468. +    uint32_t sparseTableOffset  = *reinterpret_cast<uint32_t*>(&buf[0]);
  469. +    uint32_t dataTableOffset    = *reinterpret_cast<uint32_t*>(&buf[4]);
  470. +    uint32_t sparseTableSize    = dataTableOffset - sparseTableOffset;
  471. +    uint32_t dataTableSize      = len - dataTableOffset;
  472. +
  473. +    uint8_t *sparseTable = new uint8_t[sparseTableSize];
  474. +    memcpy(sparseTable, &buf[sparseTableOffset], sparseTableSize);
  475. +
  476. +    uint8_t *dataTable = new uint8_t[dataTableSize];
  477. +    memcpy(dataTable, &buf[dataTableOffset], dataTableSize);
  478. +
  479. +    KeymapManager::instance().useKeymap(sparseTable, dataTable);
  480. +
  481. +    return 0;
  482. +}
  483. +
  484.  int pedigree_gfx_get_provider(void *p)
  485.  {
  486.      if(!p)
  487. diff --git a/src/subsys/pedigree-c/pedigree-syscalls.h b/src/subsys/pedigree-c/pedigree-syscalls.h
  488. index 4ef7d0b..f3f7262 100644
  489. --- a/src/subsys/pedigree-c/pedigree-syscalls.h
  490. +++ b/src/subsys/pedigree-c/pedigree-syscalls.h
  491. @@ -66,7 +66,6 @@ void pedigree_config_get_error_message(size_t resultIdx, char *buf, int buflen);
  492.  
  493.  int pedigree_login(int uid, const char *password);
  494.  
  495. -int pedigree_load_keymap(char *buffer, size_t len);
  496.  int pedigree_reboot();
  497.  
  498.  void pedigree_module_load(char *file);
  499. @@ -84,6 +83,7 @@ extern "C" {
  500.  
  501.  void pedigree_input_install_callback(void *p, uint32_t type, uintptr_t param);
  502.  void pedigree_input_remove_callback(void *p);
  503. +int pedigree_load_keymap(char *buffer, size_t len);
  504.  
  505.  void pedigree_event_return();
  506.  
  507. diff --git a/src/subsys/posix/system-syscalls.cc b/src/subsys/posix/system-syscalls.cc
  508. index 9e9c038..0f45710 100644
  509. --- a/src/subsys/posix/system-syscalls.cc
  510. +++ b/src/subsys/posix/system-syscalls.cc
  511. @@ -50,7 +50,6 @@
  512.  #include <PosixProcess.h>
  513.  
  514.  #include <users/UserManager.h>
  515. -#include <machine/KeymapManager.h>
  516.  //
  517.  // Syscalls pertaining to system operations.
  518.  //
  519. @@ -101,7 +100,7 @@ static char **load_string_array(Vector<String*> &rArray, uintptr_t arrayLoc, uin
  520.  long posix_sbrk(int delta)
  521.  {
  522.      SC_NOTICE("sbrk(" << delta << ")");
  523. -
  524. +
  525.      long ret = reinterpret_cast<long>(
  526.                     Processor::information().getVirtualAddressSpace().expandHeap (delta, VirtualAddressSpace::Write));
  527.      SC_NOTICE("    -> " << ret);
  528. @@ -852,28 +851,6 @@ int posix_getpgrp()
  529.          return pProcess->getId(); // Fallback if no ProcessGroup pointer yet
  530.  }
  531.  
  532. -int pedigree_load_keymap(char *buf, size_t len)
  533. -{
  534. -    // File format:  0    Sparse tree offset
  535. -    //               4    Data tree offset
  536. -    //               ...  Sparse tree & data tree.
  537. -
  538. -    uint32_t sparseTableOffset  = *reinterpret_cast<uint32_t*>(&buf[0]);
  539. -    uint32_t dataTableOffset    = *reinterpret_cast<uint32_t*>(&buf[4]);
  540. -    uint32_t sparseTableSize    = dataTableOffset - sparseTableOffset;
  541. -    uint32_t dataTableSize      = len - dataTableOffset;
  542. -
  543. -    uint8_t *sparseTable = new uint8_t[sparseTableSize];
  544. -    memcpy(sparseTable, &buf[sparseTableOffset], sparseTableSize);
  545. -
  546. -    uint8_t *dataTable = new uint8_t[dataTableSize];
  547. -    memcpy(dataTable, &buf[dataTableOffset], dataTableSize);
  548. -
  549. -    KeymapManager::instance().useKeymap(sparseTable, dataTable);
  550. -
  551. -    return 0;
  552. -}
  553. -
  554.  int posix_syslog(const char *msg, int prio)
  555.  {
  556.      if(Processor::information().getCurrentThread()->getParent()->getId() <= 1)
  557. diff --git a/src/user/applications/TUI/Font.cc b/src/user/applications/TUI/Font.cc
  558. index 3f887c7..6263ffc 100644
  559. --- a/src/user/applications/TUI/Font.cc
  560. +++ b/src/user/applications/TUI/Font.cc
  561. @@ -16,6 +16,8 @@
  562.  
  563.  #include "Font.h"
  564.  
  565. +#include <syslog.h>
  566. +
  567.  #include <graphics/Graphics.h>
  568.  
  569.  extern PedigreeGraphics::Framebuffer *g_pFramebuffer;
  570. @@ -34,8 +36,7 @@ Font::Font(size_t requestedSize, const char *pFilename, bool bCache, size_t nWid
  571.          error = FT_Init_FreeType(&m_Library);
  572.          if (error)
  573.          {
  574. -            sprintf(str, "Freetype init error: %d\n", error);
  575. -            log(str);
  576. +            syslog(LOG_ALERT, "Freetype init error: %d", error);
  577.              return;
  578.          }
  579.          m_bLibraryInitialised = true;
  580. @@ -45,22 +46,19 @@ Font::Font(size_t requestedSize, const char *pFilename, bool bCache, size_t nWid
  581.                          &m_Face);
  582.      if (error == FT_Err_Unknown_File_Format)
  583.      {
  584. -        sprintf(str, "Freetype font format error.\n");
  585. -        log(str);
  586. +        syslog(LOG_ALERT, "Freetype font format error");
  587.          return;
  588.      }
  589.      else if (error)
  590.      {
  591. -        sprintf(str, "Freetype font load error: %d\n", error);
  592. -        log(str);
  593. +        syslog(LOG_ALERT, "Freetype font load error: %d", error);
  594.          return;
  595.      }
  596.  
  597. -    error = FT_Set_Pixel_Sizes(m_Face, 0, requestedSize);
  598. +    error = FT_Set_Pixel_Sizes(m_Face, 0, requestedSize);
  599.      if (error)
  600.      {
  601. -        sprintf(str, "Freetype set pixel size error: %d\n", error);
  602. -        log(str);
  603. +        syslog(LOG_ALERT, "Freetype set pixel size error: %d", error);
  604.          return;
  605.      }
  606.  
  607. @@ -119,9 +117,9 @@ void Font::drawGlyph(PedigreeGraphics::Framebuffer *pFb, Glyph *pBitmap, int lef
  608.  {
  609.      if(!g_pFramebuffer)
  610.          return;
  611. -
  612. +
  613.      pFb->blit(pBitmap->pBlitBuffer, 0, 0, left, top, m_CellWidth, m_CellHeight);
  614. -
  615. +
  616.      /*
  617.      for (size_t y = top; y < top+m_CellHeight; y++)
  618.      {
  619. @@ -138,7 +136,7 @@ Font::Glyph *Font::generateGlyph(uint32_t c, uint32_t f, uint32_t b)
  620.  {
  621.      Glyph *pGlyph = new Glyph;
  622.      pGlyph->buffer = new rgb_t[m_CellWidth*m_CellHeight];
  623. -
  624. +
  625.      rgb_t back, front;
  626.      back.r = (b & 0xFF0000) >> 16;
  627.      back.g = (b & 0xFF00) >> 8;
  628. @@ -155,12 +153,10 @@ Font::Glyph *Font::generateGlyph(uint32_t c, uint32_t f, uint32_t b)
  629.      int error = FT_Load_Char(m_Face, c, FT_LOAD_RENDER);
  630.      if (error)
  631.      {
  632. -        char str[64];
  633. -        sprintf(str, "Freetype load char error: %d\n", error);
  634. -        log(str);
  635. +        syslog(LOG_ALERT, "Freetype load char error: %d", error);
  636.          return 0;
  637.      }
  638. -
  639. +
  640.      for (ssize_t r = 0; r < m_Face->glyph->bitmap.rows; r++)
  641.      {
  642.          if (r >= static_cast<ssize_t>(m_CellHeight)) break;
  643. @@ -174,9 +170,9 @@ Font::Glyph *Font::generateGlyph(uint32_t c, uint32_t f, uint32_t b)
  644.              pGlyph->buffer[idx] = interpolateColour(front, back, m_Face->glyph->bitmap.buffer[gidx]);
  645.          }
  646.      }
  647. -
  648. +
  649.      pGlyph->pBlitBuffer = g_pFramebuffer->createBuffer(pGlyph->buffer, PedigreeGraphics::Bits32_Rgb, m_CellWidth, m_CellHeight);
  650. -
  651. +
  652.      return pGlyph;
  653.  }
  654.  
  655. diff --git a/src/user/applications/TUI/Png.cc b/src/user/applications/TUI/Png.cc
  656. index 04e9da6..ecc0a62 100644
  657. --- a/src/user/applications/TUI/Png.cc
  658. +++ b/src/user/applications/TUI/Png.cc
  659. @@ -15,18 +15,18 @@
  660.   */
  661.  
  662.  #include "Png.h"
  663. +
  664. +#include <syslog.h>
  665.  #include <unistd.h>
  666.  
  667.  Png::Png(const char *filename) :
  668.      m_PngPtr(0), m_InfoPtr(0), m_nWidth(0), m_nHeight(0), m_pRowPointers(0)
  669.  {
  670. -    char str[64];
  671. -
  672.      // Open the file.
  673.      FILE *stream = fopen(filename, "rb");
  674.      if (!stream)
  675.      {
  676. -        log("PNG file failed to open.");
  677. +        syslog(LOG_ALERT, "PNG file failed to open");
  678.          return;
  679.      }
  680.  
  681. @@ -34,12 +34,12 @@ Png::Png(const char *filename) :
  682.      char buf[4];
  683.      if (fread(buf, 1, 4, stream) != 4)
  684.      {
  685. -        log("PNG file failed to read ident.");
  686. +        syslog(LOG_ALERT, "PNG file failed to read ident");
  687.          return;
  688.      }
  689.      if (png_sig_cmp(reinterpret_cast<png_byte*>(buf), 0, 4) != 0)
  690.      {
  691. -        log("PNG file failed IDENT check.");
  692. +        syslog(LOG_ALERT, "PNG file failed IDENT check");
  693.          return;
  694.      }
  695.  
  696. @@ -48,14 +48,14 @@ Png::Png(const char *filename) :
  697.  
  698.      if (m_PngPtr == 0)
  699.      {
  700. -        log("PNG file failed to initialise");
  701. +        syslog(LOG_ALERT, "PNG file failed to initialise");
  702.          return;
  703.      }
  704.  
  705.      m_InfoPtr = png_create_info_struct(m_PngPtr);
  706.      if (m_InfoPtr == 0)
  707.      {
  708. -        log("PNG info failed to initialise");
  709. +        syslog(LOG_ALERT, "PNG info failed to initialise");
  710.          return;
  711.      }
  712.  
  713. @@ -65,11 +65,11 @@ Png::Png(const char *filename) :
  714.  
  715.      png_set_palette_to_rgb(m_PngPtr);
  716.  
  717. -    png_read_png(m_PngPtr, m_InfoPtr,
  718. +    png_read_png(m_PngPtr, m_InfoPtr,
  719.                   PNG_TRANSFORM_STRIP_16 | // 16-bit-per-channel down to 8.
  720.                   PNG_TRANSFORM_STRIP_ALPHA | // No alpha
  721.                   PNG_TRANSFORM_PACKING , // Unpack 2 and 4 bit samples.
  722. -
  723. +
  724.                   reinterpret_cast<void*>(0));
  725.  
  726.      m_pRowPointers = reinterpret_cast<uint8_t**>(png_get_rows(m_PngPtr, m_InfoPtr));
  727. @@ -80,18 +80,16 @@ Png::Png(const char *filename) :
  728.  
  729.      if (bit_depth != 8)
  730.      {
  731. -        log("PNG - invalid bit depth");
  732. +        syslog(LOG_ALERT, "PNG - invalid bit depth");
  733.          return;
  734.      }
  735.      if (color_type != PNG_COLOR_TYPE_RGB)
  736.      {
  737. -        sprintf(str, "PNG - invalid colour type: %d", color_type);
  738. -        log(str);
  739. +        syslog(LOG_ALERT, "PNG - invalid colour type: %d", color_type);
  740.          return;
  741.      }
  742.  
  743. -    sprintf(str, "PNG loaded %ul %ul\n", m_nWidth, m_nHeight);
  744. -    log(str);
  745. +    syslog(LOG_ALERT, "PNG loaded %ul %ul", m_nWidth, m_nHeight);
  746.  }
  747.  
  748.  Png::~Png()
  749. @@ -113,7 +111,7 @@ void Png::render(rgb_t *pFb, size_t x, size_t y, size_t width, size_t height)
  750.              rgb.g = m_pRowPointers[r][c*3+1];
  751.              rgb.b = m_pRowPointers[r][c*3+2];
  752.              rgb.a = 255;
  753. -
  754. +
  755.              pFb[(r+y)*width + (c+x)] = rgb;
  756.          }
  757.      }
  758. diff --git a/src/user/applications/TUI/Terminal.cc b/src/user/applications/TUI/Terminal.cc
  759. index 6d06829..6c39ee7 100644
  760. --- a/src/user/applications/TUI/Terminal.cc
  761. +++ b/src/user/applications/TUI/Terminal.cc
  762. @@ -36,7 +36,7 @@ Terminal::Terminal(char *pName, size_t nWidth, size_t nHeight, Header *pHeader,
  763.      // Create a new backbuffer.
  764.      // m_pBuffer = Syscall::newBuffer();
  765.      // if (!m_pBuffer) log("Buffer not created correctly!");
  766. -
  767. +
  768.      m_pFramebuffer = g_pFramebuffer->createChild(m_OffsetLeft, m_OffsetTop, nWidth, nHeight);
  769.      if((!m_pFramebuffer) || (!m_pFramebuffer->getRawBuffer()))
  770.          return;
  771. @@ -76,7 +76,7 @@ Terminal::Terminal(char *pName, size_t nWidth, size_t nHeight, Header *pHeader,
  772.          close(2);
  773.          Syscall::setCtty(pName);
  774.          execl("/applications/login", "/applications/login", 0);
  775. -        log("Launching login failed!");
  776. +        syslog(LOG_ALERT, "Launching login failed!");
  777.      }
  778.  
  779.      m_Pid = pid;
  780. @@ -91,13 +91,13 @@ void Terminal::renewBuffer(size_t nWidth, size_t nHeight)
  781.  {
  782.      if(!m_pFramebuffer)
  783.          return;
  784. -
  785. +
  786.      delete m_pFramebuffer;
  787. -
  788. +
  789.      m_pFramebuffer = g_pFramebuffer->createChild(m_OffsetLeft, m_OffsetTop, nWidth, nHeight);
  790.      if((!m_pFramebuffer) || (!m_pFramebuffer->getRawBuffer()))
  791.          return;
  792. -
  793. +
  794.      uint32_t backColourInt = PedigreeGraphics::createRgb(g_MainBackgroundColour.r, g_MainBackgroundColour.g, g_MainBackgroundColour.b);
  795.      m_pFramebuffer->rect(0, 0, nWidth, nHeight, backColourInt, PedigreeGraphics::Bits24_Rgb);
  796.  
  797. @@ -146,7 +146,7 @@ void Terminal::addToQueue(uint64_t key)
  798.      else
  799.      {
  800.          uint32_t utf32 = key&0xFFFFFFFF;
  801. -
  802. +
  803.          // Begin Utf-32 -> Utf-8 conversion.
  804.          char buf[4];
  805.          size_t nbuf = 0;
  806. @@ -292,7 +292,7 @@ void Terminal::setActive(bool b, DirtyRectangle &rect)
  807.  {
  808.      // Force complete redraw
  809.      m_pFramebuffer->redraw(0, 0, m_pFramebuffer->getWidth(), m_pFramebuffer->getHeight(), false);
  810. -
  811. +
  812.      // if (b)
  813.      //    Syscall::setCurrentBuffer(m_pBuffer);
  814.  }
  815. diff --git a/src/user/applications/TUI/environment.cc b/src/user/applications/TUI/environment.cc
  816. index aa7a7e9..626303d 100644
  817. --- a/src/user/applications/TUI/environment.cc
  818. +++ b/src/user/applications/TUI/environment.cc
  819. @@ -21,34 +21,6 @@
  820.  
  821.  extern PedigreeGraphics::Framebuffer *g_pFramebuffer;
  822.  
  823. -#include <stdio.h>
  824. -extern void log();
  825. -void *operator new (size_t size) throw()
  826. -{
  827. -  void *ret = malloc(size);
  828. -  return ret;
  829. -}
  830. -void *operator new[] (size_t size) throw()
  831. -{
  832. -  return malloc(size);
  833. -}
  834. -void *operator new (size_t size, void* memory) throw()
  835. -{
  836. -  return memory;
  837. -}
  838. -void *operator new[] (size_t size, void* memory) throw()
  839. -{
  840. -  return memory;
  841. -}
  842. -void operator delete (void * p)
  843. -{
  844. -  free(p);
  845. -}
  846. -void operator delete[] (void * p)
  847. -{
  848. -  free(p);
  849. -}
  850. -
  851.  size_t Syscall::nextRequest(size_t responseToLast, char *buffer, size_t *sz, size_t buffersz, size_t *terminalId)
  852.  {
  853.      size_t ret = syscall5(TUI_NEXT_REQUEST, responseToLast, reinterpret_cast<size_t>(buffer), reinterpret_cast<size_t>(sz), buffersz, reinterpret_cast<size_t>(terminalId));
  854. @@ -57,15 +29,6 @@ size_t Syscall::nextRequest(size_t responseToLast, char *buffer, size_t *sz, siz
  855.      return ret;
  856.  }
  857.  
  858. -size_t Syscall::getFb(Display::ScreenMode *pMode)
  859. -{
  860. -    return 0;
  861. -
  862. -    return syscall1(TUI_GETFB, reinterpret_cast<size_t>(pMode));
  863. -    // Memory barrier, "sz" will have changed. Reload.
  864. -    asm volatile ("" : : : "memory");
  865. -}
  866. -
  867.  void Syscall::requestPending()
  868.  {
  869.      syscall0(TUI_REQUEST_PENDING);
  870. @@ -91,66 +54,13 @@ void Syscall::setCurrentConsole(size_t tabId)
  871.      syscall1(TUI_SET_CURRENT_CONSOLE, tabId);
  872.  }
  873.  
  874. -rgb_t *Syscall::newBuffer()
  875. -{
  876. -    return 0; // return reinterpret_cast<rgb_t*> (syscall0(TUI_VID_NEW_BUFFER));
  877. -}
  878. -
  879. -void Syscall::setCurrentBuffer(rgb_t *pBuffer)
  880. -{
  881. -    return; // syscall1(TUI_VID_SET_BUFFER, reinterpret_cast<uintptr_t>(pBuffer));
  882. -}
  883. -
  884.  void doRedraw(DirtyRectangle &rect)
  885.  {
  886.      if(rect.getX() == ~0UL && rect.getY() == ~0UL &&
  887.         rect.getX2() == ~0UL && rect.getY2() == ~0UL)
  888.          return;
  889. -
  890. -    g_pFramebuffer->redraw(rect.getX(), rect.getY(), rect.getWidth(), rect.getHeight(), true);
  891. -}
  892.  
  893. -void Syscall::killBuffer(rgb_t *pBuffer)
  894. -{
  895. -    return;
  896. -
  897. -    syscall1(TUI_VID_KILL_BUFFER, reinterpret_cast<uintptr_t>(pBuffer));
  898. -}
  899. -
  900. -void Syscall::bitBlit(rgb_t *pBuffer, size_t x, size_t y, size_t x2, size_t y2,
  901. -                      size_t w, size_t h)
  902. -{
  903. -    return;
  904. -
  905. -    vid_req_t req;
  906. -    req.buffer = pBuffer;
  907. -    req.x = x;
  908. -    req.y = y;
  909. -    req.x2 = x2;
  910. -    req.y2 = y2;
  911. -    req.w = w;
  912. -    req.h = h;
  913. -
  914. -    asm volatile("" ::: "memory");
  915. -
  916. -    syscall1(TUI_VID_BIT_BLIT, reinterpret_cast<uintptr_t>(&req));
  917. -}
  918. -
  919. -void Syscall::fillRect(rgb_t *pBuffer, size_t x, size_t y, size_t w, size_t h, rgb_t c)
  920. -{
  921. -    return;
  922. -
  923. -    vid_req_t req;
  924. -    req.buffer = pBuffer;
  925. -    req.x = x;
  926. -    req.y = y;
  927. -    req.w = w;
  928. -    req.h = h;
  929. -    req.c = &c;
  930. -
  931. -    asm volatile("" ::: "memory");
  932. -
  933. -    syscall1(TUI_VID_FILL_RECT, reinterpret_cast<uintptr_t>(&req));
  934. +    g_pFramebuffer->redraw(rect.getX(), rect.getY(), rect.getWidth(), rect.getHeight(), true);
  935.  }
  936.  
  937.  DirtyRectangle::DirtyRectangle() :
  938. diff --git a/src/user/applications/TUI/environment.h b/src/user/applications/TUI/environment.h
  939. index 0cb9902..50da3ed 100644
  940. --- a/src/user/applications/TUI/environment.h
  941. +++ b/src/user/applications/TUI/environment.h
  942. @@ -96,21 +96,12 @@ private:
  943.  
  944.  namespace Syscall
  945.  {
  946. -//    void log(char *c);    void log(const char *c);
  947. -
  948.      size_t nextRequest(size_t responseToLast, char *buffer, size_t *sz, size_t buffersz, size_t *terminalId);
  949. -    size_t getFb(Display::ScreenMode *pMode);
  950.      void requestPending();
  951.      void respondToPending(size_t response, char *buffer, size_t sz);
  952.      void createConsole(size_t tabId, char *pName);
  953.      void setCtty(char *pName);
  954.      void setCurrentConsole(size_t tabId);
  955. -    rgb_t *newBuffer();
  956. -    void setCurrentBuffer(rgb_t *pBuffer);
  957. -    void killBuffer(rgb_t *pBuffer);
  958. -    void bitBlit(rgb_t *pBuffer, size_t x, size_t y, size_t x2, size_t y2,
  959. -                 size_t w, size_t h);
  960. -    void fillRect(rgb_t *pBuffer, size_t x, size_t y, size_t w, size_t h, rgb_t c);
  961.  }
  962.  
  963.  void doRedraw(DirtyRectangle &rect);
  964. diff --git a/src/user/applications/TUI/main.cc b/src/user/applications/TUI/main.cc
  965. index 0066590..232c15a 100644
  966. --- a/src/user/applications/TUI/main.cc
  967. +++ b/src/user/applications/TUI/main.cc
  968. @@ -48,8 +48,6 @@
  969.  #define CONSOLE_GETCOLS 4
  970.  #define CONSOLE_DATA_AVAILABLE 5
  971.  #define CONSOLE_REFRESH 10
  972. -#define TUI_MODE_CHANGED 98
  973. -#define TUI_CHAR_RECV   99
  974.  
  975.  #define NORMAL_FONT_PATH    "/system/fonts/DejaVuSansMono.ttf"
  976.  #define BOLD_FONT_PATH      "/system/fonts/DejaVuSansMono-Bold.ttf"
  977. @@ -58,16 +56,6 @@
  978.  
  979.  /** End code from InputManager */
  980.  
  981. -void log(char *c)
  982. -{
  983. -    syscall1(TUI_LOG, reinterpret_cast<size_t>(c));
  984. -}
  985. -
  986. -void log(const char *c)
  987. -{
  988. -    syscall1(TUI_LOG, reinterpret_cast<size_t>(c));
  989. -}
  990. -
  991.  struct TerminalList
  992.  {
  993.      Terminal *term;
  994. @@ -84,6 +72,7 @@ size_t g_nLastResponse = 0;
  995.  
  996.  PedigreeGraphics::Framebuffer *g_pFramebuffer = 0;
  997.  
  998. +/*
  999.  void modeChanged(size_t width, size_t height)
  1000.  {
  1001.      syslog(LOG_ALERT, "w: %d, h: %d\n", width, height);
  1002. @@ -110,7 +99,7 @@ void modeChanged(size_t width, size_t height)
  1003.  
  1004.          pTL = pTL->next;
  1005.      }
  1006. -}
  1007. +}*/
  1008.  
  1009.  void selectTerminal(TerminalList *pTL, DirtyRectangle &rect)
  1010.  {
  1011. @@ -126,7 +115,7 @@ void selectTerminal(TerminalList *pTL, DirtyRectangle &rect)
  1012.      g_pHeader->render(pTL->term->getBuffer(), rect);
  1013.  
  1014.      pTL->term->redrawAll(rect);
  1015. -
  1016. +
  1017.      doRedraw(rect);
  1018.  }
  1019.  
  1020. @@ -319,7 +308,7 @@ int main (int argc, char **argv)
  1021.          syslog(LOG_EMERG, "TUI is already running\n");
  1022.          return 1;
  1023.      }
  1024. -
  1025. +
  1026.      struct stat info;
  1027.      int err = stat("/config", &info);
  1028.      if((err < 0) && (errno == ENOENT))
  1029. @@ -335,7 +324,7 @@ int main (int argc, char **argv)
  1030.          syslog(LOG_EMERG, "TUI: couldn't stat /config for some reason: %s!", strerror(errno));
  1031.          return 1;
  1032.      }
  1033. -
  1034. +
  1035.      err = stat("/config/TUI", &info);
  1036.      if((err < 0) && (errno == ENOENT))
  1037.      {
  1038. @@ -350,7 +339,7 @@ int main (int argc, char **argv)
  1039.          syslog(LOG_EMERG, "TUI: couldn't stat /config/TUI for some reason: %s!", strerror(errno));
  1040.          return 1;
  1041.      }
  1042. -
  1043. +
  1044.      fp = fopen("/config/TUI/.tui.lck", "w+");
  1045.      if(!fp)
  1046.      {
  1047. @@ -360,11 +349,11 @@ int main (int argc, char **argv)
  1048.      fclose(fp);
  1049.  
  1050.      signal(SIGINT, sigint);
  1051. -
  1052. +
  1053.      // Connect to the graphics service
  1054.      PedigreeGraphics::Framebuffer *pRootFramebuffer = new PedigreeGraphics::Framebuffer();
  1055.      g_pFramebuffer = pRootFramebuffer->createChild(0, 0, pRootFramebuffer->getWidth(), pRootFramebuffer->getHeight());
  1056. -
  1057. +
  1058.      // Have we got a working mode?
  1059.      if(!g_pFramebuffer->getRawBuffer())
  1060.      {
  1061. @@ -375,7 +364,7 @@ int main (int argc, char **argv)
  1062.  
  1063.      g_nWidth = g_pFramebuffer->getWidth();
  1064.      g_nHeight = g_pFramebuffer->getHeight();
  1065. -
  1066. +
  1067.      g_pFramebuffer->rect(0, 0, g_nWidth, g_nHeight, 0, PedigreeGraphics::Bits24_Rgb);
  1068.      g_pFramebuffer->redraw(0, 0, g_nWidth, g_nHeight, true);
  1069.  
  1070. @@ -393,14 +382,14 @@ int main (int argc, char **argv)
  1071.          syslog(LOG_EMERG, "Error: Font '%s' not loaded!", BOLD_FONT_PATH);
  1072.          return 0;
  1073.      }
  1074. -
  1075. +
  1076.      rgb_t fore = {0xff, 0xff, 0xff, 0xff};
  1077.      rgb_t back = {0, 0, 0, 0};
  1078.  
  1079.      g_pHeader =  new Header(g_nWidth);
  1080.  
  1081.      g_pHeader->addTab(const_cast<char*>("The Pedigree Operating System"), 0);
  1082. -
  1083. +
  1084.      DirtyRectangle rect;
  1085.  
  1086.      // DirtyRectangle rect;
  1087. @@ -414,7 +403,6 @@ int main (int argc, char **argv)
  1088.  
  1089.      size_t maxBuffSz = (32768 * 2) - 1;
  1090.      char *buffer = new char[maxBuffSz + 1];
  1091. -    char str[64];
  1092.      size_t tabId;
  1093.      while (true)
  1094.      {
  1095. @@ -424,14 +412,14 @@ int main (int argc, char **argv)
  1096.          if(cmd == 0)
  1097.              continue;
  1098.  
  1099. -        if (cmd == TUI_MODE_CHANGED)
  1100. +        /*if (cmd == TUI_MODE_CHANGED)
  1101.          {
  1102.              uint64_t u = * reinterpret_cast<uint64_t*>(buffer);
  1103.              syslog(LOG_ALERT, "u: %llx", u);
  1104.              modeChanged(u&0xFFFFFFFFULL, (u>>32)&0xFFFFFFFFULL);
  1105.  
  1106.              continue;
  1107. -        }
  1108. +        }*/
  1109.  
  1110.          Terminal *pT = 0;
  1111.          TerminalList *pTL = g_pTermList;
  1112. @@ -446,8 +434,7 @@ int main (int argc, char **argv)
  1113.          }
  1114.          if (pT == 0)
  1115.          {
  1116. -            sprintf(str, "Completely unrecognised terminal ID %ld, aborting.", tabId);
  1117. -            log (str);
  1118. +            syslog(LOG_ALERT, "Completely unrecognised terminal ID %ld, aborting.", tabId);
  1119.              continue;
  1120.          }
  1121.  
  1122. @@ -475,7 +462,6 @@ int main (int argc, char **argv)
  1123.  
  1124.              case CONSOLE_READ:
  1125.              {
  1126. -                char str[64];
  1127.                  size_t i = 0;
  1128.                  while (i < sz)
  1129.                  {
  1130. @@ -513,11 +499,7 @@ int main (int argc, char **argv)
  1131.                  break;
  1132.  
  1133.              default:
  1134. -            {
  1135. -                char str[64];
  1136. -                sprintf(str, "Unknown command: %x", cmd);
  1137. -                log(str);
  1138. -            }
  1139. +                syslog(LOG_ALERT, "Unknown command: %x", cmd);
  1140.          }
  1141.  
  1142.      }
  1143. --
  1144. 1.6.4.2
  1145.  
View raw paste Reply