osdev

Switching to (un)real mode, reading disk and switching back to protected mode

最后都变了- 提交于 2020-01-06 06:08:25
问题 My question is quite a bit theoretical, but I want to implement disk r/w to my Operating system, while I know how to do it in protected mode, it would take too long to implement ATAPI+ATA+FDC drivers (to make my OS boot on any device). I took two ideas to consider: Make my OS bootable only from pendrive (so I can handle only pendrive for disk r/w and it wouldn't take as much time), and jump to real mode, read sector, and jump back to protected mode . But AFAIK i have to be in conventional

Floppy disk sector count

☆樱花仙子☆ 提交于 2020-01-05 08:21:48
问题 I am trying to understand why lseek() is used in this image creator. Why 5 bytes away from start of file? If I changed that number, the OS won't boot. The image creator creates a .img file with the bootloader.bin inside. /* modify the sector count */ total_sector_number = file_size / 512 lseek(disk_image_fd, 5, SEEK_SET); write(disk_image_fd, &total_sector_number, 2); write(disk_image_fd, &kernel_32_sector_number, 2); //printf("%d\n", lawl); printf("TOTAL_SECTOR_NUMBER : %d\n", total_sector

Floppy disk sector count

泪湿孤枕 提交于 2020-01-05 08:21:22
问题 I am trying to understand why lseek() is used in this image creator. Why 5 bytes away from start of file? If I changed that number, the OS won't boot. The image creator creates a .img file with the bootloader.bin inside. /* modify the sector count */ total_sector_number = file_size / 512 lseek(disk_image_fd, 5, SEEK_SET); write(disk_image_fd, &total_sector_number, 2); write(disk_image_fd, &kernel_32_sector_number, 2); //printf("%d\n", lawl); printf("TOTAL_SECTOR_NUMBER : %d\n", total_sector

Loading a kernel without a filesystem - osdev

萝らか妹 提交于 2020-01-05 04:57:35
问题 I built a bootloader to load my kernel onto the memory. The kernel code is lying on the sectors of the floppy. The 2 stage bootloader reads out raw bytes of memory from the floppy disk and places it on the memory and executes the kernel. This works good on the bochs emulator but fails on the qemu emulator. Some tutorials out there suggest keeping the kernel file on a file system (like FAT12) and then reading the file from it. So, I want to ask that would such a system actually work on a

Kernel cannot load applications

Deadly 提交于 2020-01-03 04:33:06
问题 I am creating my own operating system in Assembly. I want to load .bin files from kernel. For that i copied some code from bootloader. But that did not work What is wrong in my code? I am using WSL(Windows Subsystem for Linux) in Windows 10 I am using mtools to create disc image. my code to load .bin files: LOAD_IMAGE: mov ax, WORD [cluster] ; cluster to read pop bx ; buffer to read into call ClusterLBA ; convert cluster to LBA xor cx, cx mov cl, BYTE [bpbSectorsPerCluster] ; sectors to read

Toy OS Filesystem [closed]

故事扮演 提交于 2020-01-01 16:25:18
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 4 years ago . I have developed a basic kernel in assembly/c that runs a basic terminal. I have set it up to run off of an iso with grub. I would like to continue this OS, but without a file system, I feel as if there's really nothing else I could do. After much time on the internet, I have come

Keyboard interrupt handler for own kernel (C)

流过昼夜 提交于 2020-01-01 16:07:30
问题 I am writing a tiny OS as part of an assigment for school,but I got stuck when it comes to get keyboard input (press a key -> display it on screen). I am using the Bare Bones tutorial from osdev.org (gcc cross-compiler, GRUB bootloader, ld linker) and since I am in protected mode I can not use BIOS interrupts for input, that's why I have to write my own interrupt handler (?) but I'm not sure how to do that even after I read some osdev articles and forum discussions. Very similar problem (http

Keyboard interrupt handler for own kernel (C)

泪湿孤枕 提交于 2020-01-01 16:06:55
问题 I am writing a tiny OS as part of an assigment for school,but I got stuck when it comes to get keyboard input (press a key -> display it on screen). I am using the Bare Bones tutorial from osdev.org (gcc cross-compiler, GRUB bootloader, ld linker) and since I am in protected mode I can not use BIOS interrupts for input, that's why I have to write my own interrupt handler (?) but I'm not sure how to do that even after I read some osdev articles and forum discussions. Very similar problem (http

Unrecognised emulation mode: elf_i386 on MinGW32

二次信任 提交于 2020-01-01 06:53:14
问题 I'm trying to make a kernel, and I cannot link the C output with the assembly. The ld . I'm getting the error: unrecognized emulation mode: elf_i386 I'm using Windows 10 professional with the MinGW32 and MSYS. The code I am using: link.ld /* * link.ld */ OUTPUT_FORMAT(elf32-i386) ENTRY(start) SECTIONS { . = 0x100000; .text : { *(.text) } .data : { *(.data) } .bss : { *(.bss) } } kernel.c /* * kernel.c */ void kmain(void) { const char *str = "my first kernel"; char *vidptr = (char*)0xb8000; /

Unrecognised emulation mode: elf_i386 on MinGW32

删除回忆录丶 提交于 2020-01-01 06:53:08
问题 I'm trying to make a kernel, and I cannot link the C output with the assembly. The ld . I'm getting the error: unrecognized emulation mode: elf_i386 I'm using Windows 10 professional with the MinGW32 and MSYS. The code I am using: link.ld /* * link.ld */ OUTPUT_FORMAT(elf32-i386) ENTRY(start) SECTIONS { . = 0x100000; .text : { *(.text) } .data : { *(.data) } .bss : { *(.bss) } } kernel.c /* * kernel.c */ void kmain(void) { const char *str = "my first kernel"; char *vidptr = (char*)0xb8000; /