n64chain.git
2 years agoUpdate toolchain to use GCC 8.1. master
Tyler J. Stachecki [Wed, 16 May 2018 14:10:10 +0000 (10:10 -0400)]
Update toolchain to use GCC 8.1.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
2 years agolibn64/io: Break out filesystem operations.
Tyler J. Stachecki [Sun, 11 Mar 2018 00:16:51 +0000 (19:16 -0500)]
libn64/io: Break out filesystem operations.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
2 years agolibn64: Add a thread for managing the SI.
Tyler J. Stachecki [Sun, 11 Mar 2018 00:08:51 +0000 (19:08 -0500)]
libn64: Add a thread for managing the SI.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
2 years agolibn64: Add a thread for managing the SP.
Tyler J. Stachecki [Sat, 10 Mar 2018 23:33:23 +0000 (18:33 -0500)]
libn64: Add a thread for managing the SP.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
2 years agoUpdate build scripts with new tool versions.
Tyler J. Stachecki [Sat, 10 Mar 2018 23:05:59 +0000 (18:05 -0500)]
Update build scripts with new tool versions.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
2 years agolibn64/os: Spin on different PI bit during boot.
Tyler J. Stachecki [Sun, 28 Jan 2018 16:36:32 +0000 (11:36 -0500)]
libn64/os: Spin on different PI bit during boot.

Was previously spinning on a not-well-documented bit that
gets raised when the interrupt line goes high (i.e., the
PI DMA is done). Spin on the PI DMA busy bit instead.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
2 years agoGraphics ucode optimizations and tweaks.
Tyler J. Stachecki [Sun, 31 Dec 2017 15:21:44 +0000 (10:21 -0500)]
Graphics ucode optimizations and tweaks.

Take advantage of the RSP's ability to dual issue if
scalar and vector instructions are interleaved correctly.

I don't think the RSP has the same limitations as the
VR4300 (wrt back-to-back stores), but I reordered those
accordingly as well.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
2 years agoCommit the RDP demo before I mess it up.
Tyler J. Stachecki [Sat, 30 Dec 2017 23:30:15 +0000 (18:30 -0500)]
Commit the RDP demo before I mess it up.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
2 years agolibgfx: Merge in very early release.
Tyler J. Stachecki [Sat, 30 Dec 2017 16:27:49 +0000 (11:27 -0500)]
libgfx: Merge in very early release.

This additional library (that gets linked in with the
cart's ELF, rather than libn64) will provide accelerated
graphics functionality.

It currently provides a ucode which can render RDP triangle
commands from 3 vertices in the ucode's vertex buffer.

None of this would would have been possible without krom's
and GreaseMonkey's invaluable help in reverse enginering
"how to triangle" (from below). krom also provided a sample
program which I used extensively while designing the RSP
ucode.

https://forums.cen64.com/viewtopic.php?f=14&t=237

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
2 years agorspasm: Do not allow input from stdin.
Tyler J. Stachecki [Sat, 30 Dec 2017 16:09:46 +0000 (11:09 -0500)]
rspasm: Do not allow input from stdin.

Unfortunately, we currently do two passes over the input
file and use rewind(), so we cannot read from stdin.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
2 years agorspasm: Add more operations yet.
Tyler J. Stachecki [Sat, 30 Dec 2017 15:41:08 +0000 (10:41 -0500)]
rspasm: Add more operations yet.

  * MFC2/MTC2: for setting/getting vector data
  * Single-register/offset instructions like BGEZ

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
2 years agorspasm: More vector operations, bugfix.
Tyler J. Stachecki [Wed, 27 Dec 2017 03:01:46 +0000 (22:01 -0500)]
rspasm: More vector operations, bugfix.

  * (Almost) all LWC2/SWC2 operations.
  * Several vector insructions added.
  * Fixed a bug with the .half directive.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
2 years agolibn64/os: Fix a small typo in the comments.
Tyler J. Stachecki [Wed, 27 Dec 2017 01:53:49 +0000 (20:53 -0500)]
libn64/os: Fix a small typo in the comments.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
2 years agolibn64: Fix a bug reported by @einhov.
Tyler J. Stachecki [Wed, 27 Dec 2017 01:44:57 +0000 (20:44 -0500)]
libn64: Fix a bug reported by @einhov.

syscall.h makes use of libn64func, so we must include
libn64.h before declaring all the syscall wrappers.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
2 years agolibn64: or why you don't push directly to master.
Tyler J. Stachecki [Wed, 20 Dec 2017 00:46:57 +0000 (19:46 -0500)]
libn64: or why you don't push directly to master.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
2 years agolibn64: Add an init ucode and execute it at boot.
Tyler J. Stachecki [Tue, 19 Dec 2017 17:21:11 +0000 (12:21 -0500)]
libn64: Add an init ucode and execute it at boot.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
2 years agolibn64: Assemble ucodes, put tsks in filesystem.
Tyler J. Stachecki [Tue, 19 Dec 2017 14:19:46 +0000 (09:19 -0500)]
libn64: Assemble ucodes, put tsks in filesystem.

Alter the build task so that it assembles all ucodes under
both libn64/ucodes and the project/ucodes directories and
places the output in the filesystem.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
2 years agolibn64/io: Restructure the PI thread.
Tyler J. Stachecki [Tue, 19 Dec 2017 01:37:54 +0000 (20:37 -0500)]
libn64/io: Restructure the PI thread.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
2 years agolibn64: Fix problems with Windows builds.
Tyler J. Stachecki [Mon, 18 Dec 2017 20:06:52 +0000 (20:06 +0000)]
libn64: Fix problems with Windows builds.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
2 years agolibn64: Don't generate breaks for divides.
Tyler J. Stachecki [Mon, 18 Dec 2017 18:31:17 +0000 (13:31 -0500)]
libn64: Don't generate breaks for divides.

@sp1187 pointed out (d)div(u) was generating break insns
and that inserting an implicit $zero (dummy) operand will
prevent it.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
2 years agolibn64/os: First pass at an I/O engine implementation.
Tyler J. Stachecki [Mon, 18 Dec 2017 05:14:55 +0000 (00:14 -0500)]
libn64/os: First pass at an I/O engine implementation.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
2 years agoFilesystem creation tool and message queues. (#2)
Tyler Stachecki [Mon, 18 Dec 2017 03:44:10 +0000 (22:44 -0500)]
Filesystem creation tool and message queues. (#2)

* Faciliate loading of external assets.

Maintain a 'filesystem' directory placed within the
the source directory - whenever make is run, files in
this directory are assembled into the final image.

An external header file is generated with offsets and
sizes of each of the files packaged. This allows for
compile-time resolution of addresses within the cart
(as opposed to doing costly dynamic lookups based on
directory and filename).

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
* Add message allocator interfaces.

The message allocators were already in-use within the
kernel - these syscalls just crack them open for direct
allocations.

The message allocators provide a means for quickly
obtaining 16-byte structures that are aligned on data
cache line boundaries.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
* Add support for "unbound" MP-SC message queues.

Add support for message queues which are not directly tied
to a thread and can be passed around as needed. Any thread
can send a message on a message queue, but only the thread
which created the message queue can recv on it.

Unlike thread-specific message queues, the receiver can opt
to block on the queue (suspend himself if no message are
available) or block until a message becomes available on
the queue.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
2 years agogcc-7.2.0.tar.bz2 doesn't exist (#1)
Mike Garcia [Sat, 16 Dec 2017 19:57:01 +0000 (06:57 +1100)]
gcc-7.2.0.tar.bz2 doesn't exist (#1)

* gcc-7.2.0.tar.bz2 doesn't exist

no file: GCC="ftp://ftp.gnu.org/gnu/gcc/gcc-7.2.0/gcc-7.2.0.tar.bz2"
replaced with GCC="ftp://ftp.gnu.org/gnu/gcc/gcc-7.2.0/gcc-7.2.0.tar.gz"
worked for me

* GCC download link fixed

no file: GCC="ftp://ftp.gnu.org/gnu/gcc/gcc-7.2.0/gcc-7.2.0.tar.bz2"
GCC="ftp://ftp.gnu.org/gnu/gcc/gcc-7.2.0/gcc-7.2.0.tar.gz"

I don't have a windows dev env, but I checked the other links and they're all fine.
Cheers
Mike.

2 years agoUpdate toolchain bootstrappers.
Tyler J. Stachecki [Sat, 9 Dec 2017 09:20:23 +0000 (04:20 -0500)]
Update toolchain bootstrappers.

On Windows, we should now be building the LTO plugin
(though, unfortunately, the tools still don't seem to
respect the linker plugin...).

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
2 years agoAdd some vr4300-specific flags.
Tyler J. Stachecki [Thu, 7 Dec 2017 05:43:29 +0000 (00:43 -0500)]
Add some vr4300-specific flags.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
2 years agoFix a nasty typo.
Tyler J. Stachecki [Thu, 7 Dec 2017 05:10:57 +0000 (00:10 -0500)]
Fix a nasty typo.

krom provided me with some demos where carts that used the
FPU would crash. It ended up being a nasty typo that would
corrupt memory when a thread which was using the FPU had to
be context switched out to memory.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
2 years agolibn64/os: Add a libn64_time() syscall.
Tyler J. Stachecki [Sat, 2 Dec 2017 11:17:09 +0000 (06:17 -0500)]
libn64/os: Add a libn64_time() syscall.

The syscall returns a timespec struct that has two fields
populated: tv_sec and tv_usec. Since the N64 doesn't have a
RTC, this function does the "next best thing" and returns
the time offset since libn64 started.

The syscall uses the COUNT register to precisely measure
time. It can effectively count upto a couple hundred years
before it "rolls over".

Since the COUNT register is effectively driven at "only",
46.875MHz the time source is just barely accurate within a
hundred usec or so.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
2 years agolibn64/os: Don't crash if bss size is 0.
Tyler J. Stachecki [Wed, 29 Nov 2017 21:50:55 +0000 (16:50 -0500)]
libn64/os: Don't crash if bss size is 0.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
2 years agoMake a simple "hello world" demo.
Tyler J. Stachecki [Wed, 29 Nov 2017 21:37:12 +0000 (16:37 -0500)]
Make a simple "hello world" demo.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/os: Don't hog all the memory at boot.
Tyler J. Stachecki [Thu, 21 Sep 2017 02:44:57 +0000 (22:44 -0400)]
libn64/os: Don't hog all the memory at boot.

Leave the majority of memory free for the user. If the
user wants to allocate more memory to the OS, they can
always call libn64_page_free() on unallocated memory to
assign it to the OS.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/os: Push the idle thread into assembly.
Tyler J. Stachecki [Thu, 21 Sep 2017 01:57:06 +0000 (21:57 -0400)]
libn64/os: Push the idle thread into assembly.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/os: Fix a typo.
Tyler J. Stachecki [Thu, 21 Sep 2017 01:30:02 +0000 (21:30 -0400)]
libn64/os: Fix a typo.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/os: Make fbtext a private interface.
Tyler J. Stachecki [Thu, 21 Sep 2017 01:24:24 +0000 (21:24 -0400)]
libn64/os: Make fbtext a private interface.

Don't allow people to get hooked on fbtext; it's not that
great and it's subject to change in the future.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/os: Cleanup the font table file.
Tyler J. Stachecki [Thu, 21 Sep 2017 01:12:02 +0000 (21:12 -0400)]
libn64/os: Cleanup the font table file.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/os: Fix a bug that manifested itself w/o -flto.
Tyler J. Stachecki [Wed, 20 Sep 2017 00:59:04 +0000 (20:59 -0400)]
libn64/os: Fix a bug that manifested itself w/o -flto.

Thanks to @PeterLemon for helping to track down this bug!

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agoAdd support for RRS type scalar opcodes.
Tyler J. Stachecki [Sun, 9 Jul 2017 23:13:04 +0000 (19:13 -0400)]
Add support for RRS type scalar opcodes.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agorspasm: Add support for identifiers:
Tyler J. Stachecki [Sun, 9 Jul 2017 18:53:16 +0000 (14:53 -0400)]
rspasm: Add support for identifiers:

  .set my_reg, $3
  .set my_vreg, $v3
  .set constant, 7
  .unset constant

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/os: Enable AI/DP/PI/SI/SP interrupts.
Tyler J. Stachecki [Sun, 9 Jul 2017 04:24:47 +0000 (00:24 -0400)]
libn64/os: Enable AI/DP/PI/SI/SP interrupts.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64: Fetch static resources in the cart.
Tyler J. Stachecki [Sun, 9 Jul 2017 03:32:52 +0000 (23:32 -0400)]
libn64: Fetch static resources in the cart.

Fetch resources such as the font table, strings used in
the crash screen, and other resources as-needed from the
cart; don't keep them in RAM.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64: General optimization/cleanup.
Tyler J. Stachecki [Sat, 8 Jul 2017 21:45:39 +0000 (17:45 -0400)]
libn64: General optimization/cleanup.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/os: Fix a virtual address bug.
Tyler J. Stachecki [Sat, 8 Jul 2017 21:14:25 +0000 (17:14 -0400)]
libn64/os: Fix a virtual address bug.

Every odd 256kB chunk of memory was not getting mapped to
the same physical address as it's 256kB neighboring chunk.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/os: Implement libn64_thread_unreg_intr.
Tyler J. Stachecki [Sat, 8 Jul 2017 19:09:34 +0000 (15:09 -0400)]
libn64/os: Implement libn64_thread_unreg_intr.

Additionally, leverage the function to automatically
unregister exit-ing threads from receiving any additional
interrupt-related messages.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/os: Implement libn64_thread_exit.
Tyler J. Stachecki [Sat, 8 Jul 2017 13:38:00 +0000 (09:38 -0400)]
libn64/os: Implement libn64_thread_exit.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/os: Fix cache bugs.
Tyler J. Stachecki [Sat, 8 Jul 2017 14:07:16 +0000 (10:07 -0400)]
libn64/os: Fix cache bugs.

In syscall.s, the cache instruction offset was harmless,
but the offset being wrong resulted in doing nothing of
value.

In context.s, we were marking a cache line dirty that
should not have been. This sometimes resulted in the value
of the thread's MI_INTR_REG getting overwritten with
garbage, at which point unexpected interrupts would start
firing and the framework would freeze.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/os: Fix a memory leak in libn64_recv_message.
Tyler J. Stachecki [Sun, 2 Jul 2017 19:26:09 +0000 (15:26 -0400)]
libn64/os: Fix a memory leak in libn64_recv_message.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agotools: Update toolchain - gcc-7.1, etc.
Tyler J. Stachecki [Sun, 2 Jul 2017 18:47:28 +0000 (14:47 -0400)]
tools: Update toolchain - gcc-7.1, etc.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/threadtest: Make the demo interesting.
Tyler J. Stachecki [Sun, 2 Jul 2017 17:59:15 +0000 (13:59 -0400)]
libn64/threadtest: Make the demo interesting.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/os: Various optimizations/improvements.
Tyler J. Stachecki [Sat, 1 Jul 2017 18:31:16 +0000 (14:31 -0400)]
libn64/os: Various optimizations/improvements.

Now that things have stablized a little bit, I optimized
various routines around cache-line boundares. Moreover, I
fixed the "double-unblock" bug that, under certain cases,
would have resulted a thread in getting queued twice.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/os: Start pumping messages on VI interrupts.
Tyler J. Stachecki [Mon, 26 Jun 2017 01:08:35 +0000 (21:08 -0400)]
libn64/os: Start pumping messages on VI interrupts.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/os: Small optimizations to thread routines.
Tyler J. Stachecki [Sun, 25 Jun 2017 23:00:05 +0000 (19:00 -0400)]
libn64/os: Small optimizations to thread routines.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/os: Fix some scheduling bugs.
Tyler J. Stachecki [Sun, 25 Jun 2017 22:26:01 +0000 (18:26 -0400)]
libn64/os: Fix some scheduling bugs.

  * In os/thread.c, when initializing the default thread,
    we weren't marking it as unblocked. This caused the
    libn64_send_message() in os/main.c to "unblock" and
    put it in the scheduler queue (even though it was
    already there to begin with).

  * In the libn64_thread_exit() syscall, we weren't marking
    the terminating thread as unblocked. As a result, if it
    received any messages after it had terminated, there
    was a chance that it would get rescheduled again.
    Marking threads as unblocked is a workaround (but will
    still result in leaked messages without further work).

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/os: Fix another bug in libn64_thread_create.
Tyler J. Stachecki [Sun, 25 Jun 2017 22:10:02 +0000 (18:10 -0400)]
libn64/os: Fix another bug in libn64_thread_create.

In some cases, the return value was not being correctly
set (to that of the created thread).

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/os: Temporarily disable interrupts.
Tyler J. Stachecki [Sun, 25 Jun 2017 19:13:34 +0000 (15:13 -0400)]
libn64/os: Temporarily disable interrupts.

RCP interrupts were sometimes hanging the hardware as they
aren't being ACK'd. Until we have a proper handler for the
RCP interrupts in place, suppress them.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/os: Fix a bug in libn64_thread_create.
Tyler J. Stachecki [Sun, 25 Jun 2017 16:19:43 +0000 (12:19 -0400)]
libn64/os: Fix a bug in libn64_thread_create.

When lower priority threads were being created, they did
not get initially queued and hence they were never run.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/os: Unblock lower-priority threads properly.
Tyler J. Stachecki [Sun, 25 Jun 2017 13:52:08 +0000 (09:52 -0400)]
libn64/os: Unblock lower-priority threads properly.

XXX: Still have an issue where lower-priority threads can be
effectively "woken up twice" (queued more than once) if a
higher priority thread sends >1 message to a blocked, lower
priority thread.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64: Add a .libn64.asm section.
Tyler J. Stachecki [Sun, 11 Jun 2017 21:34:56 +0000 (17:34 -0400)]
libn64: Add a .libn64.asm section.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/os: Change blocked thread semantics.
Tyler J. Stachecki [Sun, 11 Jun 2017 15:19:40 +0000 (11:19 -0400)]
libn64/os: Change blocked thread semantics.

Use the ERL bit in the status register to force blocked
threads to return to their restart address (ErrorEPC) as
opposed to manually setting EPC as needed. This will allow
the exception handler to queue multiple blocked threads
simultaneously without additional workarounds.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/os: Block and unblock on send/recv calls.
Tyler J. Stachecki [Sun, 4 Jun 2017 19:07:24 +0000 (15:07 -0400)]
libn64/os: Block and unblock on send/recv calls.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/os: Minor thread layout optimization.
Tyler J. Stachecki [Sun, 4 Jun 2017 18:48:24 +0000 (14:48 -0400)]
libn64/os: Minor thread layout optimization.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/os: Make message queues double-ended.
Tyler J. Stachecki [Sun, 4 Jun 2017 16:48:08 +0000 (12:48 -0400)]
libn64/os: Make message queues double-ended.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/os: Fix a bad exception handler bug.
Tyler J. Stachecki [Sun, 4 Jun 2017 15:38:10 +0000 (11:38 -0400)]
libn64/os: Fix a bad exception handler bug.

Fix a bug in the exception handler that would result in
stack corruption. Not sure how this made it through?

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/os: Add some message-passing functionality.
Tyler J. Stachecki [Sun, 4 Jun 2017 14:09:00 +0000 (10:09 -0400)]
libn64/os: Add some message-passing functionality.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/os: Pass back a thread pointer.
Tyler J. Stachecki [Sun, 4 Jun 2017 02:50:03 +0000 (22:50 -0400)]
libn64/os: Pass back a thread pointer.

Message passing will be more efficient if we pass raw
pointers for threads around. Have the create_thread syscall
return a thread pointer for that reason.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64: Reorganize headers/files.
Tyler J. Stachecki [Sun, 4 Jun 2017 02:17:31 +0000 (22:17 -0400)]
libn64: Reorganize headers/files.

Split private headers away from the include directory taht
the user touches. We don't need to expose the definitions
for threads and stuff to the user.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolib64/os: Optimize thread creation.
Tyler J. Stachecki [Sun, 4 Jun 2017 01:09:26 +0000 (21:09 -0400)]
lib64/os: Optimize thread creation.

Thread creation resulted in a lot of context switches, as
the current thread was always flushed out to RAM, the new
thread's state was written, and one of the two threads was
loaded (depending upon the priority).

Now, if the new thread has higher priority, the current
thread is saved and the new thread in setup in-place. In
addition, if the new thread has a lower or equal priority,
then no context switching at all occurs - the thread is
simply queued for later.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/os: Add a system call for freeing pages.
Tyler J. Stachecki [Sat, 3 Jun 2017 22:11:57 +0000 (18:11 -0400)]
libn64/os: Add a system call for freeing pages.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/os: Workaround bug by changing thread size.
Tyler J. Stachecki [Sat, 3 Jun 2017 20:32:14 +0000 (16:32 -0400)]
libn64/os: Workaround bug by changing thread size.

We were using bits from the thread's address to determine
the ASID, but that was dodgy because the size of a thread
was not a power of two.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/os: Reduce the overhead of the mm system.
Tyler J. Stachecki [Sat, 3 Jun 2017 17:21:22 +0000 (13:21 -0400)]
libn64/os: Reduce the overhead of the mm system.

Optimize mm code, create a page_alloc syscall and have it
utilize the same routine that the exception handler does to
allocate pages for the stack.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/os: Fix a horrible scheduler bug.
Tyler J. Stachecki [Sun, 21 May 2017 15:20:44 +0000 (11:20 -0400)]
libn64/os: Fix a horrible scheduler bug.

I'm not sure how this didn't manifest itself earlier.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/boot: Defer DMA until cache is flushed.
Tyler J. Stachecki [Sat, 20 May 2017 21:13:07 +0000 (17:13 -0400)]
libn64/boot: Defer DMA until cache is flushed.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/os: Break out the context switching routines.
Tyler J. Stachecki [Sun, 14 May 2017 15:30:15 +0000 (11:30 -0400)]
libn64/os: Break out the context switching routines.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/os: Dynamically allocate stack memory.
Tyler J. Stachecki [Sat, 13 May 2017 18:34:51 +0000 (14:34 -0400)]
libn64/os: Dynamically allocate stack memory.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/os: Improve boot code.
Tyler J. Stachecki [Sun, 7 May 2017 22:20:09 +0000 (18:20 -0400)]
libn64/os: Improve boot code.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/os: Remove old, unused function.
Tyler J. Stachecki [Tue, 1 Nov 2016 16:04:02 +0000 (12:04 -0400)]
libn64/os: Remove old, unused function.

libn64 has dedicated exception handlers now and doesn't use
an indirect branch at the exception vector anymore, so this
function is irrelevant anyways.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/os: Comment the main/entrypoint some more.
Tyler J. Stachecki [Tue, 1 Nov 2016 01:20:54 +0000 (21:20 -0400)]
libn64/os: Comment the main/entrypoint some more.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/os: Optimize panic handler slightly (for size).
Tyler J. Stachecki [Tue, 1 Nov 2016 01:17:37 +0000 (21:17 -0400)]
libn64/os: Optimize panic handler slightly (for size).

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/os: Zero out BSS section in libn64_main.
Tyler J. Stachecki [Tue, 1 Nov 2016 00:58:22 +0000 (20:58 -0400)]
libn64/os: Zero out BSS section in libn64_main.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/mm: Add memory manager, data structures.
Tyler J. Stachecki [Mon, 31 Oct 2016 18:06:30 +0000 (14:06 -0400)]
libn64/mm: Add memory manager, data structures.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agolibn64/os: Split GEHs into TLB miss/general.
Tyler J. Stachecki [Mon, 31 Oct 2016 16:13:09 +0000 (12:13 -0400)]
libn64/os: Split GEHs into TLB miss/general.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agotoolchain: Update GCC from 6.1.0 to 6.2.0.
Tyler J. Stachecki [Mon, 31 Oct 2016 16:11:33 +0000 (12:11 -0400)]
toolchain: Update GCC from 6.1.0 to 6.2.0.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agoLicense change: GPL to LGPL.
Tyler J. Stachecki [Tue, 27 Sep 2016 00:32:38 +0000 (20:32 -0400)]
License change: GPL to LGPL.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agoWhitespace fixes: tabs should be two spaces.
Tyler J. Stachecki [Tue, 27 Sep 2016 00:30:19 +0000 (20:30 -0400)]
Whitespace fixes: tabs should be two spaces.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
3 years agoInitial commit.
Tyler J. Stachecki [Sat, 27 Aug 2016 17:51:08 +0000 (13:51 -0400)]
Initial commit.

Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>