about summary refs log tree commit diff stats
path: root/dwm.h
Commit message (Expand)AuthorAgeFilesLines
...
* forgot an extern declarationAnselm R. Garbe2007-02-191-1/+1
* removed procevent, more refactoringAnselm R. Garbe2007-02-191-1/+0
* draw.c is useless (belongs to main.c now)Anselm R. Garbe2007-02-191-8/+3
* renamed view.c into screen.cAnselm R. Garbe2007-02-191-6/+4
* renamed manage.c to view.cAnselm R. Garbe2007-02-191-7/+7
* merged tag.c, view.c and tile.c to manage.cAnselm R. Garbe2007-02-191-21/+15
* some more refactoringAnselm R. Garbe2007-02-191-5/+5
* added some new convenience functionsAnselm R. Garbe2007-02-191-1/+4
* introduced tile.c, some refactoring of functionsAnselm R. Garbe2007-02-191-5/+8
* removed ugly ban(), extended resize() that it only resets the size if necessa...Anselm R. Garbe2007-02-161-2/+2
* removed getnext/getprev, redundantAnselm R. Garbe2007-02-161-2/+0
* added ban() which takes care than a banned window is not banned again... (thi...Anselm R. Garbe2007-02-141-1/+2
* replaced getproto with a saner function, now old-school artifacts of WM times...Anselm R. Garbe2007-02-071-5/+2
* implemented aspect ratio support of windowsAnselm R. Garbe2007-02-061-0/+1
* handling WM_STATE seems to make DnD in gtk/qt apps working, well let's handle...Anselm R. Garbe2007-01-281-1/+1
* renamed activescreen into selscreen 3.2Anselm R. Garbe2007-01-231-1/+1
* small changesAnselm R. Garbe2007-01-231-1/+1
* applied Sanders all5.patch (thanks for your weekend session, Sander!)Anselm R. Garbe2007-01-221-5/+1
* moved BORDERPX to config.*.hAnselm R. Garbe2007-01-171-1/+0
* removed erealloc (not used) 3.1Anselm R. Garbe2007-01-161-1/+0
* removed unnecessary bx, by, bw variablesAnselm R. Garbe2007-01-161-1/+1
* removed drawclient and drawall (they performed useless operations/consumed us...Anselm R. Garbe2007-01-151-2/+0
* implemented new color scheme accordingly to Sanders proposalAnselm R. Garbe2007-01-141-2/+1
* removed mode label stuffAnselm R. Garbe2007-01-141-3/+1
* removed client title barAnselm R. Garbe2007-01-141-5/+0
* reorganizedAnselm R. Garbe2007-01-081-0/+1
* implemented nmaster appearance in mode label (using %u)Anselm R. Garbe2007-01-081-0/+1
* experimental version which allows master clients being increased/decreasedAnselm R. Garbe2007-01-051-1/+3
* fixed comment of drawclient()Anselm R. Garbe2007-01-041-1/+1
* renamed drawtitle into drawclientAnselm R. Garbe2007-01-041-1/+1
* correctionsarg@mig292007-01-021-1/+1
* next version will contain updated copyright noticearg@mig292007-01-021-1/+1
* changed comment of updatesizehintsarg@mig292007-01-021-1/+1
* renamed updatesize into updatesizehints (thx to Sander for this hint)arg@mig292007-01-011-1/+1
* removed Client->gravarg@mig292006-12-121-1/+0
* removed gravitate for the momentarg@mig292006-12-111-1/+0
* removed viewall signature from dwm.harg@mig292006-11-301-1/+0
* added man page entryarg@mig292006-11-271-1/+1
* added togglefloat to hg tip (i consider this useful for some cases), using MO...arg@mig292006-11-271-0/+1
* fifififarg@mig292006-11-221-1/+1
* applied Gottox' windowarea patcharg@mig292006-11-161-0/+1
* renamed resizecol into resizemaster 2.1arg@mig292006-10-311-1/+1
* applied sanders try2 patcharg@mig292006-10-271-1/+1
* moved MOUSEMASK into event.c (not used in other places)Anselm R. Garbe2006-10-161-1/+0
* do* has no Arg arument anymore (never called directly) 1.9Anselm R. Garbe2006-10-061-3/+3
* code polishing, removed unnecessary newlinesAnselm R. Garbe2006-10-061-2/+1
* removed the stack position stuffAnselm R. Garbe2006-10-051-6/+0
* keep master ratio on resizecol -> arrangeAnselm R. Garbe2006-10-051-3/+3
* simplified dotile()Anselm R. Garbe2006-10-051-1/+0
* removed useless updatemasterAnselm R. Garbe2006-09-291-1/+0
11-30 10:54:42 -0800 4801' href='/akkartik/mu/commit/subx/056write.subx?h=hlt&id=6030d7e2e56d445ca67c6a0e8c9cf33e46bc673c'>6030d7e2 ^
5e27c7f1 ^
b8475380 ^
ee9a9237 ^
6030d7e2 ^


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

ee9a9237 ^
6030d7e2 ^

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

9d27e966 ^
6030d7e2 ^

ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
6030d7e2 ^


3d6450f2 ^

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

ee9a9237 ^
6030d7e2 ^

ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
6030d7e2 ^

ee9a9237 ^
6030d7e2 ^

ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
6030d7e2 ^

ee9a9237 ^
6030d7e2 ^

9d27e966 ^
6030d7e2 ^

ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
6030d7e2 ^


b31455f8 ^



6030d7e2 ^
9b16f190 ^
6030d7e2 ^
9b16f190 ^


6030d7e2 ^

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

                                                                            

                                                                             



                                                                             



                                                                               

                                            


                                                     
       


                                                                                                                                                 
 

                                                                        
              

                                                                                                                                                                       
                                                                                                                            
                                                                                                                                                                        
                                                  
                   

                                                                                                                                                                      
              
                          
                      

                                                                                                                                                                  
            
                                                   
                      
               



               
                                                                                                                                                                            




                                                                                                                                                                            
                
                                                                                                                                                                      
                                  

                                                                                                                                                                              
                                 

                                                                                                                                                                              
              
                             
                      


                                                                                                                                                                       
                         


                 
                 
           
              


                                                                                                                                                                       
 
                  
                                
                   
                               
              
                                
                      

                                                                                                                                                                  
                   

                               
              
                         
                      
                                                                                                                                                                  
                                                                 
                   

                                          
                                  

                                                                                                                                                                      
              
                                    
                      


                                                                                                                                                                  

                   
                                
                   
                               
              
                                
                      

                                                                                                                                                                  
                   

                               
              
                         
                      

                                                                                                                                                                  
                   

                               
              
                         
                      

                                                                                                                                                                  
                   

                                           
                                  

                                                                                                                                                                      
              
                                    
                      


                                                                                                                                                                  



             
                         
           
                        


            

                                      
 
                            
# 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 length 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 (address stream), s : (address array byte) -> <void>
    # . prolog
    55/push-EBP
    89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
    # 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)
    7d/jump-if-greater-or-equal  $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->length
    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->length], s)
    # . . push s
    ff          6/subop/push        1/mod/*+disp8   5/rm32/EBP    .           .             .           .           0xc/disp8       .                 # push *(EBP+12)
    # . . push &f->data[f->length]
    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:
    # . epilog
    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:
    # current write index
    0/imm32
    # current read index
    0/imm32
    # length
    8/imm32
    # data
    00 00 00 00 00 00 00 00  # 8 bytes

# . . vim:nowrap:textwidth=0