Expand description
I suspect that these are unused, and were for an older version of DGO.
All DGO stuff is handled on the IOP.
see also load-dgo.gc's dgo-header.
Types
dgo-file: basicsource
Types
vec4s: uint128source
Functions
ash(value: int, shift-amount: int) => intsource
Arithmetic shift value by shift-amount.
A positive shift-amount will shift to the left and a negative will shift to the right.
assoc(arg0: object, arg1: object) => objectsource
Is item in the association list alist?
Returns the key-value pair.
assoce(arg0: object, arg1: object) => objectsource
Is there an entry with key item in the association list alist?
Returns the key-value pair.
Treats a key of 'else like an else case
basic-type?(arg0: basic, arg1: type) => symbolsource
Is the given basic an object of the given type?
breakpoint-range-set!(arg0: uint, arg1: uint, arg2: uint) => intsource
Sets some debug register (COP0 Debug, dab, dabm) to break on memory access.
This is not supported in OpenGOAL.
delete!(arg0: object, arg1: object) => pairsource
Remove the first occurance of item from lst (where item is actual a pair in the list)
delete-car!(arg0: object, arg1: object) => objectsource
Remove the first first occurance of an element from the list where (car elt) is item.
false-func() => symbolsource
Return #f.
find-parent-method(arg0: type, arg1: int) => functionsource
Go up the type tree and find the first parent type that has a different implementation for the given method.
insert-cons!(arg0: object, arg1: object) => pairsource
Update an association list to have the given (key . value) pair kv.
If it already exists in the list, remove it.
DANGER: this function allocates memory on the global heap.
mem-copy!(arg0: pointer, arg1: pointer, arg2: int) => pointersource
Memory copy. Not a very efficient optimization, but has no restrictions.
Increasing address copy.
mem-or!(arg0: pointer, arg1: pointer, arg2: int) => pointersource
Set the dst to (logior dst src) byte by byte.
Not very efficient.
mem-set32!(arg0: pointer, arg1: int, arg2: int) => pointersource
Normal memset, but by 32-bit word.
NOTE: argument order is swapped from C
member(arg0: object, arg1: object) => objectsource
Is obj in the list lst? Returns pair with obj as its car, or #f if not found.
nassoc(arg0: string, arg1: object) => objectsource
Is there an entry named item-name in the association list alist?
Checks name with nmember or name= so you can have multiple keys.
Returns the ([key|(key..)] . value) pair.
nassoce(arg0: string, arg1: object) => objectsource
Is there an entry named item-name in the association list alist?
Checks name with nmember for multiple keys or name= for single.
Allows else as a single key that always matches
nmember(arg0: basic, arg1: object) => objectsource
Is obj in the list lst? Check with the name= function.
print-tree-bitmask(arg0: int, arg1: int) => symbolsource
Print out a single entry for a process tree 'tree' diagram
qmem-copy->!(arg0: pointer, arg1: pointer, arg2: int) => pointersource
Memory copy by quadword (16-bytes). More efficient, but has restrictions:
- dst and src should be 16-byte aligned.
- size in bytes will be rounding up to nearest 16-bytes
- Descending address copy
qmem-copy<-!(arg0: pointer, arg1: pointer, arg2: int) => pointersource
Memory copy by quadword. More efficient, but has restrictions:
- dst and src should be 16-byte aligned.
- size in bytes will be rounded up to 16-bytes
- Ascending address copy.
quad-copy!(dst: pointer, src: pointer, qwc: int) => nonesource
Optimized memory copy. The original is pretty clever, but this isn't.
rem(arg0: int, arg1: int) => intsource
Integer mod (signed, 32-bit). Even though it's called rem, it behaves the same as mod.
sort(arg0: pair, arg1: function) => pairsource
Sort a list, using compare-func to compare elements.
The comparison function can return either an integer or a true/false.
For integers, use a positive number to represent first > second
Ex: (sort lst -) will sort in ascending order
For booleans, you must explicitly use TRUE and not a truthy value.
Ex: (sort my-list (lambda ((x int) (y int)) (< x y))) will sort ascending.
NOTE: if you use an integer, don't accidentally return TRUE.
type-type?(arg0: type, arg1: type) => symbolsource
Is the given type equal to, or a child of, the second type?
type?(arg0: object, arg1: type) => symbolsource
Is the given object an object of the given type? Works for any boxed object (basic, symbol, binteger, pair).
valid?(obj: object, expected-type: type, name: string, allow-false: symbol, print-dest: object) => symbolsource
Check if the given object is valid. This will work for structures, pairs, basics, bintegers, symbols, and types.
If you set expected-type to #f, it just checks for a 4-byte aligned address that's in GOAL memory.
If you're checking a structure, set expected-type to structure. This requires 16-byte alignment
Note: packed inline structures in arrays or fields will not pass this check.
Otherwise, set it to the type you expect. More specific types will pass.
If allow-false is #t, a #f will always pass. Otherwise, #f will fail (unless you're looking for a symbol).
Use allow-false if you want to allow a 'null' reference.
The name is only used when printing out an error if the check fails.
Use a name of #f to suppress error prints.
Variables
*print-column*: bintegersource
*trace-list*: pairsource
const BIG_MEMORY: unknownsource
END_OF_MEMORY: unknownsource
PC_BIG_MEMORY: unknownsource
PC_PROFILER_ENABLE: unknownsource
SYM_TO_STRING_OFFSET: unknownsource
Types
catch-frame: stack-framesource
clock: basicsource
Fields
type: type
index: int32
mask: process-mask
clock-ratio: float
accum: float
integral-accum: float
frame-counter: time-frame
old-frame-counter: time-frame
integral-frame-counter: uint64
old-integral-frame-counter: uint64
sparticle-data: vector
seconds-per-frame: float
frames-per-second: float
time-adjust-ratio: float
Methods
update-rates!(obj: clock, arg0: float) => floatsource
Recompute all clock values for the given clock ratio (arg0).
advance-by!(obj: clock, arg0: float) => clocksource
Advance the clock by arg0 timeframes (as a float).
Both counters keep a separate fractional and integer counter.
cpu-thread: threadsource
dead-pool: process-treesource
Fields
type: type
name: string
mask: process-mask
clock: clock
parent: pointer
brother: pointer
child: pointer
ppointer: pointer
self: process-tree
Methods
get-process(obj: dead-pool, arg0: type, arg1: int) => processsource
Try to get a process from this dead pool. If it fails, try the debug dead pool and complain.
return-process(obj: dead-pool, arg0: process) => nonesource
Return a process to the dead pool.
dead-pool-heap: dead-poolsource
Fields
type: type
name: string
mask: process-mask
clock: clock
parent: pointer
brother: pointer
child: pointer
ppointer: pointer
self: process-tree
allocated-length: int32
compact-time: uint32
compact-count-targ: uint32
compact-count: uint32
fill-percent: float
first-gap: dead-pool-heap-rec
first-shrink: dead-pool-heap-rec
heap: kheap
alive-list: dead-pool-heap-rec
last: dead-pool-heap-rec
dead-list: dead-pool-heap-rec
process-list: dead-pool-heap-rec
Methods
init(obj: dead-pool-heap, arg0: symbol, arg1: int) => nonesource
Initialize the heap.
compact(obj: dead-pool-heap, arg0: int) => nonesource
Relocate processes to remove gaps and increase free memory.
shrink-heap(obj: dead-pool-heap, proc: process) => dead-pool-heapsource
Shrink the heap of a process.
This resizes the process heap to be the exact size it is currently using.
churn(obj: dead-pool-heap, arg0: int) => nonesource
Relocate processes to debug process relocation.
memory-used(obj: dead-pool-heap) => intsource
Get the amount of used memory. Gaps in between processes are considered used.
memory-total(obj: dead-pool-heap) => intsource
Get the total size of the heap.
memory-free(obj: dead-pool-heap) => intsource
Get the amount of free memory. Does not include gaps in between processes.
compact-time(obj: dead-pool-heap) => uintsource
Not working, likely was supposed to return how long the compaction took.
gap-size(obj: dead-pool-heap, arg0: dead-pool-heap-rec) => intsource
Get the size of the gap after the given record (possibly 0)
gap-location(obj: dead-pool-heap, arg0: dead-pool-heap-rec) => pointersource
Get the location of the first possible gap after the given record.
find-gap(obj: dead-pool-heap, arg0: dead-pool-heap-rec) => dead-pool-heap-recsource
Iterate through records, starting at the given one, and find the first one with a gap after it.
find-gap-by-size(obj: dead-pool-heap, arg0: int) => dead-pool-heap-recsource
Find the first gap which is at least the given size.
dead-pool-heap-rec: structuresource
event-message-block: structuresource
event-message-block-array: inline-array-classsource
Fields
type: type
length: int32
allocated-length: int32
_data: uint8
data: event-message-block
Methods
send-all!(obj: event-message-block-array) => nonesource
Send all pending messages. Will only do the send if both the sender and receiver are still alive.
handle: uint64source
kernel-context: basicsource
Fields
type: type
prevent-from-run: process-mask
require-for-run: process-mask
allow-to-run: process-mask
next-pid: int32
fast-stack-top: pointer
current-process: process
relocating-process: basic
relocating-min: int32
relocating-max: int32
relocating-offset: int32
relocating-level: level
low-memory-message: symbol
login-object: basic
process: process-treesource
Fields
type: type
name: string
mask: process-mask
clock: clock
parent: pointer
brother: pointer
child: pointer
ppointer: pointer
self: process-tree
pool: dead-pool
status: symbol
pid: int32
main-thread: cpu-thread
top-thread: cpu-thread
entity: entity-actor
level: level
state: state
next-state: state
trans-hook: function
post-hook: function
event-hook: function
allocated-length: int32
pad-unknown-0: uint32
heap-base: pointer
heap-top: pointer
heap-cur: pointer
stack-frame-top: stack-frame
connection-list: connectable
stack: uint8
States
dead-state: TODO
empty-state: TODO
process-tree: basicsource
Fields
type: type
name: string
mask: process-mask
clock: clock
parent: pointer
brother: pointer
child: pointer
ppointer: pointer
self: process-tree
Methods
activate(obj: process, arg0: process-tree, arg1: basic, arg2: pointer) => process-treesource
Start a process!
deactivate(obj: sig) => nonesource
init-from-entity!(obj: enemy, arg0: entity-actor) => nonesource
Typically the method that does the initial setup on the process, potentially using the entity-actor provided as part of that.
This commonly includes things such as:
- stack size
- collision information
- loading the skeleton group / bones
- sounds
run-logic?(obj: enemy) => symbolsource
process-tree-method-13: unknown
protect-frame: stack-framesource
stack-frame: basicsource
state: protect-framesource
Fields
type: type
name: symbol
next: stack-frame
exit: function
code: function
trans: function
post: function
enter: function
event: function
thread: basicsource
Fields
type: type
name: symbol
process: process
previous: thread
suspend-hook: function
resume-hook: function
pc: pointer
sp: pointer
stack-top: pointer
stack-size: int32
Methods
stack-size-set!(obj: thread, arg0: int) => nonesource
Modify the backup stack size of a thread. Must be called from the main thread, before any
allocations have been done on the process heap.
thread-suspend(unused: cpu-thread) => nonesource
Suspend the thread and return to the kernel.
thread-resume(thread-to-resume: cpu-thread) => nonesource
Resume a suspended thread. Call this from the kernel only.
This is also used to start a thread initialized with set-to-run.
As a result of MIPS/x86 differences, there is a hack for this.
time-frame: int64source
Variables
*gtype-basic-offset*: unknownsource
*kernel-major-version*: unknownsource
*kernel-minor-version*: unknownsource
*scratch-memory-top*: unknownsource
*tab-size*: unknownsource
DPROCESS_STACK_SIZE: unknownsource
KERNEL_DEBUG: unknownsource
PROCESS_HEAP_MAX: unknownsource
PROCESS_HEAP_MULT: unknownsource
PROCESS_HEAP_SIZE: unknownsource
PROCESS_STACK_SIZE: unknownsource
TICKS_PER_SECOND: unknownsource
Functions
change-brother(arg0: process-tree, arg1: process-tree) => objectsource
change-parent(arg0: process-tree, arg1: process-tree) => process-treesource
execute-process-tree(arg0: process-tree, arg1: function, arg2: kernel-context) => objectsource
Iterate over the process tree, running only if the mask doesn't prevent it.
Update the mask of the process-tree to have kernel-run if and only if we run at least one process.
inspect-process-heap(obj: process) => symbolsource
Inspect each object on the process heap.
inspect-process-tree(arg0: process-tree, arg1: int, arg2: int, arg3: symbol) => process-treesource
Print out a process tree diagram.
iterate-process-tree(arg0: process-tree, arg1: function, arg2: kernel-context) => objectsource
Iterate over the process tree, calling the function on each process.
kernel-dispatcher() => objectsource
Main entry point to GOAL from C++.
kill-by-name(arg0: string, arg1: process-tree) => symbolsource
Kill all processes with the given name.
kill-by-type(arg0: type, arg1: process-tree) => symbolsource
Kill all processes with the given type.
kill-not-name(arg0: string, arg1: process-tree) => symbolsource
Kill all processes, except for ones named this.
kill-not-type(arg0: type, arg1: process-tree) => symbolsource
Kill all processes not of the given type.
load-package(arg0: string, arg1: kheap) => pairsource
Load a package by name to the given heap.
method-state(arg0: type, arg1: basic) => statesource
Get a state by name from the method table of a type.
previous-brother(arg0: process-tree) => objectsource
process-by-name(arg0: string, arg1: process-tree) => processsource
Get a process by name.
process-count(arg0: process-tree) => intsource
Count the number of processes in the given tree.
process-not-name(arg0: string, arg1: process-tree) => processsource
Get a process that doesn't have the given name.
remove-exit() => nonesource
reset-and-call(obj: thread, func: function) => objectsource
Make the given thread the top thread, reset the stack, and call the function.
Sets up a return trampoline so when the function returns it will return to the
kernel context. Will NOT deactivate on return, so this is intended for temporary threads.
NOTE: this should only be done from the kernel, running on the
kernel's stack.
return-from-thread() => nonesource
Context switch to the saved kernel context now.
This is intended to be jumped to with the ret instruction (return trampoline)
at the end of a normal function, so this should preserve rax.
To make sure this happens, all ops should be asm ops and we should have no
GOAL expressions.
return-from-thread-dead() => nonesource
Like return from thread, but we clean up our process with deactivate first.
The return register is not preserved here, instead we return the value of deactivate
run-function-in-process(obj: process, func: function, a0: object, a1: object, a2: object, a3: object, a4: object, a5: object) => objectsource
Switch to the given process and run the function. This is used to initialize a process.
The function will run until it attempts to change state. At the first attempt to change state,
this function will return. The idea is that you use this when you want to initialize a process NOW.
This will then return the value of the function you called!
search-process-tree(arg0: process-tree, arg1: function) => process-treesource
Iterate process tree, returning the process that returns #t first.
set-to-run(thread: cpu-thread, func: function, a0: object, a1: object, a2: object, a3: object, a4: object, a5: object) => pointersource
Set the given thread to call the given function with the given arguments next time it resumes.
Only for main threads.
Once the function returns, the process deactivates.
set-to-run-bootstrap() => nonesource
This function is a clever hack.
To reset a thread to running a new function, we stash the arguments as saved registers.
These are then restored by thread-resume on the next run of the kernel.
This stub remaps these saved registers to argument registers.
It also creates a return trampoline to return-from-thread-dead, so if the main thread returns, the
process is properly cleaned up by deactivate.
stream<-process-mask(arg0: object, arg1: process-mask) => process-masksource
sync-dispatcher() => objectsource
Run just the listener function. Used for SQL query stuff.
throw-dispatch(obj: catch-frame, value: object) => nonesource
Throw the given value to the catch frame.
Only can throw a 64-bit value. The original could throw 128 bits.
unload-package(arg0: string) => pairsource
Mark a package as unloaded.
Variables
*dead-pool-list*: pairsource
*deci-count*: intsource
*dram-stack*: pointersource
*fake-scratchpad-data*: pointersource
*fake-scratchpad-stack*: pointersource
*global-search-name*: basicsource
*irx-version*: bintegersource
*kernel-boot-level*: symbolsource
*kernel-boot-mode*: symbolsource
*kernel-dram-stack*: unknownsource
*kernel-packages*: pairsource
*kernel-version*: bintegersource
*master-mode*: symbolsource
*pause-lock*: symbolsource
*use-old-listener-print*: symbolsource
*vis-boot*: symbolsource
const dead-state: statesource
const entity-deactivate-handler: functionsource
Expand description
Summary of state system:
A process can be put into a state, using enter-state, or the go macro.
This will set up the process to run the appropriate handler functions defined by the state.
The state handlers are:
- enter : gets run before trans on the first time the state is used. Can be #f. Must return.
- trans : gets run before code each time the code is run. Can be #f. Must return.
- code : main thread. Can suspend. If it returns, the process dies
- exit : gets run when leaving a state. must return.
- event : not sure of the details here yet.
You can use "go" to change the state of a process. This causes the process main thread execution to be abandoned.
If the main thread has exits/protects on the stack frame, they will be run first to clean up.
There are several ways to "go"
- go during init: when a process is being initialized with run-function-in-process, you can "go".
this causes the run-function-in-process to return immediately, and the next time the process is dispatched
it will go into the other state. This will automatically set the process to waiting-to-run,
and shrink the process heap, if appropriate
- go from outside the process. You can temporarily set pp to another process, and have that
process go to another state. The actual go will occur the next time the process is scheduled.
Use the go-process macro to do this.
- go from a non-main thread in the right process. You can do a go from a temporary thread, like trans or post.
If you do it from post, the go returns and the rest of the post runs. If you do it from any other thread, the temporary thread
is immediately abandonded. Like the previous two, it will defer the actual go until the next time the
process runs.
- go from the main thread of the main process. This causes the (-> pp state) to change, the stack frames
to be cleaned up, and the old state's exit to be called. It will reset the stack, then run the code.
Unlike the others, this means you "go" immediately.
The compiler has two special hooks related to states: go-hook and define-state-hook.
These take care of doing a go and a state definition and properly checking types.
The define-state-hook takes a state object and handlers and defines a global symbol
with the appropriate state type.
The go-hook calls enter state and sets (-> proc next-state) for the given process.
It type checks the arguments for the entry function.
Functions
enter-state(arg0: object, arg1: object, arg2: object, arg3: object, arg4: object, arg5: object) => objectsource
Make the process stored in pp enter the state in pp next-state
inherit-state(child: state, parent: state) => statesource
Copy handler functions from parent to child
looping-code() => symbolsource
Function which calls suspend in a loop. Can be used to create a thread that does nothing.
send-event-function(arg0: process-tree, arg1: event-message-block) => objectsource
Send an event block to a process.