Corey Tabaka | 8469724 | 2009-03-26 02:32:01 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2009 Corey Tabaka |
| 3 | * |
| 4 | * Permission is hereby granted, free of charge, to any person obtaining |
| 5 | * a copy of this software and associated documentation files |
| 6 | * (the "Software"), to deal in the Software without restriction, |
| 7 | * including without limitation the rights to use, copy, modify, merge, |
| 8 | * publish, distribute, sublicense, and/or sell copies of the Software, |
| 9 | * and to permit persons to whom the Software is furnished to do so, |
| 10 | * subject to the following conditions: |
| 11 | * |
| 12 | * The above copyright notice and this permission notice shall be |
| 13 | * included in all copies or substantial portions of the Software. |
| 14 | * |
| 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
| 19 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
| 20 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
| 21 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 22 | */ |
| 23 | #include <stdarg.h> |
| 24 | #include <reg.h> |
| 25 | #include <printf.h> |
| 26 | #include <kernel/thread.h> |
| 27 | #include <arch/x86.h> |
Corey Tabaka | b3f6cac | 2009-04-01 17:35:12 -0400 | [diff] [blame] | 28 | #include <platform/pc/memmap.h> |
Corey Tabaka | 8469724 | 2009-03-26 02:32:01 -0400 | [diff] [blame] | 29 | #include <platform/console.h> |
| 30 | #include <platform/keyboard.h> |
| 31 | #include <platform/debug.h> |
| 32 | |
| 33 | void _dputc(char c) |
| 34 | { |
| 35 | cputc(c); |
| 36 | } |
| 37 | |
| 38 | int dgetc(char *c) |
| 39 | { |
Corey Tabaka | ad21b8d | 2009-04-03 15:34:38 -0400 | [diff] [blame] | 40 | int ret = platform_read_key(c); |
| 41 | if (ret < 0) |
| 42 | arch_idle(); |
| 43 | |
| 44 | return ret; |
Corey Tabaka | 8469724 | 2009-03-26 02:32:01 -0400 | [diff] [blame] | 45 | } |
| 46 | |
| 47 | void debug_dump_regs(void) |
| 48 | { |
| 49 | } |
| 50 | |
| 51 | void platform_halt(void) |
| 52 | { |
| 53 | for(;;) { |
| 54 | x86_cli(); |
| 55 | x86_hlt(); |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | void debug_dump_memory_bytes(void *mem, int len) |
| 60 | { |
| 61 | } |
| 62 | |
| 63 | void debug_dump_memory_halfwords(void *mem, int len) |
| 64 | { |
| 65 | } |
| 66 | |
| 67 | void debug_dump_memory_words(void *mem, int len) |
| 68 | { |
| 69 | } |
| 70 | |
| 71 | void debug_set_trace_level(int trace_type, int level) |
| 72 | { |
| 73 | } |
| 74 | |
| 75 | uint32_t debug_cycle_count() |
| 76 | { |
| 77 | uint32_t timestamp; |
| 78 | rdtscl(timestamp); |
| 79 | |
| 80 | return timestamp; |
| 81 | } |