Skip to content

Commit

Permalink
Add more tests around user defined input stack effects (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbirddog authored Jul 20, 2024
1 parent 38ed21d commit 5c2d87e
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 4 deletions.
8 changes: 5 additions & 3 deletions blue.asm
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,13 @@ blue_bye:
db '16 base '
db ''
db ': xor-edi (( -- )) 31 b, FF b, ; '
db ': mov-eax-60 (( -- )) B8 b, 3C d, ; '
db ': syscall (( -- )) 0F b, 05 b, ; '
db ': syscall (( num ecx -- )) B8 b, d, 0F b, 05 b, ; '
db ''
db ': ok (( -- )) xor-edi ; '
db ': exit (( -- )) mov-eax-60 syscall ; '
db ''
db '0A base '
db ''
db ': exit (( -- )) 60 syscall ; '
db ': bye (( -- )) ok exit ; immediate '
db ''
db ': _start (( -- )) bye ; entry '
Expand Down
2 changes: 1 addition & 1 deletion flow.inc
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ flow_in:

.flow_reg:
and ebx, 7
shl ebx, 3
and rax, REG_MASK
shr rax, REG_OFFSET
and eax, 7
shl eax, 3

or ebx, eax
or ebx, 0xc0
Expand Down
32 changes: 32 additions & 0 deletions kernel_test.inc
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ kernel_test:
tc1 user_empty_words
tc1 seX_empty
tc1 ise_1
tc1 ise_1a
tc1 ise_1b
tc1 ise_2
tc2 bogus
Expand Down Expand Up @@ -221,6 +223,36 @@ ise_1:
db 0xc3
.expected_length = $ - .expected

ise_1a:
.blue:
db ': syscall (( num ecx -- )) ; '
db ': _ 60 syscall ; entry '
.blue_length = $ - .blue

.expected:
db 0xc3
db 0xb9
dd 0x3c
db 0xe8
db 0xf5, 0xff, 0xff, 0xff
db 0xc3
.expected_length = $ - .expected

ise_1b:
.blue:
db '16 base '
db ': syscall (( num ecx -- )) B8 b, d, 0F b, 05 b, ; immediate '
db '0A base '
db ': _ 60 syscall ; entry '
.blue_length = $ - .blue

.expected:
db 0xb8
dd 0x3c
db 0x0f, 0x05
db 0xc3
.expected_length = $ - .expected

ise_2:
.blue:
db ': myd, (( num eax -- )) d, ; immediate '
Expand Down

0 comments on commit 5c2d87e

Please sign in to comment.