summary refs log tree commit diff stats
Commit message (Expand)AuthorAgeFilesLines
* container.tags: replaced the word "mark" with "tag"hut2011-08-103-20/+20
* container.tags: modified DaPangus' patch for more compatibilityhut2011-08-101-6/+11
* Custom tagsDavid Pugnasse2011-08-105-21/+51
* defaults/keys.py: added sorting by ctimehut2011-08-032-0/+2
* data/mime.types: added webm typehut2011-08-031-0/+1
* api.commands: implemented command.cancel()hut2011-05-203-3/+14
* ranger/gui/ui: Fixed issues with ALT keyhut2011-05-192-3/+10
* added option "display_tags_in_all_columns"hut2011-05-083-4/+11
* defaults/keys: improved hintshut2011-05-082-8/+17
* data/scope.sh: Added bittorrent previewhut2011-05-081-0/+4
* ranger.py: More reliable check for whether ./ranger.py is startedhut2011-05-071-1/+1
* core.main: Forbid piping things into rangerhut2011-05-071-0/+5
* data/mime.types: Added wavpackhut2011-05-071-0/+1
* core.loader: Fix blocking when using interactive scripts in scope.shhut2011-04-272-3/+5
* Merge branch 'stable'hut2011-04-265-4/+9
|\
| * This gonna be cool once it's finished v1.4.3hut2011-04-054-3/+8
| * ranger.py: minor change, more general exception handlinghut2011-04-051-1/+1
| * improved ranger.pyhut2011-04-051-2/+10
| * defaults/options.py: hide __cache__ folderhut2011-04-051-1/+1
| * core.fm: fixed mimetype bughut2011-04-031-4/+4
| * Improved manpagehut2011-04-031-4/+5
| * extended apps.pyhut2011-04-031-1/+2
| * Fix loss of bookmarks when disk is fullhut2011-04-031-2/+3
* | widgets.console: fixed delete_word()hut2011-04-261-7/+21
* | Use chardet in case of encoding detection problemshut2011-04-262-5/+20
* | use lazy_property for Directory.size/infostringhut2011-04-193-13/+30
* | improved ranger.pyhut2011-04-041-2/+10
* | core.fm: fixed mimetype bughut2011-04-031-4/+4
* | defaults/options.py: hide __cache__ folderhut2011-04-021-1/+1
* | defaults/keys.py: Remove <backspace> -> "toggle hidden files" mappinghut2011-04-011-1/+1
* | Improved manpagehut2011-04-011-4/+5
* | gui.ui: clear the message in statusbar after a keypresshut2011-03-223-2/+7
* | defaults.keys: allow pasting hardlinks.hut2011-03-222-1/+9
* | extended apps.pyhut2011-03-081-1/+2
* | Fix loss of bookmarks when disk is fullhut2011-03-081-2/+3
|/
* Next version will run on pure Lisp Machines only v1.4.2hut2011-03-054-3/+8
* data/scope.sh: change exit code for html files to 4hut2011-03-051-3/+3
* core.runner: set stdin to /dev/null for detached programshut2011-03-041-2/+4
* added missing devnull variable definition, fixes last commithut2011-03-021-0/+1
* cleanupshut2011-03-022-4/+4
* fixed issue with py3.2 when opening files w/ mplayerhut2011-03-021-1/+1
* Fixed debug code in core.runnerhut2011-02-261-2/+3
* defaults.commands: include bookmarks in tab completion of :cdhut2011-02-182-1/+52
* fsobject.directory: added dirname argument to accept_filehut2011-02-181-3/+3
* data/scope.sh: support for highlight 3.3hut2011-02-171-1/+1
* data.scope: Applied Yubao's patchhut2011-02-151-4/+5
* Added --choosedir, a more logical alternative to --fail-unless-cdhut2011-02-154-5/+13
* help.invocation: typohut2011-02-151-1/+1
* Moved vimscript to README next to the bash script :)hut2011-02-152-18/+28
* Improved --choosefile vimscript in documentationhut2011-02-151-2/+4
?h=main&id=22fb844ba4edf14eb85245a35f42e721658c4f8e'>^
9d27e966 ^
33352536 ^

ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
33352536 ^


ee9a9237 ^
33352536 ^



b8475380 ^
7a583220 ^
33352536 ^

6030d7e2 ^
3d6450f2 ^
3d6450f2 ^
6030d7e2 ^
ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
33352536 ^
6030d7e2 ^
ee9a9237 ^
6030d7e2 ^

ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
33352536 ^
6030d7e2 ^
ee9a9237 ^
6030d7e2 ^

9d27e966 ^
33352536 ^

ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
33352536 ^
6030d7e2 ^

3d6450f2 ^

6030d7e2 ^
ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
33352536 ^
6030d7e2 ^
ee9a9237 ^
6030d7e2 ^

ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
33352536 ^
6030d7e2 ^
ee9a9237 ^
6030d7e2 ^

ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
33352536 ^
6030d7e2 ^
ee9a9237 ^
6030d7e2 ^

9d27e966 ^
33352536 ^

ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
33352536 ^
6030d7e2 ^

b31455f8 ^


f1eade72 ^
6030d7e2 ^
9b16f190 ^
6030d7e2 ^
9b16f190 ^
bfcc0f85 ^
438e5a0d ^



6ee77ba7 ^
ee9a9237 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162

                                                                            

                                                                             



                                                                             



                                                                               

                                            
                                          
                                                   
 
       


                                                                                                                                                 
 
                                                               
                                                           
                

                                                                                                                                                                       


                                                                                                                                                                         
                                                                                                                            
                                                                                                                                                                        
                                        
                   

                                                                                                                                                                      
              
                          
                      
                                                                                                                                                                  
                             
            
                                                   
                      







                                                                                                                                                                            
                   
                                                                                                                                                                            
                                                               
                
                                                                                                                                                                      
                                

                                                                                                                                                                              
                                 

                                                                                                                                                                              
              
                             
                      


                                                                                                                                                                       
                         



                 
           
                

                                                                                                                                                                       
             
 
                  
                                
                   
                               
              
                                
                      
                                                                                                                                                                  
                               
                   

                               
              
                         
                      
                                                                                                                                                                  
                                                                 
                   

                                          
                                  

                                                                                                                                                                      
              
                                    
                      
                                                                                                                                                                  

             

                   
                                
                   
                               
              
                                
                      
                                                                                                                                                                  
                              
                   

                               
              
                         
                      
                                                                                                                                                                  
                              
                   

                               
              
                         
                      
                                                                                                                                                                  
                                                                 
                   

                                           
                                  

                                                                                                                                                                      
              
                                    
                      
                                                                                                                                                                  

             


       
                              
                         
           
                        
           
          



                                   
 
                            
# write: like _write, but also support in-memory streams in addition to file
# descriptors.
#
# Our first dependency-injected and testable primitive. We can pass it either
# a file descriptor or an address to a stream. If a file descriptor is passed
# in, we _write to it using the right syscall. If a 'fake file descriptor' or
# stream is passed in, we append to the stream. This lets us redirect output
# in tests and check it later.
#
# We assume our data segment will never begin at an address shorter than
# 0x08000000, so any smaller arguments are assumed to be real file descriptors.
#
# A stream looks like this:
#   read: int  # index at which to read next
#   write: int  # index at which writes go
#   data: (array byte)  # prefixed by size as usual

== code
#   instruction                     effective address                                                   register    displacement    immediate
# . op          subop               mod             rm32          base        index         scale       r32
# . 1-3 bytes   3 bits              2 bits          3 bits        3 bits      3 bits        2 bits      2 bits      0/1/2/4 bytes   0/1/2/4 bytes

# TODO: come up with a way to signal when a write to disk fails
write:  # f: fd or (addr stream byte), s: (addr array byte)
    # . prologue
    55/push-ebp
    89/copy                         3/mod/direct    5/rm32/ebp    .           .             .           4/r32/esp   .               .                 # copy esp to ebp
    # if (s == 0) return
    81          7/subop/compare     1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0xc/disp8       0/imm32           # compare *(ebp+12)
    74/jump-if-=  $write:end/disp8
    # if (f < 0x08000000) _write(f, s) and return  # f can't be a user-mode address, so treat it as a kernel file descriptor
    81          7/subop/compare     1/mod/*+disp8   5/rm32/ebp    .           .             .           .           8/disp8         0x08000000/imm32  # compare *(ebp+8)
    73/jump-if-addr>=  $write:fake/disp8
    # . . push args
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0xc/disp8       .                 # push *(ebp+12)
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           8/disp8         .                 # push *(ebp+8)
    # . . call
    e8/call  _write/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    eb/jump  $write:end/disp8
$write:fake:
    # otherwise, treat 'f' as a stream to append to
    # . save registers
    50/push-eax
    51/push-ecx
    52/push-edx
    53/push-ebx
    # ecx = f
    8b/copy                         1/mod/*+disp8   5/rm32/ebp    .           .                         1/r32/ecx   8/disp8         .                 # copy *(ebp+8) to ecx
    # edx = f->write
    8b/copy                         0/mod/indirect  1/rm32/ecx    .           .             .           2/r32/edx   .               .                 # copy *ecx to edx
    # ebx = f->size
    8b/copy                         1/mod/*+disp8   1/rm32/ecx    .           .             .           3/r32/ebx   8/disp8         .                 # copy *(ecx+8) to ebx
    # eax = _append-3(&f->data[f->write], &f->data[f->size], s)
    # . . push s
    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0xc/disp8       .                 # push *(ebp+12)
    # . . push &f->data[f->size]
    8d/copy-address                 1/mod/*+disp8   4/rm32/sib    1/base/ecx  3/index/ebx   .           3/r32/ebx   0xc/disp8       .                 # copy ecx+ebx+12 to ebx
    53/push-ebx
    # . . push &f->data[f->write]
    8d/copy-address                 1/mod/*+disp8   4/rm32/sib    1/base/ecx  2/index/edx   .           3/r32/ebx   0xc/disp8       .                 # copy ecx+edx+12 to ebx
    53/push-ebx
    # . . call
    e8/call  _append-3/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    # f->write += eax
    01/add                          0/mod/indirect  1/rm32/ecx    .           .             .           0/r32/eax   .               .                 # add eax to *ecx
    # . restore registers
    5b/pop-to-ebx
    5a/pop-to-edx
    59/pop-to-ecx
    58/pop-to-eax
$write:end:
    # . epilogue
    89/copy                         3/mod/direct    4/rm32/esp    .           .             .           5/r32/ebp   .               .                 # copy ebp to esp
    5d/pop-to-ebp
    c3/return

test-write-single:
    # clear-stream(_test-stream)
    # . . push args
    68/push  _test-stream/imm32
    # . . call
    e8/call  clear-stream/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               4/imm32           # add to esp
    # write(_test-stream, "Ab")
    # . . push args
    68/push  "Ab"/imm32
    68/push  _test-stream/imm32
    # . . call
    e8/call  write/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # check-ints-equal(*_test-stream->data, 41/A 62/b 00 00, msg)
    # . . push args
    68/push  "F - test-write-single"/imm32
    68/push  0x006241/imm32/Ab
    # . . push *_test-stream->data
    b8/copy-to-eax  _test-stream/imm32
    ff          6/subop/push        1/mod/*+disp8   0/rm32/eax    .           .             .           .           0xc/disp8       .                 # push *(eax+12)
    # . . call
    e8/call  check-ints-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    # end
    c3/return

test-write-appends:
    # clear-stream(_test-stream)
    # . . push args
    68/push  _test-stream/imm32
    # . . call
    e8/call  clear-stream/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               4/imm32           # add to esp
    # write(_test-stream, "C")
    # . . push args
    68/push  "C"/imm32
    68/push  _test-stream/imm32
    # . . call
    e8/call  write/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # write(_test-stream, "D")
    # . . push args
    68/push  "D"/imm32
    68/push  _test-stream/imm32
    # . . call
    e8/call  write/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # check-ints-equal(*_test-stream->data, 43/C 44/D 00 00, msg)
    # . . push args
    68/push  "F - test-write-appends"/imm32
    68/push  0x00004443/imm32/C-D
    # . . push *_test-stream->data
    b8/copy-to-eax  _test-stream/imm32
    ff          6/subop/push        1/mod/*+disp8   0/rm32/eax    .           .             .           .           0xc/disp8       .                 # push *(eax+12)
    # . . call
    e8/call  check-ints-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    # end
    c3/return

== data

_test-stream:  # (stream byte)
    # current write index
    0/imm32
    # current read index
    0/imm32
    # size
    0x10/imm32
    # data (2 lines x 8 bytes/line)
    00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00

# . . vim:nowrap:textwidth=0