Fixed printf x86_div64_32 and testing
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
megs: 32
|
megs: 32
|
||||||
display_library: sdl2
|
display_library: x
|
||||||
romimage: file=/usr/share/bochs/BIOS-bochs-legacy
|
romimage: file=/usr/share/bochs/BIOS-bochs-legacy
|
||||||
vgaromimage: file=/usr/share/bochs/VGABIOS-lgpl-latest
|
vgaromimage: file=/usr/share/bochs/VGABIOS-lgpl-latest
|
||||||
ata0-master: type=cdrom, path=os.iso, status=inserted
|
ata0-master: type=cdrom, path=os.iso, status=inserted
|
||||||
|
|||||||
32
io.s
32
io.s
@@ -16,19 +16,29 @@ inb:
|
|||||||
global x86_div64_32
|
global x86_div64_32
|
||||||
|
|
||||||
x86_div64_32:
|
x86_div64_32:
|
||||||
mov eax, [bp+8]
|
push ebp
|
||||||
mov ecx, [bp+12]
|
mov ebp, esp
|
||||||
xor edx, edx
|
|
||||||
|
; Arguments:
|
||||||
|
; [ebp + 8] - lower 32 bits of dividend (uint32_t)
|
||||||
|
; [ebp + 12] - upper 32 bits of dividend (uint32_t)
|
||||||
|
; [ebp + 16] - divisor (uint32_t)
|
||||||
|
; [ebp + 20] - pointer to quotient (uint64_t*)
|
||||||
|
; [ebp + 24] - pointer to remainder (uint32_t*)
|
||||||
|
|
||||||
|
mov eax, [ebp + 8]
|
||||||
|
mov edx, [ebp + 12]
|
||||||
|
|
||||||
|
mov ecx, [ebp + 16]
|
||||||
|
|
||||||
div ecx
|
div ecx
|
||||||
|
mov esi, [ebp + 20]
|
||||||
|
mov [esi], eax
|
||||||
|
|
||||||
mov bx, [bp+16]
|
mov dword [esi + 4], 0
|
||||||
mov [bx+4], eax
|
|
||||||
|
|
||||||
mov eax, [bp+4]
|
mov esi, [ebp + 24]
|
||||||
div ecx
|
mov [esi], edx
|
||||||
|
|
||||||
mov [bx], eax
|
|
||||||
mov bx, [bp+18]
|
|
||||||
mov [bx], edx
|
|
||||||
|
|
||||||
|
pop ebp
|
||||||
ret
|
ret
|
||||||
Binary file not shown.
BIN
kernel.elf
BIN
kernel.elf
Binary file not shown.
22
kmain.c
22
kmain.c
@@ -3,11 +3,31 @@
|
|||||||
|
|
||||||
int kmain(int retvalue)
|
int kmain(int retvalue)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// serial testing
|
||||||
|
|
||||||
init_serial();
|
init_serial();
|
||||||
log("serial connection established", 3);
|
log("serial connection established", 3);
|
||||||
log("Kernel started", 2);
|
log("Kernel started", 2);
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
printf("Formatted: %% %c %s %d\n", 'f', "Hello", 77);
|
|
||||||
|
// printf testing
|
||||||
|
|
||||||
|
int age = 34;
|
||||||
|
int problems = 124;
|
||||||
|
char* name = "xamidev";
|
||||||
|
|
||||||
|
printf("Hello %s, you are %d years old and have %d problems. wow %%\n", name, age, problems);
|
||||||
|
|
||||||
|
long suchwow = 2934342;
|
||||||
|
char character = 65;
|
||||||
|
printf("such number %u\nsuch character %c", suchwow, character);
|
||||||
|
|
||||||
|
printf("wow negative %d\n", -3742);
|
||||||
|
printf("such hex %x %X\n", 0xcafe, 0xdeadbeef);
|
||||||
|
|
||||||
|
printf("such pointer %p\n", (void*)0xcafe1234);
|
||||||
|
|
||||||
return retvalue;
|
return retvalue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user