Init SS and SP by default
This commit is contained in:
@@ -22,6 +22,7 @@ Hello world programs that run without an operating system.
|
||||
1. [keyboard](bios_keyboard.S)
|
||||
1. [Not testable in userland](not-testable-in-userland.md)
|
||||
1. [Segment registers real mode](segment_registers_real_mode.S)
|
||||
1 [SS (TODO)](ss.S)
|
||||
1. APM
|
||||
1. [APM shutdown](apm_shutdown.S)
|
||||
1. [APM shutdown 2](apm_shutdown2.S)
|
||||
|
||||
3
TODO.md
3
TODO.md
@@ -17,6 +17,8 @@
|
||||
|
||||
- http://reverseengineering.stackexchange.com/questions/2006/how-are-the-segment-registers-fs-gs-cs-ss-ds-es-used-in-linux
|
||||
- http://stackoverflow.com/questions/10810203/what-is-the-fs-gs-register-intended-for
|
||||
- http://stackoverflow.com/questions/12760109/data-segment-in-x86-programs
|
||||
- http://stackoverflow.com/questions/14480579/when-does-segment-registers-change
|
||||
- http://stackoverflow.com/questions/15335003/x86-protected-mode-segment-registers-purpose
|
||||
- http://stackoverflow.com/questions/17210620/assembler-calculating-a-memory-address-with-register-base?lq=1
|
||||
- http://stackoverflow.com/questions/20717890/how-to-interpret-gs0x14?lq=1
|
||||
@@ -29,7 +31,6 @@
|
||||
- http://stackoverflow.com/questions/6611346/amd64-fs-gs-registers-in-linux
|
||||
- http://stackoverflow.com/questions/7844963/how-to-interpret-segment-register-accesses-on-x86-64?lq=1
|
||||
- http://stackoverflow.com/questions/928082/why-does-the-mov-instruction-have-to-be-used-this-way?lq=1
|
||||
- http://stackoverflow.com/questions/14480579/when-does-segment-registers-change
|
||||
|
||||
64-bit:
|
||||
|
||||
|
||||
13
common.h
13
common.h
@@ -8,9 +8,16 @@ The big ones do bloat the executable.
|
||||
|
||||
#define BEGIN \
|
||||
.code16;\
|
||||
cli;\
|
||||
xor %ax, %ax;\
|
||||
mov %ax, %ds
|
||||
cli ;\
|
||||
xor %ax, %ax ;\
|
||||
/* We must zero %ds for any data access.. */ \
|
||||
mov %ax, %ds ;\
|
||||
/* TODO What to move into BP and SP? http://stackoverflow.com/questions/10598802/which-value-should-be-used-for-sp-for-booting-process */ \
|
||||
mov 0x0000, %bp ;\
|
||||
/* Disables interrupts until the end of the next instruction. */ \
|
||||
mov %ax, %ss ;\
|
||||
/* We should set SP because BIOS calls may depend on that. TODO confirm. */ \
|
||||
mov %bp, %sp
|
||||
|
||||
#define END
|
||||
|
||||
|
||||
Reference in New Issue
Block a user