Ensured that _errno is always defined. Rejigged the pc86 boot code so it doesn't always waste 510 bytes of memory.
This commit is contained in:
parent
413880c52d
commit
b8e1348f2a
|
@ -60,6 +60,7 @@ EXIT:
|
||||||
|
|
||||||
! Some magic data. All EM systems need these.
|
! Some magic data. All EM systems need these.
|
||||||
|
|
||||||
.define .trppc, .ignmask
|
.define .trppc, .ignmask, _errno
|
||||||
.comm .trppc, 4
|
.comm .trppc, 4
|
||||||
.comm .ignmask, 4
|
.comm .ignmask, 4
|
||||||
|
.comm _errno, 4
|
||||||
|
|
|
@ -12,6 +12,19 @@
|
||||||
|
|
||||||
.sect .text
|
.sect .text
|
||||||
|
|
||||||
|
! ****** WARNING! ******
|
||||||
|
!
|
||||||
|
! The PC boot sector requires a magic number at the end to signify that the
|
||||||
|
! disk is bootable. Unfortunately, the ACK assembler is a bit simple and we
|
||||||
|
! can't tell it to put the 0xAA55 at a particular address without writing our
|
||||||
|
! own custom binary generator. As a result, we need to manually insert just
|
||||||
|
! the right amount of padding in order to make this work.
|
||||||
|
!
|
||||||
|
! If you ever need to change the boot code, this needs adjusting. I recommend
|
||||||
|
! a hex editor.
|
||||||
|
|
||||||
|
PADDING = 0xB9
|
||||||
|
|
||||||
! Some definitions.
|
! Some definitions.
|
||||||
|
|
||||||
BOOT_SEGMENT = 0x07C0 ! Where we've been loaded
|
BOOT_SEGMENT = 0x07C0 ! Where we've been loaded
|
||||||
|
@ -255,10 +268,9 @@ finished:
|
||||||
|
|
||||||
! Push standard parameters onto the stack and go.
|
! Push standard parameters onto the stack and go.
|
||||||
|
|
||||||
xor ax, ax
|
push envp ! envp
|
||||||
push ax ! argc
|
push argv ! argv
|
||||||
push ax ! argv
|
push 1 ! argc
|
||||||
push ax ! envp
|
|
||||||
call __m_a_i_n
|
call __m_a_i_n
|
||||||
! fall through into the exit routine.
|
! fall through into the exit routine.
|
||||||
|
|
||||||
|
@ -291,25 +303,28 @@ loading_msg: .asciz '\n\rLoading...\n\r'
|
||||||
halted_msg: .asciz '\n\rHalted.\n\r'
|
halted_msg: .asciz '\n\rHalted.\n\r'
|
||||||
running_msg: .asciz '\n\rRunning.\n\r'
|
running_msg: .asciz '\n\rRunning.\n\r'
|
||||||
|
|
||||||
|
! The argv and env arrays.
|
||||||
|
|
||||||
|
argv: .data2 exename, 0
|
||||||
|
envp: .data2 0
|
||||||
|
exename: .asciz 'pc86.img'
|
||||||
|
|
||||||
! ...and we need this to fool the PC into booting our boot sector.
|
! ...and we need this to fool the PC into booting our boot sector.
|
||||||
|
|
||||||
.align 510
|
.space PADDING
|
||||||
.data2 0xAA55
|
.data2 0xAA55
|
||||||
|
|
||||||
|
|
||||||
.define begtext,begdata,begbss
|
|
||||||
.define ERANGE,ESET,EHEAP,ECASE,EILLINS,EIDIVZ,EODDZ
|
|
||||||
.extern _end
|
|
||||||
|
|
||||||
! Define symbols at the beginning of our various segments, so that we can find
|
! Define symbols at the beginning of our various segments, so that we can find
|
||||||
! them. (Except .text, which has already been done.)
|
! them. (Except .text, which has already been done.)
|
||||||
|
|
||||||
|
.define begtext, begdata, begbss
|
||||||
.sect .data; begdata:
|
.sect .data; begdata:
|
||||||
.sect .rom; begrom:
|
.sect .rom; begrom:
|
||||||
.sect .bss; begbss:
|
.sect .bss; begbss:
|
||||||
|
|
||||||
! Some magic data. All EM systems need these.
|
! Some magic data. All EM systems need these.
|
||||||
|
|
||||||
.define .trppc, .ignmask
|
.define .trppc, .ignmask, _errno
|
||||||
.comm .trppc, 4
|
.comm .trppc, 4
|
||||||
.comm .ignmask, 4
|
.comm .ignmask, 4
|
||||||
|
.comm _errno, 4
|
||||||
|
|
|
@ -55,8 +55,8 @@ name led
|
||||||
(.ocm:{TAIL}={PLATFORMDIR}/liboccam.a) \
|
(.ocm:{TAIL}={PLATFORMDIR}/liboccam.a) \
|
||||||
(.ocm.b.mod.c.p:{TAIL}={PLATFORMDIR}/libc.a) \
|
(.ocm.b.mod.c.p:{TAIL}={PLATFORMDIR}/libc.a) \
|
||||||
{FLOATS?} \
|
{FLOATS?} \
|
||||||
(.e:{TAIL}={PLATFORMDIR}/libsys.a \
|
(.e:{TAIL}={PLATFORMDIR}/libem.a \
|
||||||
{PLATFORMDIR}/libem.a \
|
{PLATFORMDIR}/libsys.a \
|
||||||
{PLATFORMDIR}/libend.a)
|
{PLATFORMDIR}/libend.a)
|
||||||
linker
|
linker
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue