开发者

Bootloader function calls

I am a bit confused right now for my project. I did a bit of googling but was unable to find an answer that would properly explain what I need to know. I posted earlier with a different question, sorry for that but I just got confused more now.

Sorry for the noobish repeated question but reading through various sources, I am getting more and more confused and I need a concrete path to follow now. ( Too close to deadline)

I have a simple bootloader ( Just prints Welcome to OS right now ). Followed a very simple tutorial.

I have a shell code which I can make an executable/binary ( whatever is required).

I want to call that shell from ASM code of my bootloader. I DO NOT want to include a kernel in between. A little research tells me that it is possible not to use kernel as a medium if my code is basic enough or something. ( My shell is very very basic. Let's say it lists directories right now.) Now I have two questions.

1) Would I need to write some keyboard device 开发者_Go百科drivers to make it work? ( I am hoping not, ) If the answer is yes, and there exists a workaround, please feel free to elaborate.

2) Just calling that exe /binary from my ASM would work? Like my bootloader boots into a printed message saying Welcome to OS. If I call my shell from that ASM code, it would boot directly into the shell or do I need something more? Am I missing anything?


Your bootloader can run anything it wants to. Usually, it's used for starting an operating system, but there's no reason why it couldn't just launch your shell.

However, I don't know if your shell is up to the task. What does it do for input? What will it do for output? You mention listing directories. Does your shell know how to read a file system on a hard disk? Does it know how to access the hard disk?

There are many good reasons that operating systems are used. To name one: it provides common services that all applications need so they don't have to write it themselves. Like disk, USB, keyboard, video, and file system drivers.

Granted, BIOS may provide you with minimally-working access to some of these components. Keyboard I/O probably requires polling an I/O port. Likewise for printing chars to a text display. I don't recall how you access the disk, but it probably isn't too different. Presumably these are problems that have been solved in the boot loader. You could probably hack together a basic OS library by examining your boot loader code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜