osdev

What happens when you lose the virtual address of the page directory?

限于喜欢 提交于 2020-06-01 01:38:08
问题 I'm writing a memory manager for my kernel (32 bit x86) In the course of this... I'm facing a bit of a dilemma.... Description of virtual memory map: Identity map of first 4 Mb Virtual address 0xC0000000 mapped to physical address 0x100000 (Also a 4 Mb map) My page directory is at physical address 0x9c000. My page table 1 is at physical address 0x9d000. My page table 2 is at physical addres 0x9e000. (I need only two page tables here :) ... These correspond to the identity map and higher

Switch to VESA/VBE?

北城以北 提交于 2020-05-28 07:53:49
问题 So, I'm currently working on an OS, and I'm stuck in a very dumb situation : switching to VESA/VBE My current code : mov ax, 0x4F02 mov bx, 0x4118 int 0x10 It changes Qemu resolution, but now I have a problem with plotting pixels. The formula of the pixel offset is : uint32 pixel_offset = y * pitch + (x * (bpp/8)) + framebuffer; The problem is that bpp, pitch and framebuffer are supposed to be given by mov ax, 0x4F01 int 0x10 and mov ax, 0x4F00 int 0x10 First, mov ax, 0x4F00 int 0x10 softlock

Switch to VESA/VBE?

百般思念 提交于 2020-05-28 07:53:24
问题 So, I'm currently working on an OS, and I'm stuck in a very dumb situation : switching to VESA/VBE My current code : mov ax, 0x4F02 mov bx, 0x4118 int 0x10 It changes Qemu resolution, but now I have a problem with plotting pixels. The formula of the pixel offset is : uint32 pixel_offset = y * pitch + (x * (bpp/8)) + framebuffer; The problem is that bpp, pitch and framebuffer are supposed to be given by mov ax, 0x4F01 int 0x10 and mov ax, 0x4F00 int 0x10 First, mov ax, 0x4F00 int 0x10 softlock

Switch to VESA/VBE?

与世无争的帅哥 提交于 2020-05-28 07:53:17
问题 So, I'm currently working on an OS, and I'm stuck in a very dumb situation : switching to VESA/VBE My current code : mov ax, 0x4F02 mov bx, 0x4118 int 0x10 It changes Qemu resolution, but now I have a problem with plotting pixels. The formula of the pixel offset is : uint32 pixel_offset = y * pitch + (x * (bpp/8)) + framebuffer; The problem is that bpp, pitch and framebuffer are supposed to be given by mov ax, 0x4F01 int 0x10 and mov ax, 0x4F00 int 0x10 First, mov ax, 0x4F00 int 0x10 softlock

Assembly executing a long jump with an offset with different syntax

為{幸葍}努か 提交于 2020-05-23 06:53:34
问题 I am writing a GDT for a Kernel and all is going well, I'm following this tutorial. http://www.osdever.net/bkerndev/Docs/gdt.htm When link the C code to the assembly code he uses this piece of code. ; This will set up our new segment registers. We need to do ; something special in order to set CS. We do what is called a ; far jump. A jump that includes a segment as well as an offset. ; This is declared in C as 'extern void gdt_flush();' global _gdt_flush ; Allows the C code to link to this

Cannot call real mode C function from bootloader (NASM + GCC toolchain)

北城余情 提交于 2020-05-15 06:56:05
问题 I am attempting to write my own OS kernel, and have been having some issues getting the linking to work properly between my bootloader and (what will soon be) my kernel (written in C). I have the following code... src/bootloader.asm ; Allows our code to be run in real mode. BITS 16 extern kmain section .text global _start _start: jmp Start ; Moves the cursor to row dl, col dh. MoveCursor: mov ah, 2 mov bh, 0 int 10h ret ; Prints the character in al to the screen. PrintChar: mov ah, 10 mov bh,

NASM call for external C++ function

自古美人都是妖i 提交于 2020-05-09 06:35:10
问题 I am trying to call external C++ function from NASM. As I was searching on google I did not find any related solution. C++ void kernel_main() { char* vidmem = (char*)0xb8000; /* And so on... */ } NASM ;Some calls before section .text ;nothing special here global start extern kernel_main ;our problem After running compiling these two files I am getting this error: kernel.asm(.text+0xe): undefined reference to kernel_main' What is wrong here? Thanks. 回答1: There is no standardized method of

Viewing the exact memory range that a linker 'uses' for a executable binary

别等时光非礼了梦想. 提交于 2020-04-17 21:45:28
问题 I am doing a bit of OSdev, and I've been trying to implement memory management in my kernel. I have started off with a physical memory manager (this is a 32 bit OS). The idea is to keep a table of bits where we allocate a bit per 4K physical memory block. If the bit is '1', the block is in use and if '0', it isn't. I thought that this table should come after the kernel. So here is my kernel code (minimal): #include<stdint.h> #define PMMAP 0x1000 //This contains information from int 15h/E820

Viewing the exact memory range that a linker 'uses' for a executable binary

假如想象 提交于 2020-04-17 21:41:46
问题 I am doing a bit of OSdev, and I've been trying to implement memory management in my kernel. I have started off with a physical memory manager (this is a 32 bit OS). The idea is to keep a table of bits where we allocate a bit per 4K physical memory block. If the bit is '1', the block is in use and if '0', it isn't. I thought that this table should come after the kernel. So here is my kernel code (minimal): #include<stdint.h> #define PMMAP 0x1000 //This contains information from int 15h/E820

Why can't I make a char array longer than 61 characters in C? [duplicate]

限于喜欢 提交于 2020-04-07 05:27:14
问题 This question already has an answer here : Error 13: Invalid or unsupported executable while booting simple kernel in grub with string literal (1 answer) Closed 2 years ago . I'm following this tutorial to make a simple bare bones 32-bit operating system. I have gotten as far as section 4 where i'm writing to the frame buffer. Basically i'm attempting to create my own println function. Here is the code for my function: /** fb_write_cell: * Writes a character with the given foreground and