seabios.git
16 years agoDon't pass in ebp/esp to irq handlers.
Kevin O'Connor [Wed, 12 Mar 2008 01:21:47 +0000 (21:21 -0400)]
Don't pass in ebp/esp to irq handlers.

The C code won't clobber these registers, so backing them up isn't needed.
Removing them saves a few bytes on the stack.

16 years agoDon't save/restore flags and ebp on external calls - saves on stack space.
Kevin O'Connor [Wed, 12 Mar 2008 00:38:33 +0000 (20:38 -0400)]
Don't save/restore flags and ebp on external calls - saves on stack space.

It isn't necessary to save ebp - just mark it as clobbered.
The only important flag to save/restore is irqs - manually fixup all callers.

16 years agouse PACKED for bregs declaration
Kevin O'Connor [Tue, 11 Mar 2008 23:54:55 +0000 (19:54 -0400)]
use PACKED for bregs declaration

This patch makes bregs structure declared with PACKED macro (biosvar.h)

Signed-off-by: Nguyen Anh Quynh <aquynh@gmail.com>
16 years agoIgnore out/ directory.
Kevin O'Connor [Tue, 11 Mar 2008 23:50:44 +0000 (19:50 -0400)]
Ignore out/ directory.

16 years agoReorganize ata code; reduce stack usage.
Kevin O'Connor [Tue, 11 Mar 2008 23:42:41 +0000 (19:42 -0400)]
Reorganize ata code; reduce stack usage.

This fixes an issue with freedos lbacache - the bios was overrunning
the stack on disk requests.
The code has been simplified by extracting common code.
Some handlers moved to inline code to reduce overall stack usage.

16 years agoFix bug in atapi_get_sense.
Kevin O'Connor [Tue, 11 Mar 2008 23:40:44 +0000 (19:40 -0400)]
Fix bug in atapi_get_sense.

Buffer size was in wrong argument position.
Clarify code by using sizeof().

16 years agoHalt machine on call to BX_PANIC.
Kevin O'Connor [Tue, 11 Mar 2008 23:39:10 +0000 (19:39 -0400)]
Halt machine on call to BX_PANIC.

16 years agoForce functions marked as inline to always be inlined.
Kevin O'Connor [Tue, 11 Mar 2008 23:32:38 +0000 (19:32 -0400)]
Force functions marked as inline to always be inlined.

Inline alters stack usage, so don't let gcc uninline.
Also, gcc seems to include multiple copies of uninlined functions when
using -combine.
With inlining forced on, the no null check optimization causes
problems, so disable it.

16 years agoUnify ata_cmd_data_in/out functions.
Kevin O'Connor [Tue, 11 Mar 2008 15:48:04 +0000 (11:48 -0400)]
Unify ata_cmd_data_in/out functions.

The functions are very similar.

16 years agoReduce stack usage for ISRs; minor fixes.
Kevin O'Connor [Tue, 11 Mar 2008 15:14:59 +0000 (11:14 -0400)]
Reduce stack usage for ISRs; minor fixes.

Don't back up all registers on isr handlers - they don't read/modify
    them.  This saves stack space.
extended_bios_data_area_s must be packed to match ebda spec.
Enable irqs on int 08 - follows old bochs bios code.
Fix bug in int 76 -- should clear disk_interrupt_flag not
    floppy_harddisk_info.
Make sure we alert in disk_ret on failure case.
int 18/19 entry points need to setup cld/%ds too.
asm in handle_1587 clobbers flags - note that in clobber list.

16 years agoCall to int 1587 shouldn't alter regs->cx.
Kevin O'Connor [Mon, 10 Mar 2008 03:37:04 +0000 (23:37 -0400)]
Call to int 1587 shouldn't alter regs->cx.

The asm was setting regs->cx to zero - use a temp variable to avoid that.

16 years agoMinor debugging improvements.
Kevin O'Connor [Sun, 9 Mar 2008 20:11:49 +0000 (16:11 -0400)]
Minor debugging improvements.

16 years agoFix bug in int 1587.
Kevin O'Connor [Sun, 9 Mar 2008 20:10:19 +0000 (16:10 -0400)]
Fix bug in int 1587.

Wrap comparison must be done with 16bit values.
Must use 16bit form of lgdt instruction.

16 years agoFix booting logic on failure.
Kevin O'Connor [Sun, 9 Mar 2008 17:46:13 +0000 (13:46 -0400)]
Fix booting logic on failure.

Make sure we properly try next device on failures.

16 years agoFix bug in cdrom reads causing incorrect return status.
Kevin O'Connor [Sun, 9 Mar 2008 17:32:36 +0000 (13:32 -0400)]
Fix bug in cdrom reads causing incorrect return status.

Unify the return code in ata.trsfsectors (don't use trsfbytes).
Also includes minor code clean ups.

16 years agoMake sure global variables are zerod before exiting bios post.
Kevin O'Connor [Sun, 9 Mar 2008 17:32:03 +0000 (13:32 -0400)]
Make sure global variables are zerod before exiting bios post.

16 years agoSimplify e820 map generation.
Kevin O'Connor [Sun, 9 Mar 2008 16:23:42 +0000 (12:23 -0400)]
Simplify e820 map generation.

Clean up by moving code from handle_15e820 to set_e820_range.
Set ES explicilty prior to populating the map - the code was relying
on nothing changing it.

16 years agoReplace debug_exit calls with debug info while setting a failure.
Kevin O'Connor [Sun, 9 Mar 2008 16:19:23 +0000 (12:19 -0400)]
Replace debug_exit calls with debug info while setting a failure.

Calling debug_exit at the end of a call doesn't help much - several of
the registers are already clobbered at this point.  It also increases
stack usage because it prevents call tail optimization in many places.

16 years agoAdd build option -fomit-frame-pointer.
Kevin O'Connor [Sun, 9 Mar 2008 16:18:22 +0000 (12:18 -0400)]
Add build option -fomit-frame-pointer.

It seems to improve code generation.

16 years agoFix bug in SET_FARVAR.
Kevin O'Connor [Sun, 9 Mar 2008 15:53:22 +0000 (11:53 -0400)]
Fix bug in SET_FARVAR.

The (val) parameter needs to be evaluated before setting the segment.

16 years agoOptimize insb/outsb/insw/etc. functions.
Kevin O'Connor [Sun, 9 Mar 2008 05:59:58 +0000 (00:59 -0500)]
Optimize insb/outsb/insw/etc. functions.

Use "string ops" to simplify port accesses.
Always run "cld" on entry to C code.

16 years agoMinor cleanups.
Kevin O'Connor [Sun, 9 Mar 2008 04:25:16 +0000 (23:25 -0500)]
Minor cleanups.

Improve some debugging messages.
Minor code clean ups.
Improve apmbios entry points (still untested).

16 years agoFix bug in ata.c
Kevin O'Connor [Sun, 9 Mar 2008 04:20:41 +0000 (23:20 -0500)]
Fix bug in ata.c

Code wasn't incrementing offset properly.
Also clean up code a little and add some debugging info.

16 years agoPort rombios32 code from bochs-bios.
Kevin O'Connor [Sat, 8 Mar 2008 20:43:03 +0000 (15:43 -0500)]
Port rombios32 code from bochs-bios.

This adds acpi, smbios, pci init, etc.
Changes from original rombios32.c code:
* Header file translation.
* Use common functions already in code (eg, outb, memset, bios_printf,
  usleep)
* Implement trampoline for disabling bios shadowing (rombios32 code
  actually runs in the 0xf0000 area).
* Copy asm code from rombios32start.S to an asm() statement in C
  code.

16 years agoMinor hack - allow formats with 'l' to be shown in printf.
Kevin O'Connor [Sat, 8 Mar 2008 20:40:43 +0000 (15:40 -0500)]
Minor hack - allow formats with 'l' to be shown in printf.

16 years agoRevert "Commit missing files from last commit."
Kevin O'Connor [Sat, 8 Mar 2008 18:17:49 +0000 (13:17 -0500)]
Revert "Commit missing files from last commit."

This reverts commit a75284dbd70acc7ec4a832045c8a2fbec2d773d8.

16 years agoRevert "This patch adds the BIOS support for SMP, ACPI, PCI, SMM, SMBIOS."
Kevin O'Connor [Sat, 8 Mar 2008 18:17:16 +0000 (13:17 -0500)]
Revert "This patch adds the BIOS support for SMP, ACPI, PCI, SMM, SMBIOS."

This reverts commit 3d029417164e9a6dffee491fb061de3de6d85595.

Conflicts:

src/post.c

16 years agoMake sure to restore %ds on return from call16.
Kevin O'Connor [Sat, 8 Mar 2008 18:04:10 +0000 (13:04 -0500)]
Make sure to restore %ds on return from call16.

16 years agoMinor cleanup - move init of bda->equipment_list_flags
Kevin O'Connor [Sat, 8 Mar 2008 17:42:36 +0000 (12:42 -0500)]
Minor cleanup - move init of bda->equipment_list_flags

The init of equipment_list_flags was in kbd_setup() - but it is unrelated.

16 years agoFix keyboard init bug.
Kevin O'Connor [Sat, 8 Mar 2008 17:28:49 +0000 (12:28 -0500)]
Fix keyboard init bug.

kbd_flush() wasn't implemented properly.
Don't panic on first kbd_flush call.

16 years agoEnhance APM support.
Kevin O'Connor [Sat, 8 Mar 2008 16:34:46 +0000 (11:34 -0500)]
Enhance APM support.

Create and register protected mode interfaces.
Still needs more testing.

16 years agoClean up disk debugging messages.
Kevin O'Connor [Sat, 8 Mar 2008 16:34:28 +0000 (11:34 -0500)]
Clean up disk debugging messages.

16 years agouse symbols for E820 memory types
Kevin O'Connor [Sat, 8 Mar 2008 15:27:39 +0000 (10:27 -0500)]
use symbols for E820 memory types

This patch uses symbols for E820 memory types (system.c)

Signed-off-by: Nguyen Anh Quynh <aquynh@gmail.com>
16 years agoUse symbols for cmos offsets in ram_probe()
Kevin O'Connor [Fri, 7 Mar 2008 00:16:37 +0000 (19:16 -0500)]
Use symbols for cmos offsets in ram_probe()

This patches uses symbols for cmos offsets when calculating ram size
in ram_probe()
Besides, it adds some cmos offset symbols into cmos.h, and changes
some memory cmos offset to be more meaningful.

Signed-off-by: Nguyen Anh Quynh <aquynh@gmail.com>
16 years agoRename VISIBLE macro for better control.
Kevin O'Connor [Thu, 6 Mar 2008 02:09:59 +0000 (21:09 -0500)]
Rename VISIBLE macro for better control.

VISIBLE16 is used to mark functions externally available in 16bit code.
VISIBLE32 is for 32bit functions.

16 years agoCommit missing files from last commit.
Kevin O'Connor [Thu, 6 Mar 2008 01:56:23 +0000 (20:56 -0500)]
Commit missing files from last commit.

16 years agoThis patch adds the BIOS support for SMP, ACPI, PCI, SMM, SMBIOS.
Kevin O'Connor [Thu, 6 Mar 2008 01:43:38 +0000 (20:43 -0500)]
This patch adds the BIOS support for SMP, ACPI, PCI, SMM, SMBIOS.

Signed-off-by: Nguyen Anh Quynh
Several compile fixes provided by Kevin O'Connor

16 years agoAdd initial support for apmbios code.
Kevin O'Connor [Thu, 6 Mar 2008 00:52:06 +0000 (19:52 -0500)]
Add initial support for apmbios code.

16 years agoGet CDROM emulation working.
Kevin O'Connor [Wed, 5 Mar 2008 03:50:53 +0000 (22:50 -0500)]
Get CDROM emulation working.

Fix bug causing ata_cmd_packet to insl to wrong address.
Add new cdrom_read helper.
Join ata.hdidmap/cdidmap into one array variable.
Rename CONFIG_ELTORITO_BOOT to CONFIG_CDROM_BOOT.
Add cd emulation code.

16 years agoIgnore precision specifiers in printf code.
Kevin O'Connor [Wed, 5 Mar 2008 03:27:55 +0000 (22:27 -0500)]
Ignore precision specifiers in printf code.

This at least allows the variable to be printed.

16 years agoMove cdrom code to its own file (cdrom.c).
Kevin O'Connor [Wed, 5 Mar 2008 00:56:41 +0000 (19:56 -0500)]
Move cdrom code to its own file (cdrom.c).

16 years agoInitial cd emulation code.
Kevin O'Connor [Wed, 5 Mar 2008 00:45:04 +0000 (19:45 -0500)]
Initial cd emulation code.

Provides the int13 hooks - still a work in progress.

16 years agoInitial cdrom support.
Kevin O'Connor [Tue, 4 Mar 2008 02:57:30 +0000 (21:57 -0500)]
Initial cdrom support.

16 years agoUbuntu workaround found; update TODO.
Kevin O'Connor [Tue, 4 Mar 2008 02:56:54 +0000 (21:56 -0500)]
Ubuntu workaround found; update TODO.

16 years agoDon't pass segment to ata_cmd_packet.
Kevin O'Connor [Tue, 4 Mar 2008 02:56:20 +0000 (21:56 -0500)]
Don't pass segment to ata_cmd_packet.

The segment is always the stack - so no reason to pass it.

16 years agotypes.h & ata.h
Kevin O'Connor [Tue, 4 Mar 2008 01:14:12 +0000 (20:14 -0500)]
types.h & ata.h

This patch addes header guard to ata.h and move PACKED definition to
types.h (to be used for other files - sent later)

Signed-off-by: Nguyen Anh Quynh <aquynh@gmail.com>
16 years agoAdd new item to TODO.
Kevin O'Connor [Mon, 3 Mar 2008 04:26:09 +0000 (23:26 -0500)]
Add new item to TODO.

16 years agoCleanup start logic in post.
Kevin O'Connor [Mon, 3 Mar 2008 04:25:11 +0000 (23:25 -0500)]
Cleanup start logic in post.

Merge eoi_jmp_post() with check_restart_status() - it makes the logic
a little simpler to understand.

16 years agouse symbols for segment numbers
Kevin O'Connor [Mon, 3 Mar 2008 04:24:16 +0000 (23:24 -0500)]
use symbols for segment numbers

this patch uses symbols for segment numbers in romlayout.S

Signed-off-by: Nguyen Anh Quynh
16 years agoApply workaround to allow compiling under Ubuntu.
Kevin O'Connor [Mon, 3 Mar 2008 01:48:35 +0000 (20:48 -0500)]
Apply workaround to allow compiling under Ubuntu.

Add make option "AVOIDCOMBINE" that prevent -combine from being used.
Ubuntu makes symbols non-global -- have defsyms.py pick them up anyway.

16 years agoBug fixes; get mouse working.
Kevin O'Connor [Sun, 2 Mar 2008 18:58:23 +0000 (13:58 -0500)]
Bug fixes; get mouse working.

Fix bug in post causing PIC2 to not be initialized properly.
Only run ata_detect if CONFIG_ATA enabled.
Improve debugging aids - introduce debug_isr(); move DEBUGF to each file.
Enable mouse by default.
Fix bug in floppy causing extra test of PORT_FD_STATUS on recalibrate.
Always disable/enable kbd in handle_09 event.

16 years agoEnhance included bios tables.
Kevin O'Connor [Sun, 2 Mar 2008 16:24:36 +0000 (11:24 -0500)]
Enhance included bios tables.

Moved floppy parameter table to its 0xefc7 location.
Define floppy base table as a struct.
Cleaned up definitions in romlayout.S
Fixed bug in handle_15c0 - wasn't clearing cf.
Clean up some post.c usages of bios tables.

16 years agoMinor cleanup of util.h
Kevin O'Connor [Sun, 2 Mar 2008 13:48:05 +0000 (08:48 -0500)]
Minor cleanup of util.h

Enable output from DEBUGF macro.
Cleanup extended asm args.

16 years agoInitial support for ps/2 mouse.
Kevin O'Connor [Sun, 2 Mar 2008 13:43:44 +0000 (08:43 -0500)]
Initial support for ps/2 mouse.

The code doesn't work, but most things are present.

16 years agoRename PORT_KBD_* to PORT_PS2_*
Kevin O'Connor [Sun, 2 Mar 2008 13:42:16 +0000 (08:42 -0500)]
Rename PORT_KBD_* to PORT_PS2_*

This change is in preparation for mouse support.

16 years agoVarious minor cleanups.
Kevin O'Connor [Sun, 2 Mar 2008 03:17:07 +0000 (22:17 -0500)]
Various minor cleanups.

16 years agoAdd additional int15 handlers for disk drives.
Kevin O'Connor [Sun, 2 Mar 2008 03:16:32 +0000 (22:16 -0500)]
Add additional int15 handlers for disk drives.

16 years agoReduce stack usage in call16().
Kevin O'Connor [Sat, 1 Mar 2008 19:56:07 +0000 (14:56 -0500)]
Reduce stack usage in call16().

Tell gcc that registers are clobbered instead of using push/popal.

16 years agoCleanup implementation of call16().
Kevin O'Connor [Sat, 1 Mar 2008 19:46:37 +0000 (14:46 -0500)]
Cleanup implementation of call16().

16 years agoMinor - reduce stack usage of handle_1587.
Kevin O'Connor [Sat, 1 Mar 2008 19:25:44 +0000 (14:25 -0500)]
Minor - reduce stack usage of handle_1587.

16 years agoImplement basic "eoi_jmp_post" code to post step.
Kevin O'Connor [Sat, 1 Mar 2008 19:02:41 +0000 (14:02 -0500)]
Implement basic "eoi_jmp_post" code to post step.

16 years agoUpdate TODO notes.
Kevin O'Connor [Sat, 1 Mar 2008 18:48:26 +0000 (13:48 -0500)]
Update TODO notes.

16 years agoImprove comments in romlayout.S
Kevin O'Connor [Sat, 1 Mar 2008 18:39:52 +0000 (13:39 -0500)]
Improve comments in romlayout.S

16 years agoFix for int15 handlers.
Kevin O'Connor [Sat, 1 Mar 2008 18:38:38 +0000 (13:38 -0500)]
Fix for int15 handlers.

The int 1587 was long jumping to wrong segment.
Minor cleanup - breakout handlers better.

16 years agoAdd copyrights to ata.c/h files.
Kevin O'Connor [Sat, 1 Mar 2008 18:38:07 +0000 (13:38 -0500)]
Add copyrights to ata.c/h files.

16 years agoMinor update to bprintf.
Kevin O'Connor [Sat, 1 Mar 2008 18:35:17 +0000 (13:35 -0500)]
Minor update to bprintf.

Support '%c'.
Fix bug causing junk to be printed on unrecognized % code.

16 years agoMake disk access work.
Kevin O'Connor [Sat, 1 Mar 2008 18:34:04 +0000 (13:34 -0500)]
Make disk access work.

Several bug fixes.
Move ata_detect from disk.c to ata.c.

16 years agoFix header guards produced by defsys.py
Kevin O'Connor [Sat, 1 Mar 2008 15:11:55 +0000 (10:11 -0500)]
Fix header guards produced by defsys.py

Issue spotted by Nguyen Anh Quynh

16 years agoCleanup of post.c
Kevin O'Connor [Sat, 1 Mar 2008 14:57:51 +0000 (09:57 -0500)]
Cleanup of post.c

Mostly from suggestions by Nguyen Anh Quynh

16 years agoUse symbols instead of number for segment descriptors in romlayout.S
Kevin O'Connor [Sat, 1 Mar 2008 14:49:37 +0000 (09:49 -0500)]
Use symbols instead of number for segment descriptors in romlayout.S

Patch from Nguyen Anh Quynh

16 years agoInitial support for ATA disks.
Kevin O'Connor [Fri, 29 Feb 2008 05:22:27 +0000 (00:22 -0500)]
Initial support for ATA disks.

16 years agoEnable extra debugging.
Kevin O'Connor [Fri, 29 Feb 2008 05:21:27 +0000 (00:21 -0500)]
Enable extra debugging.

Route BX_INFO to debug port.
Add a new debug_stub() function.

16 years agoMinor cleanup in floppy.c
Kevin O'Connor [Fri, 29 Feb 2008 05:20:32 +0000 (00:20 -0500)]
Minor cleanup in floppy.c

16 years agoHave compiler add debugging info to main 16bit code.
Kevin O'Connor [Fri, 29 Feb 2008 01:01:11 +0000 (20:01 -0500)]
Have compiler add debugging info to main 16bit code.

16 years agothe idt descriptors look a bit wrong. this patch fixes that
Kevin O'Connor [Fri, 29 Feb 2008 01:00:20 +0000 (20:00 -0500)]
the idt descriptors look a bit wrong. this patch fixes that

From Nguyen Anh Quynh

16 years agoSome cleanups based on patch by Nguyen Anh Quynh
Kevin O'Connor [Wed, 27 Feb 2008 15:41:41 +0000 (10:41 -0500)]
Some cleanups based on patch by Nguyen Anh Quynh

Add include guards to header files.
Disable stack protector on gcc versions with that option.
Fix lds bug in src/rombios32.lds.S
Don't forward declare "struct bregs;" - it may be confusing gcc on some versions.

16 years agoMerge recent changes to bochs-bios CVS head.
Kevin O'Connor [Wed, 27 Feb 2008 15:27:00 +0000 (10:27 -0500)]
Merge recent changes to bochs-bios CVS head.

Slightly different order to rom-scanning.

16 years agoMisc updates.
Kevin O'Connor [Wed, 27 Feb 2008 02:33:14 +0000 (21:33 -0500)]
Misc updates.

Try to fix up make dependency tracking by including a "null.c" file.
Initialize hard disk tables during post.
Move RTC handlers from system.c to clock.c
Use a macro to init stacks in romlayout.S
Add C-Code stats to buildrom step.

16 years agoVersion 0.1.2
Kevin O'Connor [Tue, 26 Feb 2008 03:30:47 +0000 (22:30 -0500)]
Version 0.1.2

16 years agoVersion 0.1.1
Kevin O'Connor [Tue, 26 Feb 2008 03:29:55 +0000 (22:29 -0500)]
Version 0.1.1

16 years agoInitial checkin.
Kevin O'Connor [Tue, 26 Feb 2008 03:25:15 +0000 (22:25 -0500)]
Initial checkin.