Fixed printf
This commit is contained in:
parent
c39cca3f18
commit
8912c5921f
|
|
@ -49,22 +49,23 @@ void printf(char *string, ...){
|
||||||
va_start(vars, string);
|
va_start(vars, string);
|
||||||
while(*string){
|
while(*string){
|
||||||
if(*string == '%'){
|
if(*string == '%'){
|
||||||
|
int32_t num = 0;
|
||||||
|
char numb[12];
|
||||||
switch(*(string + 1)){
|
switch(*(string + 1)){
|
||||||
case 'd':
|
case 'd':
|
||||||
string += 2;
|
string += 2;
|
||||||
int32_t num = va_arg(vars, int32_t);
|
num = va_arg(vars, int32_t);
|
||||||
char numb[12];
|
|
||||||
itoa(num, numb, 10);
|
itoa(num, numb, 10);
|
||||||
debug_puts(numb);
|
debug_puts(numb);
|
||||||
continue;
|
continue;
|
||||||
case 'x':
|
case 'x':
|
||||||
// debug_puts(":3");
|
// debug_puts(":3");
|
||||||
string += 2;
|
string += 2;
|
||||||
int32_t hex = va_arg(vars, int32_t);
|
num = va_arg(vars, int32_t);
|
||||||
char hnumb[12];
|
// char hnumb[12];
|
||||||
itoa(hex, hnumb, 16);
|
itoa(num, numb, 16);
|
||||||
strpad(hnumb, '0', 8);
|
strpad(numb, '0', 8);
|
||||||
debug_puts(hnumb);
|
debug_puts(numb);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,6 @@
|
||||||
#include "drivers/cpuio.h"
|
#include "drivers/cpuio.h"
|
||||||
#include "system/scheduler.h"
|
#include "system/scheduler.h"
|
||||||
|
|
||||||
void test(){
|
|
||||||
printf("Hi from another thread!\n");
|
|
||||||
// *((uint16_t*)0xb8000) = 0xf41;
|
|
||||||
for(;;);
|
|
||||||
}
|
|
||||||
|
|
||||||
extern void kmain(kernel_info_t *kernel_info){
|
extern void kmain(kernel_info_t *kernel_info){
|
||||||
init_serial();
|
init_serial();
|
||||||
pm_init(kernel_info);
|
pm_init(kernel_info);
|
||||||
|
|
@ -22,10 +16,7 @@ extern void kmain(kernel_info_t *kernel_info){
|
||||||
init_scheduler();
|
init_scheduler();
|
||||||
pic_setmask(0xfe, PIC1_DATA);
|
pic_setmask(0xfe, PIC1_DATA);
|
||||||
enable_interrupts();
|
enable_interrupts();
|
||||||
// printf("done\n");
|
|
||||||
thread_start(test, 0);
|
|
||||||
// printf("%x", test);
|
|
||||||
// void test();
|
|
||||||
for(;;);
|
for(;;);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
process_t volatile processes[0x10000];
|
process_t volatile processes[0x10000];
|
||||||
uint32_t volatile process_queue[0x10000];
|
uint32_t volatile process_queue[0x10000];
|
||||||
uint32_t active_processes;
|
uint32_t volatile active_processes;
|
||||||
uint32_t volatile current_pid;
|
uint32_t volatile current_pid;
|
||||||
uint32_t volatile queue_length;
|
uint32_t volatile queue_length;
|
||||||
uint32_t volatile current_queue_index;
|
uint32_t volatile current_queue_index;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue