Compare commits
No commits in common. "32bed04914a9e2a6f1d5b1985ca1522fd8959624" and "73727c2383469caaac0e07bd0ea5423e9b4fc79d" have entirely different histories.
32bed04914
...
73727c2383
|
@ -860,35 +860,3 @@ main := fn(): void {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
#### request_page
|
|
||||||
```hb
|
|
||||||
request_page := fn(page_count: u8): ^u8 {
|
|
||||||
msg := "\{00}\{01}xxxxxxxx\0"
|
|
||||||
msg_page_count := msg + 1;
|
|
||||||
*msg_page_count = page_count
|
|
||||||
return @eca(^u8, 3, 2, msg, 12)
|
|
||||||
}
|
|
||||||
|
|
||||||
create_back_buffer := fn(total_pages: int): ^u32 {
|
|
||||||
if total_pages <= 0xFF {
|
|
||||||
return @bitcast(request_page(total_pages))
|
|
||||||
}
|
|
||||||
ptr := request_page(255)
|
|
||||||
remaining := total_pages - 0xFF
|
|
||||||
loop if remaining <= 0 break else {
|
|
||||||
if remaining < 0xFF {
|
|
||||||
request_page(remaining)
|
|
||||||
} else {
|
|
||||||
request_page(0xFF)
|
|
||||||
}
|
|
||||||
remaining -= 0xFF
|
|
||||||
}
|
|
||||||
return @bitcast(ptr)
|
|
||||||
}
|
|
||||||
|
|
||||||
main := fn(): void {
|
|
||||||
create_back_buffer(400)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
|
@ -3379,7 +3379,6 @@ impl Codegen {
|
||||||
.filter(|&(i, f)| {
|
.filter(|&(i, f)| {
|
||||||
task::unpack(f.offset).is_ok()
|
task::unpack(f.offset).is_ok()
|
||||||
&& (f.runtime || self.ct.active())
|
&& (f.runtime || self.ct.active())
|
||||||
&& (!self.ct.active() || i != 0)
|
|
||||||
&& self.is_fully_linked(i as ty::Func)
|
&& self.is_fully_linked(i as ty::Func)
|
||||||
})
|
})
|
||||||
.map(|(_, f)| {
|
.map(|(_, f)| {
|
||||||
|
@ -3701,6 +3700,5 @@ mod tests {
|
||||||
some_generic_code => README;
|
some_generic_code => README;
|
||||||
integer_inference_issues => README;
|
integer_inference_issues => README;
|
||||||
writing_into_string => README;
|
writing_into_string => README;
|
||||||
request_page => README;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -256,11 +256,7 @@ fn disasm(
|
||||||
|
|
||||||
let global_offset: u32 = (offset + rel).try_into().unwrap();
|
let global_offset: u32 = (offset + rel).try_into().unwrap();
|
||||||
if let Some(&(name, ..)) = functions.get(&global_offset) {
|
if let Some(&(name, ..)) = functions.get(&global_offset) {
|
||||||
if name.contains('\0') {
|
|
||||||
write!(out, ":{name:?}")?;
|
|
||||||
} else {
|
|
||||||
write!(out, ":{name}")?;
|
write!(out, ":{name}")?;
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
let local_has_oob = global_offset < off
|
let local_has_oob = global_offset < off
|
||||||
|| global_offset > off + len
|
|| global_offset > off + len
|
||||||
|
@ -575,6 +571,7 @@ pub fn parse_from_fs(extra_threads: usize, root: &str) -> io::Result<Vec<Ast>> {
|
||||||
};
|
};
|
||||||
|
|
||||||
let execute_task = |(_, path, command): Task, buffer: &mut Vec<u8>| {
|
let execute_task = |(_, path, command): Task, buffer: &mut Vec<u8>| {
|
||||||
|
log::dbg!("{path:?}");
|
||||||
if let Some(mut command) = command {
|
if let Some(mut command) = command {
|
||||||
let output = command.output()?;
|
let output = command.output()?;
|
||||||
if !output.status.success() {
|
if !output.status.success() {
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
main:
|
|
||||||
ADDI64 r254, r254, -8d
|
|
||||||
ST r31, r254, 0a, 8h
|
|
||||||
LI64 r2, 10d
|
|
||||||
JAL r31, r0, :create_back_buffer
|
|
||||||
LD r31, r254, 0a, 8h
|
|
||||||
ADDI64 r254, r254, 8d
|
|
||||||
JALA r0, r31, 0a
|
|
||||||
create_back_buffer:
|
|
||||||
ADDI64 r254, r254, -32d
|
|
||||||
ST r31, r254, 0a, 32h
|
|
||||||
CP r32, r2
|
|
||||||
LI64 r33, 255d
|
|
||||||
JGTS r32, r33, :0
|
|
||||||
CP r2, r32
|
|
||||||
JAL r31, r0, :request_page
|
|
||||||
JMP :1
|
|
||||||
0: LI64 r2, 255d
|
|
||||||
JAL r31, r0, :request_page
|
|
||||||
CP r33, r1
|
|
||||||
ADDI64 r32, r32, -255d
|
|
||||||
6: LI64 r34, 0d
|
|
||||||
JGTS r32, r34, :2
|
|
||||||
JMP :3
|
|
||||||
2: LI64 r34, 255d
|
|
||||||
JLTS r32, r34, :4
|
|
||||||
LI64 r2, 255d
|
|
||||||
JAL r31, r0, :request_page
|
|
||||||
JMP :5
|
|
||||||
4: CP r2, r32
|
|
||||||
JAL r31, r0, :request_page
|
|
||||||
5: CP r34, r32
|
|
||||||
ADDI64 r34, r34, -255d
|
|
||||||
CP r32, r34
|
|
||||||
JMP :6
|
|
||||||
3: CP r1, r33
|
|
||||||
1: LD r31, r254, 0a, 32h
|
|
||||||
ADDI64 r254, r254, 32d
|
|
||||||
JALA r0, r31, 0a
|
|
||||||
request_page:
|
|
||||||
ADDI64 r254, r254, -32d
|
|
||||||
ST r31, r254, 0a, 32h
|
|
||||||
CP r32, r2
|
|
||||||
LRA r33, r0, :"\0\u{1}xxxxxxxx"
|
|
||||||
CP r34, r33
|
|
||||||
ADDI64 r34, r34, 1d
|
|
||||||
ST r32, r34, 0a, 1h
|
|
||||||
LI64 r2, 3d
|
|
||||||
LI64 r3, 2d
|
|
||||||
CP r4, r33
|
|
||||||
LI64 r5, 12d
|
|
||||||
ECA
|
|
||||||
LD r31, r254, 0a, 32h
|
|
||||||
ADDI64 r254, r254, 32d
|
|
||||||
JALA r0, r31, 0a
|
|
||||||
code size: 440
|
|
||||||
ret: 42
|
|
||||||
status: Ok(())
|
|
|
@ -270,10 +270,10 @@ where
|
||||||
self.bump_pc::<OpsRRP>();
|
self.bump_pc::<OpsRRP>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
JLTS => self.cond_jmp::<i64>(Ordering::Less),
|
JLTS => self.cond_jmp::<u64>(Ordering::Less),
|
||||||
JGTS => self.cond_jmp::<i64>(Ordering::Greater),
|
JGTS => self.cond_jmp::<u64>(Ordering::Greater),
|
||||||
JLTU => self.cond_jmp::<u64>(Ordering::Less),
|
JLTU => self.cond_jmp::<i64>(Ordering::Less),
|
||||||
JGTU => self.cond_jmp::<u64>(Ordering::Greater),
|
JGTU => self.cond_jmp::<i64>(Ordering::Greater),
|
||||||
ECA => {
|
ECA => {
|
||||||
// So we don't get timer interrupt after ECALL
|
// So we don't get timer interrupt after ECALL
|
||||||
if TIMER_QUOTIENT != 0 {
|
if TIMER_QUOTIENT != 0 {
|
||||||
|
|
Loading…
Reference in a new issue