[英]How to set the Stack segment
Can some one help understand the how to set the stack for the OS. 有人可以帮助您了解如何为操作系统设置堆栈。
As far as I understood, the SS is to be set by the "programmer" to 1024 (1k) and move the SP to the top of it, is that correct? 据我了解,SS将由“程序员”设置为1024(1k),然后将SP移到它的顶部,对吗?
and I found the below on MikeOS tutorial, not sure how adding 544 to 07c0 will add 4k buffer 我在MikeOS教程上找到了以下内容,不确定将544添加到07c0将如何添加4k缓冲区
bootloader_start:
mov ax, 07C0h ; Set up 4K of stack space above buffer
add ax, 544 ; 8k buffer = 512 paragraphs + 32 paragraphs
This is the code I use to set the stack segment. 这是我用来设置堆栈段的代码。
; NASM syntax
xor ax, ax ; or set ax to whatever segment you wish
mov ss, ax ; IIRC, you can't just go mov ss, 0
mov sp, 0xF000 ; or set sp to whatever you wish
I don't think I had to put the stack there. 我认为我不必将堆栈放在那里。 You can put it wherever you want, as long as you don't overwrite system data.
只要不覆盖系统数据,就可以将其放在任意位置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.