Commit c808f1c506667c5ffb73c2c41304f635efffa25c
- Diff rendering mode:
- inline
- side by side
kernel/kernel.cc
(8 / 4)
|   | |||
| 81 | 81 | for(; ;) | |
| 82 | 82 | { | |
| 83 | 83 | // This is a test for threading | |
| 84 | /* textmode::setpos(0); | ||
| 84 | textmode::setpos(0); | ||
| 85 | 85 | cout << "KERNEL!"; | |
| 86 | 86 | scheduler::sleep(1000); | |
| 87 | 87 | textmode::setpos(0); | |
| 88 | 88 | cout << " "; | |
| 89 | scheduler::sleep(1000);*/ | ||
| 89 | scheduler::sleep(1000); | ||
| 90 | 90 | } | |
| 91 | 91 | ||
| 92 | 92 | // If we break the loop for some reason, just shutdown | |
| … | … | ||
| 95 | 95 | ||
| 96 | 96 | int test_thread(void *) | |
| 97 | 97 | { | |
| 98 | int i; | ||
| 98 | 99 | for(; ;) | |
| 99 | 100 | { | |
| 100 | 101 | textmode::setpos(20); | |
| 101 | cout << "THREAD!"; | ||
| 102 | cout << "THREAD!" << i; | ||
| 102 | 103 | scheduler::sleep(500); | |
| 103 | 104 | textmode::setpos(20); | |
| 104 | 105 | cout << " "; | |
| 105 | 106 | scheduler::sleep(500); | |
| 107 | i++; | ||
| 106 | 108 | } | |
| 109 | |||
| 110 | return 0; | ||
| 107 | 111 | } | |
| 108 | 112 | ||
| 109 | 113 | namespace kernel | |
| … | … | ||
| 137 | 137 | fs_root = initrd::initialise(initrd_address); | |
| 138 | 138 | ||
| 139 | 139 | // Start multitasking | |
| 140 | //multitasking::initialise(); | ||
| 140 | multitasking::initialise(); | ||
| 141 | 141 | } | |
| 142 | 142 | ||
| 143 | 143 | void start_error() |
kernel/lib/runtime.h
(18 / 0)
|   | |||
| 1 | /* | ||
| 2 | * Symmetry Kernel | ||
| 3 | * | ||
| 4 | * Copyright (c) 2010 Stephen Gentle | ||
| 5 | * | ||
| 6 | * Permission to use, copy, modify, and distribute this software for any | ||
| 7 | * purpose with or without fee is hereby granted, provided that the above | ||
| 8 | * copyright notice and this permission notice appear in all copies. | ||
| 9 | * | ||
| 10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 17 | */ | ||
| 18 | |||
| 1 | 19 | #ifndef RUNTIME_H | |
| 2 | 20 | #define RUNTIME_H | |
| 3 | 21 |
kernel/process/scheduler.cc
(3 / 9)
|   | |||
| 42 | 42 | return; | |
| 43 | 43 | } | |
| 44 | 44 | ||
| 45 | // Read the esp, ebp registers | ||
| 46 | uintptr esp, ebp; | ||
| 47 | |||
| 48 | esp = regs.esp; | ||
| 49 | ebp = regs.ebp; | ||
| 50 | |||
| 51 | 45 | // Save the registers | |
| 52 | 46 | current_thread->set_eip(regs.eip); | |
| 53 | current_thread->set_stack_ptr(esp, ebp); | ||
| 47 | current_thread->set_stack_ptr(regs.esp, regs.ebp); | ||
| 54 | 48 | ||
| 55 | 49 | // TODO: Get next task in vector | |
| 56 | 50 | if(current_thread == kernel) | |
| 57 | 51 | { | |
| 58 | 52 | current_thread = other; | |
| 59 | other->set_stack_ptr(esp, ebp); | ||
| 53 | other->set_stack_ptr(regs.esp, regs.ebp); | ||
| 60 | 54 | } | |
| 61 | 55 | else | |
| 62 | 56 | { | |
| … | … | ||
| 65 | 65 | regs.esp = current_thread->get_esp(); | |
| 66 | 66 | regs.ebp = current_thread->get_ebp(); | |
| 67 | 67 | ||
| 68 | current_thread->get_parent()->get_address_space()->switch_to(); | ||
| 68 | //current_thread->get_parent()->get_address_space()->switch_to(); | ||
| 69 | 69 | } | |
| 70 | 70 | ||
| 71 | 71 | size_t add_process(process * p) |

