2002-12-28 Yoshinori K. Okuji <okuji@enbug.org>

Use -mrtd and -mregparm=3 to reduce the generated code sizes.
	This means that any missing prototypes could be fatal. Also, you
	must take care when writing assembly code. See the comments at
	the beginning of startup.S, for more details.

	* kern/i386/pc/startup.S (pupa_halt): Modified for the new
	compilation mechanism.
	(pupa_chainloader_real_boot): Likewise.
	(pupa_biosdisk_rw_int13_extensions): Likewise.
	(pupa_biosdisk_rw_standard): Likewise.
	(pupa_biosdisk_check_int13_extensions): Likewise.
	(pupa_biosdisk_get_diskinfo_int13_extensions): Likewise.
	(pupa_biosdisk_get_diskinfo_standard): Likewise.
	(pupa_get_memsize): Likewise.
	(pupa_get_mmap_entry): Likewise.
	(pupa_console_putchar): Likewise.
	(pupa_console_setcursor): Likewise.
	(pupa_getrtsecs): Use pushl instead of push.

	* kern/i386/pc/init.c (pupa_machine_init): Use the scratch
	memory instead of the stack for a mmap entry, because some
	BIOSes may ignore the maximum size and overflow.

	* conf/i386-pc.rmk (COMMON_CFLAGS): Added -mrtd and -mregparm=3.

	* genmk.rb (PModule#rule): Compile automatically generated
	sources with module-specific CFLAGS as well as other sources.
This commit is contained in:
okuji 2002-12-28 07:16:30 +00:00
parent 9962ed9907
commit 62ddcc8f79
7 changed files with 141 additions and 111 deletions

View file

@ -30,7 +30,8 @@ void
pupa_machine_init (void)
{
pupa_uint32_t cont;
struct pupa_machine_mmap_entry entry;
struct pupa_machine_mmap_entry *entry
= (struct pupa_machine_mmap_entry *) PUPA_MEMORY_MACHINE_SCRATCH_ADDR;
pupa_size_t lower_mem = (pupa_get_memsize (0) << 10);
pupa_addr_t end_addr = pupa_get_end_addr ();
@ -53,31 +54,31 @@ pupa_machine_init (void)
PUPA_MEMORY_MACHINE_RESERVED_START - end_addr);
/* Check if pupa_get_mmap_entry works. */
cont = pupa_get_mmap_entry (&entry, 0);
cont = pupa_get_mmap_entry (entry, 0);
if (entry.size)
if (entry->size)
do
{
/* Avoid the lower memory. */
if (entry.addr < 0x100000)
if (entry->addr < 0x100000)
{
if (entry.len <= 0x100000 - entry.addr)
if (entry->len <= 0x100000 - entry->addr)
goto next;
entry.len -= 0x100000 - entry.addr;
entry.addr = 0x100000;
entry->len -= 0x100000 - entry->addr;
entry->addr = 0x100000;
}
/* Ignore >4GB. */
if (entry.addr <= 0xFFFFFFFF && entry.type == 1)
if (entry->addr <= 0xFFFFFFFF && entry->type == 1)
{
pupa_addr_t addr;
pupa_size_t len;
addr = (pupa_addr_t) entry.addr;
len = ((addr + entry.len > 0xFFFFFFFF)
addr = (pupa_addr_t) entry->addr;
len = ((addr + entry->len > 0xFFFFFFFF)
? 0xFFFFFFFF - addr
: (pupa_size_t) entry.len);
: (pupa_size_t) entry->len);
pupa_mm_init_region ((void *) addr, len);
}
@ -85,9 +86,9 @@ pupa_machine_init (void)
if (! cont)
break;
cont = pupa_get_mmap_entry (&entry, cont);
cont = pupa_get_mmap_entry (entry, cont);
}
while (entry.size);
while (entry->size);
else
{
pupa_uint32_t eisa_mmap = pupa_get_eisa_mmap ();